generalize the use of the flag useGC

This commit is contained in:
Volker Berlin 2020-03-18 22:23:45 +01:00
parent ff5b8f8442
commit dd01ad10b2
2 changed files with 13 additions and 5 deletions

View File

@ -27,10 +27,20 @@ public enum ScriptEngine {
NodeWat,
SpiderMonkeyWat,
Wat2Wasm,
SpiderMonkeyGC,
SpiderMonkeyWatGC,
SpiderMonkeyGC(true),
SpiderMonkeyWatGC(true),
;
public final String useGC;
private ScriptEngine() {
this.useGC = null;
}
private ScriptEngine( boolean useGC ) {
this.useGC = Boolean.toString( useGC );
}
public static ScriptEngine[] testEngines() {
ScriptEngine[] val = { //
SpiderMonkey, //

View File

@ -485,6 +485,7 @@ public class WasmRule extends TemporaryFolder {
writeJsonTestData( Collections.singletonMap( methodName, params ) );
}
compiler.setProperty( JWebAssembly.WASM_USE_GC, script.useGC );
processBuilder = createCommand( script );
processBuilder.directory( getRoot() );
Process process = processBuilder.start();
@ -540,7 +541,6 @@ public class WasmRule extends TemporaryFolder {
if( binary ) {
if( spiderMonkeyScriptGC == null ) {
File file = newFile( "spiderMonkeyGC.wasm" );
compiler.setProperty( JWebAssembly.WASM_USE_GC, "true" );
compiler.compileToBinary( file );
spiderMonkeyScriptGC = createScript( "SpiderMonkeyTest.js", "{test.wasm}", file.getName() );
}
@ -548,7 +548,6 @@ public class WasmRule extends TemporaryFolder {
} else {
if( spiderMonkeyScriptWatGC == null ) {
File file = newFile( "spiderMonkeyGC.wat" );
compiler.setProperty( JWebAssembly.WASM_USE_GC, "true" );
compiler.compileToText( file );
spiderMonkeyScriptWatGC = createScript( "SpiderMonkeyWatTest.js", "{test}", "spiderMonkeyGC" );
}
@ -572,7 +571,6 @@ public class WasmRule extends TemporaryFolder {
}
}
} finally {
compiler.setProperty( JWebAssembly.WASM_USE_GC, null );
System.clearProperty( "SpiderMonkey" );
}
ProcessBuilder process = new ProcessBuilder( spiderMonkey.getCommand(), script.getAbsolutePath() );