< prev index next >

src/hotspot/share/gc/shared/collectedHeap.cpp

Print this page
rev 58079 : 8238633: JVMTI heap walk should consult GC for marking oops
   1 /*
   2  * Copyright (c) 2001, 2019, 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  *


 314     if (op.gc_locked()) {
 315       continue;
 316     }
 317 
 318     if (op.prologue_succeeded()) {
 319       return op.result();
 320     }
 321     loop_count++;
 322     if ((QueuedAllocationWarningCount > 0) &&
 323         (loop_count % QueuedAllocationWarningCount == 0)) {
 324       log_warning(gc, ergo)("satisfy_failed_metadata_allocation() retries %d times,"
 325                             " size=" SIZE_FORMAT, loop_count, word_size);
 326     }
 327   } while (true);  // Until a GC is done
 328 }
 329 
 330 MemoryUsage CollectedHeap::memory_usage() {
 331   return MemoryUsage(InitialHeapSize, used(), capacity(), max_capacity());
 332 }
 333 



 334 
 335 #ifndef PRODUCT
 336 void CollectedHeap::check_for_non_bad_heap_word_value(HeapWord* addr, size_t size) {
 337   if (CheckMemoryInitialization && ZapUnusedHeapArea) {
 338     // please note mismatch between size (in 32/64 bit words), and ju_addr that always point to a 32 bit word
 339     for (juint* ju_addr = reinterpret_cast<juint*>(addr); ju_addr < reinterpret_cast<juint*>(addr + size); ++ju_addr) {
 340       assert(*ju_addr == badHeapWordVal, "Found non badHeapWordValue in pre-allocation check");
 341     }
 342   }
 343 }
 344 #endif // PRODUCT
 345 
 346 size_t CollectedHeap::max_tlab_size() const {
 347   // TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE].
 348   // This restriction could be removed by enabling filling with multiple arrays.
 349   // If we compute that the reasonable way as
 350   //    header_size + ((sizeof(jint) * max_jint) / HeapWordSize)
 351   // we'll overflow on the multiply, so we do the divide first.
 352   // We actually lose a little by dividing first,
 353   // but that just makes the TLAB  somewhat smaller than the biggest array,


   1 /*
   2  * Copyright (c) 2001, 2020, 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  *


 314     if (op.gc_locked()) {
 315       continue;
 316     }
 317 
 318     if (op.prologue_succeeded()) {
 319       return op.result();
 320     }
 321     loop_count++;
 322     if ((QueuedAllocationWarningCount > 0) &&
 323         (loop_count % QueuedAllocationWarningCount == 0)) {
 324       log_warning(gc, ergo)("satisfy_failed_metadata_allocation() retries %d times,"
 325                             " size=" SIZE_FORMAT, loop_count, word_size);
 326     }
 327   } while (true);  // Until a GC is done
 328 }
 329 
 330 MemoryUsage CollectedHeap::memory_usage() {
 331   return MemoryUsage(InitialHeapSize, used(), capacity(), max_capacity());
 332 }
 333 
 334 ObjectMarker* CollectedHeap::object_marker() {
 335   return new DefaultObjectMarker();
 336 }
 337 
 338 #ifndef PRODUCT
 339 void CollectedHeap::check_for_non_bad_heap_word_value(HeapWord* addr, size_t size) {
 340   if (CheckMemoryInitialization && ZapUnusedHeapArea) {
 341     // please note mismatch between size (in 32/64 bit words), and ju_addr that always point to a 32 bit word
 342     for (juint* ju_addr = reinterpret_cast<juint*>(addr); ju_addr < reinterpret_cast<juint*>(addr + size); ++ju_addr) {
 343       assert(*ju_addr == badHeapWordVal, "Found non badHeapWordValue in pre-allocation check");
 344     }
 345   }
 346 }
 347 #endif // PRODUCT
 348 
 349 size_t CollectedHeap::max_tlab_size() const {
 350   // TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE].
 351   // This restriction could be removed by enabling filling with multiple arrays.
 352   // If we compute that the reasonable way as
 353   //    header_size + ((sizeof(jint) * max_jint) / HeapWordSize)
 354   // we'll overflow on the multiply, so we do the divide first.
 355   // We actually lose a little by dividing first,
 356   // but that just makes the TLAB  somewhat smaller than the biggest array,


< prev index next >