Check-in [6a4c824ea6]

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

Overview
Comment:Add Assembly methods to get primitive types; Make JVMFunction.jvmLoadClass() generic.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6a4c824ea63ddc956db962b3f6c23a3b14509464
User & Date: stephanie.gawroriski 2020-01-19 16:22:42
Context
2020-01-20
08:02
Backup developer notes. check-in: 60df1f3717 user: squirreljme tags: trunk
2020-01-19
16:22
Add Assembly methods to get primitive types; Make JVMFunction.jvmLoadClass() generic. check-in: 6a4c824ea6 user: stephanie.gawroriski tags: trunk
15:54
Merge heads. check-in: 553fa6eb7c user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

73
74
75
76
77
78
79
































































80
81
82
83
84
85
86
	/**
	 * Trigger breakpoint within the virtual machine.
	 *
	 * @since 2019/04/21
	 */
	public static native void breakpoint();
	
































































	/**
	 * Packs the given two integers to a double value.
	 *
	 * @param __hi The high value.
	 * @param __lo The low value.
	 * @return The double value.
	 * @since 2019/06/21







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







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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
	/**
	 * Trigger breakpoint within the virtual machine.
	 *
	 * @since 2019/04/21
	 */
	public static native void breakpoint();
	
	/**
	 * Returns the class info pointer of {@code boolean}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfBoolean();
	
	/**
	 * Returns the class info pointer of {@code byte}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfByte();
	
	/**
	 * Returns the class info pointer of {@code char}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfCharacter();
	
	/**
	 * Returns the class info pointer of {@code double}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfDouble();
	
	/**
	 * Returns the class info pointer of {@code float}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfFloat();
	
	/**
	 * Returns the class info pointer of {@code int}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfInteger();
	
	/**
	 * Returns the class info pointer of {@code long}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfLong();
	
	/**
	 * Returns the class info pointer of {@code short}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfShort();
	
	/**
	 * Packs the given two integers to a double value.
	 *
	 * @param __hi The high value.
	 * @param __lo The low value.
	 * @return The double value.
	 * @since 2019/06/21

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

138
139
140
141
142
143
144

145

146
147
148
149
150
151
152
153
154
155
		throw new todo.TODO();
	}
	
	/**
	 * Returns the {@link Class} instance for the given class info pointer,
	 * if none has been created yet then it will be created as needed.
	 *

	 * @param __cldx The class index pointer.

	 * @since 2019/05/26
	 */
	public static final Class<?> jvmLoadClass(int __cldx)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Loads a string from memory and returns an `intern()` string value.







>

>


|







