Check-in [8abb266042]

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

Overview
Comment:Add base for initializing ClassInfo.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wip-springcoat-bringup
Files: files | file ages | folders
SHA1: 8abb2660426efbb6830e023d00e51abb2dc256aa
User & Date: stephanie.gawroriski 2020-03-22 20:07:34
Context
2020-03-22
21:47
Deprecate transitional object data. check-in: 2ac2df2f0a user: stephanie.gawroriski tags: wip-springcoat-bringup
20:07
Add base for initializing ClassInfo. check-in: 8abb266042 user: stephanie.gawroriski tags: wip-springcoat-bringup
12:28
Correct build error. check-in: 6115b8c9a6 user: stephanie.gawroriski tags: wip-springcoat-bringup
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to .idea/dictionaries/xer.xml.

8
9
10
11
12
13
14

15
16
17
18
19
20
21
      <w>chainer</w>
      <w>cldc</w>
      <w>convertable</w>
      <w>dlet</w>
      <w>endianess</w>
      <w>fprintf</w>
      <w>gawroriski</w>

      <w>ioob</w>
      <w>islower</w>
      <w>isupper</w>
      <w>jarray</w>
      <w>jboolean</w>
      <w>jbyte</w>
      <w>jchar</w>







>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
      <w>chainer</w>
      <w>cldc</w>
      <w>convertable</w>
      <w>dlet</w>
      <w>endianess</w>
      <w>fprintf</w>
      <w>gawroriski</w>
      <w>informations</w>
      <w>ioob</w>
      <w>islower</w>
      <w>isupper</w>
      <w>jarray</w>
      <w>jboolean</w>
      <w>jbyte</w>
      <w>jchar</w>

Changes to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/ObjectLoader.java.

5
6
7
8
9
10
11
12
13
14

15
16
17
18
19
20
21
22
23
24
25
26
27




28
29
30
31
32






33
34
35
36
37
38
39
..
50
51
52
53
54
55
56
57







































58
59
60
61
62
63
64
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.runtime.cldc.debug.Debugging;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ConstantValueString;

import net.multiphasicapps.classfile.MethodNameAndType;

/**
 * This is the loader for various different object types.
 *
 * @since 2020/03/14
 */
public final class ObjectLoader
{
	/** The string class. */
	private static final ClassName _STRING_CLASS =
		new ClassName("java/lang/String");
	




	/** Load-UTF and intern function. */
	private static final MethodNameAndType _LOAD_NAME_AND_TYPE =
		new MethodNameAndType("__loadUtfAndIntern",
		"(J)Ljava/lang/String;");
	






