summaryrefslogtreecommitdiff
path: root/rts/Threads.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2018-01-18 00:50:31 -0500
committerBen Gamari <ben@smart-cactus.org>2018-01-18 00:50:31 -0500
commite1d4140be4d2a1508015093b69e1ef53516e1eb6 (patch)
tree93b5ffd337e78ca6d54073b9935bd9ac459199a9 /rts/Threads.c
parent8bb150df9e5e711d67f9800c0d694ecf457cd8f5 (diff)
downloadhaskell-e1d4140be4d2a1508015093b69e1ef53516e1eb6.tar.gz
Revert "Improve accuracy of get/setAllocationCounter"
This reverts commit a1a689dda48113f3735834350fb562bb1927a633.
Diffstat (limited to 'rts/Threads.c')
-rw-r--r--rts/Threads.c13
1 files changed, 12 insertions, 1 deletions
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)
{