Commit 1ed0193c authored by Simon Marlow's avatar Simon Marlow

Add a new primop mkWeakNoFinalizer (#5879)

parent 3144f856
......@@ -1821,6 +1821,12 @@ primop MkWeakOp "mkWeak#" GenPrimOp
has_side_effects = True
out_of_line = True
primop MkWeakNoFinalizerOp "mkWeakNoFinalizer#" GenPrimOp
o -> b -> State# RealWorld -> (# State# RealWorld, Weak# b #)
with
has_side_effects = True
out_of_line = True
primop MkWeakForeignEnvOp "mkWeakForeignEnv#" GenPrimOp
o -> b -> Addr# -> Addr# -> Int# -> Addr# -> State# RealWorld -> (# State# RealWorld, Weak# b #)
with
......
......@@ -426,6 +426,7 @@ RTS_FUN_DECL(stg_isCurrentThreadBoundzh);
RTS_FUN_DECL(stg_threadStatuszh);
RTS_FUN_DECL(stg_mkWeakzh);
RTS_FUN_DECL(stg_mkWeakNoFinalizzerzh);
RTS_FUN_DECL(stg_mkWeakForeignzh);
RTS_FUN_DECL(stg_mkWeakForeignEnvzh);
RTS_FUN_DECL(stg_finalizzeWeakzh);
......
......@@ -294,6 +294,7 @@ typedef struct _RtsSymbolVal {
} RtsSymbolVal;
#define Maybe_Stable_Names SymI_HasProto(stg_mkWeakzh) \
SymI_HasProto(stg_mkWeakNoFinalizzerzh) \
SymI_HasProto(stg_mkWeakForeignEnvzh) \
SymI_HasProto(stg_makeStableNamezh) \
SymI_HasProto(stg_finalizzeWeakzh)
......
......@@ -384,14 +384,10 @@ stg_mkWeakzh
{
/* R1 = key
R2 = value
R3 = finalizer (or NULL)
R3 = finalizer (or stg_NO_FINALIZER_closure)
*/
W_ w;
if (R3 == NULL) {
R3 = stg_NO_FINALIZER_closure;
}
ALLOC_PRIM( SIZEOF_StgWeak, R1_PTR & R2_PTR & R3_PTR, stg_mkWeakzh );
w = Hp - SIZEOF_StgWeak + WDS(1);
......@@ -416,6 +412,16 @@ stg_mkWeakzh
RET_P(w);
}
stg_mkWeakNoFinalizzerzh
{
/* R1 = key
R2 = value
*/
R3 = stg_NO_FINALIZER_closure;
jump stg_mkWeakzh;
}
stg_mkWeakForeignEnvzh
{
/* R1 = key
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment