24
25 #ifndef SHARE_VM_GC_G1_G1ALLOCATOR_INLINE_HPP
26 #define SHARE_VM_GC_G1_G1ALLOCATOR_INLINE_HPP
27
28 #include "gc/g1/g1Allocator.hpp"
29 #include "gc/g1/g1AllocRegion.inline.hpp"
30 #include "gc/shared/plab.inline.hpp"
31
32 inline MutatorAllocRegion* G1Allocator::mutator_alloc_region() {
33 return &_mutator_alloc_region;
34 }
35
36 inline SurvivorGCAllocRegion* G1Allocator::survivor_gc_alloc_region() {
37 return &_survivor_gc_alloc_region;
38 }
39
40 inline OldGCAllocRegion* G1Allocator::old_gc_alloc_region() {
41 return &_old_gc_alloc_region;
42 }
43
44 inline HeapWord* G1Allocator::attempt_allocation(size_t word_size) {
45 return mutator_alloc_region()->attempt_allocation(word_size);
46 }
47
48 inline HeapWord* G1Allocator::attempt_allocation_locked(size_t word_size) {
49 HeapWord* result = mutator_alloc_region()->attempt_allocation_locked(word_size);
50 assert(result != NULL || mutator_alloc_region()->get() == NULL,
51 "Must not have a mutator alloc region if there is no memory, but is " PTR_FORMAT, p2i(mutator_alloc_region()->get()));
52 return result;
53 }
54
55 inline HeapWord* G1Allocator::attempt_allocation_force(size_t word_size) {
56 return mutator_alloc_region()->attempt_allocation_force(word_size);
57 }
58
59 inline PLAB* G1PLABAllocator::alloc_buffer(InCSetState dest) {
60 assert(dest.is_valid(),
61 "Allocation buffer index out-of-bounds: " CSETSTATE_FORMAT, dest.value());
62 assert(_alloc_buffers[dest.value()] != NULL,
63 "Allocation buffer is NULL: " CSETSTATE_FORMAT, dest.value());
64 return _alloc_buffers[dest.value()];
65 }
|
24
25 #ifndef SHARE_VM_GC_G1_G1ALLOCATOR_INLINE_HPP
26 #define SHARE_VM_GC_G1_G1ALLOCATOR_INLINE_HPP
27
28 #include "gc/g1/g1Allocator.hpp"
29 #include "gc/g1/g1AllocRegion.inline.hpp"
30 #include "gc/shared/plab.inline.hpp"
31
32 inline MutatorAllocRegion* G1Allocator::mutator_alloc_region() {
33 return &_mutator_alloc_region;
34 }
35
36 inline SurvivorGCAllocRegion* G1Allocator::survivor_gc_alloc_region() {
37 return &_survivor_gc_alloc_region;
38 }
39
40 inline OldGCAllocRegion* G1Allocator::old_gc_alloc_region() {
41 return &_old_gc_alloc_region;
42 }
43
44 inline HeapWord* G1Allocator::attempt_allocation(size_t min_word_size,
45 size_t desired_word_size,
46 size_t* actual_word_size) {
47 HeapWord* result = mutator_alloc_region()->attempt_retained_allocation(min_word_size, desired_word_size, actual_word_size);
48 if (result != NULL) {
49 return result;
50 }
51 return mutator_alloc_region()->attempt_allocation(min_word_size, desired_word_size, actual_word_size);
52 }
53
54 inline HeapWord* G1Allocator::attempt_allocation_locked(size_t word_size) {
55 HeapWord* result = mutator_alloc_region()->attempt_allocation_locked(word_size);
56 assert(result != NULL || mutator_alloc_region()->get() == NULL,
57 "Must not have a mutator alloc region if there is no memory, but is " PTR_FORMAT, p2i(mutator_alloc_region()->get()));
58 return result;
59 }
60
61 inline HeapWord* G1Allocator::attempt_allocation_force(size_t word_size) {
62 return mutator_alloc_region()->attempt_allocation_force(word_size);
63 }
64
65 inline PLAB* G1PLABAllocator::alloc_buffer(InCSetState dest) {
66 assert(dest.is_valid(),
67 "Allocation buffer index out-of-bounds: " CSETSTATE_FORMAT, dest.value());
68 assert(_alloc_buffers[dest.value()] != NULL,
69 "Allocation buffer is NULL: " CSETSTATE_FORMAT, dest.value());
70 return _alloc_buffers[dest.value()];
71 }
|