virtual size_t used_in_alloc_regions() { assert(Heap_lock->owner() != NULL, "Should be owned on this thread's behalf."); size_t result = 0; // Read only once in case it is set to NULL concurrently HeapRegion* hr = mutator_alloc_region(AllocationContext::current())->get(); if (hr != NULL) { result += hr->used(); } return result; }
size_t G1Allocator::unsafe_max_tlab_alloc(AllocationContext_t context) { // Return the remaining space in the cur alloc region, but not less than // the min TLAB size. // Also, this value can be at most the humongous object threshold, // since we can't allow tlabs to grow big enough to accommodate // humongous objects. HeapRegion* hr = mutator_alloc_region(context)->get(); size_t max_tlab = _g1h->max_tlab_size() * wordSize; if (hr == NULL) { return max_tlab; } else { return MIN2(MAX2(hr->free(), (size_t) MinTLABSize), max_tlab); } }
// Do we currently have an active mutator region to allocate into? bool has_mutator_alloc_region(AllocationContext_t context) { return mutator_alloc_region(context)->get() != NULL; }