1 /* 2 * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "classfile/classLoaderData.hpp" 27 #include "classfile/vmClasses.hpp" 28 #include "gc/shared/allocTracer.hpp" 29 #include "gc/shared/barrierSet.hpp" 30 #include "gc/shared/collectedHeap.hpp" 31 #include "gc/shared/collectedHeap.inline.hpp" 32 #include "gc/shared/gcLocker.inline.hpp" 33 #include "gc/shared/gcHeapSummary.hpp" 34 #include "gc/shared/stringdedup/stringDedup.hpp" 35 #include "gc/shared/gcTrace.hpp" 36 #include "gc/shared/gcTraceTime.inline.hpp" 37 #include "gc/shared/gcVMOperations.hpp" 38 #include "gc/shared/gcWhen.hpp" 39 #include "gc/shared/gc_globals.hpp" 40 #include "gc/shared/memAllocator.hpp" 41 #include "gc/shared/tlab_globals.hpp" 42 #include "logging/log.hpp" 43 #include "logging/logStream.hpp" 44 #include "memory/classLoaderMetaspace.hpp" 45 #include "memory/metaspaceUtils.hpp" 46 #include "memory/resourceArea.hpp" 47 #include "memory/universe.hpp" 48 #include "oops/instanceMirrorKlass.hpp" 49 #include "oops/oop.inline.hpp" 50 #include "runtime/handles.inline.hpp" 51 #include "runtime/init.hpp" 52 #include "runtime/javaThread.hpp" 53 #include "runtime/perfData.hpp" 54 #include "runtime/threadSMR.hpp" 55 #include "runtime/vmThread.hpp" 56 #include "services/heapDumper.hpp" 57 #include "utilities/align.hpp" 58 #include "utilities/copy.hpp" 59 #include "utilities/events.hpp" 60 61 class ClassLoaderData; 62 63 size_t CollectedHeap::_lab_alignment_reserve = ~(size_t)0; 64 Klass* CollectedHeap::_filler_object_klass = NULL; 65 size_t CollectedHeap::_filler_array_max_size = 0; 66 size_t CollectedHeap::_stack_chunk_max_size = 0; 67 68 class GCMessage : public FormatBuffer<1024> { 69 public: 70 bool is_before; 71 }; 72 73 template <> 74 void EventLogBase<GCMessage>::print(outputStream* st, GCMessage& m) { 75 st->print_cr("GC heap %s", m.is_before ? "before" : "after"); 76 st->print_raw(m); 77 } 78 79 class GCHeapLog : public EventLogBase<GCMessage> { 80 private: 81 void log_heap(CollectedHeap* heap, bool before); 82 83 public: 84 GCHeapLog() : EventLogBase<GCMessage>("GC Heap History", "gc") {} 85 86 void log_heap_before(CollectedHeap* heap) { 87 log_heap(heap, true); 88 } 89 void log_heap_after(CollectedHeap* heap) { 90 log_heap(heap, false); 91 } 92 }; 93 94 void GCHeapLog::log_heap(CollectedHeap* heap, bool before) { 95 if (!should_log()) { 96 return; 97 } 98 99 double timestamp = fetch_timestamp(); 100 MutexLocker ml(&_mutex, Mutex::_no_safepoint_check_flag); 101 int index = compute_log_index(); 102 _records[index].thread = NULL; // Its the GC thread so it's not that interesting. 103 _records[index].timestamp = timestamp; 104 _records[index].data.is_before = before; 105 stringStream st(_records[index].data.buffer(), _records[index].data.size()); 106 107 st.print_cr("{Heap %s GC invocations=%u (full %u):", 108 before ? "before" : "after", 109 heap->total_collections(), 110 heap->total_full_collections()); 111 112 heap->print_on(&st); 113 st.print_cr("}"); 114 } 115 116 ParallelObjectIterator::ParallelObjectIterator(uint thread_num) : 117 _impl(Universe::heap()->parallel_object_iterator(thread_num)) 118 {} 119 120 ParallelObjectIterator::~ParallelObjectIterator() { 121 delete _impl; 122 } 123 124 void ParallelObjectIterator::object_iterate(ObjectClosure* cl, uint worker_id) { 125 _impl->object_iterate(cl, worker_id); 126 } 127 128 size_t CollectedHeap::unused() const { 129 MutexLocker ml(Heap_lock); 130 return capacity() - used(); 131 } 132 133 VirtualSpaceSummary CollectedHeap::create_heap_space_summary() { 134 size_t capacity_in_words = capacity() / HeapWordSize; 135 136 return VirtualSpaceSummary( 137 _reserved.start(), _reserved.start() + capacity_in_words, _reserved.end()); 138 } 139 140 GCHeapSummary CollectedHeap::create_heap_summary() { 141 VirtualSpaceSummary heap_space = create_heap_space_summary(); 142 return GCHeapSummary(heap_space, used()); 143 } 144 145 MetaspaceSummary CollectedHeap::create_metaspace_summary() { 146 const MetaspaceChunkFreeListSummary& ms_chunk_free_list_summary = 147 MetaspaceUtils::chunk_free_list_summary(Metaspace::NonClassType); 148 const MetaspaceChunkFreeListSummary& class_chunk_free_list_summary = 149 MetaspaceUtils::chunk_free_list_summary(Metaspace::ClassType); 150 return MetaspaceSummary(MetaspaceGC::capacity_until_GC(), 151 MetaspaceUtils::get_combined_statistics(), 152 ms_chunk_free_list_summary, class_chunk_free_list_summary); 153 } 154 155 void CollectedHeap::print_heap_before_gc() { 156 LogTarget(Debug, gc, heap) lt; 157 if (lt.is_enabled()) { 158 LogStream ls(lt); 159 ls.print_cr("Heap before GC invocations=%u (full %u):", total_collections(), total_full_collections()); 160 ResourceMark rm; 161 print_on(&ls); 162 } 163 164 if (_gc_heap_log != NULL) { 165 _gc_heap_log->log_heap_before(this); 166 } 167 } 168 169 void CollectedHeap::print_heap_after_gc() { 170 LogTarget(Debug, gc, heap) lt; 171 if (lt.is_enabled()) { 172 LogStream ls(lt); 173 ls.print_cr("Heap after GC invocations=%u (full %u):", total_collections(), total_full_collections()); 174 ResourceMark rm; 175 print_on(&ls); 176 } 177 178 if (_gc_heap_log != NULL) { 179 _gc_heap_log->log_heap_after(this); 180 } 181 } 182 183 void CollectedHeap::print() const { print_on(tty); } 184 185 void CollectedHeap::print_on_error(outputStream* st) const { 186 st->print_cr("Heap:"); 187 print_extended_on(st); 188 st->cr(); 189 190 BarrierSet* bs = BarrierSet::barrier_set(); 191 if (bs != NULL) { 192 bs->print_on(st); 193 } 194 } 195 196 void CollectedHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) { 197 const GCHeapSummary& heap_summary = create_heap_summary(); 198 gc_tracer->report_gc_heap_summary(when, heap_summary); 199 200 const MetaspaceSummary& metaspace_summary = create_metaspace_summary(); 201 gc_tracer->report_metaspace_summary(when, metaspace_summary); 202 } 203 204 void CollectedHeap::trace_heap_before_gc(const GCTracer* gc_tracer) { 205 trace_heap(GCWhen::BeforeGC, gc_tracer); 206 } 207 208 void CollectedHeap::trace_heap_after_gc(const GCTracer* gc_tracer) { 209 trace_heap(GCWhen::AfterGC, gc_tracer); 210 } 211 212 // Default implementation, for collectors that don't support the feature. 213 bool CollectedHeap::supports_concurrent_gc_breakpoints() const { 214 return false; 215 } 216 217 bool CollectedHeap::is_oop(oop object) const { 218 if (!is_object_aligned(object)) { 219 return false; 220 } 221 222 if (!is_in(object)) { 223 return false; 224 } 225 226 if (is_in(object->klass_or_null())) { 227 return false; 228 } 229 230 return true; 231 } 232 233 // Memory state functions. 234 235 236 CollectedHeap::CollectedHeap() : 237 _capacity_at_last_gc(0), 238 _used_at_last_gc(0), 239 _is_gc_active(false), 240 _last_whole_heap_examined_time_ns(os::javaTimeNanos()), 241 _total_collections(0), 242 _total_full_collections(0), 243 _gc_cause(GCCause::_no_gc), 244 _gc_lastcause(GCCause::_no_gc) 245 { 246 // If the minimum object size is greater than MinObjAlignment, we can 247 // end up with a shard at the end of the buffer that's smaller than 248 // the smallest object. We can't allow that because the buffer must 249 // look like it's full of objects when we retire it, so we make 250 // sure we have enough space for a filler int array object. 251 size_t min_size = min_dummy_object_size(); 252 _lab_alignment_reserve = min_size > (size_t)MinObjAlignment ? align_object_size(min_size) : 0; 253 254 const size_t max_len = size_t(arrayOopDesc::max_array_length(T_INT)); 255 const size_t elements_per_word = HeapWordSize / sizeof(jint); 256 _filler_array_max_size = align_object_size(filler_array_hdr_size() + 257 max_len / elements_per_word); 258 259 NOT_PRODUCT(_promotion_failure_alot_count = 0;) 260 NOT_PRODUCT(_promotion_failure_alot_gc_number = 0;) 261 262 if (UsePerfData) { 263 EXCEPTION_MARK; 264 265 // create the gc cause jvmstat counters 266 _perf_gc_cause = PerfDataManager::create_string_variable(SUN_GC, "cause", 267 80, GCCause::to_string(_gc_cause), CHECK); 268 269 _perf_gc_lastcause = 270 PerfDataManager::create_string_variable(SUN_GC, "lastCause", 271 80, GCCause::to_string(_gc_lastcause), CHECK); 272 } 273 274 // Create the ring log 275 if (LogEvents) { 276 _gc_heap_log = new GCHeapLog(); 277 } else { 278 _gc_heap_log = NULL; 279 } 280 } 281 282 // This interface assumes that it's being called by the 283 // vm thread. It collects the heap assuming that the 284 // heap lock is already held and that we are executing in 285 // the context of the vm thread. 286 void CollectedHeap::collect_as_vm_thread(GCCause::Cause cause) { 287 Thread* thread = Thread::current(); 288 assert(thread->is_VM_thread(), "Precondition#1"); 289 assert(Heap_lock->is_locked(), "Precondition#2"); 290 GCCauseSetter gcs(this, cause); 291 switch (cause) { 292 case GCCause::_codecache_GC_threshold: 293 case GCCause::_codecache_GC_aggressive: 294 case GCCause::_heap_inspection: 295 case GCCause::_heap_dump: 296 case GCCause::_metadata_GC_threshold: { 297 HandleMark hm(thread); 298 do_full_collection(false); // don't clear all soft refs 299 break; 300 } 301 case GCCause::_archive_time_gc: 302 case GCCause::_metadata_GC_clear_soft_refs: { 303 HandleMark hm(thread); 304 do_full_collection(true); // do clear all soft refs 305 break; 306 } 307 default: 308 ShouldNotReachHere(); // Unexpected use of this function 309 } 310 } 311 312 MetaWord* CollectedHeap::satisfy_failed_metadata_allocation(ClassLoaderData* loader_data, 313 size_t word_size, 314 Metaspace::MetadataType mdtype) { 315 uint loop_count = 0; 316 uint gc_count = 0; 317 uint full_gc_count = 0; 318 319 assert(!Heap_lock->owned_by_self(), "Should not be holding the Heap_lock"); 320 321 do { 322 MetaWord* result = loader_data->metaspace_non_null()->allocate(word_size, mdtype); 323 if (result != NULL) { 324 return result; 325 } 326 327 if (GCLocker::is_active_and_needs_gc()) { 328 // If the GCLocker is active, just expand and allocate. 329 // If that does not succeed, wait if this thread is not 330 // in a critical section itself. 331 result = loader_data->metaspace_non_null()->expand_and_allocate(word_size, mdtype); 332 if (result != NULL) { 333 return result; 334 } 335 JavaThread* jthr = JavaThread::current(); 336 if (!jthr->in_critical()) { 337 // Wait for JNI critical section to be exited 338 GCLocker::stall_until_clear(); 339 // The GC invoked by the last thread leaving the critical 340 // section will be a young collection and a full collection 341 // is (currently) needed for unloading classes so continue 342 // to the next iteration to get a full GC. 343 continue; 344 } else { 345 if (CheckJNICalls) { 346 fatal("Possible deadlock due to allocating while" 347 " in jni critical section"); 348 } 349 return NULL; 350 } 351 } 352 353 { // Need lock to get self consistent gc_count's 354 MutexLocker ml(Heap_lock); 355 gc_count = Universe::heap()->total_collections(); 356 full_gc_count = Universe::heap()->total_full_collections(); 357 } 358 359 // Generate a VM operation 360 VM_CollectForMetadataAllocation op(loader_data, 361 word_size, 362 mdtype, 363 gc_count, 364 full_gc_count, 365 GCCause::_metadata_GC_threshold); 366 VMThread::execute(&op); 367 368 // If GC was locked out, try again. Check before checking success because the 369 // prologue could have succeeded and the GC still have been locked out. 370 if (op.gc_locked()) { 371 continue; 372 } 373 374 if (op.prologue_succeeded()) { 375 return op.result(); 376 } 377 loop_count++; 378 if ((QueuedAllocationWarningCount > 0) && 379 (loop_count % QueuedAllocationWarningCount == 0)) { 380 log_warning(gc, ergo)("satisfy_failed_metadata_allocation() retries %d times," 381 " size=" SIZE_FORMAT, loop_count, word_size); 382 } 383 } while (true); // Until a GC is done 384 } 385 386 MemoryUsage CollectedHeap::memory_usage() { 387 return MemoryUsage(InitialHeapSize, used(), capacity(), max_capacity()); 388 } 389 390 void CollectedHeap::set_gc_cause(GCCause::Cause v) { 391 if (UsePerfData) { 392 _gc_lastcause = _gc_cause; 393 _perf_gc_lastcause->set_value(GCCause::to_string(_gc_lastcause)); 394 _perf_gc_cause->set_value(GCCause::to_string(v)); 395 } 396 _gc_cause = v; 397 } 398 399 #ifndef PRODUCT 400 void CollectedHeap::check_for_non_bad_heap_word_value(HeapWord* addr, size_t size) { 401 if (CheckMemoryInitialization && ZapUnusedHeapArea) { 402 // please note mismatch between size (in 32/64 bit words), and ju_addr that always point to a 32 bit word 403 for (juint* ju_addr = reinterpret_cast<juint*>(addr); ju_addr < reinterpret_cast<juint*>(addr + size); ++ju_addr) { 404 assert(*ju_addr == badHeapWordVal, "Found non badHeapWordValue in pre-allocation check"); 405 } 406 } 407 } 408 #endif // PRODUCT 409 410 size_t CollectedHeap::max_tlab_size() const { 411 // TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE]. 412 // This restriction could be removed by enabling filling with multiple arrays. 413 // If we compute that the reasonable way as 414 // header_size + ((sizeof(jint) * max_jint) / HeapWordSize) 415 // we'll overflow on the multiply, so we do the divide first. 416 // We actually lose a little by dividing first, 417 // but that just makes the TLAB somewhat smaller than the biggest array, 418 // which is fine, since we'll be able to fill that. 419 size_t max_int_size = typeArrayOopDesc::header_size(T_INT) + 420 sizeof(jint) * 421 ((juint) max_jint / (size_t) HeapWordSize); 422 return align_down(max_int_size, MinObjAlignment); 423 } 424 425 size_t CollectedHeap::filler_array_hdr_size() { 426 return align_object_offset(arrayOopDesc::header_size(T_INT)); // align to Long 427 } 428 429 size_t CollectedHeap::filler_array_min_size() { 430 return align_object_size(filler_array_hdr_size()); // align to MinObjAlignment 431 } 432 433 void CollectedHeap::zap_filler_array_with(HeapWord* start, size_t words, juint value) { 434 Copy::fill_to_words(start + filler_array_hdr_size(), 435 words - filler_array_hdr_size(), value); 436 } 437 438 #ifdef ASSERT 439 void CollectedHeap::fill_args_check(HeapWord* start, size_t words) 440 { 441 assert(words >= min_fill_size(), "too small to fill"); 442 assert(is_object_aligned(words), "unaligned size"); 443 } 444 445 void CollectedHeap::zap_filler_array(HeapWord* start, size_t words, bool zap) 446 { 447 if (ZapFillerObjects && zap) { 448 zap_filler_array_with(start, words, 0XDEAFBABE); 449 } 450 } 451 #endif // ASSERT 452 453 void 454 CollectedHeap::fill_with_array(HeapWord* start, size_t words, bool zap) 455 { 456 assert(words >= filler_array_min_size(), "too small for an array"); 457 assert(words <= filler_array_max_size(), "too big for a single object"); 458 459 const size_t payload_size = words - filler_array_hdr_size(); 460 const size_t len = payload_size * HeapWordSize / sizeof(jint); 461 assert((int)len >= 0, "size too large " SIZE_FORMAT " becomes %d", words, (int)len); 462 463 ObjArrayAllocator allocator(Universe::fillerArrayKlassObj(), words, (int)len, /* do_zero */ false); 464 allocator.initialize(start); 465 if (DumpSharedSpaces) { 466 // This array is written into the CDS archive. Make sure it 467 // has deterministic contents. 468 zap_filler_array_with(start, words, 0); 469 } else { 470 DEBUG_ONLY(zap_filler_array(start, words, zap);) 471 } 472 } 473 474 void 475 CollectedHeap::fill_with_object_impl(HeapWord* start, size_t words, bool zap) 476 { 477 assert(words <= filler_array_max_size(), "too big for a single object"); 478 479 if (words >= filler_array_min_size()) { 480 fill_with_array(start, words, zap); 481 } else if (words > 0) { 482 assert(words == min_fill_size(), "unaligned size"); 483 ObjAllocator allocator(CollectedHeap::filler_object_klass(), words); 484 allocator.initialize(start); 485 } 486 } 487 488 void CollectedHeap::fill_with_object(HeapWord* start, size_t words, bool zap) 489 { 490 DEBUG_ONLY(fill_args_check(start, words);) 491 HandleMark hm(Thread::current()); // Free handles before leaving. 492 fill_with_object_impl(start, words, zap); 493 } 494 495 void CollectedHeap::fill_with_objects(HeapWord* start, size_t words, bool zap) 496 { 497 DEBUG_ONLY(fill_args_check(start, words);) 498 HandleMark hm(Thread::current()); // Free handles before leaving. 499 500 // Multiple objects may be required depending on the filler array maximum size. Fill 501 // the range up to that with objects that are filler_array_max_size sized. The 502 // remainder is filled with a single object. 503 const size_t min = min_fill_size(); 504 const size_t max = filler_array_max_size(); 505 while (words > max) { 506 const size_t cur = (words - max) >= min ? max : max - min; 507 fill_with_array(start, cur, zap); 508 start += cur; 509 words -= cur; 510 } 511 512 fill_with_object_impl(start, words, zap); 513 } 514 515 void CollectedHeap::fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap) { 516 CollectedHeap::fill_with_object(start, end, zap); 517 } 518 519 HeapWord* CollectedHeap::allocate_new_tlab(size_t min_size, 520 size_t requested_size, 521 size_t* actual_size) { 522 guarantee(false, "thread-local allocation buffers not supported"); 523 return NULL; 524 } 525 526 void CollectedHeap::ensure_parsability(bool retire_tlabs) { 527 assert(SafepointSynchronize::is_at_safepoint() || !is_init_completed(), 528 "Should only be called at a safepoint or at start-up"); 529 530 ThreadLocalAllocStats stats; 531 532 for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next();) { 533 BarrierSet::barrier_set()->make_parsable(thread); 534 if (UseTLAB) { 535 if (retire_tlabs) { 536 thread->tlab().retire(&stats); 537 } else { 538 thread->tlab().make_parsable(); 539 } 540 } 541 } 542 543 stats.publish(); 544 } 545 546 void CollectedHeap::resize_all_tlabs() { 547 assert(SafepointSynchronize::is_at_safepoint() || !is_init_completed(), 548 "Should only resize tlabs at safepoint"); 549 550 if (UseTLAB && ResizeTLAB) { 551 for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) { 552 thread->tlab().resize(); 553 } 554 } 555 } 556 557 jlong CollectedHeap::millis_since_last_whole_heap_examined() { 558 return (os::javaTimeNanos() - _last_whole_heap_examined_time_ns) / NANOSECS_PER_MILLISEC; 559 } 560 561 void CollectedHeap::record_whole_heap_examined_timestamp() { 562 _last_whole_heap_examined_time_ns = os::javaTimeNanos(); 563 } 564 565 void CollectedHeap::full_gc_dump(GCTimer* timer, bool before) { 566 assert(timer != NULL, "timer is null"); 567 if ((HeapDumpBeforeFullGC && before) || (HeapDumpAfterFullGC && !before)) { 568 GCTraceTime(Info, gc) tm(before ? "Heap Dump (before full gc)" : "Heap Dump (after full gc)", timer); 569 HeapDumper::dump_heap(); 570 } 571 572 LogTarget(Trace, gc, classhisto) lt; 573 if (lt.is_enabled()) { 574 GCTraceTime(Trace, gc, classhisto) tm(before ? "Class Histogram (before full gc)" : "Class Histogram (after full gc)", timer); 575 ResourceMark rm; 576 LogStream ls(lt); 577 VM_GC_HeapInspection inspector(&ls, false /* ! full gc */); 578 inspector.doit(); 579 } 580 } 581 582 void CollectedHeap::pre_full_gc_dump(GCTimer* timer) { 583 full_gc_dump(timer, true); 584 } 585 586 void CollectedHeap::post_full_gc_dump(GCTimer* timer) { 587 full_gc_dump(timer, false); 588 } 589 590 void CollectedHeap::initialize_reserved_region(const ReservedHeapSpace& rs) { 591 // It is important to do this in a way such that concurrent readers can't 592 // temporarily think something is in the heap. (Seen this happen in asserts.) 593 _reserved.set_word_size(0); 594 _reserved.set_start((HeapWord*)rs.base()); 595 _reserved.set_end((HeapWord*)rs.end()); 596 } 597 598 void CollectedHeap::post_initialize() { 599 StringDedup::initialize(); 600 initialize_serviceability(); 601 } 602 603 #ifndef PRODUCT 604 605 bool CollectedHeap::promotion_should_fail(volatile size_t* count) { 606 // Access to count is not atomic; the value does not have to be exact. 607 if (PromotionFailureALot) { 608 const size_t gc_num = total_collections(); 609 const size_t elapsed_gcs = gc_num - _promotion_failure_alot_gc_number; 610 if (elapsed_gcs >= PromotionFailureALotInterval) { 611 // Test for unsigned arithmetic wrap-around. 612 if (++*count >= PromotionFailureALotCount) { 613 *count = 0; 614 return true; 615 } 616 } 617 } 618 return false; 619 } 620 621 bool CollectedHeap::promotion_should_fail() { 622 return promotion_should_fail(&_promotion_failure_alot_count); 623 } 624 625 void CollectedHeap::reset_promotion_should_fail(volatile size_t* count) { 626 if (PromotionFailureALot) { 627 _promotion_failure_alot_gc_number = total_collections(); 628 *count = 0; 629 } 630 } 631 632 void CollectedHeap::reset_promotion_should_fail() { 633 reset_promotion_should_fail(&_promotion_failure_alot_count); 634 } 635 636 #endif // #ifndef PRODUCT 637 638 bool CollectedHeap::supports_object_pinning() const { 639 return false; 640 } 641 642 oop CollectedHeap::pin_object(JavaThread* thread, oop obj) { 643 ShouldNotReachHere(); 644 return NULL; 645 } 646 647 void CollectedHeap::unpin_object(JavaThread* thread, oop obj) { 648 ShouldNotReachHere(); 649 } 650 651 bool CollectedHeap::is_archived_object(oop object) const { 652 return false; 653 } 654 655 // It's the caller's responsibility to ensure glitch-freedom 656 // (if required). 657 void CollectedHeap::update_capacity_and_used_at_gc() { 658 _capacity_at_last_gc = capacity(); 659 _used_at_last_gc = used(); 660 }