Use leftmost region in GC allocations

Dominik Inführ dominik.infuehr at gmail.com
Tue Feb 6 19:05:52 UTC 2018


Hi,

allocate_single in ShenandoahFreeSet doesn't use the leftmost-Region. Quite
a minor problem but it might be worth to fix.

diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp
@@ -72,9 +72,9 @@
     }
     case ShenandoahHeap::_alloc_gclab:
     case ShenandoahHeap::_alloc_shared_gc: {
-      for (size_t idx = _rightmost; idx > _leftmost; idx--) {
-        if (is_free(idx)) {
-          HeapWord* result = try_allocate_in(word_size, type, idx,
in_new_region);
+      for (size_t idx = _rightmost + 1; idx > _leftmost; idx--) {
+        if (is_free(idx - 1)) {
+          HeapWord* result = try_allocate_in(word_size, type, idx - 1,
in_new_region);
           if (result != NULL) {
             return result;
           }


Dominik


More information about the shenandoah-dev mailing list