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