185 assert(Thread::current()->is_VM_thread(), "Precondition#1"); 186 assert(Heap_lock->is_locked(), "Precondition#2"); 187 GCCauseSetter gcs(this, cause); 188 switch (cause) { 189 case GCCause::_heap_inspection: 190 case GCCause::_heap_dump: 191 case GCCause::_metadata_GC_threshold : { 192 HandleMark hm; 193 do_full_collection(false); // don't clear all soft refs 194 break; 195 } 196 case GCCause::_last_ditch_collection: { 197 HandleMark hm; 198 do_full_collection(true); // do clear all soft refs 199 break; 200 } 201 default: 202 ShouldNotReachHere(); // Unexpected use of this function 203 } 204 } 205 MetaWord* CollectedHeap::satisfy_failed_metadata_allocation( 206 ClassLoaderData* loader_data, 207 size_t size, Metaspace::MetadataType mdtype) { 208 return collector_policy()->satisfy_failed_metadata_allocation(loader_data, size, mdtype); 209 } 210 211 212 void CollectedHeap::pre_initialize() { 213 // Used for ReduceInitialCardMarks (when COMPILER2 is used); 214 // otherwise remains unused. 215 #ifdef COMPILER2 216 _defer_initial_card_mark = ReduceInitialCardMarks && can_elide_tlab_store_barriers() 217 && (DeferInitialCardMark || card_mark_must_follow_store()); 218 #else 219 assert(_defer_initial_card_mark == false, "Who would set it?"); 220 #endif 221 } 222 223 #ifndef PRODUCT 224 void CollectedHeap::check_for_bad_heap_word_value(HeapWord* addr, size_t size) { 225 if (CheckMemoryInitialization && ZapUnusedHeapArea) { 226 for (size_t slot = 0; slot < size; slot += 1) { 227 assert((*(intptr_t*) (addr + slot)) != ((intptr_t) badHeapWordVal), 228 "Found badHeapWordValue in post-allocation check"); 229 } 230 } | 185 assert(Thread::current()->is_VM_thread(), "Precondition#1"); 186 assert(Heap_lock->is_locked(), "Precondition#2"); 187 GCCauseSetter gcs(this, cause); 188 switch (cause) { 189 case GCCause::_heap_inspection: 190 case GCCause::_heap_dump: 191 case GCCause::_metadata_GC_threshold : { 192 HandleMark hm; 193 do_full_collection(false); // don't clear all soft refs 194 break; 195 } 196 case GCCause::_last_ditch_collection: { 197 HandleMark hm; 198 do_full_collection(true); // do clear all soft refs 199 break; 200 } 201 default: 202 ShouldNotReachHere(); // Unexpected use of this function 203 } 204 } 205 206 void CollectedHeap::pre_initialize() { 207 // Used for ReduceInitialCardMarks (when COMPILER2 is used); 208 // otherwise remains unused. 209 #ifdef COMPILER2 210 _defer_initial_card_mark = ReduceInitialCardMarks && can_elide_tlab_store_barriers() 211 && (DeferInitialCardMark || card_mark_must_follow_store()); 212 #else 213 assert(_defer_initial_card_mark == false, "Who would set it?"); 214 #endif 215 } 216 217 #ifndef PRODUCT 218 void CollectedHeap::check_for_bad_heap_word_value(HeapWord* addr, size_t size) { 219 if (CheckMemoryInitialization && ZapUnusedHeapArea) { 220 for (size_t slot = 0; slot < size; slot += 1) { 221 assert((*(intptr_t*) (addr + slot)) != ((intptr_t) badHeapWordVal), 222 "Found badHeapWordValue in post-allocation check"); 223 } 224 } |