diff options
author | Andy Hanson <anhans@microsoft.com> | 2019-07-12 16:20:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-12 16:20:52 -0700 |
commit | 4b5ae70e341bad3c9f25d33cfee58d2bb93d3db7 (patch) | |
tree | 868167c4e037c3789091a2858db868d18de25a3f /src/gc | |
parent | 41d0619707a29b910b7d8056a3b5d4423fc928d2 (diff) | |
download | coreclr-4b5ae70e341bad3c9f25d33cfee58d2bb93d3db7.tar.gz coreclr-4b5ae70e341bad3c9f25d33cfee58d2bb93d3db7.tar.bz2 coreclr-4b5ae70e341bad3c9f25d33cfee58d2bb93d3db7.zip |
Fixes when accessing fgn_maxgen_percent (#25650)
* Fixes when accessing fgn_maxgen_percent
PR #25350 changed `fgn_maxgen_percent` to be a per-heap property when
`MULTIPLE_HEAPS` is set. A few uses need to be updated.
* In `full_gc_wait`, must re-read `fgn_maxgen_percent` before the
second test of `maxgen_percent == 0`.
(Otherwise the second test is statically unreachable.)
* In RegisterForFullGCNotification, must set `fgn_maxgen_percent` when
`MULTIPLE_HEAPS` is not set
* In CancelFullGCNotification, must set `fgn_maxgen_percent` for each
heap separately when `MULTIPLE_HEAPS` is set.
Fix dotnet/corefx#39374
* Avoid duplicate code when getting fgn_maxgen_percent twice in full_gc_wait
Diffstat (limited to 'src/gc')
-rw-r--r-- | src/gc/gc.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp index f107b134ca..f49366474e 100644 --- a/src/gc/gc.cpp +++ b/src/gc/gc.cpp @@ -12377,13 +12377,13 @@ void gc_heap::send_full_gc_notification (int gen_num, BOOL due_to_alloc_p) wait_full_gc_status gc_heap::full_gc_wait (GCEvent *event, int time_out_ms) { - uint32_t maxgen_percent = 0; #ifdef MULTIPLE_HEAPS - maxgen_percent = g_heaps[0]->fgn_maxgen_percent; + gc_heap* hp = gc_heap::g_heaps[0]; #else - maxgen_percent = fgn_maxgen_percent; + gc_heap* hp = pGenGCHeap; #endif //MULTIPLE_HEAPS - if (maxgen_percent == 0) + + if (hp->fgn_maxgen_percent == 0) { return wait_full_gc_na; } @@ -12392,7 +12392,7 @@ wait_full_gc_status gc_heap::full_gc_wait (GCEvent *event, int time_out_ms) if ((wait_result == WAIT_OBJECT_0) || (wait_result == WAIT_TIMEOUT)) { - if (maxgen_percent == 0) + if (hp->fgn_maxgen_percent == 0) { return wait_full_gc_cancelled; } @@ -36900,6 +36900,7 @@ bool GCHeap::RegisterForFullGCNotification(uint32_t gen2Percentage, } #else //MULTIPLE_HEAPS pGenGCHeap->fgn_last_alloc = dd_new_allocation (pGenGCHeap->dynamic_data_of (0)); + pGenGCHeap->fgn_maxgen_percent = gen2Percentage; #endif //MULTIPLE_HEAPS pGenGCHeap->full_gc_approach_event.Reset(); @@ -36913,9 +36914,17 @@ bool GCHeap::RegisterForFullGCNotification(uint32_t gen2Percentage, bool GCHeap::CancelFullGCNotification() { +#ifdef MULTIPLE_HEAPS + for (int hn = 0; hn < gc_heap::n_heaps; hn++) + { + gc_heap* hp = gc_heap::g_heaps [hn]; + hp->fgn_maxgen_percent = 0; + } +#else //MULTIPLE_HEAPS pGenGCHeap->fgn_maxgen_percent = 0; - pGenGCHeap->fgn_loh_percent = 0; +#endif //MULTIPLE_HEAPS + pGenGCHeap->fgn_loh_percent = 0; pGenGCHeap->full_gc_approach_event.Set(); pGenGCHeap->full_gc_end_event.Set(); |