	/**
	 * Not used.
	 *
	 * @since 2020/03/14
	 */
	private ObjectLoader()
	{
................................................................................
	public static SpringObject loadClassInfo(SpringThreadWorker __thread,
		SpringClass __class)
		throws NullPointerException
	{
		if (__thread == null || __class == null)
			throw new NullPointerException("NARG");
		
		throw Debugging.todo();







































	}
	
	/**
	 * Loads a constant pool based string value into the intern pool of the
	 * VM.
	 *
	 * @param __thread The creating thread.







|


>













>
>
>
>





>
>
>
>
>
>







 







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







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
..
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import java.util.Map;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ConstantValueString;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodNameAndType;

/**
 * This is the loader for various different object types.
 *
 * @since 2020/03/14
 */
public final class ObjectLoader
{
	/** The string class. */
	private static final ClassName _STRING_CLASS =
		new ClassName("java/lang/String");
	
	/** The class info class. */
	private static final ClassName _CLASSINFO_CLASS =
		new ClassName("cc/squirreljme/jvm/ClassInfo");
	
	/** Load-UTF and intern function. */
	private static final MethodNameAndType _LOAD_NAME_AND_TYPE =
		new MethodNameAndType("__loadUtfAndIntern",
		"(J)Ljava/lang/String;");
	
	/** Classinfo constructor. */
	private static final MethodDescriptor _CLASSINFO_CONSTRUCTOR =
		new MethodDescriptor("(IJJIIIIILcc/squirreljme/jvm/ClassInfo;" +
			"[Lcc/squirreljme/jvm/ClassInfo;Lcc/squirreljme/jvm/ClassInfo;" +
			"Ljava/lang/Class;[J[JJIIIIJJ)V");
	
	/**
	 * Not used.
	 *
	 * @since 2020/03/14
	 */
	private ObjectLoader()
	{
................................................................................
	public static SpringObject loadClassInfo(SpringThreadWorker __thread,
		SpringClass __class)
		throws NullPointerException
	{
		if (__thread == null || __class == null)
			throw new NullPointerException("NARG");
		
		// Prevent other threads from loading class infos
		Map<ClassName, SpringObject> classInfos = __thread.machine._classInfos;
		synchronized (classInfos)
		{
			// Pre-cached?
			SpringObject rv = classInfos.get(__class.name);
			if (rv != null)
				return rv;
			
			// Use for the allocation of strings
			MemoryManager mmu = __thread.machine.tasks.memory;
			
			// Initialize instance
			rv = __thread.newInstance(_CLASSINFO_CLASS, _CLASSINFO_CONSTRUCTOR,
				0, // int __fl
				(long)-1, // long __minip
				mmu.loadUtf(__class.name.toString()).pointer, // long __namep
				-1, // int __sz
				-1, // int __bz
				-1, // int __no
				-1, // int __dim
				-1, // int __csz
				SpringNullObject.NULL, // ClassInfo __scl
				SpringNullObject.NULL, // ClassInfo[] __icl
				SpringNullObject.NULL, // ClassInfo __ccl
				SpringNullObject.NULL, // Class<?> __cop
				SpringNullObject.NULL, // long[] __vtv
				SpringNullObject.NULL, // long[] __vtp
				(long)-1, // long __pool
				-1, // int __jardx
				-1, // int __nm
				-1, // int __cd
				-1, // int __sfp
				(long)-1, // long __dn
				(long)-1); // long __sm
			
			// Cache and use it
			classInfos.put(__class.name, rv);
			return rv;
		}
	}
	
	/**
	 * Loads a constant pool based string value into the intern pool of the
	 * VM.
	 *
	 * @param __thread The creating thread.

Changes to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringArrayObjectLong.java.

105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
	@Override
	public final void set(int __dx, Object __v)
		throws SpringArrayStoreException, SpringArrayIndexOutOfBoundsException
	{
		// Try setting
		try
		{
			this._elements[__dx] = ((Number)__v).longValue();

		}
		
		// {@squirreljme.error BK0o Could not set the index in the long
		// array.}
		catch (ClassCastException e)
		{
			throw new SpringArrayStoreException("BK0o", e);







|
>







105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
	@Override
	public final void set(int __dx, Object __v)
		throws SpringArrayStoreException, SpringArrayIndexOutOfBoundsException
	{
		// Try setting
		try
		{
			this._elements[__dx] = ((__v instanceof SpringPointer) ?
				((SpringPointer)__v).pointer : ((Number)__v).longValue());
		}
		
		// {@squirreljme.error BK0o Could not set the index in the long
		// array.}
		catch (ClassCastException e)
		{
			throw new SpringArrayStoreException("BK0o", e);

Changes to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringMachine.java.

21
22
23
24
25
26
27

28
29
30
31
32
33
34
..
78
79
80
81
82
83
84




85
86
87
88
89
90
91
import cc.squirreljme.vm.springcoat.exceptions.SpringMachineExitException;
import cc.squirreljme.vm.springcoat.exceptions.SpringVirtualMachineException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.MethodNameAndType;
import net.multiphasicapps.classfile.PrimitiveType;

/**
 * This class contains the instance of the SpringCoat virtual machine and has
 * a classpath along with all the needed storage for variables and such.
................................................................................
	private final Map<ClassName, SpringObject> _classobjects =
		new HashMap<>();
	
	/** Class names by their objects. */
	@Deprecated
	private final Map<SpringObject, ClassName> _namesbyclass =
		new HashMap<>();




	
	/** Main entry point arguments. */
	private final String[] _args;
	
	/** System properties. */
	final Map<String, String> _sysproperties;
	







>







 







>
>
>
>







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
..
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import cc.squirreljme.vm.springcoat.exceptions.SpringMachineExitException;
import cc.squirreljme.vm.springcoat.exceptions.SpringVirtualMachineException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.MethodNameAndType;
import net.multiphasicapps.classfile.PrimitiveType;

/**
 * This class contains the instance of the SpringCoat virtual machine and has
 * a classpath along with all the needed storage for variables and such.
................................................................................
	private final Map<ClassName, SpringObject> _classobjects =
		new HashMap<>();
	
	/** Class names by their objects. */
	@Deprecated
	private final Map<SpringObject, ClassName> _namesbyclass =
		new HashMap<>();
	
	/** Class informations. */
	final Map<ClassName, SpringObject> _classInfos =
		new TreeMap<>();
	
	/** Main entry point arguments. */
	private final String[] _args;
	
	/** System properties. */
	final Map<String, String> _sysproperties;
	

Changes to modules/cldc-compact/src/main/java/cc/squirreljme/jvm/ClassInfo.java.

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
..
79
80
81
82
83
84
85



86
87
88
89
90
91
92
93
94
95
96
...
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
	
	/** Interfaces. */
	public final ClassInfo[] interfaceclasses;
	
	/** The component class. */
	public final ClassInfo componentclass;
	
	/** Pointer to the class object. */
	public final Class<?> classobjptr;
	
	/** Virtual invoke VTable. */
	public final long[] vtablevirtual;
	
	/** Virtual invoke VTable pool entries. */
	public final long[] vtablepool;
	
	/** The pointer to the constant pool of this class. */
................................................................................
	
	/** The pointer of the default constructor. */
	public final long defaultnew;
	
	/** The static main pointer of this class. */
	public final long staticmain;
	



	/**
	 * 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 __sz The size of this class.
	 * @param __bz The base offset for fields.
	 * @param __no The number of objects in the field instance.
	 * @param __dim Dimensions.
................................................................................
	 * @param __jardx The JAR Index.
	 * @param __nm The number of methods that are used.
	 * @param __cd The class depth.
	 * @param __sfp The static field offset.
	 * @param __dn The default constructor.
	 * @since 2019/04/26
	 */
	public ClassInfo(long __sp, int __fl, long __minip, long __namep, int __sz,
		int __bz, int __no, int __dim, int __csz, ClassInfo __scl,
		ClassInfo[] __icl, ClassInfo __ccl, Class<?> __cop, long[] __vtv,
		long[] __vtp, long __pool, int __jardx, int __nm, int __cd, int __sfp,
		long __dn, long __sm)
	{
		// Set
		this.selfptr = __sp;
		this.flags = __fl;
		this.miniptr = __minip;
		this.namep = __namep;
		this.size = __sz;
		this.base = __bz;
		this.numobjects = __no;
		this.dimensions = __dim;







<
<
<







 







>
>
>



<







 







|






|







49
50
51
52
53
54
55



56
57
58
59
60
61
62
..
76
77
78
79
80
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
...
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
	
	/** Interfaces. */
	public final ClassInfo[] interfaceclasses;
	
	/** The component class. */
	public final ClassInfo componentclass;
	



	/** Virtual invoke VTable. */
	public final long[] vtablevirtual;
	
	/** Virtual invoke VTable pool entries. */
	public final long[] vtablepool;
	
	/** The pointer to the constant pool of this class. */
................................................................................
	
	/** The pointer of the default constructor. */
	public final long defaultnew;
	
	/** The static main pointer of this class. */
	public final long staticmain;
	
	/** Pointer to the class object, may be dynamically initialized. */
	public Class<?> classobjptr;
	
	/**
	 * Class information constructor.
	 *

	 * @param __fl Class information flags.
	 * @param __minip Pointer to the hardware class data in ROM.
	 * @param __namep The name pointer.
	 * @param __sz The size of this class.
	 * @param __bz The base offset for fields.
	 * @param __no The number of objects in the field instance.
	 * @param __dim Dimensions.
................................................................................
	 * @param __jardx The JAR Index.
	 * @param __nm The number of methods that are used.
	 * @param __cd The class depth.
	 * @param __sfp The static field offset.
	 * @param __dn The default constructor.
	 * @since 2019/04/26
	 */
	public ClassInfo(int __fl, long __minip, long __namep, int __sz,
		int __bz, int __no, int __dim, int __csz, ClassInfo __scl,
		ClassInfo[] __icl, ClassInfo __ccl, Class<?> __cop, long[] __vtv,
		long[] __vtp, long __pool, int __jardx, int __nm, int __cd, int __sfp,
		long __dn, long __sm)
	{
		// Set
		this.selfptr = Assembly.objectToPointer(this);
		this.flags = __fl;
		this.miniptr = __minip;
		this.namep = __namep;
		this.size = __sz;
		this.base = __bz;
		this.numobjects = __no;
		this.dimensions = __dim;