138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
		throw new todo.TODO();
	}
	
	/**
	 * Returns the {@link Class} instance for the given class info pointer,
	 * if none has been created yet then it will be created as needed.
	 *
	 * @param <T> The class type.
	 * @param __cldx The class index pointer.
	 * @return The resulting class.
	 * @since 2019/05/26
	 */
	public static final <T> Class<T> jvmLoadClass(int __cldx)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
	
	/**
	 * Loads a string from memory and returns an `intern()` string value.

Changes to runt/apis/cldc-compact/java/lang/Float.java.

7
8
9
10
11
12
13

14
15
16
17
18
19
20
..
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;

import cc.squirreljme.runtime.cldc.annotation.ProgrammerTip;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;

public final class Float
	extends Number
	implements Comparable<Float>
{
................................................................................
	
	/** The mask for NaN values. */
	private static final int _NAN_MASK =
		0b0111_1111_1000_0000_0000_0000_0000_0000;
	
	/** The class representing the primitive type. */
	public static final Class<Float> TYPE =
		ObjectAccess.<Float>classByNameType("float");
	
	/** The stored value. */
	private final float _value;
	
	/**
	 * Stores the specified float.
	 *







>







 







|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.lang;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.JVMFunction;
import cc.squirreljme.runtime.cldc.annotation.ProgrammerTip;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;

public final class Float
	extends Number
	implements Comparable<Float>
{
................................................................................
	
	/** The mask for NaN values. */
	private static final int _NAN_MASK =
		0b0111_1111_1000_0000_0000_0000_0000_0000;
	
	/** The class representing the primitive type. */
	public static final Class<Float> TYPE =
		JVMFunction.<Float>jvmLoadClass(Assembly.classInfoOfFloat());
	
	/** The stored value. */
	private final float _value;
	
	/**
	 * Stores the specified float.
	 *

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

73
74
75
76
77
78
79
































































80
81
82
83
84
85
86
	/**
	 * Trigger breakpoint within the virtual machine.
	 *
	 * @since 2019/04/21
	 */
	public static native void breakpoint();
	
































































	/**
	 * Packs the given two integers to a double value.
	 *
	 * @param __hi The high value.
	 * @param __lo The low value.
	 * @return The double value.
	 * @since 2019/06/21







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







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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
	/**
	 * Trigger breakpoint within the virtual machine.
	 *
	 * @since 2019/04/21
	 */
	public static native void breakpoint();
	
	/**
	 * Returns the class info pointer of {@code boolean}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfBoolean();
	
	/**
	 * Returns the class info pointer of {@code byte}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfByte();
	
	/**
	 * Returns the class info pointer of {@code char}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfCharacter();
	
	/**
	 * Returns the class info pointer of {@code double}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfDouble();
	
	/**
	 * Returns the class info pointer of {@code float}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfFloat();
	
	/**
	 * Returns the class info pointer of {@code int}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfInteger();
	
	/**
	 * Returns the class info pointer of {@code long}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfLong();
	
	/**
	 * Returns the class info pointer of {@code short}.
	 *
	 * @return The class info pointer.
	 * @since 2020/01/19
	 */
	public static native int classInfoOfShort();
	
	/**
	 * Packs the given two integers to a double value.
	 *
	 * @param __hi The high value.
	 * @param __lo The low value.
	 * @return The double value.
	 * @since 2019/06/21

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

289
290
291
292
293
294
295

296

297
298
299
300
301
302
303
304
305
306
		return 0;
	}
	
	/**
	 * Returns the {@link Class} instance for the given class info pointer,
	 * if none has been created yet then it will be created as needed.
	 *

	 * @param __cldx The class index pointer.

	 * @since 2019/05/26
	 */
	public static final Class<?> jvmLoadClass(int __cldx)
	{
		// Access of invalid class?
		if (__cldx == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		Assembly.breakpoint();
		throw new todo.TODO();







>

>


|







289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
		return 0;
	}
	
	/**
	 * Returns the {@link Class} instance for the given class info pointer,
	 * if none has been created yet then it will be created as needed.
	 *
	 * @param <T> The class type.
	 * @param __cldx The class index pointer.
	 * @return The resulting class.
	 * @since 2019/05/26
	 */
	public static final <T> Class<T> jvmLoadClass(int __cldx)
	{
		// Access of invalid class?
		if (__cldx == Constants.BAD_MAGIC)
			Assembly.breakpoint();
		
		Assembly.breakpoint();
		throw new todo.TODO();

Changes to runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/NearNativeByteCodeHandler.java.

2148
2149
2150
2151
2152
2153
2154








































2155
2156
2157
2158
2159
2160
2161
....
3091
3092
3093
3094
3095
3096
3097














3098
3099
3100
3101
3102
3103
3104
						0);
				break;
				
				// Breakpoint
			case "breakpoint":
				codebuilder.add(NativeInstructionType.BREAKPOINT);
				break;








































				
				// Long/Double bits
			case "doubleToRawLongBits":
			case "longBitsToDouble":
				if (__in[0].register != __out.register)
				{
					int a = __in[0].register,
................................................................................
		ByteCodeState state = this.state;
		rv = this.__eData(new NativeCodeLabel("refclear", refcljumps.size()));
		refcljumps.put(key, rv);
		
		// Use the created label
		return rv.label;
	}














	
	/**
	 * Loads the class information for a class.
	 *
	 * @param __cl The class to load.
	 * @param __r The output register.
	 * @throws NullPointerException On null arguments.







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







 







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







2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
....
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
						0);
				break;
				
				// Breakpoint
			case "breakpoint":
				codebuilder.add(NativeInstructionType.BREAKPOINT);
				break;
				
				// Load boolean class
			case "classInfoOfBoolean":
				this.__loadClassInfo("boolean", __out.register);
				break;
				
				// Load byte class
			case "classInfoOfByte":
				this.__loadClassInfo("byte", __out.register);
				break;
				
				// Load short class
			case "classInfoOfShort":
				this.__loadClassInfo("short", __out.register);
				break;
				
				// Load character class
			case "classInfoOfCharacter":
				this.__loadClassInfo("char", __out.register);
				break;
				
				// Load int class
			case "classInfoOfInteger":
				this.__loadClassInfo("int", __out.register);
				break;
				
				// Load float class
			case "classInfoOfFloat":
				this.__loadClassInfo("float", __out.register);
				break;
				
				// Load long class
			case "classInfoOfLong":
				this.__loadClassInfo("long", __out.register);
				break;
				
				// Load double class
			case "classInfoOfDouble":
				this.__loadClassInfo("double", __out.register);
				break;
				
				// Long/Double bits
			case "doubleToRawLongBits":
			case "longBitsToDouble":
				if (__in[0].register != __out.register)
				{
					int a = __in[0].register,
................................................................................
		ByteCodeState state = this.state;
		rv = this.__eData(new NativeCodeLabel("refclear", refcljumps.size()));
		refcljumps.put(key, rv);
		
		// Use the created label
		return rv.label;
	}
	
	/**
	 * Loads the class information for a class.
	 *
	 * @param __cl The class to load.
	 * @param __r The output register.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/01/19
	 */
	private final void __loadClassInfo(String __cl, int __r)
		throws NullPointerException
	{
		this.__loadClassInfo(new ClassName(__cl), __r);
	}
	
	/**
	 * Loads the class information for a class.
	 *
	 * @param __cl The class to load.
	 * @param __r The output register.
	 * @throws NullPointerException On null arguments.