Check-in [905f13a21e]

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

Overview
Comment:Logic to allocate the data needed to store the ClassInfo data.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 905f13a21ef53d9573c103d913d93075003df55e
User & Date: stephanie.gawroriski 2019-10-26 21:09:34
Context
2019-10-27
16:26
Refactor the class loading a bit; Store resource index of the class; Base for moving around code. check-in: cebb4a9b01 user: stephanie.gawroriski tags: trunk
2019-10-26
21:09
Logic to allocate the data needed to store the ClassInfo data. check-in: 905f13a21e user: stephanie.gawroriski tags: trunk
20:56
Add reference to the class constant pool in ClassInfo. check-in: 030afdd274 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

42
43
44
45
46
47
48












49
50
51
52
53
54
55
	 * Returns a dual pool parser for this class.
	 *
	 * @return The dual pool parser.
	 * @since 2019/10/13
	 */
	public final ClassDualPoolParser dualPool()
	{












		throw new todo.TODO();
	}
	
	/**
	 * Returns the size of all of the fields.
	 *
	 * @param __is Get the size of static fields?







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







42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
	 * Returns a dual pool parser for this class.
	 *
	 * @return The dual pool parser.
	 * @since 2019/10/13
	 */
	public final ClassDualPoolParser dualPool()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the number of fields in the class.
	 *
	 * @param __is Get the static field count.
	 * @return The number of fields in the class.
	 * @since 2019/10/26
	 */
	public final int fieldCount(boolean __is)
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the size of all of the fields.
	 *
	 * @param __is Get the size of static fields?

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

155
156
157
158
159
160
161








162
163
164
165
166
167
168
		int cidx = classpath.resourceClassFind("cc/squirreljme/jvm/ClassInfo");
		if (cidx < 0)
			throw new TaskVirtualMachineError("SV0l");
		
		// Get parser for this class, because we need its info
		ClassFileParser ciparser = new ClassFileParser(
			classpath.resourceData(cidx));








		
		throw new todo.TODO();
	}
	
	/**
	 * Loads the in-memory class information for the given class.
	 *







>
>
>
>
>
>
>
>







155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
		int cidx = classpath.resourceClassFind("cc/squirreljme/jvm/ClassInfo");
		if (cidx < 0)
			throw new TaskVirtualMachineError("SV0l");
		
		// Get parser for this class, because we need its info
		ClassFileParser ciparser = new ClassFileParser(
			classpath.resourceData(cidx));
		
		// Need to allocate class data
		TaskAllocator allocator = this.allocator;
		
		// Allocate the space needed to store the class information
		int infopointer = allocator.allocateObject(Constants.OBJECT_BASE_SIZE +
			ciparser.fieldSize(false));
		rv._infopointer = infopointer;
		
		throw new todo.TODO();
	}
	
	/**
	 * Loads the in-memory class information for the given class.
	 *

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

51
52
53
54
55
56
57












58
59
60
61
62
63
64
	public final int allocate(int __tag, int __sz)
	{
		// Just perform the allocation with our PID as part of the tag and
		// whatever was passed, masked correctly
		return Allocator.allocate(
			this.tagbits | (__tag & Allocator.CHUNK_BITS_VALUE_MASK), __sz);
	}












	
	/**
	 * Frees the given pointer, this is just a helper method.
	 *
	 * @param __p The pointer to free.
	 * @since 2019/10/19
	 */







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







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
	public final int allocate(int __tag, int __sz)
	{
		// Just perform the allocation with our PID as part of the tag and
		// whatever was passed, masked correctly
		return Allocator.allocate(
			this.tagbits | (__tag & Allocator.CHUNK_BITS_VALUE_MASK), __sz);
	}
	
	/**
	 * Allocates an object type.
	 *
	 * @param __sz The size of the object.
	 * @return The allocated bytes.
	 * @since 2019/10/26
	 */
	public final int allocateObject(int __sz)
	{
		return this.allocate(Allocator.CHUNK_BIT_IS_OBJECT, __sz);
	}
	
	/**
	 * Frees the given pointer, this is just a helper method.
	 *
	 * @param __p The pointer to free.
	 * @since 2019/10/19
	 */

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

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * This represents a class of a task.
 *
 * @since 2019/10/19
 */
public final class TaskClass
{
	/** The allocated class information. */
	int _allocatedclass;
	
	/** The run-time constant pool pointer. */
	int _pool;
	
	/**
	 * Initializes the class container.
	 *







|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 * This represents a class of a task.
 *
 * @since 2019/10/19
 */
public final class TaskClass
{
	/** The allocated class information. */
	int _infopointer;
	
	/** The run-time constant pool pointer. */
	int _pool;
	
	/**
	 * Initializes the class container.
	 *