diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-04-21 21:26:32 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-04-22 10:12:24 -0700 |
commit | 0a43823615155f956f078ce7b7a8a580bc01fbe1 (patch) | |
tree | 741d1b423ea3f8f9430c96559df13524c970f7d1 | |
parent | a35db41bcca092212328b6be2fa0eddb635f2f3f (diff) | |
download | binaryen-0a43823615155f956f078ce7b7a8a580bc01fbe1.tar.gz binaryen-0a43823615155f956f078ce7b7a8a580bc01fbe1.tar.bz2 binaryen-0a43823615155f956f078ce7b7a8a580bc01fbe1.zip |
br_table offsets are int32s, not lebs
-rw-r--r-- | bin/wasm.js | 2 | ||||
-rw-r--r-- | scripts/spidermonkify.py | 4 | ||||
-rw-r--r-- | src/wasm-binary.h | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/bin/wasm.js b/bin/wasm.js index c658f2f2a..7a7b454bc 100644 --- a/bin/wasm.js +++ b/bin/wasm.js @@ -60128,7 +60128,7 @@ function __ZN4wasm17WasmBinaryBuilder11visitSwitchEPNS_6SwitchE(i9, i10) { i5 = i10 + 8 | 0; i7 = 0; while (1) { - i1 = __ZN4wasm17WasmBinaryBuilder12getBreakNameEi(i9, __ZN4wasm17WasmBinaryBuilder9getU32LEBEv(i9) | 0) | 0; + i1 = __ZN4wasm17WasmBinaryBuilder12getBreakNameEi(i9, __ZN4wasm17WasmBinaryBuilder8getInt32Ev(i9) | 0) | 0; if ((i7 | 0) == (i2 | 0)) break; HEAP32[i8 >> 2] = i1; i6 = HEAP32[i3 >> 2] | 0; diff --git a/scripts/spidermonkify.py b/scripts/spidermonkify.py index 9c99b4087..b199faafc 100644 --- a/scripts/spidermonkify.py +++ b/scripts/spidermonkify.py @@ -59,8 +59,8 @@ new Uint8Array(wasmTextToBinary(os.file.readFile("test/hello_world.wast"))))' investigate with >>> map(chr, map(ord, open('moz.wasm').read())) or -import json; print json.dumps(map(chr, -map(ord, open('moz.wasm').read()))).replace(',', '\n') +python -c "print str(map(chr,map(ord, + open('a.out.wasm').read()))).replace(',', '\n')" ''' subprocess.check_call( emscripten.shared.SPIDERMONKEY_ENGINE + diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 1e54a7607..159dd24fa 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -861,9 +861,9 @@ public: recurse(curr->condition); o << int8_t(BinaryConsts::TableSwitch) << U32LEB(curr->targets.size()); for (auto target : curr->targets) { - o << U32LEB(getBreakIndex(target)); + o << uint32_t(getBreakIndex(target)); } - o << U32LEB(getBreakIndex(curr->default_)); + o << uint32_t(getBreakIndex(curr->default_)); } void visitCall(Call *curr) { if (debug) std::cerr << "zz node: Call" << std::endl; @@ -1742,9 +1742,9 @@ public: curr->value = popExpression(); auto numTargets = getU32LEB(); for (size_t i = 0; i < numTargets; i++) { - curr->targets.push_back(getBreakName(getU32LEB())); + curr->targets.push_back(getBreakName(getInt32())); } - curr->default_ = getBreakName(getU32LEB()); + curr->default_ = getBreakName(getInt32()); } void visitCall(Call *curr) { if (debug) std::cerr << "zz node: Call" << std::endl; |