Check-in [ec1724f28d]

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

Overview
Comment:Add missing Jar Index for the run-time ClassInfo.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ec1724f28df77bd298c7bd7f4b034492d0401491
User & Date: stephanie.gawroriski 2019-12-01 16:53:46
Context
2019-12-01
18:44
Implement store of method count. check-in: 6051f39a25 user: stephanie.gawroriski tags: trunk
16:53
Add missing Jar Index for the run-time ClassInfo. check-in: ec1724f28d user: stephanie.gawroriski tags: trunk
16:46
Cleanup some old fields and methods; Add constant type for class names. check-in: ba772e3cac user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/apis/cldc-compact/cc/squirreljme/jvm/ClassInfo.java.

68
69
70
71
72
73
74



75
76
77
78
79
80
81
..
87
88
89
90
91
92
93

94
95
96
97
98
99
100
101
102
103
104
105
106
...
114
115
116
117
118
119
120

121
122
123
	
	/** Virtual invoke VTable pool entries. */
	public final int[] vtablepool;
	
	/** The pointer to the constant pool of this class. */
	public final int pool;
	



	/**
	 * Class information constructor.
	 *
	 * @param __sp Self pointer.
	 * @param __fl Class information flags.
	 * @param __minip Pointer to the hardware class data in ROM.
	 * @param __namep The name pointer.
................................................................................
	 * @param __scl The super class data.
	 * @param __icl Interface classes.
	 * @param __ccl Component class.
	 * @param __cop Pointer to the class object.
	 * @param __vtv Virtual invoke VTable address.
	 * @param __vtp Virtual invoke VTable pool addresses.
	 * @param __pool The pointer to the class constant pool.

	 * @since 2019/04/26
	 */
	public ClassInfo(int __sp, int __fl, int __minip, int __namep, int __sz,
		int __bz, int __no, int __dim, int __csz, ClassInfo __scl,
		ClassInfo[] __icl, ClassInfo __ccl, Class<?> __cop, int[] __vtv,
		int[] __vtp, int __pool)
	{
		// Always implicitly set magic
		this.magic = MAGIC_NUMBER;
		
		// Set
		this.selfptr = __sp;
		this.flags = __fl;
................................................................................
		this.superclass = __scl;
		this.interfaceclasses = (__icl == null ? new ClassInfo[0] : __icl);
		this.componentclass = __ccl;
		this.classobjptr = __cop;
		this.vtablevirtual = (__vtv == null ? new int[0] : __vtv);
		this.vtablepool = (__vtp == null ? new int[0] : __vtp);
		this.pool = __pool;

	}
}








>
>
>







 







>





|







 







>



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
..
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
...
118
119
120
121
122
123
124
125
126
127
128
	
	/** Virtual invoke VTable pool entries. */
	public final int[] vtablepool;
	
	/** The pointer to the constant pool of this class. */
	public final int pool;
	
	/** The JAR this class is a part of. */
	public final int jardx;
	
	/**
	 * Class information constructor.
	 *
	 * @param __sp Self pointer.
	 * @param __fl Class information flags.
	 * @param __minip Pointer to the hardware class data in ROM.
	 * @param __namep The name pointer.
................................................................................
	 * @param __scl The super class data.
	 * @param __icl Interface classes.
	 * @param __ccl Component class.
	 * @param __cop Pointer to the class object.
	 * @param __vtv Virtual invoke VTable address.
	 * @param __vtp Virtual invoke VTable pool addresses.
	 * @param __pool The pointer to the class constant pool.
	 * @param __jardx The JAR Index.
	 * @since 2019/04/26
	 */
	public ClassInfo(int __sp, int __fl, int __minip, int __namep, int __sz,
		int __bz, int __no, int __dim, int __csz, ClassInfo __scl,
		ClassInfo[] __icl, ClassInfo __ccl, Class<?> __cop, int[] __vtv,
		int[] __vtp, int __pool, int __jardx)
	{
		// Always implicitly set magic
		this.magic = MAGIC_NUMBER;
		
		// Set
		this.selfptr = __sp;
		this.flags = __fl;
................................................................................
		this.superclass = __scl;
		this.interfaceclasses = (__icl == null ? new ClassInfo[0] : __icl);
		this.componentclass = __ccl;
		this.classobjptr = __cop;
		this.vtablevirtual = (__vtv == null ? new int[0] : __vtv);
		this.vtablepool = (__vtp == null ? new int[0] : __vtp);
		this.pool = __pool;
		this.jardx = __jardx;
	}
}

Changes to runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassInfoProperty.java.

79
80
81
82
83
84
85




86
87
88
89
90
91
	/** Virtual invoke VTable pool entries. */
	public static final byte INT_ARRAY_VTABLEPOOL =
		15;
	
	/** The pointer to the constant pool of this class. */
	public static final byte INT_POOL =
		16;




	
	/** The number of properties available. */
	public static final byte NUM_PROPERTIES =
		17;
}








>
>
>
>



|


79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
	/** Virtual invoke VTable pool entries. */
	public static final byte INT_ARRAY_VTABLEPOOL =
		15;
	
	/** The pointer to the constant pool of this class. */
	public static final byte INT_POOL =
		16;
	
	/** The JAR Index. */
	public static final byte INT_JARDX =
		17;
	
	/** The number of properties available. */
	public static final byte NUM_PROPERTIES =
		18;
}

Changes to runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassInfoUtility.java.

143
144
145
146
147
148
149















150
151
152
153
154
155
156
...
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395





396
397
398
399
400
401
402
	 */
	public final void setFlags(TaskClass __cl, int __v)
		throws NullPointerException
	{
		this.setProperty(__cl, ClassInfoProperty.INT_FLAGS,
			__v);
	}















	
	/**
	 * Sets the class magic number.
	 *
	 * @param __cl The class.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/01
................................................................................
			// The property index
			int pdx;
			
			// Depends on the field name and type
			String nat = cifs.name(cif) + ":" + cifs.type(cif);
			switch (nat)
			{
				// Self pointer.
				case "selfptr:int":
					pdx = ClassInfoProperty.INT_SELFPTR;
					break;

				// Magic number used to detect corruption.
				case "magic:int":
					pdx = ClassInfoProperty.INT_MAGIC;
					break;

				// Class information flags.
				case "flags:int":
					pdx = ClassInfoProperty.INT_FLAGS;
					break;

				// The pointer to the minimized class file.
				case "miniptr:int":
					pdx = ClassInfoProperty.INT_MINIPTR;
					break;

				// The pointer to the class name.
				case "namep:int":
					pdx = ClassInfoProperty.INT_NAMEP;
					break;

				// The allocation size of this class.
				case "size:int":
					pdx = ClassInfoProperty.INT_SIZE;
					break;

				// The base offset for fields in this class.
				case "base:int":
					pdx = ClassInfoProperty.INT_BASE;
					break;

				// The number of objects in the instance fields, for GC.
				case "numobjects:int":
					pdx = ClassInfoProperty.INT_NUMOBJECTS;
					break;

				// The dimensions this class uses, if it is an array.
				case "dimensions:int":
					pdx = ClassInfoProperty.INT_DIMENSIONS;
					break;

				// The cell size of components if this is an array.
				case "cellsize:int":
					pdx = ClassInfoProperty.INT_CELLSIZE;
					break;

				// The super class data.
				case "superclass:cc/squirreljme/jvm/ClassInfo":
					pdx = ClassInfoProperty.CLASSINFO_SUPERCLASS;
					break;

				// Interfaces.
				case "interfaceclasses:[Lcc/squirreljme/jvm/ClassInfo;":
					pdx = ClassInfoProperty.CLASSINFO_ARRAY_INTERFACECLASSES;
					break;

				// The component class.
				case "componentclass:cc/squirreljme/jvm/ClassInfo":
					pdx = ClassInfoProperty.CLASSINFO_COMPONENTCLASS;
					break;

				// Pointer to the class object.
				case "classobjptr:java/lang/Class":
					pdx = ClassInfoProperty.CLASS_CLASSOBJPTR;
					break;

				// Virtual invoke VTable.
				case "vtablevirtual:[I":
					pdx = ClassInfoProperty.INT_ARRAY_VTABLEVIRTUAL;
					break;

				// Virtual invoke VTable pool entries.
				case "vtablepool:[I":
					pdx = ClassInfoProperty.INT_ARRAY_VTABLEPOOL;
					break;

				// The pointer to the constant pool of this class.
				case "pool:int":
					pdx = ClassInfoProperty.INT_POOL;
					break;





				
				default:
					throw new todo.TODO(nat);
			}
			
			// Store
			props[pdx] = offset;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|




|




|




|




|




|




|




|




|




|




|




|




|




|




|




|




|



>
>
>
>
>







143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
...
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
	 */
	public final void setFlags(TaskClass __cl, int __v)
		throws NullPointerException
	{
		this.setProperty(__cl, ClassInfoProperty.INT_FLAGS,
			__v);
	}
	
	/**
	 * Sets the JAR index.
	 *
	 * @param __cl The class.
	 * @param __v The value to set.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/01
	 */
	public final void setJarIndex(TaskClass __cl, int __v)
		throws NullPointerException
	{
		this.setProperty(__cl, ClassInfoProperty.INT_JARDX,
			__v);
	}
	
	/**
	 * Sets the class magic number.
	 *
	 * @param __cl The class.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/01
................................................................................
			// The property index
			int pdx;
			
			// Depends on the field name and type
			String nat = cifs.name(cif) + ":" + cifs.type(cif);
			switch (nat)
			{
					// Self pointer.
				case "selfptr:int":
					pdx = ClassInfoProperty.INT_SELFPTR;
					break;

					// Magic number used to detect corruption.
				case "magic:int":
					pdx = ClassInfoProperty.INT_MAGIC;
					break;

					// Class information flags.
				case "flags:int":
					pdx = ClassInfoProperty.INT_FLAGS;
					break;

					// The pointer to the minimized class file.
				case "miniptr:int":
					pdx = ClassInfoProperty.INT_MINIPTR;
					break;

					// The pointer to the class name.
				case "namep:int":
					pdx = ClassInfoProperty.INT_NAMEP;
					break;

					// The allocation size of this class.
				case "size:int":
					pdx = ClassInfoProperty.INT_SIZE;
					break;

					// The base offset for fields in this class.
				case "base:int":
					pdx = ClassInfoProperty.INT_BASE;
					break;

					// The number of objects in the instance fields, for GC.
				case "numobjects:int":
					pdx = ClassInfoProperty.INT_NUMOBJECTS;
					break;

					// The dimensions this class uses, if it is an array.
				case "dimensions:int":
					pdx = ClassInfoProperty.INT_DIMENSIONS;
					break;

					// The cell size of components if this is an array.
				case "cellsize:int":
					pdx = ClassInfoProperty.INT_CELLSIZE;
					break;

					// The super class data.
				case "superclass:cc/squirreljme/jvm/ClassInfo":
					pdx = ClassInfoProperty.CLASSINFO_SUPERCLASS;
					break;

					// Interfaces.
				case "interfaceclasses:[Lcc/squirreljme/jvm/ClassInfo;":
					pdx = ClassInfoProperty.CLASSINFO_ARRAY_INTERFACECLASSES;
					break;

					// The component class.
				case "componentclass:cc/squirreljme/jvm/ClassInfo":
					pdx = ClassInfoProperty.CLASSINFO_COMPONENTCLASS;
					break;

					// Pointer to the class object.
				case "classobjptr:java/lang/Class":
					pdx = ClassInfoProperty.CLASS_CLASSOBJPTR;
					break;

					// Virtual invoke VTable.
				case "vtablevirtual:[I":
					pdx = ClassInfoProperty.INT_ARRAY_VTABLEVIRTUAL;
					break;

					// Virtual invoke VTable pool entries.
				case "vtablepool:[I":
					pdx = ClassInfoProperty.INT_ARRAY_VTABLEPOOL;
					break;

					// The pointer to the constant pool of this class.
				case "pool:int":
					pdx = ClassInfoProperty.INT_POOL;
					break;
					
					// The JAR Index
				case "jardx:int":
					pdx = ClassInfoProperty.INT_JARDX;
					break;
				
				default:
					throw new todo.TODO(nat);
			}
			
			// Store
			props[pdx] = offset;

Changes to runt/klib/supervisor/cc/squirreljme/jvm/task/TaskClass.java.

15
16
17
18
19
20
21

22
23
24
25
26
27
28
...
223
224
225
226
227
228
229




230
231
232
233
234
235
236
import cc.squirreljme.jvm.io.MemoryBlob;
import cc.squirreljme.jvm.lib.ClassFieldsParser;
import cc.squirreljme.jvm.lib.ClassFileParser;
import cc.squirreljme.jvm.lib.ClassInfoProperty;
import cc.squirreljme.jvm.lib.ClassInfoUtility;
import cc.squirreljme.jvm.lib.ClassMethodsParser;
import cc.squirreljme.jvm.lib.ClassNameUtils;

import java.util.Objects;

/**
 * This represents a class of a task.
 *
 * @since 2019/10/19
 */
