unsafeThawArrayzh_fast
{
- SET_INFO(R1,stg_MUT_ARR_PTRS_info);
-
// SUBTLETY TO DO WITH THE OLD GEN MUTABLE LIST
//
// A MUT_ARR_PTRS lives on the mutable list, but a MUT_ARR_PTRS_FROZEN
// it on the mutable list for the GC to remove (removing something from
// the mutable list is not easy, because the mut_list is only singly-linked).
//
+ // So that we can tell whether a MUT_ARR_PTRS_FROZEN is on the mutable list,
+ // when we freeze it we set the info ptr to be MUT_ARR_PTRS_FROZEN0 to indicate
+ // that it is still on the mutable list.
+
// So, when we thaw a MUT_ARR_PTRS_FROZEN, we must cope with two cases:
// either it is on a mut_list, or it isn't. We adopt the convention that
// the mut_link field is NULL if it isn't on a mut_list, and the GC
// maintains this invariant.
//
- if (StgMutClosure_mut_link(R1) == NULL) {
+ if (%INFO_TYPE(%GET_STD_INFO(R1)) != HALF_W_(MUT_ARR_PTRS_FROZEN0)) {
foreign "C" recordMutable(R1 "ptr");
}
+ SET_INFO(R1,stg_MUT_ARR_PTRS_info);
+
RET_P(R1);
}
*/
#if MIN_UPD_SIZE > 1
-#define THUNK_1_SIZE (SIZEOF_StgHeader + WDS(MIN_UPD_SIZE))
+#define THUNK_1_SIZE (SIZEOF_StgThunkHeader + WDS(MIN_UPD_SIZE))
#define TICK_ALLOC_THUNK_1() TICK_ALLOC_UP_THK(WDS(1),WDS(MIN_UPD_SIZE-1))
#else
-#define THUNK_1_SIZE (SIZEOF_StgHeader + WDS(1))
+#define THUNK_1_SIZE (SIZEOF_StgThunkHeader + WDS(1))
#define TICK_ALLOC_THUNK_1() TICK_ALLOC_UP_THK(WDS(1),0)
#endif
#if MIN_UPD_SIZE > 2
-#define THUNK_2_SIZE (SIZEOF_StgHeader + WDS(MIN_UPD_SIZE))
+#define THUNK_2_SIZE (SIZEOF_StgThunkHeader + WDS(MIN_UPD_SIZE))
#define TICK_ALLOC_THUNK_2() TICK_ALLOC_UP_THK(WDS(2),WDS(MIN_UPD_SIZE-2))
#else
-#define THUNK_2_SIZE (SIZEOF_StgHeader + WDS(2))
+#define THUNK_2_SIZE (SIZEOF_StgThunkHeader + WDS(2))
#define TICK_ALLOC_THUNK_2() TICK_ALLOC_UP_THK(WDS(2),0)
#endif
HP_CHK_GEN_TICKY(SIZE, R1_PTR & R2_PTR, atomicModifyMutVarzh_fast);
+#if defined(SMP)
+ foreign "C" ACQUIRE_LOCK(sm_mutex "ptr");
+#endif
+
x = StgMutVar_var(R1);
TICK_ALLOC_THUNK_2();
z = Hp - THUNK_2_SIZE + WDS(1);
SET_HDR(z, stg_ap_2_upd_info, W_[CCCS]);
LDV_RECORD_CREATE(z);
- StgClosure_payload(z,0) = R2;
- StgClosure_payload(z,1) = x;
+ StgThunk_payload(z,0) = R2;
+ StgThunk_payload(z,1) = x;
TICK_ALLOC_THUNK_1();
CCCS_ALLOC(THUNK_1_SIZE);
y = z - THUNK_1_SIZE;
SET_HDR(y, stg_sel_0_upd_info, W_[CCCS]);
LDV_RECORD_CREATE(y);
- StgClosure_payload(y,0) = z;
+ StgThunk_payload(y,0) = z;
StgMutVar_var(R1) = y;
r = y - THUNK_1_SIZE;
SET_HDR(r, stg_sel_1_upd_info, W_[CCCS]);
LDV_RECORD_CREATE(r);
- StgClosure_payload(r,0) = z;
+ StgThunk_payload(r,0) = z;
+
+#if defined(SMP)
+ foreign "C" RELEASE_LOCK(sm_mutex "ptr");
+#endif
RET_P(r);
}
StgWeak_link(w) = W_[weak_ptr_list];
W_[weak_ptr_list] = w;
- IF_DEBUG(weak, foreign "C" fprintf(stderr,stg_weak_msg,w));
+ IF_DEBUG(weak, foreign "C" debugBelch(stg_weak_msg,w));
RET_P(w);
}
// Catch retry frame ------------------------------------------------------------
+#define CATCH_RETRY_FRAME_ERROR(label) \
+ label { foreign "C" barf("catch_retry_frame incorrectly entered!"); }
-#define CATCH_RETRY_FRAME_ENTRY_TEMPLATE(label,ret) \
- label \
- { \
- W_ r, frame, trec, outer; \
- IF_NOT_REG_R1(W_ rval; rval = Sp(0); Sp_adj(1); ) \
- \
- frame = Sp; \
- trec = StgTSO_trec(CurrentTSO); \
- "ptr" outer = foreign "C" stmGetEnclosingTRec(trec "ptr"); \
- r = foreign "C" stmCommitTransaction(trec "ptr"); \
- if (r) { \
- /* Succeeded (either first branch or second branch) */ \
- StgTSO_trec(CurrentTSO) = outer; \
- Sp = Sp + SIZEOF_StgCatchRetryFrame; \
- IF_NOT_REG_R1(Sp_adj(-1); Sp(0) = rval;) \
- jump ret; \
- } else { \
- /* Did not commit: retry */ \
- W_ new_trec; \
- "ptr" new_trec = foreign "C" stmStartTransaction(outer "ptr"); \
- StgTSO_trec(CurrentTSO) = new_trec; \
- if (StgCatchRetryFrame_running_alt_code(frame)) { \
- R1 = StgCatchRetryFrame_alt_code(frame); \
- } else { \
- R1 = StgCatchRetryFrame_first_code(frame); \
- StgCatchRetryFrame_first_code_trec(frame) = new_trec; \
- } \
- Sp_adj(-1); \
- jump RET_LBL(stg_ap_v); \
- } \
- }
-
-CATCH_RETRY_FRAME_ENTRY_TEMPLATE(stg_catch_retry_frame_0_ret,%RET_VEC(Sp(SP_OFF),0))
-CATCH_RETRY_FRAME_ENTRY_TEMPLATE(stg_catch_retry_frame_1_ret,%RET_VEC(Sp(SP_OFF),1))
-CATCH_RETRY_FRAME_ENTRY_TEMPLATE(stg_catch_retry_frame_2_ret,%RET_VEC(Sp(SP_OFF),2))
-CATCH_RETRY_FRAME_ENTRY_TEMPLATE(stg_catch_retry_frame_3_ret,%RET_VEC(Sp(SP_OFF),3))
-CATCH_RETRY_FRAME_ENTRY_TEMPLATE(stg_catch_retry_frame_4_ret,%RET_VEC(Sp(SP_OFF),4))
-CATCH_RETRY_FRAME_ENTRY_TEMPLATE(stg_catch_retry_frame_5_ret,%RET_VEC(Sp(SP_OFF),5))
-CATCH_RETRY_FRAME_ENTRY_TEMPLATE(stg_catch_retry_frame_6_ret,%RET_VEC(Sp(SP_OFF),6))
-CATCH_RETRY_FRAME_ENTRY_TEMPLATE(stg_catch_retry_frame_7_ret,%RET_VEC(Sp(SP_OFF),7))
+CATCH_RETRY_FRAME_ERROR(stg_catch_retry_frame_0_ret)
+CATCH_RETRY_FRAME_ERROR(stg_catch_retry_frame_1_ret)
+CATCH_RETRY_FRAME_ERROR(stg_catch_retry_frame_2_ret)
+CATCH_RETRY_FRAME_ERROR(stg_catch_retry_frame_3_ret)
+CATCH_RETRY_FRAME_ERROR(stg_catch_retry_frame_4_ret)
+CATCH_RETRY_FRAME_ERROR(stg_catch_retry_frame_5_ret)
+CATCH_RETRY_FRAME_ERROR(stg_catch_retry_frame_6_ret)
+CATCH_RETRY_FRAME_ERROR(stg_catch_retry_frame_7_ret)
#if MAX_VECTORED_RTN > 8
#error MAX_VECTORED_RTN has changed: please modify stg_catch_retry_frame too.
stg_catch_retry_frame_5_ret,
stg_catch_retry_frame_6_ret,
stg_catch_retry_frame_7_ret)
-CATCH_RETRY_FRAME_ENTRY_TEMPLATE(,%ENTRY_CODE(Sp(SP_OFF)))
-
+{
+ W_ r, frame, trec, outer;
+ IF_NOT_REG_R1(W_ rval; rval = Sp(0); Sp_adj(1); )
+
+ frame = Sp;
+ trec = StgTSO_trec(CurrentTSO);
+ "ptr" outer = foreign "C" stmGetEnclosingTRec(trec "ptr");
+ r = foreign "C" stmCommitTransaction(trec "ptr");
+ if (r) {
+ /* Succeeded (either first branch or second branch) */
+ StgTSO_trec(CurrentTSO) = outer;
+ Sp = Sp + SIZEOF_StgCatchRetryFrame;
+ IF_NOT_REG_R1(Sp_adj(-1); Sp(0) = rval;)
+ jump %ENTRY_CODE(Sp(SP_OFF));
+ } else {
+ /* Did not commit: retry */
+ W_ new_trec;
+ "ptr" new_trec = foreign "C" stmStartTransaction(outer "ptr");
+ StgTSO_trec(CurrentTSO) = new_trec;
+ if (StgCatchRetryFrame_running_alt_code(frame)) {
+ R1 = StgCatchRetryFrame_alt_code(frame);
+ } else {
+ R1 = StgCatchRetryFrame_first_code(frame);
+ StgCatchRetryFrame_first_code_trec(frame) = new_trec;
+ }
+ Sp_adj(-1);
+ jump RET_LBL(stg_ap_v);
+ }
+}
// Atomically frame -------------------------------------------------------------
-#define ATOMICALLY_FRAME_ENTRY_TEMPLATE(label,ret) \
- label \
- { \
- W_ frame, trec, valid; \
- IF_NOT_REG_R1(W_ rval; rval = Sp(0); Sp_adj(1); ) \
- \
- frame = Sp; \
- trec = StgTSO_trec(CurrentTSO); \
- if (StgAtomicallyFrame_waiting(frame)) { \
- /* The TSO is currently waiting: should we stop waiting? */ \
- valid = foreign "C" stmReWait(trec "ptr"); \
- if (valid) { \
- /* Previous attempt is still valid: no point trying again yet */ \
- IF_NOT_REG_R1(Sp_adj(-1); Sp(0) = rval;) \
- jump stg_block_noregs; \
- } else { \
- /* Previous attempt is no longer valid: try again */ \
- "ptr" trec = foreign "C" stmStartTransaction(NO_TREC "ptr"); \
- StgTSO_trec(CurrentTSO) = trec; \
- StgAtomicallyFrame_waiting(frame) = 0; /* false; */ \
- R1 = StgAtomicallyFrame_code(frame); \
- Sp_adj(-1); \
- jump RET_LBL(stg_ap_v); \
- } \
- } else { \
- /* The TSO is not currently waiting: try to commit the transaction */ \
- valid = foreign "C" stmCommitTransaction(trec "ptr"); \
- if (valid) { \
- /* Transaction was valid: commit succeeded */ \
- StgTSO_trec(CurrentTSO) = NO_TREC; \
- Sp = Sp + SIZEOF_StgAtomicallyFrame; \
- IF_NOT_REG_R1(Sp_adj(-1); Sp(0) = rval;) \
- jump ret; \
- } else { \
- /* Transaction was not valid: try again */ \
- "ptr" trec = foreign "C" stmStartTransaction(NO_TREC "ptr"); \
- StgTSO_trec(CurrentTSO) = trec; \
- R1 = StgAtomicallyFrame_code(frame); \
- Sp_adj(-1); \
- jump RET_LBL(stg_ap_v); \
- } \
- } \
- }
-ATOMICALLY_FRAME_ENTRY_TEMPLATE(stg_atomically_frame_0_ret,%RET_VEC(Sp(SP_OFF),0))
-ATOMICALLY_FRAME_ENTRY_TEMPLATE(stg_atomically_frame_1_ret,%RET_VEC(Sp(SP_OFF),1))
-ATOMICALLY_FRAME_ENTRY_TEMPLATE(stg_atomically_frame_2_ret,%RET_VEC(Sp(SP_OFF),2))
-ATOMICALLY_FRAME_ENTRY_TEMPLATE(stg_atomically_frame_3_ret,%RET_VEC(Sp(SP_OFF),3))
-ATOMICALLY_FRAME_ENTRY_TEMPLATE(stg_atomically_frame_4_ret,%RET_VEC(Sp(SP_OFF),4))
-ATOMICALLY_FRAME_ENTRY_TEMPLATE(stg_atomically_frame_5_ret,%RET_VEC(Sp(SP_OFF),5))
-ATOMICALLY_FRAME_ENTRY_TEMPLATE(stg_atomically_frame_6_ret,%RET_VEC(Sp(SP_OFF),6))
-ATOMICALLY_FRAME_ENTRY_TEMPLATE(stg_atomically_frame_7_ret,%RET_VEC(Sp(SP_OFF),7))
+#define ATOMICALLY_FRAME_ERROR(label) \
+ label { foreign "C" barf("atomically_frame incorrectly entered!"); }
+
+ATOMICALLY_FRAME_ERROR(stg_atomically_frame_0_ret)
+ATOMICALLY_FRAME_ERROR(stg_atomically_frame_1_ret)
+ATOMICALLY_FRAME_ERROR(stg_atomically_frame_2_ret)
+ATOMICALLY_FRAME_ERROR(stg_atomically_frame_3_ret)
+ATOMICALLY_FRAME_ERROR(stg_atomically_frame_4_ret)
+ATOMICALLY_FRAME_ERROR(stg_atomically_frame_5_ret)
+ATOMICALLY_FRAME_ERROR(stg_atomically_frame_6_ret)
+ATOMICALLY_FRAME_ERROR(stg_atomically_frame_7_ret)
#if MAX_VECTORED_RTN > 8
#error MAX_VECTORED_RTN has changed: please modify stg_atomically_frame too.
#define ATOMICALLY_FRAME_WORDS 2
#endif
+
INFO_TABLE_RET(stg_atomically_frame,
ATOMICALLY_FRAME_WORDS, ATOMICALLY_FRAME_BITMAP,
ATOMICALLY_FRAME,
stg_atomically_frame_5_ret,
stg_atomically_frame_6_ret,
stg_atomically_frame_7_ret)
-ATOMICALLY_FRAME_ENTRY_TEMPLATE(,%ENTRY_CODE(Sp(SP_OFF)))
+{
+ W_ frame, trec, valid;
+ IF_NOT_REG_R1(W_ rval; rval = Sp(0); Sp_adj(1); )
+
+ frame = Sp;
+ trec = StgTSO_trec(CurrentTSO);
+ if (StgAtomicallyFrame_waiting(frame)) {
+ /* The TSO is currently waiting: should we stop waiting? */
+ valid = foreign "C" stmReWait(CurrentTSO "ptr");
+ if (valid) {
+ /* Previous attempt is still valid: no point trying again yet */
+ IF_NOT_REG_R1(Sp_adj(-2);
+ Sp(1) = stg_NO_FINALIZER_closure;
+ Sp(0) = stg_ut_1_0_unreg_info;)
+ jump stg_block_noregs;
+ } else {
+ /* Previous attempt is no longer valid: try again */
+ "ptr" trec = foreign "C" stmStartTransaction(NO_TREC "ptr");
+ StgTSO_trec(CurrentTSO) = trec;
+ StgAtomicallyFrame_waiting(frame) = 0 :: CInt; /* false; */
+ R1 = StgAtomicallyFrame_code(frame);
+ Sp_adj(-1);
+ jump RET_LBL(stg_ap_v);
+ }
+ } else {
+ /* The TSO is not currently waiting: try to commit the transaction */
+ valid = foreign "C" stmCommitTransaction(trec "ptr");
+ if (valid) {
+ /* Transaction was valid: commit succeeded */
+ StgTSO_trec(CurrentTSO) = NO_TREC;
+ Sp = Sp + SIZEOF_StgAtomicallyFrame;
+ IF_NOT_REG_R1(Sp_adj(-1); Sp(0) = rval;)
+ jump %ENTRY_CODE(Sp(SP_OFF));
+ } else {
+ /* Transaction was not valid: try again */
+ "ptr" trec = foreign "C" stmStartTransaction(NO_TREC "ptr");
+ StgTSO_trec(CurrentTSO) = trec;
+ R1 = StgAtomicallyFrame_code(frame);
+ Sp_adj(-1);
+ jump RET_LBL(stg_ap_v);
+ }
+ }
+}
// STM catch frame --------------------------------------------------------------
Sp = Sp - SIZEOF_StgAtomicallyFrame;
frame = Sp;
- SET_HDR(frame,stg_atomically_frame_info,CCCS);
- StgAtomicallyFrame_waiting(frame) = 0; // False
+ SET_HDR(frame,stg_atomically_frame_info, W_[CCCS]);
+ StgAtomicallyFrame_waiting(frame) = 0 :: CInt; // False
StgAtomicallyFrame_code(frame) = R1;
/* Start the memory transcation */
Sp = Sp - SIZEOF_StgCatchSTMFrame;
frame = Sp;
- SET_HDR(frame, stg_catch_stm_frame_info, CCCS);
+ SET_HDR(frame, stg_catch_stm_frame_info, W_[CCCS]);
StgCatchSTMFrame_handler(frame) = R2;
/* Apply R1 to the realworld token */
Sp = Sp - SIZEOF_StgCatchRetryFrame;
frame = Sp;
- SET_HDR(frame, stg_catch_retry_frame_info, CCCS);
- StgCatchRetryFrame_running_alt_code(frame) = 0; // false;
+ SET_HDR(frame, stg_catch_retry_frame_info, W_[CCCS]);
+ StgCatchRetryFrame_running_alt_code(frame) = 0 :: CInt; // false;
StgCatchRetryFrame_first_code(frame) = R1;
StgCatchRetryFrame_alt_code(frame) = R2;
StgCatchRetryFrame_first_code_trec(frame) = new_trec;
W_ outer;
W_ r;
- MAYBE_GC (NO_PTRS, readTVarzh_fast); // STM operations may allocate
+ MAYBE_GC (NO_PTRS, retryzh_fast); // STM operations may allocate
// Find the enclosing ATOMICALLY_FRAME or CATCH_RETRY_FRAME
retry_pop_stack:
// Retry in the first code: try the alternative
"ptr" trec = foreign "C" stmStartTransaction(outer "ptr");
StgTSO_trec(CurrentTSO) = trec;
- StgCatchRetryFrame_running_alt_code(frame) = 1; // true;
+ StgCatchRetryFrame_running_alt_code(frame) = 1 :: CInt; // true;
R1 = StgCatchRetryFrame_alt_code(frame);
Sp_adj(-1);
jump RET_LBL(stg_ap_v);
other_trec = StgCatchRetryFrame_first_code_trec(frame);
r = foreign "C" stmMergeForWaiting(trec "ptr", other_trec "ptr");
if (r) {
+ r = foreign "C" stmCommitTransaction(trec "ptr");
+ }
+ if (r) {
// Merge between siblings succeeded: commit it back to enclosing transaction
// and then propagate the retry
- r = foreign "C" stmCommitTransaction(trec "ptr");
StgTSO_trec(CurrentTSO) = outer;
Sp = Sp + SIZEOF_StgCatchRetryFrame;
goto retry_pop_stack;
// Merge failed: we musn't propagate the retry. Try both paths again.
"ptr" trec = foreign "C" stmStartTransaction(outer "ptr");
StgCatchRetryFrame_first_code_trec(frame) = trec;
- StgCatchRetryFrame_running_alt_code(frame) = 0; // false;
+ StgCatchRetryFrame_running_alt_code(frame) = 0 :: CInt; // false;
StgTSO_trec(CurrentTSO) = trec;
R1 = StgCatchRetryFrame_first_code(frame);
Sp_adj(-1);
r = foreign "C" stmWait(CurrentTSO "ptr", trec "ptr");
if (r) {
// Transaction was valid: stmWait put us on the TVars' queues, we now block
- StgAtomicallyFrame_waiting(frame) = 1; // true
+ StgAtomicallyFrame_waiting(frame) = 1 :: CInt; // true
Sp = frame;
+ // Fix up the stack in the unregisterised case: the return convention is different.
+ IF_NOT_REG_R1(Sp_adj(-2);
+ Sp(1) = stg_NO_FINALIZER_closure;
+ Sp(0) = stg_ut_1_0_unreg_info;)
jump stg_block_noregs;
} else {
// Transaction was not valid: retry immediately
{
W_ mvar, val, info, tso;
+#if defined(SMP)
+ foreign "C" ACQUIRE_LOCK(sm_mutex "ptr");
+#endif
+
/* args: R1 = MVar closure */
mvar = R1;
StgTSO_block_info(CurrentTSO) = mvar;
StgMVar_tail(mvar) = CurrentTSO;
+#if defined(SMP)
+ foreign "C" RELEASE_LOCK(sm_mutex "ptr");
+#endif
+
jump stg_block_takemvar;
}
if (StgMVar_head(mvar) == stg_END_TSO_QUEUE_closure) {
StgMVar_tail(mvar) = stg_END_TSO_QUEUE_closure;
}
+
+#if defined(SMP)
+ foreign "C" RELEASE_LOCK(sm_mutex "ptr");
+#endif
+
RET_P(val);
}
else
*/
SET_INFO(mvar,stg_EMPTY_MVAR_info);
StgMVar_value(mvar) = stg_END_TSO_QUEUE_closure;
+
+#if defined(SMP)
+ foreign "C" RELEASE_LOCK(sm_mutex "ptr");
+#endif
+
RET_P(val);
}
}
{
W_ mvar, val, info, tso;
+#if defined(SMP)
+ foreign "C" ACQUIRE_LOCK(sm_mutex "ptr");
+#endif
+
/* args: R1 = MVar closure */
mvar = R1;
/* HACK: we need a pointer to pass back,
* so we abuse NO_FINALIZER_closure
*/
+#if defined(SMP)
+ foreign "C" RELEASE_LOCK(sm_mutex "ptr");
+#endif
RET_NP(0, stg_NO_FINALIZER_closure);
}
{
/* No further putMVars, MVar is now empty */
StgMVar_value(mvar) = stg_END_TSO_QUEUE_closure;
-
- /* do this last... we might have locked the MVar in the SMP case,
- * and writing the info pointer will unlock it.
- */
SET_INFO(mvar,stg_EMPTY_MVAR_info);
}
+#if defined(SMP)
+ foreign "C" RELEASE_LOCK(sm_mutex "ptr");
+#endif
+
RET_NP(1, val);
}
{
W_ mvar, info, tso;
+#if defined(SMP)
+ foreign "C" ACQUIRE_LOCK(sm_mutex "ptr");
+#endif
+
/* args: R1 = MVar, R2 = value */
mvar = R1;
StgTSO_block_info(CurrentTSO) = mvar;
StgMVar_tail(mvar) = CurrentTSO;
+#if defined(SMP)
+ foreign "C" RELEASE_LOCK(sm_mutex "ptr");
+#endif
jump stg_block_putmvar;
}
StgMVar_tail(mvar) = stg_END_TSO_QUEUE_closure;
}
+#if defined(SMP)
+ foreign "C" RELEASE_LOCK(sm_mutex "ptr");
+#endif
jump %ENTRY_CODE(Sp(0));
}
else
StgMVar_value(mvar) = R2;
/* unlocks the MVar in the SMP case */
SET_INFO(mvar,stg_FULL_MVAR_info);
+
+#if defined(SMP)
+ foreign "C" RELEASE_LOCK(sm_mutex "ptr");
+#endif
jump %ENTRY_CODE(Sp(0));
}
{
W_ mvar, info, tso;
+#if defined(SMP)
+ foreign "C" ACQUIRE_LOCK(sm_mutex "ptr");
+#endif
+
/* args: R1 = MVar, R2 = value */
mvar = R1;
info = GET_INFO(mvar);
if (info == stg_FULL_MVAR_info) {
+#if defined(SMP)
+ foreign "C" RELEASE_LOCK(sm_mutex "ptr");
+#endif
RET_N(0);
}
StgMVar_tail(mvar) = stg_END_TSO_QUEUE_closure;
}
+#if defined(SMP)
+ foreign "C" RELEASE_LOCK(sm_mutex "ptr");
+#endif
jump %ENTRY_CODE(Sp(0));
}
else
StgMVar_value(mvar) = R2;
/* unlocks the MVar in the SMP case */
SET_INFO(mvar,stg_FULL_MVAR_info);
+#if defined(SMP)
+ foreign "C" RELEASE_LOCK(sm_mutex "ptr");
+#endif
jump %ENTRY_CODE(Sp(0));
}
index = foreign "C" lookupStableName(R1 "ptr");
/* Is there already a StableName for this heap object?
- * stable_ptr_table is an array of snEntry structs.
+ * stable_ptr_table is a pointer to an array of snEntry structs.
*/
- if ( snEntry_sn_obj(stable_ptr_table + index*SIZEOF_snEntry) == NULL ) {
+ if ( snEntry_sn_obj(W_[stable_ptr_table] + index*SIZEOF_snEntry) == NULL ) {
sn_obj = Hp - SIZEOF_StgStableName + WDS(1);
SET_HDR(sn_obj, stg_STABLE_NAME_info, W_[CCCS]);
StgStableName_sn(sn_obj) = index;
- snEntry_sn_obj(stable_ptr_table + index*SIZEOF_snEntry) = sn_obj;
+ snEntry_sn_obj(W_[stable_ptr_table] + index*SIZEOF_snEntry) = sn_obj;
} else {
- sn_obj = snEntry_sn_obj(stable_ptr_table + index*SIZEOF_snEntry);
+ sn_obj = snEntry_sn_obj(W_[stable_ptr_table] + index*SIZEOF_snEntry);
}
RET_P(sn_obj);
/* Args: R1 = the stable ptr */
W_ r, sp;
sp = R1;
- r = snEntry_addr(stable_ptr_table + sp*SIZEOF_snEntry);
+ r = snEntry_addr(W_[stable_ptr_table] + sp*SIZEOF_snEntry);
RET_P(r);
}
STRING(stg_delayzh_malloc_str, "delayzh_fast")
delayzh_fast
{
-#ifdef mingw32_TARGET_OS
+#ifdef mingw32_HOST_OS
W_ ares;
CInt reqID;
#else
ASSERT(StgTSO_why_blocked(CurrentTSO) == NotBlocked::I16);
StgTSO_why_blocked(CurrentTSO) = BlockedOnDelay::I16;
-#ifdef mingw32_TARGET_OS
+#ifdef mingw32_HOST_OS
/* could probably allocate this on the heap instead */
"ptr" ares = foreign "C" stgMallocBytes(SIZEOF_StgAsyncIOResult,
}
-#ifdef mingw32_TARGET_OS
+#ifdef mingw32_HOST_OS
STRING(stg_asyncReadzh_malloc_str, "asyncReadzh_fast")
asyncReadzh_fast
{