< prev index next >
src/hotspot/share/gc/g1/g1Allocator.inline.hpp
Print this page
rev 56323 : imported patch 8220310.mut.0
@@ -28,12 +28,13 @@
#include "gc/g1/g1Allocator.hpp"
#include "gc/g1/g1AllocRegion.inline.hpp"
#include "gc/shared/plab.inline.hpp"
#include "memory/universe.hpp"
-inline MutatorAllocRegion* G1Allocator::mutator_alloc_region() {
- return &_mutator_alloc_region;
+inline MutatorAllocRegion* G1Allocator::mutator_alloc_region(uint node_index) {
+ assert(_g1h->mem_node_mgr()->is_valid_node_index(node_index), "Invariant, index %u", node_index);
+ return &_mutator_alloc_region[node_index];
}
inline SurvivorGCAllocRegion* G1Allocator::survivor_gc_alloc_region() {
return &_survivor_gc_alloc_region;
}
@@ -43,26 +44,29 @@
}
inline HeapWord* G1Allocator::attempt_allocation(size_t min_word_size,
size_t desired_word_size,
size_t* actual_word_size) {
- HeapWord* result = mutator_alloc_region()->attempt_retained_allocation(min_word_size, desired_word_size, actual_word_size);
+ uint node_index = _g1h->mem_node_mgr()->index_of_current_thread();
+ HeapWord* result = mutator_alloc_region(node_index)->attempt_retained_allocation(min_word_size, desired_word_size, actual_word_size);
if (result != NULL) {
return result;
}
- return mutator_alloc_region()->attempt_allocation(min_word_size, desired_word_size, actual_word_size);
+ return mutator_alloc_region(node_index)->attempt_allocation(min_word_size, desired_word_size, actual_word_size);
}
inline HeapWord* G1Allocator::attempt_allocation_locked(size_t word_size) {
- HeapWord* result = mutator_alloc_region()->attempt_allocation_locked(word_size);
- assert(result != NULL || mutator_alloc_region()->get() == NULL,
- "Must not have a mutator alloc region if there is no memory, but is " PTR_FORMAT, p2i(mutator_alloc_region()->get()));
+ uint node_index = _g1h->mem_node_mgr()->index_of_current_thread();
+ HeapWord* result = mutator_alloc_region(node_index)->attempt_allocation_locked(word_size);
+ assert(result != NULL || mutator_alloc_region(node_index)->get() == NULL,
+ "Must not have a mutator alloc region if there is no memory, but is " PTR_FORMAT, p2i(mutator_alloc_region(node_index)->get()));
return result;
}
inline HeapWord* G1Allocator::attempt_allocation_force(size_t word_size) {
- return mutator_alloc_region()->attempt_allocation_force(word_size);
+ uint node_index = _g1h->mem_node_mgr()->index_of_current_thread();
+ return mutator_alloc_region(node_index)->attempt_allocation_force(word_size);
}
inline PLAB* G1PLABAllocator::alloc_buffer(G1HeapRegionAttr dest) {
assert(dest.is_valid(),
"Allocation buffer index out of bounds: %s", dest.get_type_str());
< prev index next >