................................................................................
		ClassFileParser thisparser = __task.classpath.classParser(
			this.resourceindex);
		
		// Pointer to self
		int infopointer = this._infopointer;
		ciutil.setSelfPointer(this, infopointer);
		




		// Set pointer to the mini-class which may or may not be valid at all
		ciutil.setMiniClassPointer(this, thisparser.baseAddress());
		
		// Set magic number
		ciutil.setMagicNumber(this);
		
		// Set flags







>







 







>
>
>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
...
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
import cc.squirreljme.jvm.io.MemoryBlob;
import cc.squirreljme.jvm.lib.ClassFieldsParser;
import cc.squirreljme.jvm.lib.ClassFileParser;
import cc.squirreljme.jvm.lib.ClassInfoProperty;
import cc.squirreljme.jvm.lib.ClassInfoUtility;
import cc.squirreljme.jvm.lib.ClassMethodsParser;
import cc.squirreljme.jvm.lib.ClassNameUtils;
import cc.squirreljme.jvm.lib.ClassPath;
import java.util.Objects;

/**
 * This represents a class of a task.
 *
 * @since 2019/10/19
 */
................................................................................
		ClassFileParser thisparser = __task.classpath.classParser(
			this.resourceindex);
		
		// Pointer to self
		int infopointer = this._infopointer;
		ciutil.setSelfPointer(this, infopointer);
		
		// Set the JAR index
		ciutil.setJarIndex(this, ClassPath.resourceIndexToJarIndex(
			this.resourceindex));
		
		// Set pointer to the mini-class which may or may not be valid at all
		ciutil.setMiniClassPointer(this, thisparser.baseAddress());
		
		// Set magic number
		ciutil.setMagicNumber(this);
		
		// Set flags