diff options
Diffstat (limited to 'rts')
-rw-r--r-- | rts/Exception.cmm | 42 | ||||
-rw-r--r-- | rts/HeapStackCheck.cmm | 48 | ||||
-rw-r--r-- | rts/PrimOps.cmm | 150 | ||||
-rw-r--r-- | rts/StgMiscClosures.cmm | 32 | ||||
-rw-r--r-- | rts/StgStartup.cmm | 16 | ||||
-rw-r--r-- | rts/StgStdThunks.cmm | 10 | ||||
-rw-r--r-- | rts/Updates.cmm | 12 |
7 files changed, 121 insertions, 189 deletions
diff --git a/rts/Exception.cmm b/rts/Exception.cmm index 346c9499eb..a0a6db4fc7 100644 --- a/rts/Exception.cmm +++ b/rts/Exception.cmm @@ -47,8 +47,7 @@ -------------------------------------------------------------------------- */ -INFO_TABLE_RET( stg_unblockAsyncExceptionszh_ret, - 0/*framesize*/, 0/*bitmap*/, RET_SMALL ) +INFO_TABLE_RET( stg_unblockAsyncExceptionszh_ret, RET_SMALL ) { CInt r; @@ -73,7 +72,7 @@ INFO_TABLE_RET( stg_unblockAsyncExceptionszh_ret, Sp_adj(1); #endif SAVE_THREAD_STATE(); - r = foreign "C" maybePerformBlockedException (MyCapability() "ptr", + (r) = foreign "C" maybePerformBlockedException (MyCapability() "ptr", CurrentTSO "ptr") [R1]; if (r != 0::CInt) { @@ -106,8 +105,7 @@ INFO_TABLE_RET( stg_unblockAsyncExceptionszh_ret, #endif } -INFO_TABLE_RET( stg_blockAsyncExceptionszh_ret, - 0/*framesize*/, 0/*bitmap*/, RET_SMALL ) +INFO_TABLE_RET( stg_blockAsyncExceptionszh_ret, RET_SMALL ) { StgTSO_flags(CurrentTSO) = StgTSO_flags(CurrentTSO) | TSO_BLOCKEX::I32 | TSO_INTERRUPTIBLE::I32; @@ -165,7 +163,7 @@ unblockAsyncExceptionszh_fast * thread, which might result in the thread being killed. */ SAVE_THREAD_STATE(); - r = foreign "C" maybePerformBlockedException (MyCapability() "ptr", + (r) = foreign "C" maybePerformBlockedException (MyCapability() "ptr", CurrentTSO "ptr") [R1]; if (r != 0::CInt) { @@ -229,7 +227,7 @@ killThreadzh_fast W_ retcode; out = BaseReg + OFFSET_StgRegTable_rmp_tmp_w; - retcode = foreign "C" throwTo(MyCapability() "ptr", + (retcode) = foreign "C" throwTo(MyCapability() "ptr", CurrentTSO "ptr", target "ptr", exception "ptr", @@ -260,22 +258,16 @@ killThreadzh_fast #define SP_OFF 1 #endif -#if defined(PROFILING) -#define CATCH_FRAME_BITMAP 7 -#define CATCH_FRAME_WORDS 4 -#else -#define CATCH_FRAME_BITMAP 1 -#define CATCH_FRAME_WORDS 2 -#endif - /* Catch frames are very similar to update frames, but when entering * one we just pop the frame off the stack and perform the correct * kind of return to the activation record underneath us on the stack. */ -INFO_TABLE_RET(stg_catch_frame, - CATCH_FRAME_WORDS, CATCH_FRAME_BITMAP, - CATCH_FRAME) +INFO_TABLE_RET(stg_catch_frame, CATCH_FRAME, +#if defined(PROFILING) + W_ unused1, W_ unused2, +#endif + W_ unused3, "ptr" W_ unused4) #ifdef REG_R1 { Sp = Sp + SIZEOF_StgCatchFrame; @@ -347,7 +339,7 @@ section "data" { no_break_on_exception: W_[1]; } -INFO_TABLE_RET(stg_raise_ret, 1, 0, RET_SMALL) +INFO_TABLE_RET(stg_raise_ret, RET_SMALL, "ptr" W_ arg1) { R1 = Sp(1); Sp = Sp + WDS(2); @@ -377,7 +369,7 @@ raisezh_fast retry_pop_stack: StgTSO_sp(CurrentTSO) = Sp; - frame_type = foreign "C" raiseExceptionHelper(BaseReg "ptr", CurrentTSO "ptr", exception "ptr") []; + (frame_type) = foreign "C" raiseExceptionHelper(BaseReg "ptr", CurrentTSO "ptr", exception "ptr") []; Sp = StgTSO_sp(CurrentTSO); if (frame_type == ATOMICALLY_FRAME) { /* The exception has reached the edge of a memory transaction. Check that @@ -391,8 +383,8 @@ retry_pop_stack: W_ trec, outer; W_ r; trec = StgTSO_trec(CurrentTSO); - r = foreign "C" stmValidateNestOfTransactions(trec "ptr") []; - "ptr" outer = foreign "C" stmGetEnclosingTRec(trec "ptr") []; + (r) = foreign "C" stmValidateNestOfTransactions(trec "ptr") []; + ("ptr" outer) = foreign "C" stmGetEnclosingTRec(trec "ptr") []; foreign "C" stmAbortTransaction(MyCapability() "ptr", trec "ptr") []; foreign "C" stmFreeAbortedTRec(MyCapability() "ptr", trec "ptr") []; @@ -409,7 +401,7 @@ retry_pop_stack: } else { // Transaction was not valid: we retry the exception (otherwise continue // with a further call to raiseExceptionHelper) - "ptr" trec = foreign "C" stmStartTransaction(MyCapability() "ptr", NO_TREC "ptr") []; + ("ptr" trec) = foreign "C" stmStartTransaction(MyCapability() "ptr", NO_TREC "ptr") []; StgTSO_trec(CurrentTSO) = trec; R1 = StgAtomicallyFrame_code(Sp); jump stg_ap_v_fast; @@ -433,7 +425,7 @@ retry_pop_stack: // for exmplae. Perhaps the stop_on_exception flag should // be per-thread. W_[rts_stop_on_exception] = 0; - "ptr" ioAction = foreign "C" deRefStablePtr (W_[rts_breakpoint_io_action] "ptr") []; + ("ptr" ioAction) = foreign "C" deRefStablePtr (W_[rts_breakpoint_io_action] "ptr") []; Sp = Sp - WDS(6); Sp(5) = exception; Sp(4) = stg_raise_ret_info; @@ -491,7 +483,7 @@ retry_pop_stack: } else { W_ trec, outer; trec = StgTSO_trec(CurrentTSO); - "ptr" outer = foreign "C" stmGetEnclosingTRec(trec "ptr") []; + ("ptr" outer) = foreign "C" stmGetEnclosingTRec(trec "ptr") []; foreign "C" stmAbortTransaction(MyCapability() "ptr", trec "ptr") []; foreign "C" stmFreeAbortedTRec(MyCapability() "ptr", trec "ptr") []; StgTSO_trec(CurrentTSO) = outer; diff --git a/rts/HeapStackCheck.cmm b/rts/HeapStackCheck.cmm index e9ddf5b69e..75f14184a9 100644 --- a/rts/HeapStackCheck.cmm +++ b/rts/HeapStackCheck.cmm @@ -108,7 +108,7 @@ There are canned sequences for 'n' pointer values in registers. -------------------------------------------------------------------------- */ -INFO_TABLE_RET( stg_enter, 1/*framesize*/, 0/*bitmap*/, RET_SMALL) +INFO_TABLE_RET( stg_enter, RET_SMALL, "ptr" W_ unused) { R1 = Sp(1); Sp_adj(2); @@ -430,7 +430,7 @@ stg_gc_noregs /*-- void return ------------------------------------------------------------ */ -INFO_TABLE_RET( stg_gc_void, 0/*framesize*/, 0/*bitmap*/, RET_SMALL) +INFO_TABLE_RET( stg_gc_void, RET_SMALL) { Sp_adj(1); jump %ENTRY_CODE(Sp(0)); @@ -438,7 +438,7 @@ INFO_TABLE_RET( stg_gc_void, 0/*framesize*/, 0/*bitmap*/, RET_SMALL) /*-- R1 is boxed/unpointed -------------------------------------------------- */ -INFO_TABLE_RET( stg_gc_unpt_r1, 1/*framesize*/, 0/*bitmap*/, RET_SMALL) +INFO_TABLE_RET( stg_gc_unpt_r1, RET_SMALL, "ptr" W_ unused) { R1 = Sp(1); Sp_adj(2); @@ -456,7 +456,7 @@ stg_gc_unpt_r1 /*-- R1 is unboxed -------------------------------------------------- */ /* the 1 is a bitmap - i.e. 1 non-pointer word on the stack. */ -INFO_TABLE_RET( stg_gc_unbx_r1, 1/*framesize*/, 1/*bitmap*/, RET_SMALL ) +INFO_TABLE_RET( stg_gc_unbx_r1, RET_SMALL, W_ unused ) { R1 = Sp(1); Sp_adj(2); @@ -473,7 +473,7 @@ stg_gc_unbx_r1 /*-- F1 contains a float ------------------------------------------------- */ -INFO_TABLE_RET( stg_gc_f1, 1/*framesize*/, 1/*bitmap*/, RET_SMALL ) +INFO_TABLE_RET( stg_gc_f1, RET_SMALL, F_ unused ) { F1 = F_[Sp+WDS(1)]; Sp_adj(2); @@ -490,17 +490,7 @@ stg_gc_f1 /*-- D1 contains a double ------------------------------------------------- */ -/* we support doubles of either 1 or 2 words in size */ - -#if SIZEOF_DOUBLE == SIZEOF_VOID_P -# define DBL_BITMAP 1 -# define DBL_WORDS 1 -#else -# define DBL_BITMAP 3 -# define DBL_WORDS 2 -#endif - -INFO_TABLE_RET( stg_gc_d1, DBL_WORDS/*framesize*/, DBL_BITMAP/*bitmap*/, RET_SMALL ) +INFO_TABLE_RET( stg_gc_d1, RET_SMALL, D_ unused ) { D1 = D_[Sp + WDS(1)]; Sp = Sp + WDS(1) + SIZEOF_StgDouble; @@ -518,17 +508,7 @@ stg_gc_d1 /*-- L1 contains an int64 ------------------------------------------------- */ -/* we support int64s of either 1 or 2 words in size */ - -#if SIZEOF_VOID_P == 8 -# define LLI_BITMAP 1 -# define LLI_WORDS 1 -#else -# define LLI_BITMAP 3 -# define LLI_WORDS 2 -#endif - -INFO_TABLE_RET( stg_gc_l1, LLI_WORDS/*framesize*/, LLI_BITMAP/*bitmap*/, RET_SMALL ) +INFO_TABLE_RET( stg_gc_l1, RET_SMALL, L_ unused ) { L1 = L_[Sp + WDS(1)]; Sp_adj(1) + SIZEOF_StgWord64; @@ -545,7 +525,7 @@ stg_gc_l1 /*-- Unboxed tuple return, one pointer (unregisterised build only) ---------- */ -INFO_TABLE_RET( stg_ut_1_0_unreg, 1/*size*/, 0/*BITMAP*/, RET_SMALL ) +INFO_TABLE_RET( stg_ut_1_0_unreg, RET_SMALL, "ptr" W_ unused ) { Sp_adj(1); // one ptr is on the stack (Sp(0)) @@ -642,7 +622,7 @@ __stg_gc_fun appropriately. The stack layout is given above. -------------------------------------------------------------------------- */ -INFO_TABLE_RET( stg_gc_fun, 0/*framesize*/, 0/*bitmap*/, RET_FUN ) +INFO_TABLE_RET( stg_gc_fun, RET_FUN ) { R1 = Sp(2); Sp_adj(3); @@ -729,7 +709,7 @@ INFO_TABLE_RET( stg_gc_fun, 0/*framesize*/, 0/*bitmap*/, RET_FUN ) Sp(1) = R9; /* liveness mask */ \ Sp(0) = stg_gc_gen_info; -INFO_TABLE_RET( stg_gc_gen, 0/*framesize*/, 0/*bitmap*/, RET_DYN ) +INFO_TABLE_RET( stg_gc_gen, RET_DYN ) /* bitmap in the above info table is unused, the real one is on the stack. */ { RESTORE_EVERYTHING; @@ -830,7 +810,7 @@ stg_block_1 * * -------------------------------------------------------------------------- */ -INFO_TABLE_RET( stg_block_takemvar, 1/*framesize*/, 0/*bitmap*/, RET_SMALL ) +INFO_TABLE_RET( stg_block_takemvar, RET_SMALL, "ptr" W_ unused ) { R1 = Sp(1); Sp_adj(2); @@ -855,7 +835,7 @@ stg_block_takemvar BLOCK_BUT_FIRST(stg_block_takemvar_finally); } -INFO_TABLE_RET( stg_block_putmvar, 2/*framesize*/, 0/*bitmap*/, RET_SMALL ) +INFO_TABLE_RET( stg_block_putmvar, RET_SMALL, "ptr" W_ unused1, "ptr" W_ unused2 ) { R2 = Sp(2); R1 = Sp(1); @@ -902,7 +882,7 @@ stg_block_blackhole BLOCK_BUT_FIRST(stg_block_blackhole_finally); } -INFO_TABLE_RET( stg_block_throwto, 2/*framesize*/, 0/*bitmap*/, RET_SMALL ) +INFO_TABLE_RET( stg_block_throwto, RET_SMALL, "ptr" W_ unused, "ptr" W_ unused ) { R2 = Sp(2); R1 = Sp(1); @@ -928,7 +908,7 @@ stg_block_throwto } #ifdef mingw32_HOST_OS -INFO_TABLE_RET( stg_block_async, 0/*framesize*/, 0/*bitmap*/, RET_SMALL ) +INFO_TABLE_RET( stg_block_async, RET_SMALL ) { W_ ares; W_ len, errC; diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index 800f93ed89..ad761ab2e4 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -49,7 +49,7 @@ newByteArrayzh_fast n = R1; payload_words = ROUNDUP_BYTES_TO_WDS(n); words = BYTES_TO_WDS(SIZEOF_StgArrWords) + payload_words; - "ptr" p = foreign "C" allocateLocal(MyCapability() "ptr",words) []; + ("ptr" p) = foreign "C" allocateLocal(MyCapability() "ptr",words) []; TICK_ALLOC_PRIM(SIZEOF_StgArrWords,WDS(payload_words),0); SET_HDR(p, stg_ARR_WORDS_info, W_[CCCS]); StgArrWords_words(p) = payload_words; @@ -73,7 +73,7 @@ newPinnedByteArrayzh_fast words = words + 1; } - "ptr" p = foreign "C" allocatePinned(words) []; + ("ptr" p) = foreign "C" allocatePinned(words) []; TICK_ALLOC_PRIM(SIZEOF_StgArrWords,WDS(payload_words),0); // Again, if the ArrWords header isn't a multiple of 8 bytes, we @@ -97,7 +97,7 @@ newArrayzh_fast MAYBE_GC(R2_PTR,newArrayzh_fast); words = BYTES_TO_WDS(SIZEOF_StgMutArrPtrs) + n; - "ptr" arr = foreign "C" allocateLocal(MyCapability() "ptr",words) [R2]; + ("ptr" arr) = foreign "C" allocateLocal(MyCapability() "ptr",words) [R2]; TICK_ALLOC_PRIM(SIZEOF_StgMutArrPtrs, WDS(n), 0); SET_HDR(arr, stg_MUT_ARR_PTRS_DIRTY_info, W_[CCCS]); @@ -676,7 +676,7 @@ gcdIntzh_fast FETCH_MP_TEMP(mp_tmp_w); W_[mp_tmp_w] = R1; - r = foreign "C" __gmpn_gcd_1(mp_tmp_w "ptr", 1, R2) []; + (r) = foreign "C" __gmpn_gcd_1(mp_tmp_w "ptr", 1, R2) []; R1 = r; /* Result parked in R1, return via info-pointer at TOS */ @@ -687,7 +687,9 @@ gcdIntzh_fast gcdIntegerIntzh_fast { /* R1 = s1; R2 = d1; R3 = the int */ - R1 = foreign "C" __gmpn_gcd_1( BYTE_ARR_CTS(R2) "ptr", R1, R3) []; + W_ s1; + (s1) = foreign "C" __gmpn_gcd_1( BYTE_ARR_CTS(R2) "ptr", R1, R3) []; + R1 = s1; /* Result parked in R1, return via info-pointer at TOS */ jump %ENTRY_CODE(Sp(0)); @@ -768,7 +770,7 @@ cmpIntegerzh_fast up = BYTE_ARR_CTS(R2); vp = BYTE_ARR_CTS(R4); - cmp = foreign "C" __gmpn_cmp(up "ptr", vp "ptr", size) []; + (cmp) = foreign "C" __gmpn_cmp(up "ptr", vp "ptr", size) []; if (cmp == 0 :: CInt) { R1 = 0; @@ -891,7 +893,7 @@ forkzh_fast W_ threadid; closure = R1; - "ptr" threadid = foreign "C" createIOThread( MyCapability() "ptr", + ("ptr" threadid) = foreign "C" createIOThread( MyCapability() "ptr", RtsFlags_GcFlags_initialStkSize(RtsFlags), closure "ptr") []; foreign "C" scheduleThread(MyCapability() "ptr", threadid "ptr") []; @@ -914,7 +916,7 @@ forkOnzh_fast cpu = R1; closure = R2; - "ptr" threadid = foreign "C" createIOThread( MyCapability() "ptr", + ("ptr" threadid) = foreign "C" createIOThread( MyCapability() "ptr", RtsFlags_GcFlags_initialStkSize(RtsFlags), closure "ptr") []; foreign "C" scheduleThreadOn(MyCapability() "ptr", cpu, threadid "ptr") []; @@ -951,7 +953,7 @@ isCurrentThreadBoundzh_fast { /* no args */ W_ r; - r = foreign "C" isThreadBound(CurrentTSO) []; + (r) = foreign "C" isThreadBound(CurrentTSO) []; RET_N(r); } @@ -970,25 +972,19 @@ isCurrentThreadBoundzh_fast // Catch retry frame ------------------------------------------------------------ +INFO_TABLE_RET(stg_catch_retry_frame, CATCH_RETRY_FRAME, #if defined(PROFILING) -#define CATCH_RETRY_FRAME_BITMAP 7 -#define CATCH_RETRY_FRAME_WORDS 5 -#else -#define CATCH_RETRY_FRAME_BITMAP 1 -#define CATCH_RETRY_FRAME_WORDS 3 + W_ unused1, W_ unused2, #endif - -INFO_TABLE_RET(stg_catch_retry_frame, - CATCH_RETRY_FRAME_WORDS, CATCH_RETRY_FRAME_BITMAP, - CATCH_RETRY_FRAME) + W_ unused3, "ptr" W_ unused4, "ptr" W_ unused5) { 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" stmCommitNestedTransaction(MyCapability() "ptr", trec "ptr") []; + ("ptr" outer) = foreign "C" stmGetEnclosingTRec(trec "ptr") []; + (r) = foreign "C" stmCommitNestedTransaction(MyCapability() "ptr", trec "ptr") []; if (r != 0) { /* Succeeded (either first branch or second branch) */ StgTSO_trec(CurrentTSO) = outer; @@ -998,7 +994,7 @@ INFO_TABLE_RET(stg_catch_retry_frame, } else { /* Did not commit: re-execute */ W_ new_trec; - "ptr" new_trec = foreign "C" stmStartTransaction(MyCapability() "ptr", outer "ptr") []; + ("ptr" new_trec) = foreign "C" stmStartTransaction(MyCapability() "ptr", outer "ptr") []; StgTSO_trec(CurrentTSO) = new_trec; if (StgCatchRetryFrame_running_alt_code(frame) != 0::I32) { R1 = StgCatchRetryFrame_alt_code(frame); @@ -1012,28 +1008,22 @@ INFO_TABLE_RET(stg_catch_retry_frame, // Atomically frame ------------------------------------------------------------ +INFO_TABLE_RET(stg_atomically_frame, ATOMICALLY_FRAME, #if defined(PROFILING) -#define ATOMICALLY_FRAME_BITMAP 3 -#define ATOMICALLY_FRAME_WORDS 4 -#else -#define ATOMICALLY_FRAME_BITMAP 0 -#define ATOMICALLY_FRAME_WORDS 2 + W_ unused1, W_ unused2, #endif - -INFO_TABLE_RET(stg_atomically_frame, - ATOMICALLY_FRAME_WORDS, ATOMICALLY_FRAME_BITMAP, - ATOMICALLY_FRAME) + "ptr" W_ unused3, "ptr" W_ unused4) { W_ frame, trec, valid, next_invariant, q, 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") []; + ("ptr" outer) = foreign "C" stmGetEnclosingTRec(trec "ptr") []; if (outer == NO_TREC) { /* First time back at the atomically frame -- pick up invariants */ - "ptr" q = foreign "C" stmGetInvariantsToCheck(MyCapability() "ptr", trec "ptr") []; + ("ptr" q) = foreign "C" stmGetInvariantsToCheck(MyCapability() "ptr", trec "ptr") []; StgAtomicallyFrame_next_invariant_to_check(frame) = q; } else { @@ -1054,7 +1044,7 @@ INFO_TABLE_RET(stg_atomically_frame, if (q != END_INVARIANT_CHECK_QUEUE) { /* We can't commit yet: another invariant to check */ - "ptr" trec = foreign "C" stmStartTransaction(MyCapability() "ptr", trec "ptr") []; + ("ptr" trec) = foreign "C" stmStartTransaction(MyCapability() "ptr", trec "ptr") []; StgTSO_trec(CurrentTSO) = trec; next_invariant = StgInvariantCheckQueue_invariant(q); @@ -1064,7 +1054,7 @@ INFO_TABLE_RET(stg_atomically_frame, } else { /* We've got no more invariants to check, try to commit */ - valid = foreign "C" stmCommitTransaction(MyCapability() "ptr", trec "ptr") []; + (valid) = foreign "C" stmCommitTransaction(MyCapability() "ptr", trec "ptr") []; if (valid != 0) { /* Transaction was valid: commit succeeded */ StgTSO_trec(CurrentTSO) = NO_TREC; @@ -1073,7 +1063,7 @@ INFO_TABLE_RET(stg_atomically_frame, jump %ENTRY_CODE(Sp(SP_OFF)); } else { /* Transaction was not valid: try again */ - "ptr" trec = foreign "C" stmStartTransaction(MyCapability() "ptr", NO_TREC "ptr") []; + ("ptr" trec) = foreign "C" stmStartTransaction(MyCapability() "ptr", NO_TREC "ptr") []; StgTSO_trec(CurrentTSO) = trec; StgAtomicallyFrame_next_invariant_to_check(frame) = END_INVARIANT_CHECK_QUEUE; R1 = StgAtomicallyFrame_code(frame); @@ -1082,9 +1072,11 @@ INFO_TABLE_RET(stg_atomically_frame, } } -INFO_TABLE_RET(stg_atomically_waiting_frame, - ATOMICALLY_FRAME_WORDS, ATOMICALLY_FRAME_BITMAP, - ATOMICALLY_FRAME) +INFO_TABLE_RET(stg_atomically_waiting_frame, ATOMICALLY_FRAME, +#if defined(PROFILING) + W_ unused1, W_ unused2, +#endif + "ptr" W_ unused3, "ptr" W_ unused4) { W_ frame, trec, valid; IF_NOT_REG_R1(W_ rval; rval = Sp(0); Sp_adj(1); ) @@ -1092,7 +1084,7 @@ INFO_TABLE_RET(stg_atomically_waiting_frame, frame = Sp; /* The TSO is currently waiting: should we stop waiting? */ - valid = foreign "C" stmReWait(MyCapability() "ptr", CurrentTSO "ptr") []; + (valid) = foreign "C" stmReWait(MyCapability() "ptr", CurrentTSO "ptr") []; if (valid != 0) { /* Previous attempt is still valid: no point trying again yet */ IF_NOT_REG_R1(Sp_adj(-2); @@ -1101,7 +1093,7 @@ INFO_TABLE_RET(stg_atomically_waiting_frame, jump stg_block_noregs; } else { /* Previous attempt is no longer valid: try again */ - "ptr" trec = foreign "C" stmStartTransaction(MyCapability() "ptr", NO_TREC "ptr") []; + ("ptr" trec) = foreign "C" stmStartTransaction(MyCapability() "ptr", NO_TREC "ptr") []; StgTSO_trec(CurrentTSO) = trec; StgHeader_info(frame) = stg_atomically_frame_info; R1 = StgAtomicallyFrame_code(frame); @@ -1117,29 +1109,23 @@ INFO_TABLE_RET(stg_atomically_waiting_frame, #define SP_OFF 1 #endif -#if defined(PROFILING) -#define CATCH_STM_FRAME_BITMAP 3 -#define CATCH_STM_FRAME_WORDS 4 -#else -#define CATCH_STM_FRAME_BITMAP 0 -#define CATCH_STM_FRAME_WORDS 2 -#endif - /* Catch frames are very similar to update frames, but when entering * one we just pop the frame off the stack and perform the correct * kind of return to the activation record underneath us on the stack. */ -INFO_TABLE_RET(stg_catch_stm_frame, - CATCH_STM_FRAME_WORDS, CATCH_STM_FRAME_BITMAP, - CATCH_STM_FRAME) +INFO_TABLE_RET(stg_catch_stm_frame, CATCH_STM_FRAME, +#if defined(PROFILING) + W_ unused1, W_ unused2, +#endif + "ptr" W_ unused3, "ptr" W_ unused4) { IF_NOT_REG_R1(W_ rval; rval = Sp(0); Sp_adj(1); ) W_ r, frame, trec, outer; frame = Sp; trec = StgTSO_trec(CurrentTSO); - "ptr" outer = foreign "C" stmGetEnclosingTRec(trec "ptr") []; - r = foreign "C" stmCommitNestedTransaction(MyCapability() "ptr", trec "ptr") []; + ("ptr" outer) = foreign "C" stmGetEnclosingTRec(trec "ptr") []; + (r) = foreign "C" stmCommitNestedTransaction(MyCapability() "ptr", trec "ptr") []; if (r != 0) { /* Commit succeeded */ StgTSO_trec(CurrentTSO) = outer; @@ -1149,7 +1135,7 @@ INFO_TABLE_RET(stg_catch_stm_frame, } else { /* Commit failed */ W_ new_trec; - "ptr" new_trec = foreign "C" stmStartTransaction(MyCapability() "ptr", outer "ptr") []; + ("ptr" new_trec) = foreign "C" stmStartTransaction(MyCapability() "ptr", outer "ptr") []; StgTSO_trec(CurrentTSO) = new_trec; R1 = StgCatchSTMFrame_code(frame); jump stg_ap_v_fast; @@ -1188,7 +1174,7 @@ atomicallyzh_fast StgAtomicallyFrame_next_invariant_to_check(frame) = END_INVARIANT_CHECK_QUEUE; /* Start the memory transcation */ - "ptr" new_trec = foreign "C" stmStartTransaction(MyCapability() "ptr", old_trec "ptr") [R1]; + ("ptr" new_trec) = foreign "C" stmStartTransaction(MyCapability() "ptr", old_trec "ptr") [R1]; StgTSO_trec(CurrentTSO) = new_trec; /* Apply R1 to the realworld token */ @@ -1216,7 +1202,7 @@ catchSTMzh_fast W_ cur_trec; W_ new_trec; cur_trec = StgTSO_trec(CurrentTSO); - "ptr" new_trec = foreign "C" stmStartTransaction(MyCapability() "ptr", cur_trec "ptr"); + ("ptr" new_trec) = foreign "C" stmStartTransaction(MyCapability() "ptr", cur_trec "ptr"); StgTSO_trec(CurrentTSO) = new_trec; /* Apply R1 to the realworld token */ @@ -1239,7 +1225,7 @@ catchRetryzh_fast /* Start a nested transaction within which to run the first code */ trec = StgTSO_trec(CurrentTSO); - "ptr" new_trec = foreign "C" stmStartTransaction(MyCapability() "ptr", trec "ptr") [R1,R2]; + ("ptr" new_trec) = foreign "C" stmStartTransaction(MyCapability() "ptr", trec "ptr") [R1,R2]; StgTSO_trec(CurrentTSO) = new_trec; /* Set up the catch-retry frame */ @@ -1269,11 +1255,11 @@ retryzh_fast // Find the enclosing ATOMICALLY_FRAME or CATCH_RETRY_FRAME retry_pop_stack: StgTSO_sp(CurrentTSO) = Sp; - frame_type = foreign "C" findRetryFrameHelper(CurrentTSO "ptr") []; + (frame_type) = foreign "C" findRetryFrameHelper(CurrentTSO "ptr") []; Sp = StgTSO_sp(CurrentTSO); frame = Sp; trec = StgTSO_trec(CurrentTSO); - "ptr" outer = foreign "C" stmGetEnclosingTRec(trec "ptr") []; + ("ptr" outer) = foreign "C" stmGetEnclosingTRec(trec "ptr") []; if (frame_type == CATCH_RETRY_FRAME) { // The retry reaches a CATCH_RETRY_FRAME before the atomic frame @@ -1283,7 +1269,7 @@ retry_pop_stack: foreign "C" stmFreeAbortedTRec(MyCapability() "ptr", trec "ptr") []; if (!StgCatchRetryFrame_running_alt_code(frame) != 0::I32) { // Retry in the first branch: try the alternative - "ptr" trec = foreign "C" stmStartTransaction(MyCapability() "ptr", outer "ptr") []; + ("ptr" trec) = foreign "C" stmStartTransaction(MyCapability() "ptr", outer "ptr") []; StgTSO_trec(CurrentTSO) = trec; StgCatchRetryFrame_running_alt_code(frame) = 1 :: CInt; // true; R1 = StgCatchRetryFrame_alt_code(frame); @@ -1305,12 +1291,12 @@ retry_pop_stack: foreign "C" stmAbortTransaction(MyCapability() "ptr", trec "ptr") []; foreign "C" stmFreeAbortedTRec(MyCapability() "ptr", trec "ptr") []; trec = outer; - StgTSO_trec(CurrentTSO) = trec; - "ptr" outer = foreign "C" stmGetEnclosingTRec(trec "ptr") []; + StgTSO_trec(CurrentTSO) = trec; + ("ptr" outer) = foreign "C" stmGetEnclosingTRec(trec "ptr") []; } ASSERT(outer == NO_TREC); - r = foreign "C" stmWait(MyCapability() "ptr", CurrentTSO "ptr", trec "ptr") []; + (r) = foreign "C" stmWait(MyCapability() "ptr", CurrentTSO "ptr", trec "ptr") []; if (r != 0) { // Transaction was valid: stmWait put us on the TVars' queues, we now block StgHeader_info(frame) = stg_atomically_waiting_frame_info; @@ -1323,7 +1309,7 @@ retry_pop_stack: jump stg_block_stmwait; } else { // Transaction was not valid: retry immediately - "ptr" trec = foreign "C" stmStartTransaction(MyCapability() "ptr", outer "ptr") []; + ("ptr" trec) = foreign "C" stmStartTransaction(MyCapability() "ptr", outer "ptr") []; StgTSO_trec(CurrentTSO) = trec; R1 = StgAtomicallyFrame_code(frame); Sp = frame; @@ -1358,7 +1344,7 @@ newTVarzh_fast MAYBE_GC (R1_PTR, newTVarzh_fast); new_value = R1; - "ptr" tv = foreign "C" stmNewTVar(MyCapability() "ptr", new_value "ptr") []; + ("ptr" tv) = foreign "C" stmNewTVar(MyCapability() "ptr", new_value "ptr") []; RET_P(tv); } @@ -1374,7 +1360,7 @@ readTVarzh_fast MAYBE_GC (R1_PTR, readTVarzh_fast); // Call to stmReadTVar may allocate trec = StgTSO_trec(CurrentTSO); tvar = R1; - "ptr" result = foreign "C" stmReadTVar(MyCapability() "ptr", trec "ptr", tvar "ptr") []; + ("ptr" result) = foreign "C" stmReadTVar(MyCapability() "ptr", trec "ptr", tvar "ptr") []; RET_P(result); } @@ -1481,7 +1467,7 @@ takeMVarzh_fast mvar = R1; #if defined(THREADED_RTS) - "ptr" info = foreign "C" lockClosure(mvar "ptr") []; + ("ptr" info) = foreign "C" lockClosure(mvar "ptr") []; #else info = GET_INFO(mvar); #endif @@ -1520,10 +1506,10 @@ takeMVarzh_fast #if defined(GRAN) || defined(PAR) /* ToDo: check 2nd arg (mvar) is right */ - "ptr" tso = foreign "C" unblockOne(StgMVar_head(mvar),mvar) []; + ("ptr" tso) = foreign "C" unblockOne(StgMVar_head(mvar),mvar) []; StgMVar_head(mvar) = tso; #else - "ptr" tso = foreign "C" unblockOne(MyCapability() "ptr", + ("ptr" tso) = foreign "C" unblockOne(MyCapability() "ptr", StgMVar_head(mvar) "ptr") []; StgMVar_head(mvar) = tso; #endif @@ -1562,7 +1548,7 @@ tryTakeMVarzh_fast mvar = R1; #if defined(THREADED_RTS) - "ptr" info = foreign "C" lockClosure(mvar "ptr") []; + ("ptr" info) = foreign "C" lockClosure(mvar "ptr") []; #else info = GET_INFO(mvar); #endif @@ -1594,10 +1580,10 @@ tryTakeMVarzh_fast #if defined(GRAN) || defined(PAR) /* ToDo: check 2nd arg (mvar) is right */ - "ptr" tso = foreign "C" unblockOne(StgMVar_head(mvar) "ptr", mvar "ptr") []; + ("ptr" tso) = foreign "C" unblockOne(StgMVar_head(mvar) "ptr", mvar "ptr") []; StgMVar_head(mvar) = tso; #else - "ptr" tso = foreign "C" unblockOne(MyCapability() "ptr", + ("ptr" tso) = foreign "C" unblockOne(MyCapability() "ptr", StgMVar_head(mvar) "ptr") []; StgMVar_head(mvar) = tso; #endif @@ -1632,7 +1618,7 @@ putMVarzh_fast mvar = R1; #if defined(THREADED_RTS) - "ptr" info = foreign "C" lockClosure(mvar "ptr") [R2]; + ("ptr" info) = foreign "C" lockClosure(mvar "ptr") [R2]; #else info = GET_INFO(mvar); #endif @@ -1664,10 +1650,10 @@ putMVarzh_fast #if defined(GRAN) || defined(PAR) /* ToDo: check 2nd arg (mvar) is right */ - "ptr" tso = foreign "C" unblockOne(MyCapability() "ptr", StgMVar_head(mvar) "ptr",mvar "ptr") []; + ("ptr" tso) = foreign "C" unblockOne(MyCapability() "ptr", StgMVar_head(mvar) "ptr",mvar "ptr") []; StgMVar_head(mvar) = tso; #else - "ptr" tso = foreign "C" unblockOne(MyCapability() "ptr", StgMVar_head(mvar) "ptr") []; + ("ptr" tso) = foreign "C" unblockOne(MyCapability() "ptr", StgMVar_head(mvar) "ptr") []; StgMVar_head(mvar) = tso; #endif @@ -1705,7 +1691,7 @@ tryPutMVarzh_fast mvar = R1; #if defined(THREADED_RTS) - "ptr" info = foreign "C" lockClosure(mvar "ptr") [R2]; + ("ptr" info) = foreign "C" lockClosure(mvar "ptr") [R2]; #else info = GET_INFO(mvar); #endif @@ -1730,10 +1716,10 @@ tryPutMVarzh_fast #if defined(GRAN) || defined(PAR) /* ToDo: check 2nd arg (mvar) is right */ - "ptr" tso = foreign "C" unblockOne(MyCapability() "ptr", StgMVar_head(mvar) "ptr",mvar "ptr") []; + ("ptr" tso) = foreign "C" unblockOne(MyCapability() "ptr", StgMVar_head(mvar) "ptr",mvar "ptr") []; StgMVar_head(mvar) = tso; #else - "ptr" tso = foreign "C" unblockOne(MyCapability() "ptr", StgMVar_head(mvar) "ptr") []; + ("ptr" tso) = foreign "C" unblockOne(MyCapability() "ptr", StgMVar_head(mvar) "ptr") []; StgMVar_head(mvar) = tso; #endif @@ -1772,7 +1758,7 @@ makeStableNamezh_fast ALLOC_PRIM( SIZEOF_StgStableName, R1_PTR, makeStableNamezh_fast ); - index = foreign "C" lookupStableName(R1 "ptr") []; + (index) = foreign "C" lookupStableName(R1 "ptr") []; /* Is there already a StableName for this heap object? * stable_ptr_table is a pointer to an array of snEntry structs. @@ -1795,7 +1781,7 @@ makeStablePtrzh_fast /* Args: R1 = a */ W_ sp; MAYBE_GC(R1_PTR, makeStablePtrzh_fast); - "ptr" sp = foreign "C" getStablePtr(R1 "ptr") []; + ("ptr" sp) = foreign "C" getStablePtr(R1 "ptr") []; RET_N(sp); } @@ -2010,7 +1996,7 @@ delayzh_fast #ifdef mingw32_HOST_OS /* could probably allocate this on the heap instead */ - "ptr" ares = foreign "C" stgMallocBytes(SIZEOF_StgAsyncIOResult, + ("ptr" ares) = foreign "C" stgMallocBytes(SIZEOF_StgAsyncIOResult, stg_delayzh_malloc_str); reqID = foreign "C" addDelayRequest(R1); StgAsyncIOResult_reqID(ares) = reqID; @@ -2030,7 +2016,7 @@ delayzh_fast W_ time; W_ divisor; - time = foreign "C" getourtimeofday() [R1]; + (time) = foreign "C" getourtimeofday() [R1]; divisor = TO_W_(RtsFlags_MiscFlags_tickInterval(RtsFlags))*1000; target = ((R1 + divisor - 1) / divisor) /* divide rounding up */ + time + 1; /* Add 1 as getourtimeofday rounds down */ diff --git a/rts/StgMiscClosures.cmm b/rts/StgMiscClosures.cmm index e532e51a53..e092e3fdc0 100644 --- a/rts/StgMiscClosures.cmm +++ b/rts/StgMiscClosures.cmm @@ -57,9 +57,7 @@ stg_interp_constr_entry haven't got a good story about that yet. */ -INFO_TABLE_RET( stg_ctoi_R1p, - 0/*size*/, 0/*bitmap*/, /* special layout! */ - RET_BCO) +INFO_TABLE_RET( stg_ctoi_R1p, RET_BCO) { Sp_adj(-2); Sp(1) = R1; @@ -70,9 +68,7 @@ INFO_TABLE_RET( stg_ctoi_R1p, /* * When the returned value is a pointer, but unlifted, in R1 ... */ -INFO_TABLE_RET( stg_ctoi_R1unpt, - 0/*size*/, 0/*bitmap*/, /* special layout! */ - RET_BCO ) +INFO_TABLE_RET( stg_ctoi_R1unpt, RET_BCO ) { Sp_adj(-2); Sp(1) = R1; @@ -83,9 +79,7 @@ INFO_TABLE_RET( stg_ctoi_R1unpt, /* * When the returned value is a non-pointer in R1 ... */ -INFO_TABLE_RET( stg_ctoi_R1n, - 0/*size*/, 0/*bitmap*/, /* special layout! */ - RET_BCO ) +INFO_TABLE_RET( stg_ctoi_R1n, RET_BCO ) { Sp_adj(-2); Sp(1) = R1; @@ -96,9 +90,7 @@ INFO_TABLE_RET( stg_ctoi_R1n, /* * When the returned value is in F1 */ -INFO_TABLE_RET( stg_ctoi_F1, - 0/*size*/, 0/*bitmap*/, /* special layout! */ - RET_BCO ) +INFO_TABLE_RET( stg_ctoi_F1, RET_BCO ) { Sp_adj(-2); F_[Sp + WDS(1)] = F1; @@ -109,9 +101,7 @@ INFO_TABLE_RET( stg_ctoi_F1, /* * When the returned value is in D1 */ -INFO_TABLE_RET( stg_ctoi_D1, - 0/*size*/, 0/*bitmap*/, /* special layout! */ - RET_BCO ) +INFO_TABLE_RET( stg_ctoi_D1, RET_BCO ) { Sp_adj(-1) - SIZEOF_DOUBLE; D_[Sp + WDS(1)] = D1; @@ -122,9 +112,7 @@ INFO_TABLE_RET( stg_ctoi_D1, /* * When the returned value is in L1 */ -INFO_TABLE_RET( stg_ctoi_L1, - 0/*size*/, 0/*bitmap*/, /* special layout! */ - RET_BCO ) +INFO_TABLE_RET( stg_ctoi_L1, RET_BCO ) { Sp_adj(-1) - 8; L_[Sp + WDS(1)] = L1; @@ -135,9 +123,7 @@ INFO_TABLE_RET( stg_ctoi_L1, /* * When the returned value is a void */ -INFO_TABLE_RET( stg_ctoi_V, - 0/*size*/, 0/*bitmap*/, /* special layout! */ - RET_BCO ) +INFO_TABLE_RET( stg_ctoi_V, RET_BCO ) { Sp_adj(-1); Sp(0) = stg_gc_void_info; @@ -149,9 +135,7 @@ INFO_TABLE_RET( stg_ctoi_V, * should apply the BCO on the stack to its arguments, also on the * stack. */ -INFO_TABLE_RET( stg_apply_interp, - 0/*size*/, 0/*bitmap*/, /* special layout! */ - RET_BCO ) +INFO_TABLE_RET( stg_apply_interp, RET_BCO ) { /* Just in case we end up in here... (we shouldn't) */ jump stg_yield_to_interpreter; diff --git a/rts/StgStartup.cmm b/rts/StgStartup.cmm index 2d83a676c0..5b0f7e2a5f 100644 --- a/rts/StgStartup.cmm +++ b/rts/StgStartup.cmm @@ -36,16 +36,12 @@ Returning from the STG world. -------------------------------------------------------------------------- */ +INFO_TABLE_RET( stg_stop_thread, STOP_FRAME, #if defined(PROFILING) -#define STOP_THREAD_BITMAP 3 -#define STOP_THREAD_WORDS 2 -#else -#define STOP_THREAD_BITMAP 0 -#define STOP_THREAD_WORDS 0 + W_ unused, + W_ unused #endif - -INFO_TABLE_RET( stg_stop_thread, STOP_THREAD_WORDS, STOP_THREAD_BITMAP, - STOP_FRAME) +) { /* The final exit. @@ -148,7 +144,7 @@ stg_threadFinished results that comes back. ------------------------------------------------------------------------- */ -INFO_TABLE_RET( stg_forceIO, 0/*size*/, 0/*bitmap*/, RET_SMALL) +INFO_TABLE_RET( stg_forceIO, RET_SMALL) #ifdef REG_R1 { @@ -172,7 +168,7 @@ INFO_TABLE_RET( stg_forceIO, 0/*size*/, 0/*bitmap*/, RET_SMALL) is a register or not. ------------------------------------------------------------------------- */ -INFO_TABLE_RET( stg_noforceIO, 0/*size*/, 0/*bitmap*/, RET_SMALL ) +INFO_TABLE_RET( stg_noforceIO, RET_SMALL ) #ifdef REG_R1 { diff --git a/rts/StgStdThunks.cmm b/rts/StgStdThunks.cmm index 342a6eb164..db9c254233 100644 --- a/rts/StgStdThunks.cmm +++ b/rts/StgStdThunks.cmm @@ -32,17 +32,15 @@ #ifdef PROFILING #define SAVE_CCCS(fs) StgHeader_ccs(Sp-fs) = W_[CCCS] #define GET_SAVED_CCCS W_[CCCS] = StgHeader_ccs(Sp) -#define RET_BITMAP 3 -#define RET_FRAMESIZE 2 +#define RET_PARAMS W_ unused1, W_ unused2 #else #define SAVE_CCCS(fs) /* empty */ #define GET_SAVED_CCCS /* empty */ -#define RET_BITMAP 0 -#define RET_FRAMESIZE 0 +#define RET_PARAMS #endif #define SELECTOR_CODE_UPD(offset) \ - INFO_TABLE_RET(stg_sel_ret_##offset##_upd, RET_FRAMESIZE, RET_BITMAP, RET_SMALL) \ + INFO_TABLE_RET(stg_sel_ret_##offset##_upd, RET_SMALL, RET_PARAMS) \ { \ R1 = StgClosure_payload(R1,offset); \ GET_SAVED_CCCS; \ @@ -85,7 +83,7 @@ SELECTOR_CODE_UPD(14) SELECTOR_CODE_UPD(15) #define SELECTOR_CODE_NOUPD(offset) \ - INFO_TABLE_RET(stg_sel_ret_##offset##_noupd, RET_FRAMESIZE, RET_BITMAP, RET_SMALL) \ + INFO_TABLE_RET(stg_sel_ret_##offset##_noupd, RET_SMALL, RET_PARAMS) \ { \ R1 = StgClosure_payload(R1,offset); \ GET_SAVED_CCCS; \ diff --git a/rts/Updates.cmm b/rts/Updates.cmm index a9f25b76fb..7ebade0aea 100644 --- a/rts/Updates.cmm +++ b/rts/Updates.cmm @@ -45,11 +45,9 @@ } #if defined(PROFILING) -#define UPD_FRAME_BITMAP 3 -#define UPD_FRAME_WORDS 3 +#define UPD_FRAME_PARAMS W_ unused1, W_ unused2, "ptr" W_ unused3 #else -#define UPD_FRAME_BITMAP 0 -#define UPD_FRAME_WORDS 1 +#define UPD_FRAME_PARAMS "ptr" W_ unused1 #endif /* this bitmap indicates that the first word of an update frame is a @@ -57,11 +55,9 @@ * there's a cost-centre-stack in there too). */ -INFO_TABLE_RET( stg_upd_frame, - UPD_FRAME_WORDS, UPD_FRAME_BITMAP, UPDATE_FRAME) +INFO_TABLE_RET( stg_upd_frame, UPDATE_FRAME, UPD_FRAME_PARAMS) UPD_FRAME_ENTRY_TEMPLATE -INFO_TABLE_RET( stg_marked_upd_frame, - UPD_FRAME_WORDS, UPD_FRAME_BITMAP, UPDATE_FRAME) +INFO_TABLE_RET( stg_marked_upd_frame, UPDATE_FRAME, UPD_FRAME_PARAMS) UPD_FRAME_ENTRY_TEMPLATE |