diff options
author | Ben Gamari <ben@smart-cactus.org> | 2018-01-18 00:50:31 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-01-18 00:50:31 -0500 |
commit | e1d4140be4d2a1508015093b69e1ef53516e1eb6 (patch) | |
tree | 93b5ffd337e78ca6d54073b9935bd9ac459199a9 /rts | |
parent | 8bb150df9e5e711d67f9800c0d694ecf457cd8f5 (diff) | |
download | haskell-e1d4140be4d2a1508015093b69e1ef53516e1eb6.tar.gz |
Revert "Improve accuracy of get/setAllocationCounter"
This reverts commit a1a689dda48113f3735834350fb562bb1927a633.
Diffstat (limited to 'rts')
-rw-r--r-- | rts/PrimOps.cmm | 20 | ||||
-rw-r--r-- | rts/RtsSymbols.c | 4 | ||||
-rw-r--r-- | rts/Threads.c | 13 |
3 files changed, 14 insertions, 23 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index 1caa0c3343..2b3a304d06 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -2495,23 +2495,3 @@ stg_traceMarkerzh ( W_ msg ) return (); } - -stg_getThreadAllocationCounterzh () -{ - // Account for the allocation in the current block - W_ offset; - offset = Hp - bdescr_start(CurrentNursery); - return (StgTSO_alloc_limit(CurrentTSO) - offset); -} - -stg_setThreadAllocationCounterzh ( I64 counter ) -{ - // Allocation in the current block will be subtracted by - // getThreadAllocationCounter#, so we have to offset any existing - // allocation here. See also openNursery/closeNursery in - // compiler/codeGen/StgCmmForeign.hs. - W_ offset; - offset = Hp - bdescr_start(CurrentNursery); - StgTSO_alloc_limit(CurrentTSO) = counter + offset; - return (); -} diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index 0fc98663ec..2ea6713eee 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -744,6 +744,8 @@ SymI_HasProto(rts_isProfiled) \ SymI_HasProto(rts_isDynamic) \ SymI_HasProto(rts_setInCallCapability) \ + SymI_HasProto(rts_getThreadAllocationCounter) \ + SymI_HasProto(rts_setThreadAllocationCounter) \ SymI_HasProto(rts_enableThreadAllocationLimit) \ SymI_HasProto(rts_disableThreadAllocationLimit) \ SymI_HasProto(rts_setMainThread) \ @@ -894,8 +896,6 @@ SymI_HasProto(stg_traceCcszh) \ SymI_HasProto(stg_traceEventzh) \ SymI_HasProto(stg_traceMarkerzh) \ - SymI_HasProto(stg_getThreadAllocationCounterzh) \ - SymI_HasProto(stg_setThreadAllocationCounterzh) \ SymI_HasProto(getMonotonicNSec) \ SymI_HasProto(lockFile) \ SymI_HasProto(unlockFile) \ diff --git a/rts/Threads.c b/rts/Threads.c index c54156f383..b09dfa8ccc 100644 --- a/rts/Threads.c +++ b/rts/Threads.c @@ -165,8 +165,19 @@ rts_getThreadId(StgPtr tso) } /* --------------------------------------------------------------------------- - * Enabling and disabling the thread allocation limit + * Getting & setting the thread allocation limit * ------------------------------------------------------------------------ */ +HsInt64 rts_getThreadAllocationCounter(StgPtr tso) +{ + // NB. doesn't take into account allocation in the current nursery + // block, so it might be off by up to 4k. + return PK_Int64((W_*)&(((StgTSO *)tso)->alloc_limit)); +} + +void rts_setThreadAllocationCounter(StgPtr tso, HsInt64 i) +{ + ASSIGN_Int64((W_*)&(((StgTSO *)tso)->alloc_limit), i); +} void rts_enableThreadAllocationLimit(StgPtr tso) { |