diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-06-22 17:51:06 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-06-25 03:54:55 -0400 |
commit | d3c2d59bafe253dd7e4966a46564fb16acb1af5c (patch) | |
tree | da757ae9fd5a45674915c1e111990b45d839ede7 | |
parent | a788d4d17ad332dbfbe08e6822c52ae0de6ef496 (diff) | |
download | haskell-d3c2d59bafe253dd7e4966a46564fb16acb1af5c.tar.gz |
RTS: avoid overflow on 32-bit arch (#18375)
We're now correctly computing allocated bytes on 32-bit arch, so we get
huge increases.
Metric Increase:
haddock.Cabal
haddock.base
haddock.compiler
space_leak_001
-rw-r--r-- | rts/Capability.h | 2 | ||||
-rw-r--r-- | rts/HeapStackCheck.cmm | 4 | ||||
-rw-r--r-- | rts/sm/Storage.c | 4 | ||||
-rw-r--r-- | rts/sm/Storage.h | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/rts/Capability.h b/rts/Capability.h index 3078680aa6..82046c0b9e 100644 --- a/rts/Capability.h +++ b/rts/Capability.h @@ -114,7 +114,7 @@ struct Capability_ { // Total words allocated by this cap since rts start // See Note [allocation accounting] in Storage.c - W_ total_allocated; + uint64_t total_allocated; #if defined(THREADED_RTS) // Worker Tasks waiting in the wings. Singly-linked. diff --git a/rts/HeapStackCheck.cmm b/rts/HeapStackCheck.cmm index fc128e312f..1c1de089dc 100644 --- a/rts/HeapStackCheck.cmm +++ b/rts/HeapStackCheck.cmm @@ -100,8 +100,8 @@ stg_gc_noregs CLOSE_NURSERY(); Capability_total_allocated(MyCapability()) = Capability_total_allocated(MyCapability()) + - BYTES_TO_WDS(bdescr_free(CurrentNursery) - - bdescr_start(CurrentNursery)); + %zx64(BYTES_TO_WDS(bdescr_free(CurrentNursery) - + bdescr_start(CurrentNursery))); CurrentNursery = bdescr_link(CurrentNursery); bdescr_free(CurrentNursery) = bdescr_start(CurrentNursery); OPEN_NURSERY(); diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index b47afaf7df..96bc133d02 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -1455,10 +1455,10 @@ dirty_MVAR(StgRegTable *reg, StgClosure *p, StgClosure *old_val) // program. Also emits events reporting the per-cap allocation // totals. // -StgWord +uint64_t calcTotalAllocated (void) { - W_ tot_alloc = 0; + uint64_t tot_alloc = 0; W_ n; for (n = 0; n < n_capabilities; n++) { diff --git a/rts/sm/Storage.h b/rts/sm/Storage.h index cdb9720650..8d90c3ba5f 100644 --- a/rts/sm/Storage.h +++ b/rts/sm/Storage.h @@ -94,8 +94,8 @@ INLINE_HEADER void newNurseryBlock (bdescr *bd) { bd->free = bd->start; } -void updateNurseriesStats (void); -StgWord calcTotalAllocated (void); +void updateNurseriesStats (void); +uint64_t calcTotalAllocated (void); /* ----------------------------------------------------------------------------- Stats 'n' DEBUG stuff |