Check-in [e7f955b71f]

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

Overview
Comment:Add count of the class depth.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e7f955b71f626ba33c284a9f76e01ae09963ad9c
User & Date: stephanie.gawroriski 2019-12-01 21:27:54
Context
2019-12-02
08:02
Backup developer notes. check-in: 88c8311617 user: squirreljme tags: trunk
2019-12-01
21:27
Add count of the class depth. check-in: e7f955b71f user: stephanie.gawroriski tags: trunk
19:32
Initializing of interfaces a class implements. check-in: fb829ede09 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

74
75
76
77
78
79
80



81
82
83
84
85
86
87
..
95
96
97
98
99
100
101

102
103
104
105
106
107
108
109
110
111
112
113
114
...
124
125
126
127
128
129
130

131
132
133
	
	/** The JAR this class is a part of. */
	public final int jardx;
	
	/** The total method count. */
	public final int nummethods;
	



	/**
	 * 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 __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.
	 * @param __nm The number of methods that are used.

	 * @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, int __nm)
	{
		// Always implicitly set magic
		this.magic = MAGIC_NUMBER;
		
		// Set
		this.selfptr = __sp;
		this.flags = __fl;
................................................................................
		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;
		this.nummethods = __nm;

	}
}








>
>
>







 







>





|







 







>



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
...
128
129
130
131
132
133
134
135
136
137
138
	
	/** The JAR this class is a part of. */
	public final int jardx;
	
	/** The total method count. */
	public final int nummethods;
	
	/** The depth of this class. */
	public final int classdepth;
	
	/**
	 * 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 __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.
	 * @param __nm The number of methods that are used.
	 * @param __cd The class depth.
	 * @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, int __nm, int __cd)
	{
		// Always implicitly set magic
		this.magic = MAGIC_NUMBER;
		
		// Set
		this.selfptr = __sp;
		this.flags = __fl;
................................................................................
		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;
		this.nummethods = __nm;
		this.classdepth = __cd;
	}
}

Changes to runt/klib/supervisor/cc/squirreljme/jvm/ClassInfo.java.

74
75
76
77
78
79
80



81
82
83
84
85
86
87
..
95
96
97
98
99
100
101

102
103
104
105
106
107
108
109
110
111
112
113
114
...
124
125
126
127
128
129
130

131
132
133
	
	/** The JAR this class is a part of. */
	public final int jardx;
	
	/** The total method count. */
	public final int nummethods;
	



	/**
	 * 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 __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.
	 * @param __nm The number of methods that are used.

	 * @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, int __nm)
	{
		// Always implicitly set magic
		this.magic = MAGIC_NUMBER;
		
		// Set
		this.selfptr = __sp;
		this.flags = __fl;
................................................................................
		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;
		this.nummethods = __nm;

	}
}








>
>
>







 







>





|







 







>



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
...
128
129
130
131
132
133
134
135
136
137
138
	
	/** The JAR this class is a part of. */
	public final int jardx;
	
	/** The total method count. */
	public final int nummethods;
	
	/** The depth of this class. */
	public final int classdepth;
	
	/**
	 * 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 __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.
	 * @param __nm The number of methods that are used.
	 * @param __cd The class depth.
	 * @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, int __nm, int __cd)
	{
		// Always implicitly set magic
		this.magic = MAGIC_NUMBER;
		
		// Set
		this.selfptr = __sp;
		this.flags = __fl;
................................................................................
		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;
		this.nummethods = __nm;
		this.classdepth = __cd;
	}
}

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

87
88
89
90
91
92
93




94
95
96
97

98
99
	/** The JAR Index. */
	public static final byte INT_JARDX =
		17;
	
	/** The number of methods the class has. */
	public static final byte INT_NUMMETHODS =
		18;




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

}








>
>
>
>



<
>


87
88
89
90
91
92
93
94
95
96
97
98
99
100

101
102
103
	/** The JAR Index. */
	public static final byte INT_JARDX =
		17;
	
	/** The number of methods the class has. */
	public static final byte INT_NUMMETHODS =
		18;
	
	/** The depth of this class. */
	public static final byte INT_CLASSDEPTH =
		19;
	
	/** The number of properties available. */
	public static final byte NUM_PROPERTIES =

		20;
}

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

