mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
Remove all special handling for SpiderMonkey. It is compatible now.
This commit is contained in:
parent
561dc37540
commit
9bbc82bb6d
@ -119,14 +119,6 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod
|
|||||||
wasm.write( WASM_BINARY_MAGIC );
|
wasm.write( WASM_BINARY_MAGIC );
|
||||||
wasm.writeInt32( WASM_BINARY_VERSION );
|
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.Type, functionTypes );
|
||||||
writeSection( SectionType.Import, imports.values() );
|
writeSection( SectionType.Import, imports.values() );
|
||||||
writeSection( SectionType.Function, functions.values() );
|
writeSection( SectionType.Function, functions.values() );
|
||||||
|
@ -54,8 +54,6 @@ import de.inetsoftware.jwebassembly.wasm.WasmBlockOperator;
|
|||||||
*/
|
*/
|
||||||
public class TextModuleWriter extends ModuleWriter {
|
public class TextModuleWriter extends ModuleWriter {
|
||||||
|
|
||||||
private final boolean spiderMonkey = Boolean.getBoolean( "SpiderMonkey" );
|
|
||||||
|
|
||||||
private final WasmTarget target;
|
private final WasmTarget target;
|
||||||
|
|
||||||
private final StringBuilder output = new StringBuilder();
|
private final StringBuilder output = new StringBuilder();
|
||||||
@ -109,9 +107,6 @@ public class TextModuleWriter extends ModuleWriter {
|
|||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
Appendable textOutput = target.getTextOutput();
|
Appendable textOutput = target.getTextOutput();
|
||||||
textOutput.append( "(module" );
|
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++ ) {
|
for( int i = 0; i < types.size(); i++ ) {
|
||||||
newline( textOutput );
|
newline( textOutput );
|
||||||
@ -318,7 +313,7 @@ public class TextModuleWriter extends ModuleWriter {
|
|||||||
if( type instanceof ValueType ) {
|
if( type instanceof ValueType ) {
|
||||||
output.append( type.toString() );
|
output.append( type.toString() );
|
||||||
} else if( options.useGC() ) {
|
} else if( options.useGC() ) {
|
||||||
output.append( "(ref " ).append( normalizeName( type.toString() ) ).append( ')' );
|
output.append( "(optref " ).append( normalizeName( type.toString() ) ).append( ')' );
|
||||||
} else {
|
} else {
|
||||||
output.append( ValueType.anyref.toString() );
|
output.append( ValueType.anyref.toString() );
|
||||||
}
|
}
|
||||||
|
@ -535,44 +535,40 @@ public class WasmRule extends TemporaryFolder {
|
|||||||
*/
|
*/
|
||||||
private ProcessBuilder spiderMonkeyCommand( boolean binary, boolean gc ) throws IOException {
|
private ProcessBuilder spiderMonkeyCommand( boolean binary, boolean gc ) throws IOException {
|
||||||
File script;
|
File script;
|
||||||
try {
|
if( gc ) {
|
||||||
System.setProperty( "SpiderMonkey", "true" );
|
if( binary ) {
|
||||||
if( gc ) {
|
if( spiderMonkeyScriptGC == null ) {
|
||||||
if( binary ) {
|
File file = newFile( "spiderMonkeyGC.wasm" );
|
||||||
if( spiderMonkeyScriptGC == null ) {
|
compiler.compileToBinary( file );
|
||||||
File file = newFile( "spiderMonkeyGC.wasm" );
|
spiderMonkeyScriptGC = createScript( "SpiderMonkeyTest.js", "{test.wasm}", file.getName() );
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
script = spiderMonkeyScriptGC;
|
||||||
} else {
|
} else {
|
||||||
if( binary ) {
|
if( spiderMonkeyScriptWatGC == null ) {
|
||||||
if( spiderMonkeyScript == null ) {
|
File file = newFile( "spiderMonkeyGC.wat" );
|
||||||
File file = newFile( "spiderMonkey.wasm" );
|
compiler.compileToText( file );
|
||||||
compiler.compileToBinary( file );
|
spiderMonkeyScriptWatGC = createScript( "SpiderMonkeyWatTest.js", "{test}", "spiderMonkeyGC" );
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
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() );
|
ProcessBuilder process = new ProcessBuilder( spiderMonkey.getCommand(), script.getAbsolutePath() );
|
||||||
if( gc ) {
|
if( gc ) {
|
||||||
process.command().add( 1, "--wasm-gc" );
|
process.command().add( 1, "--wasm-gc" );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user