Check-in [cef945116b]

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

Overview
Comment:Implement jvmCanArrayStore().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:cef945116bf359f843e1e3ec7c9ce80569e1b6ab
User & Date: stephanie.gawroriski 2019-06-12 22:16:35
Context
2019-06-12
22:19
Add check for interface types as well. check-in: f7fe0f7589 user: stephanie.gawroriski tags: trunk
22:16
Implement jvmCanArrayStore(). check-in: cef945116b user: stephanie.gawroriski tags: trunk
21:54
Correct CHECKCAST where it would place un-cached entries on the stack when they should be cached. check-in: 844222f1c4 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

33
34
35
36
37
38
39
40
41
42
43
44


















45
46
47
48
49
50
51
...
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
	 * @return If this object can be stored in the array then {@code 1} will
	 * be returned, otherwise {@code 0} will.
	 * @since 2019/04/27
	 */
	public static final int jvmCanArrayStore(int __p, int __v)
	{
		// Access of invalid object?
		if (__p == Constants.BAD_MAGIC)
			throw new VirtualMachineError();
		
		Assembly.breakpoint();
		throw new todo.TODO();


















	}
	
	/**
	 * Returns the component type of the array
	 *
	 * @param __clid The class ID
	 * @return The component type of the array or {@code 0} if it is not an
................................................................................
		if (pcl == 0 || pcl == Constants.BAD_MAGIC)
			throw new VirtualMachineError();
		
		// Scan through
		ClassInfo mine = Assembly.pointerToClassInfo(pcl);
		for (ClassInfo seek = mine; seek != null; seek = seek.superclass)
		{
			//Assembly.breakpoint();
			
			// Get self pointer
			int selfptr = seek.selfptr;
			
			// Make sure we are not reading bad memory
			if (selfptr == Constants.BAD_MAGIC)
				throw new VirtualMachineError();
			







|


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







 







<
<







33
34
35
36
37
38
39
40
41
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
68
69
...
204
205
206
207
208
209
210


211
212
213
214
215
216
217
	 * @return If this object can be stored in the array then {@code 1} will
	 * be returned, otherwise {@code 0} will.
	 * @since 2019/04/27
	 */
	public static final int jvmCanArrayStore(int __p, int __v)
	{
		// Access of invalid object?
		if (__p == Constants.BAD_MAGIC || __v == Constants.BAD_MAGIC)
			throw new VirtualMachineError();
		
		// Can always store null values
		if (__v == 0)
			return 1;
		
		// Load the component for this array
		ClassInfo pci = Assembly.pointerToClassInfo(
			Assembly.memReadInt(__p, Constants.OBJECT_CLASS_OFFSET)).
			componentclass;
		
		// Load value class type
		int vcl = Assembly.memReadInt(__v, Constants.OBJECT_CLASS_OFFSET);
		
		// Quick exact class match?
		int pcisp = pci.selfptr;
		if (pcisp == vcl)
			return 1;
		
		// Check if the value we are putting in is an instance of the given
		// class component type
		return JVMFunction.jvmIsInstance(vcl, pcisp);
	}
	
	/**
	 * Returns the component type of the array
	 *
	 * @param __clid The class ID
	 * @return The component type of the array or {@code 0} if it is not an
................................................................................
		if (pcl == 0 || pcl == Constants.BAD_MAGIC)
			throw new VirtualMachineError();
		
		// Scan through
		ClassInfo mine = Assembly.pointerToClassInfo(pcl);
		for (ClassInfo seek = mine; seek != null; seek = seek.superclass)
		{


			// Get self pointer
			int selfptr = seek.selfptr;
			
			// Make sure we are not reading bad memory
			if (selfptr == Constants.BAD_MAGIC)
				throw new VirtualMachineError();