--- a/src/hotspot/share/gc/g1/g1Allocator.inline.hpp Wed Nov 13 10:49:12 2019 -0800
+++ b/src/hotspot/share/gc/g1/g1Allocator.inline.hpp Wed Nov 13 10:49:32 2019 -0800
@@ -39,8 +39,9 @@
return &_mutator_alloc_regions[node_index];
}
-inline SurvivorGCAllocRegion* G1Allocator::survivor_gc_alloc_region() {
- return &_survivor_gc_alloc_region;
+inline SurvivorGCAllocRegion* G1Allocator::survivor_gc_alloc_region(uint node_index) {
+ assert(node_index < _num_alloc_regions, "Invalid index: %u", node_index);
+ return &_survivor_gc_alloc_regions[node_index];
}
inline OldGCAllocRegion* G1Allocator::old_gc_alloc_region() {
@@ -71,17 +72,39 @@
return mutator_alloc_region(node_index)->attempt_allocation_force(word_size);
}
-inline PLAB* G1PLABAllocator::alloc_buffer(G1HeapRegionAttr dest) {
+inline PLAB* G1PLABAllocator::alloc_buffer(G1HeapRegionAttr dest, uint node_index) const {
assert(dest.is_valid(),
"Allocation buffer index out of bounds: %s", dest.get_type_str());
assert(_alloc_buffers[dest.type()] != NULL,
"Allocation buffer is NULL: %s", dest.get_type_str());
- return _alloc_buffers[dest.type()];
+ return alloc_buffer(dest.type(), node_index);
+}
+
+inline PLAB* G1PLABAllocator::alloc_buffer(region_type_t dest, uint node_index) const {
+ assert(dest < G1HeapRegionAttr::Num,
+ "Allocation buffer index out of bounds: %u", dest);
+
+ if (dest == G1HeapRegionAttr::Young) {
+ assert(node_index < alloc_buffers_length(dest),
+ "Allocation buffer index out of bounds: %u, %u", dest, node_index);
+ return _alloc_buffers[dest][node_index];
+ } else {
+ return _alloc_buffers[dest][0];
+ }
+}
+
+inline uint G1PLABAllocator::alloc_buffers_length(region_type_t dest) const {
+ if (dest == G1HeapRegionAttr::Young) {
+ return _allocator->num_nodes();
+ } else {
+ return 1;
+ }
}
inline HeapWord* G1PLABAllocator::plab_allocate(G1HeapRegionAttr dest,
- size_t word_sz) {
- PLAB* buffer = alloc_buffer(dest);
+ size_t word_sz,
+ uint node_index) {
+ PLAB* buffer = alloc_buffer(dest, node_index);
if (_survivor_alignment_bytes == 0 || !dest.is_young()) {
return buffer->allocate(word_sz);
} else {
@@ -91,12 +114,13 @@
inline HeapWord* G1PLABAllocator::allocate(G1HeapRegionAttr dest,
size_t word_sz,
- bool* refill_failed) {
- HeapWord* const obj = plab_allocate(dest, word_sz);
+ bool* refill_failed,
+ uint node_index) {
+ HeapWord* const obj = plab_allocate(dest, word_sz, node_index);
if (obj != NULL) {
return obj;
}
- return allocate_direct_or_new_plab(dest, word_sz, refill_failed);
+ return allocate_direct_or_new_plab(dest, word_sz, refill_failed, node_index);
}
// Create the maps which is used to identify archive objects.