Skip to content

Commit

Permalink
fix: patch parser to support narrow-width integer sign byte opcode
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jan 16, 2024
1 parent 3c37db1 commit ae90475
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 8 deletions.
14 changes: 10 additions & 4 deletions lib/wasm-parser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3054,9 +3054,9 @@ var require_signatures = __commonJS({
}
});

// node_modules/.pnpm/@webassemblyjs+helper-wasm-bytecode@1.11.6/node_modules/@webassemblyjs/helper-wasm-bytecode/lib/section.js
// node_modules/.pnpm/@webassemblyjs+helper-wasm-bytecode@1.11.6_patch_hash=2yqg2jtg6wn6u6w2h6qfarflum/node_modules/@webassemblyjs/helper-wasm-bytecode/lib/section.js
var require_section = __commonJS({
"node_modules/.pnpm/@webassemblyjs+helper-wasm-bytecode@1.11.6/node_modules/@webassemblyjs/helper-wasm-bytecode/lib/section.js"(exports) {
"node_modules/.pnpm/@webassemblyjs+helper-wasm-bytecode@1.11.6_patch_hash=2yqg2jtg6wn6u6w2h6qfarflum/node_modules/@webassemblyjs/helper-wasm-bytecode/lib/section.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
Expand Down Expand Up @@ -3088,9 +3088,9 @@ var require_section = __commonJS({
}
});

// node_modules/.pnpm/@webassemblyjs+helper-wasm-bytecode@1.11.6/node_modules/@webassemblyjs/helper-wasm-bytecode/lib/index.js
// node_modules/.pnpm/@webassemblyjs+helper-wasm-bytecode@1.11.6_patch_hash=2yqg2jtg6wn6u6w2h6qfarflum/node_modules/@webassemblyjs/helper-wasm-bytecode/lib/index.js
var require_lib6 = __commonJS({
"node_modules/.pnpm/@webassemblyjs+helper-wasm-bytecode@1.11.6/node_modules/@webassemblyjs/helper-wasm-bytecode/lib/index.js"(exports) {
"node_modules/.pnpm/@webassemblyjs+helper-wasm-bytecode@1.11.6_patch_hash=2yqg2jtg6wn6u6w2h6qfarflum/node_modules/@webassemblyjs/helper-wasm-bytecode/lib/index.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
Expand Down Expand Up @@ -3381,6 +3381,12 @@ var require_lib6 = __commonJS({
189: createSymbolObject("reinterpret/f64", "i64"),
190: createSymbolObject("reinterpret/i32", "f32"),
191: createSymbolObject("reinterpret/i64", "f64"),
// https://github.com/xtuc/webassemblyjs/pull/1147
192: createSymbolObject("extend8_s", "i32"),
193: createSymbolObject("extend16_s", "i32"),
194: createSymbolObject("extend8_s", "i64"),
195: createSymbolObject("extend16_s", "i64"),
196: createSymbolObject("extend32_s", "i64"),
// Atomic Memory Instructions
65024: createSymbol("memory.atomic.notify", 1),
65025: createSymbol("memory.atomic.wait32", 1),
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,10 @@
"vite": "^5.0.11",
"vitest": "^1.2.0"
},
"packageManager": "pnpm@8.14.1"
"packageManager": "pnpm@8.14.1",
"pnpm": {
"patchedDependencies": {
"@webassemblyjs/helper-wasm-bytecode@1.11.6": "patches/@webassemblyjs__helper-wasm-bytecode@1.11.6.patch"
}
}
}
19 changes: 19 additions & 0 deletions patches/@webassemblyjs__helper-wasm-bytecode@1.11.6.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/lib/index.js b/lib/index.js
index cd647d2d169fe793dc3100a148c0beef19c286fc..76d80a75a4be8218ad3af3097dff3d05921793d4 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -311,6 +311,14 @@ var symbolsByByte = {
0xbd: createSymbolObject("reinterpret/f64", "i64"),
0xbe: createSymbolObject("reinterpret/i32", "f32"),
0xbf: createSymbolObject("reinterpret/i64", "f64"),
+
+ // https://github.com/xtuc/webassemblyjs/pull/1147
+ 0xc0: createSymbolObject("extend8_s", "i32"),
+ 0xc1: createSymbolObject("extend16_s", "i32"),
+ 0xc2: createSymbolObject("extend8_s", "i64"),
+ 0xc3: createSymbolObject("extend16_s", "i64"),
+ 0xc4: createSymbolObject("extend32_s", "i64"),
+
// Atomic Memory Instructions
0xfe00: createSymbol("memory.atomic.notify", 1),
0xfe01: createSymbol("memory.atomic.wait32", 1),
12 changes: 9 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ae90475

Please sign in to comment.