diff options
author | GHC GitLab CI <ghc-ci@gitlab-haskell.org> | 2020-10-22 16:59:11 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-11 03:20:35 -0500 |
commit | 7a65f9e140906087273ce95f062775f18f6a708d (patch) | |
tree | 881be7a87883ad1b49a55abbd3e2a9cdd52bfbe0 | |
parent | 2782487f5f6ad9df4dc8725226a47f07fec77f9f (diff) | |
download | haskell-7a65f9e140906087273ce95f062775f18f6a708d.tar.gz |
rts: Introduce highMemDynamic
-rw-r--r-- | includes/rts/storage/GC.h | 4 | ||||
-rw-r--r-- | rts/sm/Storage.c | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/includes/rts/storage/GC.h b/includes/rts/storage/GC.h index e8dc05048a..a364682741 100644 --- a/includes/rts/storage/GC.h +++ b/includes/rts/storage/GC.h @@ -230,6 +230,10 @@ void revertCAFs (void); // (preferably use RtsConfig.keep_cafs instead) void setKeepCAFs (void); +// Let the runtime know that all the CAFs in high mem are not +// to be retained. Useful in conjunction with loadNativeObj +void setHighMemDynamic (void); + /* ----------------------------------------------------------------------------- This is the write barrier for MUT_VARs, a.k.a. IORefs. A MUT_VAR_CLEAN object is not on the mutable list; a MUT_VAR_DIRTY diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index 98aefa9a4b..f5419abc9c 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -45,6 +45,7 @@ StgIndStatic *dyn_caf_list = NULL; StgIndStatic *debug_caf_list = NULL; StgIndStatic *revertible_caf_list = NULL; bool keepCAFs; +bool highMemDynamic; W_ large_alloc_lim; /* GC if n_large_blocks in any nursery * reaches this. */ @@ -518,7 +519,7 @@ newCAF(StgRegTable *reg, StgIndStatic *caf) bh = lockCAF(reg, caf); if (!bh) return NULL; - if(keepCAFs) + if(keepCAFs && !(highMemDynamic && (void*) caf > (void*) 0x80000000)) { // Note [dyn_caf_list] // If we are in GHCi _and_ we are using dynamic libraries, @@ -572,6 +573,12 @@ setKeepCAFs (void) keepCAFs = 1; } +void +setHighMemDynamic (void) +{ + highMemDynamic = 1; +} + // An alternate version of newCAF which is used for dynamically loaded // object code in GHCi. In this case we want to retain *all* CAFs in // the object code, because they might be demanded at any time from an |