@@ -26,11 +26,9 @@ EM_JS(CountArgsFunc, _PyEM_GetCountArgsPtr, (), {
26
26
// Binary module for the checks. It has to be done in web assembly because
27
27
// clang/llvm have no support yet for the reference types yet. In fact, the wasm
28
28
// binary toolkit doesn't yet support the ref.test instruction either. To
29
- // convert the following module to the binary, my approach is to find and
30
- // replace "ref.test $type" -> "drop i32.const n" on the source text. This
31
- // results in the bytes "0x1a, 0x41, n" where we need the bytes "0xfb, 0x14, n"
32
- // so doing a find and replace on the output from "0x1a, 0x41" -> "0xfb, 0x14"
33
- // gets us the output we need.
29
+ // convert the following textual wasm to a binary, you can build wabt from this
30
+ // branch: https://github.com/WebAssembly/wabt/pull/2529 and then use that
31
+ // wat2wasm binary.
34
32
//
35
33
// (module
36
34
// (type $type0 (func (param) (result i32)))
@@ -154,15 +152,15 @@ addOnPreRun(() => {
154
152
let ptr = 0 ;
155
153
try {
156
154
const mod = new WebAssembly .Module (code );
157
- const inst = new WebAssembly .Instance (mod , {e : {t : wasmTable } });
155
+ const inst = new WebAssembly .Instance (mod , { e : { t : wasmTable } });
158
156
ptr = addFunction (inst .exports .f );
159
- } catch (e ) {
157
+ } catch (e ) {
160
158
// If something goes wrong, we'll null out _PyEM_CountFuncParams and fall
161
159
// back to the JS trampoline.
162
160
}
163
161
Module ._PyEM_CountArgsPtr = ptr ;
164
- const offset = HEAP32 [__PyEM_EMSCRIPTEN_COUNT_ARGS_OFFSET / 4 ];
165
- HEAP32 [__PyRuntime / 4 + offset ] = ptr ;
162
+ const offset = HEAP32 [__PyEM_EMSCRIPTEN_COUNT_ARGS_OFFSET / 4 ];
163
+ HEAP32 [( __PyRuntime + offset ) / 4 ] = ptr ;
166
164
});
167
165
);
168
166
0 commit comments