Remove all special handling for SpiderMonkey. It is compatible now.

This commit is contained in:
Volker Berlin 2020-04-04 11:40:35 +02:00
parent 561dc37540
commit 9bbc82bb6d
3 changed files with 30 additions and 47 deletions

View File

@ -119,14 +119,6 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod
wasm.write( WASM_BINARY_MAGIC );
wasm.writeInt32( WASM_BINARY_VERSION );
if( options.useGC() && Boolean.getBoolean( "SpiderMonkey" ) ) {
// Section 42, enable GcFeatureOptIn for SpiderMonkey https://github.com/lars-t-hansen/moz-gc-experiments/blob/master/version2.md
wasm.writeVaruint32( 42 );
wasm.writeVaruint32( 1 );
wasm.write( 3 ); // version of GcFeatureOptIn
// End Section 42
}
writeSection( SectionType.Type, functionTypes );
writeSection( SectionType.Import, imports.values() );
writeSection( SectionType.Function, functions.values() );

View File

@ -54,8 +54,6 @@ import de.inetsoftware.jwebassembly.wasm.WasmBlockOperator;
*/
public class TextModuleWriter extends ModuleWriter {
private final boolean spiderMonkey = Boolean.getBoolean( "SpiderMonkey" );
private final WasmTarget target;
private final StringBuilder output = new StringBuilder();
@ -109,9 +107,6 @@ public class TextModuleWriter extends ModuleWriter {
public void close() throws IOException {
Appendable textOutput = target.getTextOutput();
textOutput.append( "(module" );
if( spiderMonkey && options.useGC() ) {
textOutput.append( " (gc_feature_opt_in 3)" ); // enable GcFeatureOptIn for SpiderMonkey https://github.com/lars-t-hansen/moz-gc-experiments/blob/master/version2.md
}
for( int i = 0; i < types.size(); i++ ) {
newline( textOutput );
@ -318,7 +313,7 @@ public class TextModuleWriter extends ModuleWriter {
if( type instanceof ValueType ) {
output.append( type.toString() );
} else if( options.useGC() ) {
output.append( "(ref " ).append( normalizeName( type.toString() ) ).append( ')' );
output.append( "(optref " ).append( normalizeName( type.toString() ) ).append( ')' );
} else {
output.append( ValueType.anyref.toString() );
}

View File

@ -535,44 +535,40 @@ public class WasmRule extends TemporaryFolder {
*/
private ProcessBuilder spiderMonkeyCommand( boolean binary, boolean gc ) throws IOException {
File script;
try {
System.setProperty( "SpiderMonkey", "true" );
if( gc ) {
if( binary ) {
if( spiderMonkeyScriptGC == null ) {
File file = newFile( "spiderMonkeyGC.wasm" );
compiler.compileToBinary( file );
spiderMonkeyScriptGC = createScript( "SpiderMonkeyTest.js", "{test.wasm}", file.getName() );
}
script = spiderMonkeyScriptGC;
} else {
if( spiderMonkeyScriptWatGC == null ) {
File file = newFile( "spiderMonkeyGC.wat" );
compiler.compileToText( file );
spiderMonkeyScriptWatGC = createScript( "SpiderMonkeyWatTest.js", "{test}", "spiderMonkeyGC" );
}
script = spiderMonkeyScriptWatGC;
if( gc ) {
if( binary ) {
if( spiderMonkeyScriptGC == null ) {
File file = newFile( "spiderMonkeyGC.wasm" );
compiler.compileToBinary( file );
spiderMonkeyScriptGC = createScript( "SpiderMonkeyTest.js", "{test.wasm}", file.getName() );
}
script = spiderMonkeyScriptGC;
} else {
if( binary ) {
if( spiderMonkeyScript == null ) {
File file = newFile( "spiderMonkey.wasm" );
compiler.compileToBinary( file );
spiderMonkeyScript = createScript( "SpiderMonkeyTest.js", "{test.wasm}", file.getName() );
}
script = spiderMonkeyScript;
} else {
if( spiderMonkeyWatScript == null ) {
File file = newFile( "spiderMonkey.wat" );
compiler.compileToText( file );
spiderMonkeyWatScript = createScript( "SpiderMonkeyWatTest.js", "{test}", "spiderMonkey" );
}
script = spiderMonkeyWatScript;
if( spiderMonkeyScriptWatGC == null ) {
File file = newFile( "spiderMonkeyGC.wat" );
compiler.compileToText( file );
spiderMonkeyScriptWatGC = createScript( "SpiderMonkeyWatTest.js", "{test}", "spiderMonkeyGC" );
}
script = spiderMonkeyScriptWatGC;
}
} else {
if( binary ) {
if( spiderMonkeyScript == null ) {
File file = newFile( "spiderMonkey.wasm" );
compiler.compileToBinary( file );
spiderMonkeyScript = createScript( "SpiderMonkeyTest.js", "{test.wasm}", file.getName() );
}
script = spiderMonkeyScript;
} else {
if( spiderMonkeyWatScript == null ) {
File file = newFile( "spiderMonkey.wat" );
compiler.compileToText( file );
spiderMonkeyWatScript = createScript( "SpiderMonkeyWatTest.js", "{test}", "spiderMonkey" );
}
script = spiderMonkeyWatScript;
}
} finally {
System.clearProperty( "SpiderMonkey" );
}
ProcessBuilder process = new ProcessBuilder( spiderMonkey.getCommand(), script.getAbsolutePath() );
if( gc ) {
process.command().add( 1, "--wasm-gc" );