54
55
56
57
58
59
60














61
62
63
64
65
66
67
...
142
143
144
145
146
147
148















149
150
151
152
153
154
155
...
488
489
490
491
492
493
494





495
496
497
498
499
500
501
	 * @since 2019/12/01
	 */
	public final int classAllocationSize(TaskClass __cl)
		throws NullPointerException
	{
		return this.property(__cl, ClassInfoProperty.INT_SIZE);
	}














	
	/**
	 * Returns the allocation size of instances of this class.
	 *
	 * @return The allocation size of this.
	 * @since 2019/11/30
	 */
................................................................................
	 */
	public final void setClassAllocationSize(TaskClass __cl, int __v)
		throws NullPointerException
	{
		this.setProperty(__cl, ClassInfoProperty.INT_SIZE,
			__v);
	}















	
	/**
	 * Sets the flags.
	 *
	 * @param __cl The class.
	 * @param __v The value to set.
	 * @throws NullPointerException On null arguments.
................................................................................
					pdx = ClassInfoProperty.INT_JARDX;
					break;
					
					// The number of methods in the class
				case "nummethods:int":
					pdx = ClassInfoProperty.INT_NUMMETHODS;
					break;





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







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







 







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







 







>
>
>
>
>







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
...
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
...
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
	 * @since 2019/12/01
	 */
	public final int classAllocationSize(TaskClass __cl)
		throws NullPointerException
	{
		return this.property(__cl, ClassInfoProperty.INT_SIZE);
	}
	
	/**
	 * Returns the class depth.
	 *
	 * @param __cl The class.
	 * @return The class depth.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/01
	 */
	public final int classDepth(TaskClass __cl)
		throws NullPointerException
	{
		return this.property(__cl, ClassInfoProperty.INT_CLASSDEPTH);
	}
	
	/**
	 * Returns the allocation size of instances of this class.
	 *
	 * @return The allocation size of this.
	 * @since 2019/11/30
	 */
