Skip to content
Snippets Groups Projects
Commit 33d9db17 authored by Cheng Shao's avatar Cheng Shao
Browse files

rts: add __wrapped_freeJSVal

This commit wraps imported freeJSVal in a __wrapped_freeJSVal C
function for wasm backend RTS. In general, wasm imports are only
supposed to be directly called by C; they shouldn't be used as
function pointers, which confuses wasm-ld at link-time when generating
shared libraries.
parent 71a471e7
No related branches found
No related tags found
No related merge requests found
......@@ -83,6 +83,10 @@ JSValKey __imported_newJSVal(HsJSVal);
__attribute__((import_module("ghc_wasm_jsffi"),
import_name("freeJSVal"))) void __imported_freeJSVal(JSValKey);
static void __wrapped_freeJSVal(JSValKey k) {
__imported_freeJSVal(k);
}
HaskellObj rts_mkJSVal(Capability*, HsJSVal);
HaskellObj rts_mkJSVal(Capability *cap, HsJSVal v) {
JSValKey k = __imported_newJSVal(v);
......@@ -95,7 +99,7 @@ HaskellObj rts_mkJSVal(Capability *cap, HsJSVal v) {
(StgCFinalizerList *)allocate(cap, sizeofW(StgCFinalizerList));
SET_HDR(cfin, &stg_C_FINALIZER_LIST_info, CCS_SYSTEM);
cfin->link = &stg_NO_FINALIZER_closure;
cfin->fptr = (void (*)(void))__imported_freeJSVal;
cfin->fptr = (void (*)(void))__wrapped_freeJSVal;
cfin->ptr = (void *)k;
cfin->flag = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment