@@ -26,11 +26,9 @@ EM_JS(CountArgsFunc, _PyEM_GetCountArgsPtr, (), {
2626// Binary module for the checks. It has to be done in web assembly because
2727// clang/llvm have no support yet for the reference types yet. In fact, the wasm
2828// 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.
3432//
3533// (module
3634// (type $type0 (func (param) (result i32)))
@@ -154,15 +152,15 @@ addOnPreRun(() => {
154152let ptr = 0 ;
155153try {
156154const 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 } });
158156ptr = addFunction (inst .exports .f );
159- }catch (e ) {
157+ }catch (e ) {
160158// If something goes wrong, we'll null out _PyEM_CountFuncParams and fall
161159// back to the JS trampoline.
162160 }
163161Module ._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 ;
166164});
167165);
168166