Check-in [25c05490d0]

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

Overview
Comment:Move ApiLevel obtaining to the system call interface.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:25c05490d0270ed77bf7f75dcd88d38276681910
User & Date: stephanie.gawroriski 2019-05-24 13:15:22
Context
2019-05-24
13:30
Add test for intern strings. check-in: 27ade338c0 user: stephanie.gawroriski tags: trunk
13:15
Move ApiLevel obtaining to the system call interface. check-in: 25c05490d0 user: stephanie.gawroriski tags: trunk
07:02
Backup developer notes. check-in: 6acae66621 user: squirreljme tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/cldc/vki/Assembly.java.

5
6
7
8
9
10
11


12
13
14
15
16
17
18
....
1144
1145
1146
1147
1148
1149
1150








1151
1152
1153
1154
1155
1156
1157
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.vki;



/**
 * This class is used special by the compiler to transform all the various
 * operations into regular instructions rather than method calls.
 *
 * The compiler will take all of the method arguments and instead use their
 * inputs and outputs from the values of registers instead. However due to
 * this, this means that these instructions are purely primitive in that
................................................................................
				{
					System.exit(__args[0]);
					
					rv = 0;
					err = 0;
				}
				break;








			
			default:
				// Returns no value but sets an error
				rv = -1;
				err = SystemCallError.UNSUPPORTED_SYSTEM_CALL;
				
				// If the ID is valid then a bad array access will be used







>
>







 







>
>
>
>
>
>
>
>







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
....
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.vki;

import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * This class is used special by the compiler to transform all the various
 * operations into regular instructions rather than method calls.
 *
 * The compiler will take all of the method arguments and instead use their
 * inputs and outputs from the values of registers instead. However due to
 * this, this means that these instructions are purely primitive in that
................................................................................
				{
					System.exit(__args[0]);
					
					rv = 0;
					err = 0;
				}
				break;
				
				// API level
			case SystemCallIndex.API_LEVEL:
				{
					rv = ApiLevel.LEVEL_SQUIRRELJME_0_3_0_DEV;
					err = 0;
				}
				break;
			
			default:
				// Returns no value but sets an error
				rv = -1;
				err = SystemCallError.UNSUPPORTED_SYSTEM_CALL;
				
				// If the ID is valid then a bad array access will be used

Changes to runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/asm/SystemProperties.java.

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
	 *
	 * @since 2018/09/20
	 */
	private SystemProperties()
	{
	}
	
	/**
	 * Returns the API level of the virtual machine.
	 *
	 * @return The API level.
	 * @since 2018/12/05
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static native int apiLevel();
	
	/**
	 * Returns the approximated path where the VM's executable exists. This
	 * will be the actual JVM's JAR or EXE file.
	 *
	 * @return The approximated executable path or {@code null} if it is not
	 * known.
	 * @since 2018/12/08







<
<
<
<
<
<
<
<
<







27
28
29
30
31
32
33









34
35
36
37
38
39
40
	 *
	 * @since 2018/09/20
	 */
	private SystemProperties()
	{
	}
	









	/**
	 * Returns the approximated path where the VM's executable exists. This
	 * will be the actual JVM's JAR or EXE file.
	 *
	 * @return The approximated executable path or {@code null} if it is not
	 * known.
	 * @since 2018/12/08

Changes to runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/lang/ApiLevel.java.

6
7
8
9
10
11
12
13


14
15
16
17
18
19
20
..
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
..
76
77
78
79
80
81
82
83
84
85
86
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.lang;

import cc.squirreljme.runtime.cldc.asm.SystemProperties;



/**
 * Provides access to the current API level.
 *
 * This is used for backwards compatibility.
 *
 * Levels are in the form of {@code 0M_mm_R_yyDDD} (Major version, minor
................................................................................
 *
 * @since 2018/12/05
 */
public final class ApiLevel
{
	/** The current API level. */
	public static final int CURRENT_LEVEL =
		SystemProperties.apiLevel();
	
	/** Undefined. */
	public static final int UNDEFINED =
		0x7FFFFFFF;
	
	/** SquirrelJME 0.2.0 (December 25, 2018). */
	public static final int LEVEL_SQUIRRELJME_0_2_0_20181225 =
................................................................................
	 *
	 * @param __l The level to check.
	 * @return If the minimum level is met.
	 * @since 2019/02/02
	 */
	public static boolean minimumLevel(int __l)
	{
		return (SystemProperties.apiLevel() >= __l);
	}
}








|
>
>







 







|







 







|



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
..
78
79
80
81
82
83
84
85
86
87
88
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.runtime.cldc.lang;

