Commit 6f098e15 authored by Stephanie Gawroriski's avatar Stephanie Gawroriski
Browse files

SpringCoat can now accept system properties for tasks.

parent 0f30352f
......@@ -55,6 +55,8 @@ More detailed changes:
properties.
* Added string representation for the stack map table.
* SpringCoat
* Add support for system properties being based to virtual machine
instances.
* SummerCoat
* New Virtual Machine, register based.
* Vast improvements over SpringCoat, faster and slimmer.
......
......@@ -49,10 +49,10 @@ public class SpringCoatFactory
throws IllegalArgumentException, NullPointerException, VMException
{
// Create a new instance of the VM
SpringTaskManager tm = new SpringTaskManager(__sm, __ps);
SpringTaskManager tm = new SpringTaskManager(__sm, __ps, __sprops);
return new SpringMachine(__sm, new SpringClassLoader(__cp),
tm, __maincl, __ismid, -1,
__gd, __ps, tm.nativedisplay, __args);
__gd, __ps, tm.nativedisplay, __sprops, __args);
}
}
......@@ -111,6 +111,9 @@ public final class SpringMachine
private final Map<String, Long> _strstringtolong =
new HashMap<>();
/** System properties. */
final Map<String, String> _sysproperties;
/** The next thread ID to use. */
private volatile int _nextthreadid;
......@@ -136,6 +139,7 @@ public final class SpringMachine
* @param __gd Guest depth.
* @param __profiler The profiler to use.
* @param __nda The native display provider.
* @param __sprops System properties.
* @param __args Main entry point arguments.
* @throws NullPointerException On null arguments.
* @since 2018/09/03
......@@ -143,7 +147,8 @@ public final class SpringMachine
public SpringMachine(VMSuiteManager __sm, SpringClassLoader __cl,
SpringTaskManager __tm, String __bootcl, boolean __bootmid,
int __bootdx, int __gd, ProfilerSnapshot __profiler,
VMNativeDisplayAccess __nda, String... __args)
VMNativeDisplayAccess __nda, Map<String, String> __sprops,
String... __args)
throws NullPointerException
{
if (__cl == null || __sm == null || __nda == null)
......@@ -160,6 +165,8 @@ public final class SpringMachine
this._args = (__args == null ? new String[0] : __args.clone());
this.profiler = (__profiler != null ? __profiler :
new ProfilerSnapshot());
this._sysproperties = (__sprops == null ?
new HashMap<String, String>() : new HashMap<>(__sprops));
// Setup resource accessor
this.resourceaccessor = new VMResourceAccess(__sm);
......
......@@ -42,6 +42,9 @@ public final class SpringTaskManager
private final Map<Integer, SpringTask> _tasks =
new HashMap<>();
/** System properties. */
private final Map<String, String> _sysprops;
/** Access to the native display. */
protected final VMNativeDisplayAccess nativedisplay =
new VMNativeDisplayAccess();
......@@ -54,10 +57,12 @@ public final class SpringTaskManager
*
* @param __sm The suite manager.
* @param __ps The snapshot for profiling.
* @param __sp System properties.
* @throws NullPointerException On null arguments.
* @since 2018/11/04
*/
public SpringTaskManager(VMSuiteManager __sm, ProfilerSnapshot __ps)
public SpringTaskManager(VMSuiteManager __sm, ProfilerSnapshot __ps,
Map<String, String> __sp)
throws NullPointerException
{
if (__sm == null)
......@@ -65,6 +70,8 @@ public final class SpringTaskManager
this.suites = __sm;
this.profiler = (__ps == null ? new ProfilerSnapshot() : __ps);
this._sysprops = (__sp == null ? new HashMap<String, String>() :
new HashMap<>(__sp));
}
/**
......@@ -140,7 +147,7 @@ public final class SpringTaskManager
// Build machine for the task
SpringMachine machine = new SpringMachine(suites,
new SpringClassLoader(scl), this, null, false, bootdx, __gd + 1,
this.profiler, this.nativedisplay, __args);
this.profiler, this.nativedisplay, this._sysprops, __args);
// Lock on tasks
Map<Integer, SpringTask> tasks = this._tasks;
......
......@@ -1686,8 +1686,12 @@ public final class SpringThreadWorker
// Get system property
case "cc/squirreljme/runtime/cldc/asm/SystemProperties::" +
"systemProperty:(Ljava/lang/String;)Ljava/lang/String;":
return System.getProperty(this.<String>asNativeObject(
String.class, __args[0]));
String pk = this.<String>asNativeObject(String.class,
__args[0]),
pv = this.machine._sysproperties.get(pk);
if (pv != null)
return pv;
return System.getProperty(pk);
// Current thread ID
case "cc/squirreljme/runtime/cldc/asm/TaskAccess::" +
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment