Check-in [5a68aa5516]

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

Overview
Comment:Make EXIT a system call.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:5a68aa55162df4d68bbf0e0075c4f1c820791353
User & Date: stephanie.gawroriski 2019-05-23 23:22:00
Context
2019-05-23
23:42
Remove PrimitiveAccess and move the float/double bits to Assembly. check-in: dbf94d0b19 user: stephanie.gawroriski tags: trunk
23:22
Make EXIT a system call. check-in: 5a68aa5516 user: stephanie.gawroriski tags: trunk
23:14
Add GARBAGE_COLLECT system call and remove MemoryAccess (not used anymore). check-in: 7434d31525 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

1082
1083
1084
1085
1086
1087
1088










1089
1090
1091
1092
1093
1094
1095
				break;
				
				// Invoke the garbage collector
			case SystemCallIndex.GARBAGE_COLLECT:
				{
					Runtime.getRuntime().gc();
					










					rv = 0;
					err = 0;
				}
				break;
			
			default:
				// Returns no value but sets an error







>
>
>
>
>
>
>
>
>
>







1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
				break;
				
				// Invoke the garbage collector
			case SystemCallIndex.GARBAGE_COLLECT:
				{
					Runtime.getRuntime().gc();
					
					rv = 0;
					err = 0;
				}
				break;
				
				// Exit the VM
			case SystemCallIndex.EXIT:
				{
					System.exit(__args[0]);
					
					rv = 0;
					err = 0;
				}
				break;
			
			default:
				// Returns no value but sets an error

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

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
	 *
	 * @since 2018/10/13
	 */
	private SystemAccess()
	{
	}
	
	/**
	 * Exits the process with the system exit code.
	 *
	 * @param __code The exit code.
	 * @since 2018/10/13
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native void exit(int __code);
	
	/**
	 * Returns the specified environment variable, it is unspecified and
	 * system dependent if variables are case sensitive or not. Locale may
	 * be considered by the host system additionally. If environment variables
	 * do not exist in the environment then only {@code null} will be
	 * returned.
	 *







<
<
<
<
<
<
<
<
<







25
26
27
28
29
30
31









32
33
34
35
36
37
38
	 *
	 * @since 2018/10/13
	 */
	private SystemAccess()
	{
	}
	









	/**
	 * Returns the specified environment variable, it is unspecified and
	 * system dependent if variables are case sensitive or not. Locale may
	 * be considered by the host system additionally. If environment variables
	 * do not exist in the environment then only {@code null} will be
	 * returned.
	 *

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

66
67
68
69
70
71
72

73
74





75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
	
	/** VM Information: Max memory in bytes. */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_3_0_DEV)
	public static final short VMI_MEM_MAX =
		9;
	
	/** Invoke the garbage collector. */

	public static final short GARBAGE_COLLECT =
		10;





	
	/** System call count. */
	public static final int NUM_SYSCALLS =
		11;
	
	/**
	 * Not used.
	 *
	 * @since 2019/05/23
	 */
	private SystemCallIndex()
	{
	}
}








>


>
>
>
>
>



|











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
	
	/** VM Information: Max memory in bytes. */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_3_0_DEV)
	public static final short VMI_MEM_MAX =
		9;
	
	/** Invoke the garbage collector. */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_3_0_DEV)
	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.
	 *
	 * @since 2019/05/23
	 */
	private SystemCallIndex()
	{
	}
}

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

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
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.runtime.cldc.asm.SystemAccess;
import cc.squirreljme.runtime.cldc.vki.Assembly;
import cc.squirreljme.runtime.cldc.vki.SystemCallError;
import cc.squirreljme.runtime.cldc.vki.SystemCallIndex;

/**
 * This class contains information about the host memory environment along
 * with providing methods to perform garbage collection and exit the
................................................................................
	public void exit(int __v)
		throws SecurityException
	{
		// Check that we can exit
		System.getSecurityManager().checkExit(__v);
		
		// Then do the exit if no exception was thrown
		SystemAccess.exit(__v);
	}
	
	/**
	 * Returns the amount of memory that is free for the JVM to use.
	 *
	 * @return The amount of free memory.
	 * @since 2018/10/14







<







 







|







6
7
8
9
10
11
12

13
14
15
16
17
18
19
..
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.runtime.cldc.vki.Assembly;
import cc.squirreljme.runtime.cldc.vki.SystemCallError;
import cc.squirreljme.runtime.cldc.vki.SystemCallIndex;

/**
 * This class contains information about the host memory environment along
 * with providing methods to perform garbage collection and exit the
................................................................................
	public void exit(int __v)
		throws SecurityException
	{
		// Check that we can exit
		System.getSecurityManager().checkExit(__v);
		
		// Then do the exit if no exception was thrown
		Assembly.sysCall(SystemCallIndex.EXIT, __v);
	}
	
	/**
	 * Returns the amount of memory that is free for the JVM to use.
	 *
	 * @return The amount of free memory.
	 * @since 2018/10/14

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

12
13
14
15
16
17
18



19
20
21
22
23
24
25
...
811
812
813
814
815
816
817
818
819
820
821
822

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import cc.squirreljme.runtime.cldc.asm.StaticMethod;
import cc.squirreljme.runtime.cldc.asm.SystemAccess;
import cc.squirreljme.runtime.cldc.asm.TaskAccess;
import cc.squirreljme.runtime.cldc.lang.UncaughtExceptionHandler;



import java.util.HashMap;
import java.util.Map;

/**
 * A thread represents literally a single stream of execution that can
 * execute concurrently (or not).
 *
................................................................................
					{
					}
				}
			}
			
			// Exit the VM with our normal exit code, since no other
			// thread called exit at all for this point
			SystemAccess.exit(exitcode);
		}
	}
}








>
>
>







 







|




12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
...
814
815
816
817
818
819
820
821
822
823
824
825

import cc.squirreljme.runtime.cldc.annotation.ImplementationNote;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import cc.squirreljme.runtime.cldc.asm.StaticMethod;
import cc.squirreljme.runtime.cldc.asm.SystemAccess;
import cc.squirreljme.runtime.cldc.asm.TaskAccess;
import cc.squirreljme.runtime.cldc.lang.UncaughtExceptionHandler;
import cc.squirreljme.runtime.cldc.vki.Assembly;
import cc.squirreljme.runtime.cldc.vki.SystemCallError;
import cc.squirreljme.runtime.cldc.vki.SystemCallIndex;
import java.util.HashMap;
import java.util.Map;

/**
 * A thread represents literally a single stream of execution that can
 * execute concurrently (or not).
 *
................................................................................
					{
					}
				}
			}
			
			// Exit the VM with our normal exit code, since no other
			// thread called exit at all for this point
			Assembly.sysCall(SystemCallIndex.EXIT, exitcode);
		}
	}
}

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

1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
....
4228
4229
4230
4231
4232
4233
4234












4235
4236
4237
4238
4239
4240
4241
					VMClassLibrary[] vp = this.machine.classloader.classPath();
					int n = vp.length;
					String[] rv = new String[n];
					for (int i = 0; i < n; i++)
						rv[i] = vp[i].name();
					return this.asVMObject(rv);
				}
			
				// Exit the virtual machine
			case "cc/squirreljme/runtime/cldc/asm/SystemAccess::" +
				"exit:(I)V":
				this.thread.profiler.exitAll(System.nanoTime());
				this.machine.exit((Integer)__args[0]);
				return null;
				
				// 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])));
			
................................................................................
				break;
				
				// Invoke the garbage collector
			case SystemCallIndex.GARBAGE_COLLECT:
				{
					Runtime.getRuntime().gc();
					












					rv = 0;
					err = 0;
				}
				break;
			
			default:
				// Returns no value but sets an error







<
<
<
<
<
<
<







 







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







1674
1675
1676
1677
1678
1679
1680







1681
1682
1683
1684
1685
1686
1687
....
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
					VMClassLibrary[] vp = this.machine.classloader.classPath();
					int n = vp.length;
					String[] rv = new String[n];
					for (int i = 0; i < n; i++)
						rv[i] = vp[i].name();
					return this.asVMObject(rv);
				}







				
				// 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])));
			
................................................................................
				break;
				
				// Invoke the garbage collector
			case SystemCallIndex.GARBAGE_COLLECT:
				{
					Runtime.getRuntime().gc();
					
					rv = 0;
					err = 0;
				}
				break;
				
				// Exit the VM
			case SystemCallIndex.EXIT:
				{
					// Tell everything to cleanup and exit
					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