Skip to content

Commit

Permalink
Avoid marshalling FFI_TYPE_LONGDOUBLE when WASM_BIGINT is not used
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke authored and Hood committed Jun 26, 2021
1 parent 139f8e1 commit 61bd5a3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/wasm32/ffi.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,12 @@ ffi_call, (ffi_cif * cif, ffi_fp fn, void *rvalue, void **avalue),
SIG(sig += 'd');
break;
case FFI_TYPE_LONGDOUBLE:
// emscripten doesn't define HEAPU64 by default
const HEAPU64 = new BigInt64Array(HEAP8.buffer);
#if WASM_BIGINT
args.push(DEREF_U64(arg_ptr, 0));
args.push(DEREF_U64(arg_ptr, 1));
#else
throw new Error('longdouble marshalling nyi');
#endif
break;
case FFI_TYPE_UINT8:
args.push(HEAPU8[arg_ptr]);
Expand Down Expand Up @@ -479,7 +481,6 @@ ffi_prep_closure_loc_helper,
}
cur_ptr -= 4 * (sig.length - 1 - ret_by_arg);
var args_ptr = cur_ptr;
var HEAPU64 = new BigInt64Array(HEAP8.buffer);
for (var sig_idx = 1 + ret_by_arg; sig_idx < sig.length; sig_idx++) {
var jsargs_idx = sig_idx - 1;
var cargs_idx = jsargs_idx - ret_by_arg;
Expand Down

0 comments on commit 61bd5a3

Please sign in to comment.