import cc.squirreljme.runtime.cldc.vki.Assembly;
import cc.squirreljme.runtime.cldc.vki.SystemCallError;
import cc.squirreljme.runtime.cldc.vki.SystemCallIndex;

/**
 * Provides access to the current API level.
 *
 * This is used for backwards compatibility.
 *
 * Levels are in the form of {@code 0M_mm_R_yyDDD} (Major version, minor
................................................................................
 *
 * @since 2018/12/05
 */
public final class ApiLevel
{
	/** The current API level. */
	public static final int CURRENT_LEVEL =
		Assembly.sysCallV(SystemCallIndex.API_LEVEL);
	
	/** Undefined. */
	public static final int UNDEFINED =
		0x7FFFFFFF;
	
	/** SquirrelJME 0.2.0 (December 25, 2018). */
	public static final int LEVEL_SQUIRRELJME_0_2_0_20181225 =
................................................................................
	 *
	 * @param __l The level to check.
	 * @return If the minimum level is met.
	 * @since 2019/02/02
	 */
	public static boolean minimumLevel(int __l)
	{
		return (CURRENT_LEVEL >= __l);
	}
}

Changes to runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/vki/SystemCallIndex.java.

74
75
76
77
78
79
80





81
82
83
84
85
86
87
	public static final short GARBAGE_COLLECT =
		10;
	
	/** Exit the VM. */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_3_0_DEV)
	public static final short EXIT =
		11;





	
	/** System call count. */
	public static final int NUM_SYSCALLS =
		12;
	
	/**
	 * Not used.







>
>
>
>
>







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
	public static final short GARBAGE_COLLECT =
		10;
	
	/** Exit the VM. */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_3_0_DEV)
	public static final short EXIT =
		11;
	
	/** The API Level of the VM. */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_3_0_DEV)
	public static final short API_LEVEL =
		12;
	
	/** System call count. */
	public static final int NUM_SYSCALLS =
		12;
	
	/**
	 * Not used.

Changes to runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringThreadWorker.java.

1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
....
4237
4238
4239
4240
4241
4242
4243








4244
4245
4246
4247
4248
4249
4250
				
				// Get environment variable
			case "cc/squirreljme/runtime/cldc/asm/SystemAccess::" +
				"getEnv:(Ljava/lang/String;)Ljava/lang/String;":
				return this.asVMObject(SystemAccess.getEnv(
					this.<String>asNativeObject(String.class, __args[0])));
			
				// Returns the API level of the VM
			case "cc/squirreljme/runtime/cldc/asm/SystemProperties::" +
				"apiLevel:()I":
				return ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225;
				
				// Approximated executable path
			case "cc/squirreljme/runtime/cldc/asm/SystemProperties::" +
				"executablePath:()Ljava/lang/String;":
				// Just use the one of the host VM, if it is known anyway
				return this.asVMObject(SystemProperties.executablePath());
				
				// The guest depth of this virtual machine
................................................................................
					this.thread.profiler.exitAll(System.nanoTime());
					this.machine.exit((Integer)__args[0]);
					
					rv = 0;
					err = 0;
				}
				break;








			
			default:
				// Returns no value but sets an error
				rv = -1;
				err = SystemCallError.UNSUPPORTED_SYSTEM_CALL;
				
				// If the ID is valid then a bad array access will be used







<
<
<
<
<







 







>
>
>
>
>
>
>
>







1681
1682
1683
1684
1685
1686
1687





1688
1689
1690
1691
1692
1693
1694
....
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
				
				// Get environment variable
			case "cc/squirreljme/runtime/cldc/asm/SystemAccess::" +
				"getEnv:(Ljava/lang/String;)Ljava/lang/String;":
				return this.asVMObject(SystemAccess.getEnv(
					this.<String>asNativeObject(String.class, __args[0])));
			





				// Approximated executable path
			case "cc/squirreljme/runtime/cldc/asm/SystemProperties::" +
				"executablePath:()Ljava/lang/String;":
				// Just use the one of the host VM, if it is known anyway
				return this.asVMObject(SystemProperties.executablePath());
				
				// The guest depth of this virtual machine
................................................................................
					this.thread.profiler.exitAll(System.nanoTime());
					this.machine.exit((Integer)__args[0]);
					
					rv = 0;
					err = 0;
				}
				break;
				
				// API level
			case SystemCallIndex.API_LEVEL:
				{
					rv = ApiLevel.LEVEL_SQUIRRELJME_0_3_0_DEV;
					err = 0;
				}
				break;
			
			default:
				// Returns no value but sets an error
				rv = -1;
				err = SystemCallError.UNSUPPORTED_SYSTEM_CALL;
				
				// If the ID is valid then a bad array access will be used