961
962 msg = java_lang_String::create_from_str("Metaspace", CHECK_false);
963 java_lang_Throwable::set_message(Universe::_out_of_memory_error_metaspace, msg());
964 msg = java_lang_String::create_from_str("Compressed class space", CHECK_false);
965 java_lang_Throwable::set_message(Universe::_out_of_memory_error_class_metaspace, msg());
966
967 msg = java_lang_String::create_from_str("Requested array size exceeds VM limit", CHECK_false);
968 java_lang_Throwable::set_message(Universe::_out_of_memory_error_array_size, msg());
969
970 msg = java_lang_String::create_from_str("GC overhead limit exceeded", CHECK_false);
971 java_lang_Throwable::set_message(Universe::_out_of_memory_error_gc_overhead_limit, msg());
972
973 msg = java_lang_String::create_from_str("Java heap space: failed reallocation of scalar replaced objects", CHECK_false);
974 java_lang_Throwable::set_message(Universe::_out_of_memory_error_realloc_objects, msg());
975
976 msg = java_lang_String::create_from_str("/ by zero", CHECK_false);
977 java_lang_Throwable::set_message(Universe::_arithmetic_exception_instance, msg());
978
979 // Setup the array of errors that have preallocated backtrace
980 k = Universe::_out_of_memory_error_java_heap->klass();
981 assert(k->name() == vmSymbols::java_lang_OutOfMemoryError(), "should be out of memory error");
982 k_h = instanceKlassHandle(THREAD, k);
983
984 int len = (StackTraceInThrowable) ? (int)PreallocatedOutOfMemoryErrorCount : 0;
985 Universe::_preallocated_out_of_memory_error_array = oopFactory::new_objArray(k_h(), len, CHECK_false);
986 for (int i=0; i<len; i++) {
987 oop err = k_h->allocate_instance(CHECK_false);
988 Handle err_h = Handle(THREAD, err);
989 java_lang_Throwable::allocate_backtrace(err_h, CHECK_false);
990 Universe::preallocated_out_of_memory_errors()->obj_at_put(i, err_h());
991 }
992 Universe::_preallocated_out_of_memory_error_avail_count = (jint)len;
993 }
994
995
996 // Setup static method for registering finalizers
997 // The finalizer klass must be linked before looking up the method, in
998 // case it needs to get rewritten.
999 InstanceKlass::cast(SystemDictionary::Finalizer_klass())->link_class(CHECK_false);
1000 Method* m = InstanceKlass::cast(SystemDictionary::Finalizer_klass())->find_method(
1001 vmSymbols::register_method_name(),
|
961
962 msg = java_lang_String::create_from_str("Metaspace", CHECK_false);
963 java_lang_Throwable::set_message(Universe::_out_of_memory_error_metaspace, msg());
964 msg = java_lang_String::create_from_str("Compressed class space", CHECK_false);
965 java_lang_Throwable::set_message(Universe::_out_of_memory_error_class_metaspace, msg());
966
967 msg = java_lang_String::create_from_str("Requested array size exceeds VM limit", CHECK_false);
968 java_lang_Throwable::set_message(Universe::_out_of_memory_error_array_size, msg());
969
970 msg = java_lang_String::create_from_str("GC overhead limit exceeded", CHECK_false);
971 java_lang_Throwable::set_message(Universe::_out_of_memory_error_gc_overhead_limit, msg());
972
973 msg = java_lang_String::create_from_str("Java heap space: failed reallocation of scalar replaced objects", CHECK_false);
974 java_lang_Throwable::set_message(Universe::_out_of_memory_error_realloc_objects, msg());
975
976 msg = java_lang_String::create_from_str("/ by zero", CHECK_false);
977 java_lang_Throwable::set_message(Universe::_arithmetic_exception_instance, msg());
978
979 // Setup the array of errors that have preallocated backtrace
980 k = Universe::_out_of_memory_error_java_heap->klass();
981 assert(k->name()->equals(vmSymbols::java_lang_OutOfMemoryError()), "should be out of memory error");
982 k_h = instanceKlassHandle(THREAD, k);
983
984 int len = (StackTraceInThrowable) ? (int)PreallocatedOutOfMemoryErrorCount : 0;
985 Universe::_preallocated_out_of_memory_error_array = oopFactory::new_objArray(k_h(), len, CHECK_false);
986 for (int i=0; i<len; i++) {
987 oop err = k_h->allocate_instance(CHECK_false);
988 Handle err_h = Handle(THREAD, err);
989 java_lang_Throwable::allocate_backtrace(err_h, CHECK_false);
990 Universe::preallocated_out_of_memory_errors()->obj_at_put(i, err_h());
991 }
992 Universe::_preallocated_out_of_memory_error_avail_count = (jint)len;
993 }
994
995
996 // Setup static method for registering finalizers
997 // The finalizer klass must be linked before looking up the method, in
998 // case it needs to get rewritten.
999 InstanceKlass::cast(SystemDictionary::Finalizer_klass())->link_class(CHECK_false);
1000 Method* m = InstanceKlass::cast(SystemDictionary::Finalizer_klass())->find_method(
1001 vmSymbols::register_method_name(),
|