80 }
81 }
82
83 inline HeapWord* G1PLABAllocator::allocate(InCSetState dest,
84 size_t word_sz,
85 bool* refill_failed) {
86 HeapWord* const obj = plab_allocate(dest, word_sz);
87 if (obj != NULL) {
88 return obj;
89 }
90 return allocate_direct_or_new_plab(dest, word_sz, refill_failed);
91 }
92
93 // Create the maps which is used to identify archive objects.
94 inline void G1ArchiveAllocator::enable_archive_object_check() {
95 if (_archive_check_enabled) {
96 return;
97 }
98
99 _archive_check_enabled = true;
100 size_t length = Universe::heap()->max_capacity();
101 _closed_archive_region_map.initialize((HeapWord*)Universe::heap()->base(),
102 (HeapWord*)Universe::heap()->base() + length,
103 HeapRegion::GrainBytes);
104 _open_archive_region_map.initialize((HeapWord*)Universe::heap()->base(),
105 (HeapWord*)Universe::heap()->base() + length,
106 HeapRegion::GrainBytes);
107 }
108
109 // Set the regions containing the specified address range as archive.
110 inline void G1ArchiveAllocator::set_range_archive(MemRegion range, bool open) {
111 assert(_archive_check_enabled, "archive range check not enabled");
112 if (open) {
113 _open_archive_region_map.set_by_address(range, true);
114 } else {
115 _closed_archive_region_map.set_by_address(range, true);
116 }
117 }
118
119 // Check if an object is in a closed archive region using the _archive_region_map.
120 inline bool G1ArchiveAllocator::in_closed_archive_range(oop object) {
|
80 }
81 }
82
83 inline HeapWord* G1PLABAllocator::allocate(InCSetState dest,
84 size_t word_sz,
85 bool* refill_failed) {
86 HeapWord* const obj = plab_allocate(dest, word_sz);
87 if (obj != NULL) {
88 return obj;
89 }
90 return allocate_direct_or_new_plab(dest, word_sz, refill_failed);
91 }
92
93 // Create the maps which is used to identify archive objects.
94 inline void G1ArchiveAllocator::enable_archive_object_check() {
95 if (_archive_check_enabled) {
96 return;
97 }
98
99 _archive_check_enabled = true;
100 size_t length = G1CollectedHeap::heap()->max_reserved_capacity();
101 _closed_archive_region_map.initialize((HeapWord*)Universe::heap()->base(),
102 (HeapWord*)Universe::heap()->base() + length,
103 HeapRegion::GrainBytes);
104 _open_archive_region_map.initialize((HeapWord*)Universe::heap()->base(),
105 (HeapWord*)Universe::heap()->base() + length,
106 HeapRegion::GrainBytes);
107 }
108
109 // Set the regions containing the specified address range as archive.
110 inline void G1ArchiveAllocator::set_range_archive(MemRegion range, bool open) {
111 assert(_archive_check_enabled, "archive range check not enabled");
112 if (open) {
113 _open_archive_region_map.set_by_address(range, true);
114 } else {
115 _closed_archive_region_map.set_by_address(range, true);
116 }
117 }
118
119 // Check if an object is in a closed archive region using the _archive_region_map.
120 inline bool G1ArchiveAllocator::in_closed_archive_range(oop object) {
|