< prev index next >

src/hotspot/share/memory/universe.cpp

Print this page
rev 49275 : [mq]: JDK-8199781.patch


 584   k->itable().initialize_itable(false, CHECK);
 585 }
 586 
 587 
 588 void Universe::reinitialize_itables(TRAPS) {
 589   ClassLoaderDataGraph::dictionary_classes_do(initialize_itable_for_klass, CHECK);
 590 }
 591 
 592 
 593 bool Universe::on_page_boundary(void* addr) {
 594   return is_aligned(addr, os::vm_page_size());
 595 }
 596 
 597 
 598 bool Universe::should_fill_in_stack_trace(Handle throwable) {
 599   // never attempt to fill in the stack trace of preallocated errors that do not have
 600   // backtrace. These errors are kept alive forever and may be "re-used" when all
 601   // preallocated errors with backtrace have been consumed. Also need to avoid
 602   // a potential loop which could happen if an out of memory occurs when attempting
 603   // to allocate the backtrace.
 604   return ((throwable() != Universe::_out_of_memory_error_java_heap) &&
 605           (throwable() != Universe::_out_of_memory_error_metaspace)  &&
 606           (throwable() != Universe::_out_of_memory_error_class_metaspace)  &&
 607           (throwable() != Universe::_out_of_memory_error_array_size) &&
 608           (throwable() != Universe::_out_of_memory_error_gc_overhead_limit) &&
 609           (throwable() != Universe::_out_of_memory_error_realloc_objects));
 610 }
 611 
 612 
 613 oop Universe::gen_out_of_memory_error(oop default_err) {
 614   // generate an out of memory error:
 615   // - if there is a preallocated error and stack traces are available
 616   //   (j.l.Throwable is initialized), then return the preallocated
 617   //   error with a filled in stack trace, and with the message
 618   //   provided by the default error.
 619   // - otherwise, return the default error, without a stack trace.
 620   int next;
 621   if ((_preallocated_out_of_memory_error_avail_count > 0) &&
 622       SystemDictionary::Throwable_klass()->is_initialized()) {
 623     next = (int)Atomic::add(-1, &_preallocated_out_of_memory_error_avail_count);
 624     assert(next < (int)PreallocatedOutOfMemoryErrorCount, "avail count is corrupt");
 625   } else {
 626     next = -1;
 627   }
 628   if (next < 0) {
 629     // all preallocated errors have been used.




 584   k->itable().initialize_itable(false, CHECK);
 585 }
 586 
 587 
 588 void Universe::reinitialize_itables(TRAPS) {
 589   ClassLoaderDataGraph::dictionary_classes_do(initialize_itable_for_klass, CHECK);
 590 }
 591 
 592 
 593 bool Universe::on_page_boundary(void* addr) {
 594   return is_aligned(addr, os::vm_page_size());
 595 }
 596 
 597 
 598 bool Universe::should_fill_in_stack_trace(Handle throwable) {
 599   // never attempt to fill in the stack trace of preallocated errors that do not have
 600   // backtrace. These errors are kept alive forever and may be "re-used" when all
 601   // preallocated errors with backtrace have been consumed. Also need to avoid
 602   // a potential loop which could happen if an out of memory occurs when attempting
 603   // to allocate the backtrace.
 604   return ((!oopDesc::equals(throwable(), Universe::_out_of_memory_error_java_heap)) &&
 605           (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_metaspace))  &&
 606           (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_class_metaspace))  &&
 607           (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_array_size)) &&
 608           (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_gc_overhead_limit)) &&
 609           (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_realloc_objects)));
 610 }
 611 
 612 
 613 oop Universe::gen_out_of_memory_error(oop default_err) {
 614   // generate an out of memory error:
 615   // - if there is a preallocated error and stack traces are available
 616   //   (j.l.Throwable is initialized), then return the preallocated
 617   //   error with a filled in stack trace, and with the message
 618   //   provided by the default error.
 619   // - otherwise, return the default error, without a stack trace.
 620   int next;
 621   if ((_preallocated_out_of_memory_error_avail_count > 0) &&
 622       SystemDictionary::Throwable_klass()->is_initialized()) {
 623     next = (int)Atomic::add(-1, &_preallocated_out_of_memory_error_avail_count);
 624     assert(next < (int)PreallocatedOutOfMemoryErrorCount, "avail count is corrupt");
 625   } else {
 626     next = -1;
 627   }
 628   if (next < 0) {
 629     // all preallocated errors have been used.


< prev index next >