summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcheck.py19
-rw-r--r--src/js/wasm.js-post.js30
m---------test/emscripten0
3 files changed, 25 insertions, 24 deletions
diff --git a/check.py b/check.py
index a8bd65bb4..8b1db8dac 100755
--- a/check.py
+++ b/check.py
@@ -586,19 +586,20 @@ if has_emcc:
print '\n[ checking wasm.js methods... ]\n'
- for method_init in [None, 'asm2wasm', 'wasm-s-parser', 'just-asm', 'wasm-binary']:
+ for method_init in [None, 'interpret-asm2wasm', 'interpret-s-expr', 'asmjs', 'interpret-binary']:
for success in [1, 0]:
method = method_init
command = ['emcc', '-o', 'a.wasm.js', '-s', 'BINARYEN=1', os.path.join('test', 'hello_world.c') ]
if method:
command += ['-s', 'BINARYEN_METHOD="' + method + '"']
else:
- method = 'wasm-s-parser' # this is the default
+ method = 'interpret-s-expr' # this is the default
print method, ' : ', ' '.join(command), ' => ', success
subprocess.check_call(command)
see_polyfill = 'var WasmJS = ' in open('a.wasm.js').read()
- if method and 'asm2wasm' not in method and 'wasm-s-parser' not in method and 'wasm-binary' not in method:
+
+ if method and 'interpret' not in method:
assert not see_polyfill, 'verify polyfill was not added - we specified a method, and it does not need it'
else:
assert see_polyfill, 'we need the polyfill'
@@ -608,20 +609,20 @@ if has_emcc:
asm = asm.replace('"almost asm"', '"use asm"; var not_in_asm = [].length + (true || { x: 5 }.x);')
asm = asm.replace("'almost asm'", '"use asm"; var not_in_asm = [].length + (true || { x: 5 }.x);')
open('a.wasm.asm.js', 'w').write(asm)
- if method == 'asm2wasm':
+ if method == 'interpret-asm2wasm':
os.unlink('a.wasm.wast') # we should not need the .wast
if not success:
break_cashew() # we need cashew
- elif method == 'wasm-s-parser':
+ elif method == 'interpret-s-expr':
os.unlink('a.wasm.asm.js') # we should not need the .asm.js
if not success:
os.unlink('a.wasm.wast.mappedGlobals')
- elif method == 'just-asm':
+ elif method == 'asmjs':
os.unlink('a.wasm.wast') # we should not need the .wast
break_cashew() # we don't use cashew, so ok to break it
if not success:
os.unlink('a.wasm.js')
- elif method == 'wasm-binary':
+ elif method == 'interpret-binary':
os.unlink('a.wasm.wast') # we should not need the .wast
os.unlink('a.wasm.asm.js') # we should not need the .asm.js
if not success:
@@ -656,7 +657,7 @@ if has_emcc:
extra = json.loads(open(emcc).read())
if os.path.exists('a.normal.js'): os.unlink('a.normal.js')
for opts in [[], ['-O1'], ['-O2'], ['-O3'], ['-Oz']]:
- for method in ['asm2wasm', 'wasm-s-parser', 'just-asm', 'wasm-binary']:
+ for method in ['interpret-asm2wasm', 'interpret-s-expr', 'asmjs', 'interpret-binary']:
command = ['emcc', '-o', 'a.wasm.js', '-s', 'BINARYEN=1', os.path.join('test', c)] + opts + extra
command += ['-s', 'BINARYEN_METHOD="' + method + '"']
print '....' + ' '.join(command)
@@ -683,7 +684,7 @@ if has_emcc:
execute()
- if method in ['asm2wasm', 'wasm-s-parser']:
+ if method in ['interpret-asm2wasm', 'interpret-s-expr']:
# binary and back
shutil.copyfile('a.wasm.wast', 'a.wasm.original.wast')
recreated = binary_format_check('a.wasm.wast', verify_final_result=False)
diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js
index 12e9e5315..0549dbd51 100644
--- a/src/js/wasm.js-post.js
+++ b/src/js/wasm.js-post.js
@@ -17,10 +17,10 @@
function integrateWasmJS(Module) {
// wasm.js has several methods for creating the compiled code module here:
// * 'native-wasm' : use native WebAssembly support in the browser
- // * 'wasm-s-parser': load s-expression code from a .wast and interpret
- // * 'wasm-binary': load binary wasm and interpret
- // * 'asm2wasm': load asm.js code, translate to wasm, and interpret
- // * 'just-asm': no wasm, just load the asm.js code and use that (good for testing)
+ // * 'interpret-s-expr': load s-expression code from a .wast and interpret
+ // * 'interpret-binary': load binary wasm and interpret
+ // * 'interpret-asm2wasm': load asm.js code, translate to wasm, and interpret
+ // * 'asmjs': no wasm, just load the asm.js code and use that (good for testing)
// The method can be set at compile time (BINARYEN_METHOD), or runtime by setting Module['wasmJSMethod'].
// The method can be a comma-separated list, in which case, we will try the
// options one by one. Some of them can fail gracefully, and then we can try
@@ -28,7 +28,7 @@ function integrateWasmJS(Module) {
// inputs
- var method = Module['wasmJSMethod'] || {{{ wasmJSMethod }}} || 'native-wasm,wasm-s-parser'; // by default, try native and then .wast
+ var method = Module['wasmJSMethod'] || {{{ wasmJSMethod }}} || 'native-wasm,interpret-s-expr'; // by default, try native and then .wast
var wasmTextFile = Module['wasmTextFile'] || {{{ wasmTextFile }}};
var wasmBinaryFile = Module['wasmBinaryFile'] || {{{ wasmBinaryFile }}};
@@ -229,23 +229,23 @@ function integrateWasmJS(Module) {
wasmJS['providedTotalMemory'] = Module['buffer'].byteLength;
- // Prepare to generate wasm, using either asm2wasm or wasm-s-parser
+ // Prepare to generate wasm, using either asm2wasm or s-exprs
var code;
- if (method === 'wasm-binary') {
+ if (method === 'interpret-binary') {
code = getBinary();
} else {
- code = Module['read'](method == 'asm2wasm' ? asmjsCodeFile : wasmTextFile);
+ code = Module['read'](method == 'interpret-asm2wasm' ? asmjsCodeFile : wasmTextFile);
}
var temp;
- if (method == 'asm2wasm') {
+ if (method == 'interpret-asm2wasm') {
temp = wasmJS['_malloc'](code.length + 1);
wasmJS['writeAsciiToMemory'](code, temp);
wasmJS['_load_asm2wasm'](temp);
- } else if (method === 'wasm-s-parser') {
+ } else if (method === 'interpret-s-expr') {
temp = wasmJS['_malloc'](code.length + 1);
wasmJS['writeAsciiToMemory'](code, temp);
wasmJS['_load_s_expr2wasm'](temp);
- } else if (method === 'wasm-binary') {
+ } else if (method === 'interpret-binary') {
temp = wasmJS['_malloc'](code.length);
wasmJS['HEAPU8'].set(code, temp);
wasmJS['_load_binary2wasm'](temp, code.length);
@@ -261,9 +261,9 @@ function integrateWasmJS(Module) {
Module['newBuffer'] = null;
}
- if (method == 'wasm-s-parser') {
+ if (method == 'interpret-s-expr') {
applyMappedGlobals(wasmTextFile);
- } else if (method == 'wasm-binary') {
+ } else if (method == 'interpret-binary') {
applyMappedGlobals(wasmBinaryFile);
}
@@ -281,9 +281,9 @@ function integrateWasmJS(Module) {
//Module['printErr']('using wasm/js method: ' + curr);
if (curr === 'native-wasm') {
if (doNativeWasm()) return;
- } else if (curr === 'just-asm') {
+ } else if (curr === 'asmjs') {
if (doJustAsm()) return;
- } else if (curr === 'asm2wasm' || curr === 'wasm-s-parser' || curr === 'wasm-binary') {
+ } else if (curr === 'interpret-asm2wasm' || curr === 'interpret-s-expr' || curr === 'interpret-binary') {
if (doWasmPolyfill(curr)) return;
} else {
throw 'bad method: ' + curr;
diff --git a/test/emscripten b/test/emscripten
-Subproject b4e694961408bc530155161998f0165e5d4c8ba
+Subproject 2c7867418c0159eef403b0cf673e8b9aaaf29ee