diff options
Diffstat (limited to 'rts')
-rw-r--r-- | rts/Schedule.c | 6 | ||||
-rw-r--r-- | rts/Threads.c | 6 | ||||
-rw-r--r-- | rts/sm/Storage.c | 10 |
3 files changed, 14 insertions, 8 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c index f25b37288d..957aa4b9cb 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -1086,15 +1086,15 @@ schedulePostRunThread (Capability *cap, StgTSO *t) // If the current thread's allocation limit has run out, send it // the AllocationLimitExceeded exception. - if (t->alloc_limit < 0 && (t->flags & TSO_ALLOC_LIMIT)) { + if (PK_Int64((W_*)&(t->alloc_limit)) < 0 && (t->flags & TSO_ALLOC_LIMIT)) { // Use a throwToSelf rather than a throwToSingleThreaded, because // it correctly handles the case where the thread is currently // inside mask. Also the thread might be blocked (e.g. on an // MVar), and throwToSingleThreaded doesn't unblock it // correctly in that case. throwToSelf(cap, t, allocationLimitExceeded_closure); - t->alloc_limit = (StgInt64)RtsFlags.GcFlags.allocLimitGrace - * BLOCK_SIZE; + ASSIGN_Int64((W_*)&(t->alloc_limit), + (StgInt64)RtsFlags.GcFlags.allocLimitGrace * BLOCK_SIZE); } /* some statistics gathering in the parallel case */ diff --git a/rts/Threads.c b/rts/Threads.c index 90efd9ce4e..99f2be7304 100644 --- a/rts/Threads.c +++ b/rts/Threads.c @@ -110,7 +110,7 @@ createThread(Capability *cap, W_ size) tso->stackobj = stack; tso->tot_stack_size = stack->stack_size; - tso->alloc_limit = 0; + ASSIGN_Int64((W_*)&(tso->alloc_limit), 0); tso->trec = NO_TREC; @@ -173,12 +173,12 @@ 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 ((StgTSO *)tso)->alloc_limit; + return PK_Int64((W_*)&(((StgTSO *)tso)->alloc_limit)); } void rts_setThreadAllocationCounter(StgPtr tso, HsInt64 i) { - ((StgTSO *)tso)->alloc_limit = i; + ASSIGN_Int64((W_*)&(((StgTSO *)tso)->alloc_limit), i); } void rts_enableThreadAllocationLimit(StgPtr tso) diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index f02c00591c..50926b70b3 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -746,7 +746,10 @@ StgPtr allocate (Capability *cap, W_ n) TICK_ALLOC_HEAP_NOCTR(WDS(n)); CCS_ALLOC(cap->r.rCCCS,n); if (cap->r.rCurrentTSO != NULL) { - cap->r.rCurrentTSO->alloc_limit -= n*sizeof(W_); + // cap->r.rCurrentTSO->alloc_limit -= n*sizeof(W_) + ASSIGN_Int64((W_*)&(cap->r.rCurrentTSO->alloc_limit), + (PK_Int64((W_*)&(cap->r.rCurrentTSO->alloc_limit)) + - n*sizeof(W_))); } if (n >= LARGE_OBJECT_THRESHOLD/sizeof(W_)) { @@ -897,7 +900,10 @@ allocatePinned (Capability *cap, W_ n) TICK_ALLOC_HEAP_NOCTR(WDS(n)); CCS_ALLOC(cap->r.rCCCS,n); if (cap->r.rCurrentTSO != NULL) { - cap->r.rCurrentTSO->alloc_limit -= n*sizeof(W_); + // cap->r.rCurrentTSO->alloc_limit -= n*sizeof(W_); + ASSIGN_Int64((W_*)&(cap->r.rCurrentTSO->alloc_limit), + (PK_Int64((W_*)&(cap->r.rCurrentTSO->alloc_limit)) + - n*sizeof(W_))); } bd = cap->pinned_object_block; |