Check-in [a6b7e6ef96]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make int/float consist of parts, it is simpler to handler and matches long/double.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a6b7e6ef967ec46de14a082c12cc0d50ab86069a
User & Date: stephanie.gawroriski 2019-09-11 14:10:18
Context
2019-09-11
14:15
Internally represent parts as shorts in the pool entries. check-in: 340a286a61 user: stephanie.gawroriski tags: trunk
14:10
Make int/float consist of parts, it is simpler to handler and matches long/double. check-in: a6b7e6ef96 user: stephanie.gawroriski tags: trunk
2019-09-10
07:04
Backup developer notes. check-in: 10cdb0c83f user: squirreljme tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/libs/tool-classfile/dev/shadowtail/classfile/mini/DualPoolEncoder.java.

19
20
21
22
23
24
25

26
27
28
29
30
31
32
...
154
155
156
157
158
159
160

161
162

163
164
165
166
167
168
169
...
171
172
173
174
175
176
177




178
179
180


181
182
































183
184
185
186
187
188
189
...
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442


443
444
445
446
447
448
449
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;

import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.io.TableSectionOutputStream;

/**
 * This contains the encoder and decoder for dual pools.
 *
 * @since 2019/07/17
................................................................................
						// Everything else just consists of parts which are
						// either values to other indexes or an ordinal
					case ACCESSED_FIELD:
					case CLASS_INFO_POINTER:
					case CLASS_NAME:
					case CLASS_NAMES:
					case CLASS_POOL:

					case DOUBLE:
					case LONG:

					case INVOKED_METHOD:
					case METHOD_DESCRIPTOR:
					case METHOD_INDEX:
					case USED_STRING:
						// Read parts
						if (iswide)
							for (int p = 0; p < numparts; p++)
................................................................................
						else
							for (int p = 0; p < numparts; p++)
								parts[p] = xd.readByte() & 0xFF;
						
						// Build value depending on the parts used
						switch (etype)
						{




							case CLASS_NAME:
								if (true)
									throw new todo.TODO();


								break;
							
































								// Unknown
							default:
								throw new todo.OOPS(etype.name());
						}
						break;
						
						// Unknown
................................................................................
					
					// Write NUL terminator so it can be directly used
					// as a UTF-8 C pointer
					dos.writeByte(0);
				}
				break;
				
				// Integer
			case INTEGER:
				dos.writeInt((Integer)__v);
				break;
				
				// Float
			case FLOAT:
				dos.writeInt(Float.floatToRawIntBits((Float)__v));
				break;
				
				// Everything else just consists of parts which are
				// either values to other indexes or an ordinal
			case ACCESSED_FIELD:
			case CLASS_INFO_POINTER:
			case CLASS_NAME:
			case CLASS_NAMES:
			case CLASS_POOL:


			case DOUBLE:
			case LONG:
			case INVOKED_METHOD:
			case METHOD_DESCRIPTOR:
			case METHOD_INDEX:
			case USED_STRING:
				if (__wide)







>







 







>
|

>







 







>
>
>
>

<
<
>
>

|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







<
<
<
<
<
<
<
<
<
<







>
>







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
...
174
175
176
177
178
179
180
181
182
183
184
185


186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
...
458
459
460
461
462
463
464










465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.InvalidClassFormatException;
import net.multiphasicapps.io.TableSectionOutputStream;

/**
 * This contains the encoder and decoder for dual pools.
 *
 * @since 2019/07/17
................................................................................
						// Everything else just consists of parts which are
						// either values to other indexes or an ordinal
					case ACCESSED_FIELD:
					case CLASS_INFO_POINTER:
					case CLASS_NAME:
					case CLASS_NAMES:
					case CLASS_POOL:
					case INTEGER:
					case FLOAT:
					case LONG:
					case DOUBLE:
					case INVOKED_METHOD:
					case METHOD_DESCRIPTOR:
					case METHOD_INDEX:
					case USED_STRING:
						// Read parts
						if (iswide)
							for (int p = 0; p < numparts; p++)
................................................................................
						else
							for (int p = 0; p < numparts; p++)
								parts[p] = xd.readByte() & 0xFF;
						
						// Build value depending on the parts used
						switch (etype)
						{
								// Name of class, the actual class name is
								// the first and secondary ones just indicate
								// and array and its component (not needed
								// to load the information)
							case CLASS_NAME:


								value = new ClassName(entries.get(parts[0]).
									<String>value(String.class));
								break;
								
								// Raw integer value
							case INTEGER:
								value = ((parts[0] & 0xFFFF) << 16) |
									(parts[1] & 0xFFFF);
								break;
								
								// Raw float value
							case FLOAT:
								value = Float.intBitsToFloat(
									((parts[0] & 0xFFFF) << 16) |
									(parts[1] & 0xFFFF));
								break;
								
								// Raw long value
							case LONG:
								value = (((long)(((parts[0] & 0xFFFF) << 16) |
									((parts[1] & 0xFFFF))) &
										0xFFFFFFFFL) << 32L) |
									((long)(((parts[2] & 0xFFFF) << 16) |
									((parts[3] & 0xFFFF))) & 0xFFFFFFFFL);
								break;
								
								// Raw double value
							case DOUBLE:
								value = Double.longBitsToDouble(
									(((long)(((parts[0] & 0xFFFF) << 16) |
									((parts[1] & 0xFFFF))) &
										0xFFFFFFFFL) << 32L) |
									((long)(((parts[2] & 0xFFFF) << 16) |
									((parts[3] & 0xFFFF))) & 0xFFFFFFFFL));
								break;
								
								// Unknown
							default:
								throw new todo.OOPS(etype.name());
						}
						break;
						
						// Unknown
................................................................................
					
					// Write NUL terminator so it can be directly used
					// as a UTF-8 C pointer
					dos.writeByte(0);
				}
				break;
				










				// Everything else just consists of parts which are
				// either values to other indexes or an ordinal
			case ACCESSED_FIELD:
			case CLASS_INFO_POINTER:
			case CLASS_NAME:
			case CLASS_NAMES:
			case CLASS_POOL:
			case INTEGER:
			case FLOAT:
			case DOUBLE:
			case LONG:
			case INVOKED_METHOD:
			case METHOD_DESCRIPTOR:
			case METHOD_INDEX:
			case USED_STRING:
				if (__wide)

Changes to runt/libs/tool-classfile/dev/shadowtail/classfile/pool/DualClassRuntimePoolBuilder.java.

162
163
164
165
166
167
168





169

170


171
172
173
174
175
176
177
			return rv;
		
		// Depends on the type to be stored
		MinimizedPoolEntryType type;
		switch ((type = MinimizedPoolEntryType.ofClass(__v.getClass())))
		{
			case INTEGER:





			case FLOAT:

				return classpool.add(__v);


			
			case LONG:
				long l = (Long)__v;
				return classpool.add(__v,
					((int)(l >>> 48)) & 0xFFFF,
					((int)(l >>> 32)) & 0xFFFF,
					((int)(l >>> 16)) & 0xFFFF,







>
>
>
>
>

>
|
>
>







162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
			return rv;
		
		// Depends on the type to be stored
		MinimizedPoolEntryType type;
		switch ((type = MinimizedPoolEntryType.ofClass(__v.getClass())))
		{
			case INTEGER:
				int bi = (Integer)__v;
				return classpool.add(__v,
					(bi >> 16) & 0xFFFF,
					(bi) & 0xFFFF);
				
			case FLOAT:
				int bf = Float.floatToRawIntBits((Float)__v);
				return classpool.add(__v,
					(bf >> 16) & 0xFFFF,
					(bf) & 0xFFFF);
			
			case LONG:
				long l = (Long)__v;
				return classpool.add(__v,
					((int)(l >>> 48)) & 0xFFFF,
					((int)(l >>> 32)) & 0xFFFF,
					((int)(l >>> 16)) & 0xFFFF,