................................................................................
	 */
	public final void setClassAllocationSize(TaskClass __cl, int __v)
		throws NullPointerException
	{
		this.setProperty(__cl, ClassInfoProperty.INT_SIZE,
			__v);
	}
	
	/**
	 * Sets the class depth, the number of super classes ahead of this.
	 *
	 * @param __cl The class.
	 * @param __v The value to set.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/01
	 */
	public final void setClassDepth(TaskClass __cl, int __v)
		throws NullPointerException
	{
		this.setProperty(__cl, ClassInfoProperty.INT_CLASSDEPTH,
			__v);
	}
	
	/**
	 * Sets the flags.
	 *
	 * @param __cl The class.
	 * @param __v The value to set.
	 * @throws NullPointerException On null arguments.
................................................................................
					pdx = ClassInfoProperty.INT_JARDX;
					break;
					
					// The number of methods in the class
				case "nummethods:int":
					pdx = ClassInfoProperty.INT_NUMMETHODS;
					break;
					
					// The class depth
				case "classdepth:int":
					pdx = ClassInfoProperty.INT_CLASSDEPTH;
					break;
				
				default:
					throw new todo.TODO(nat);
			}
			
			// Store
			props[pdx] = offset;

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

262
263
264
265
266
267
268





269
270
271
272
273
274
275
		String superclassname = Objects.toString(thisparser.superClassName(),
			null);
		TaskClass superclass = (superclassname == null ? null :
			__task.loadClass(superclassname));
		if (superclass != null)
			ciutil.setSuperClass(this, superclass);
		





		// The base for this class
		int basesize = (superclass == null ? 0 :
			ciutil.classAllocationSize(superclass));
		ciutil.setBaseSize(this, basesize);
		
		// Number of methods the class has
		int methodcount = (superclass != null ? ciutil.







>
>
>
>
>







262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
		String superclassname = Objects.toString(thisparser.superClassName(),
			null);
		TaskClass superclass = (superclassname == null ? null :
			__task.loadClass(superclassname));
		if (superclass != null)
			ciutil.setSuperClass(this, superclass);
		
		// Set the class depth
		int classdepth = (superclass == null ? 0 :
			ciutil.classDepth(superclass) + 1);
		ciutil.setClassDepth(this, classdepth);
		
		// The base for this class
		int basesize = (superclass == null ? 0 :
			ciutil.classAllocationSize(superclass));
		ciutil.setBaseSize(this, basesize);
		
		// Number of methods the class has
		int methodcount = (superclass != null ? ciutil.

Changes to runt/libs/tool-jarfile/dev/shadowtail/jarfile/LoadedClassInfo.java.

77
78
79
80
81
82
83




84
85
86
87
88
89
90
...
138
139
140
141
142
143
144
























145
146
147
148
149
150
151
...
376
377
378
379
380
381
382





383
384
385
386
387
388
389
	private int _vtable =
		-1;
	
	/** The constant pool references for this class vtable. */
	private int _vtablepool =
		-1;
	




	/**
	 * Initializes the boot info.
	 *
	 * @param __cl The class.
	 * @param __co The class offset.
	 * @param __bs The reference to the owning bootstrap.
	 * @throws NullPointerException On null arguments.
................................................................................
		BootstrapState bootstrap = this.__bootstrap();
		
		// The base offset is the allocation size of the super-class
		ClassName supercl = this._class.superName();
		this._baseoff = (rv = (supercl == null ? 0 :
			bootstrap.findClass(supercl).allocationSize()));
		
























		return rv;
	}
	
	/**
	 * Returns the instance offset of the field.
	 *
	 * @param __fn The field name.
................................................................................
				
					// Class info reference
				case "_class:I":
					initializer.memWriteInt(Modifier.RAM_OFFSET,
						wp, bootstrap.findClass(
							"cc/squirreljme/jvm/ClassInfo").infoPointer());
					break;





					
					// Class<?> pointer, starts always at zero since it
					// is generated at run-time
				case "classobjptr:Ljava/lang/Class;":
					initializer.memWriteInt(
						wp, 0);
					break;







>
>
>
>







 







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







 







>
>
>
>
>







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
...
142
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
172
173
174
175
176
177
178
179
...
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
	private int _vtable =
		-1;
	
	/** The constant pool references for this class vtable. */
	private int _vtablepool =
		-1;
	
	/** The depth of this class. */
	private int _classdepth =
		-1;
	
	/**
	 * Initializes the boot info.
	 *
	 * @param __cl The class.
	 * @param __co The class offset.
	 * @param __bs The reference to the owning bootstrap.
	 * @throws NullPointerException On null arguments.
................................................................................
		BootstrapState bootstrap = this.__bootstrap();
		
		// The base offset is the allocation size of the super-class
		ClassName supercl = this._class.superName();
		this._baseoff = (rv = (supercl == null ? 0 :
			bootstrap.findClass(supercl).allocationSize()));
		
		return rv;
	}
	
	/**
	 * Returns the depth of this class.
	 *
	 * @return The depth of this class.
	 * @since 2019/12/01
	 */
	public final int classDepth()
	{
		// Was already cached?
		int rv = this._classdepth;
		if (rv >= 0)
			return rv;
		
		// Find the bootstrap
		BootstrapState bootstrap = this.__bootstrap();
		
		// The class depth is just one added from the super-class
		ClassName supercl = this._class.superName();
		this._classdepth = (rv = (supercl == null ? 0 :
			bootstrap.findClass(supercl).classDepth() + 1));
		
		return rv;
	}
	
	/**
	 * Returns the instance offset of the field.
	 *
	 * @param __fn The field name.
................................................................................
				
					// Class info reference
				case "_class:I":
					initializer.memWriteInt(Modifier.RAM_OFFSET,
						wp, bootstrap.findClass(
							"cc/squirreljme/jvm/ClassInfo").infoPointer());
					break;
					
					// The depth of this class
				case "classdepth:I":
					initializer.memWriteInt(wp, this.classDepth());
					break;
					
					// Class<?> pointer, starts always at zero since it
					// is generated at run-time
				case "classobjptr:Ljava/lang/Class;":
					initializer.memWriteInt(
						wp, 0);
					break;