Check-in [fb829ede09]

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

Overview
Comment:Initializing of interfaces a class implements.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fb829ede094178c95ef8ff6894690f1a7918e93c
User & Date: stephanie.gawroriski 2019-12-01 19:32:42
Context
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
18:44
Implement store of method count. check-in: 6051f39a25 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

85
86
87
88
89
90
91

92
93
94
95
96
97
98
...
103
104
105
106
107
108
109
110




111
112
113
114
115
116
117
		AbstractPoolParser sp = this.classpool,
			rp = this.runtimepool,
			ap = (__rt ? rp : sp);
		
		// Get pool entry properties
		int etype = ap.entryType(__dx, __ft);
		short[] eparts = ap.entryParts(__dx, __ft);

		BinaryBlob eblob = ap.entryData(__dx, __ft);
		
		// Depends on the entry type
		switch (etype)
		{
				// String, skip hash and length copies
			case ClassPoolConstants.TYPE_STRING:
................................................................................
				return new PoolClassName(
					(String)this.entry(false, eparts[0] & 0xFFFF, true),
					(PoolClassName)this.entry(false, eparts[1] & 0xFFFF,
						true));
					
				// Names of multiple classes
			case ClassPoolConstants.TYPE_CLASSNAMES:
				throw new todo.TODO();




			
				// Unknown
			default:
				throw new todo.TODO("Pool " + etype);
		}
	}
	







>







 







|
>
>
>
>







85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
...
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
		AbstractPoolParser sp = this.classpool,
			rp = this.runtimepool,
			ap = (__rt ? rp : sp);
		
		// Get pool entry properties
		int etype = ap.entryType(__dx, __ft);
		short[] eparts = ap.entryParts(__dx, __ft);
		int enumparts = eparts.length;
		BinaryBlob eblob = ap.entryData(__dx, __ft);
		
		// Depends on the entry type
		switch (etype)
		{
				// String, skip hash and length copies
			case ClassPoolConstants.TYPE_STRING:
................................................................................
				return new PoolClassName(
					(String)this.entry(false, eparts[0] & 0xFFFF, true),
					(PoolClassName)this.entry(false, eparts[1] & 0xFFFF,
						true));
					
				// Names of multiple classes
			case ClassPoolConstants.TYPE_CLASSNAMES:
				PoolClassName[] rvpn = new PoolClassName[enumparts];
				for (int i = 0; i < enumparts; i++)
					rvpn[i] = (PoolClassName)this.entry(false,
						eparts[i] & 0xFFFF, true);
				return rvpn;
			
				// Unknown
			default:
				throw new todo.TODO("Pool " + etype);
		}
	}
	

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

155
156
157
158
159
160
161














162
163
164
165
166
167
168
	 * @since 2019/12/01
	 */
	public final int flags()
	{
		return this.blob.readJavaInt(
			ClassFileConstants.OFFSET_OF_INT_CLASSFLAGS);
	}














	
	/**
	 * Returns the number of methods in the class.
	 *
	 * @param __is Get the static method count.
	 * @return The number of methods in the class.
	 * @since 2019/11/29







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







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
180
181
182
	 * @since 2019/12/01
	 */
	public final int flags()
	{
		return this.blob.readJavaInt(
			ClassFileConstants.OFFSET_OF_INT_CLASSFLAGS);
	}
	
	/**
	 * Returns the names of the interfaces that this class implements.
	 *
	 * @return The names of the implemented interfaces.
	 * @since 2019/12/01
	 */
	public final PoolClassName[] interfaceNames()
	{
		PoolClassName[] rv = this.pool().entryAsClassNames(false, this.blob.
			readJavaUnsignedShort(
				ClassFileConstants.OFFSET_OF_USHORT_CLASSINTS));
		return (rv == null ? new PoolClassName[0] : rv);
	}
	
	/**
	 * Returns the number of methods in the class.
	 *
	 * @param __is Get the static method count.
	 * @return The number of methods in the class.
	 * @since 2019/11/29

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

157
158
159
160
161
162
163















164
165
166
167
168
169
170
	 */
	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.







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







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
185
	 */
	public final void setFlags(TaskClass __cl, int __v)
		throws NullPointerException
	{
		this.setProperty(__cl, ClassInfoProperty.INT_FLAGS,
			__v);
	}
	
	/**
	 * Sets the interfaces array of the class.
	 *
	 * @param __cl The class.
	 * @param __v The value to set.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/01
	 */
	public final void setInterfaces(TaskClass __cl, int __v)
		throws NullPointerException
	{
		this.setProperty(__cl,
			ClassInfoProperty.CLASSINFO_ARRAY_INTERFACECLASSES, __v);
	}
	
	/**
	 * Sets the JAR index.
	 *
	 * @param __cl The class.
	 * @param __v The value to set.
	 * @throws NullPointerException On null arguments.

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

59
60
61
62
63
64
65




























66
67
68
69
70
71
72
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
		
		// Ran out of memory?
		if (rv == 0)
			throw new TaskOutOfMemoryError();
		
		return rv;
	}




























	
	/**
	 * Allocates an integer sized array with the given values.
	 *
	 * @param __cl The class to set it as.
	 * @param __v The values to store.
	 * @return The pointer to the allocated array.
................................................................................
	 */
	public final int allocateArrayInt(TaskClass __cl, int... __v)
		throws NullPointerException
	{
		if (__cl == null || __v == null)
			throw new NullPointerException("NARG");
		
		// Initialize base array
		int count = __v.length;
		int rv = this.allocateArrayIntEmpty(__cl, count);
		
		// Copy pointer values to the array
		int bp = rv + Constants.ARRAY_BASE_SIZE;
		for (int i = 0, wp = 0; i < count; i++, wp += 4)
			Assembly.memWriteInt(bp, wp, __v[i]);
		
		// Return the result of it
		return rv;
	}
	
	/**
	 * Allocates an integer sized array with the given values, no class type
	 * is set here.
	 *







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







 







|
|
|
|
|
|
|
|
<
<







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
...
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117


118
119
120
121
122
123
124
		
		// Ran out of memory?
		if (rv == 0)
			throw new TaskOutOfMemoryError();
		
		return rv;
	}
	
	/**
	 * Allocates an integer sized array with the given values, no class type
	 * is set.
	 *
	 * @param __v The values to store.
	 * @return The pointer to the allocated array.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/12/01
	 */
	public final int allocateArrayInt(int... __v)
		throws NullPointerException
	{
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// Initialize base array
		int count = __v.length;
		int rv = this.allocateArrayIntEmpty(count);
		
		// Copy pointer values to the array
		int bp = rv + Constants.ARRAY_BASE_SIZE;
		for (int i = 0, wp = 0; i < count; i++, wp += 4)
			Assembly.memWriteInt(bp, wp, __v[i]);
		
		// Return the result of it
		return rv;
	}
	
	/**
	 * Allocates an integer sized array with the given values.
	 *
	 * @param __cl The class to set it as.
	 * @param __v The values to store.
	 * @return The pointer to the allocated array.
................................................................................
	 */
	public final int allocateArrayInt(TaskClass __cl, int... __v)
		throws NullPointerException
	{
		if (__cl == null || __v == null)
			throw new NullPointerException("NARG");
		
		// Allocate using the base form
		int rv = this.allocateArrayInt(__v);
		
		// Store object type
		Assembly.memWriteInt(rv, Constants.OBJECT_CLASS_OFFSET,
			__cl.infoPointer());
		
		// Use this


		return rv;
	}
	
	/**
	 * Allocates an integer sized array with the given values, no class type
	 * is set here.
	 *

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

16
17
18
19
20
21
22

23
24
25
26
27
28
29
...
285
286
287
288
289
290
291
292
293

294
295


296



297
298
299
300
301
302
303
...
305
306
307
308
309
310
311




312
313
314
315
316
317
318
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
 */
................................................................................
		ciutil.setClassAllocationSize(this,
			basesize + thisparser.fieldSize(false));
		
		// Set number of objects this has, for garbage collection
		ciutil.setObjectCount(this, thisparser.objectCount(false));
		
		// Initialize interfaces
		if (true)
		{

			// CLASSINFO_ARRAY_INTERFACECLASSES
			throw new todo.TODO();


		}



		
		// Initialize the VTables for the class now
		if (true)
		{
			// INT_ARRAY_VTABLEVIRTUAL
			// INT_ARRAY_VTABLEPOOL
			throw new todo.TODO();
................................................................................
		
		// Initialize the actual pool constants now
		if (true)
		{
			throw new todo.TODO();
		}
		




		// Set the class type for the vtable array last, since everything
		// is now setup with it!
		TaskClass intarrayclass = __task.loadClass("[I");
		Assembly.memWriteInt(vtvirtual, Constants.OBJECT_CLASS_OFFSET,
			intarrayclass.infoPointer());
		Assembly.memWriteInt(vtpool, Constants.OBJECT_CLASS_OFFSET,
			intarrayclass.infoPointer());







>







 







|
<
>
|
|
>
>
|
>
>
>







 







>
>
>
>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
...
286
287
288
289
290
291
292
293

294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
...
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
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 cc.squirreljme.jvm.lib.PoolClassName;
import java.util.Objects;

/**
 * This represents a class of a task.
 *
 * @since 2019/10/19
 */
................................................................................
		ciutil.setClassAllocationSize(this,
			basesize + thisparser.fieldSize(false));
		
		// Set number of objects this has, for garbage collection
		ciutil.setObjectCount(this, thisparser.objectCount(false));
		
		// Initialize interfaces
		PoolClassName[] interfacenames = thisparser.interfaceNames();

		int numints = interfacenames.length;
		int[] ifps = new int[numints];
		for (int i = 0; i < numints; i++)
			ifps[i] = __task.loadClass(interfacenames[i].toString()).
				infoPointer();
		
		// Allocate and store
		int ifacespointer = __task.allocator.allocateArrayInt(ifps);
		ciutil.setInterfaces(this, ifacespointer);
		
		// Initialize the VTables for the class now
		if (true)
		{
			// INT_ARRAY_VTABLEVIRTUAL
			// INT_ARRAY_VTABLEPOOL
			throw new todo.TODO();
................................................................................
		
		// Initialize the actual pool constants now
		if (true)
		{
			throw new todo.TODO();
		}
		
		// Set interfaces array type
		Assembly.memWriteInt(ifacespointer, Constants.OBJECT_CLASS_OFFSET,
			__task.loadClass("[Lcc/squirreljme/jvm/ClassInfo;").infoPointer());
		
		// Set the class type for the vtable array last, since everything
		// is now setup with it!
		TaskClass intarrayclass = __task.loadClass("[I");
		Assembly.memWriteInt(vtvirtual, Constants.OBJECT_CLASS_OFFSET,
			intarrayclass.infoPointer());
		Assembly.memWriteInt(vtpool, Constants.OBJECT_CLASS_OFFSET,
			intarrayclass.infoPointer());