494 if (Thread::current()->is_VM_thread()) {
495 assert_pll_locked(is_locked);
496 } else {
497 assert_pll_ownership();
498 }
499 return _reference_pending_list;
500 }
501
502 void Universe::set_reference_pending_list(oop list) {
503 assert_pll_ownership();
504 _reference_pending_list = list;
505 }
506
507 bool Universe::has_reference_pending_list() {
508 assert_pll_ownership();
509 return _reference_pending_list != NULL;
510 }
511
512 oop Universe::swap_reference_pending_list(oop list) {
513 assert_pll_locked(is_locked);
514 return Atomic::xchg(list, &_reference_pending_list);
515 }
516
517 #undef assert_pll_locked
518 #undef assert_pll_ownership
519
520 void Universe::reinitialize_vtable_of(Klass* ko, TRAPS) {
521 // init vtable of k and all subclasses
522 ko->vtable().initialize_vtable(false, CHECK);
523 if (ko->is_instance_klass()) {
524 for (Klass* sk = ko->subklass();
525 sk != NULL;
526 sk = sk->next_sibling()) {
527 reinitialize_vtable_of(sk, CHECK);
528 }
529 }
530 }
531
532 void Universe::reinitialize_vtables(TRAPS) {
533 // The vtables are initialized by starting at java.lang.Object and
534 // initializing through the subclass links, so that the super
563 return ((throwable() != Universe::_out_of_memory_error_java_heap) &&
564 (throwable() != Universe::_out_of_memory_error_metaspace) &&
565 (throwable() != Universe::_out_of_memory_error_class_metaspace) &&
566 (throwable() != Universe::_out_of_memory_error_array_size) &&
567 (throwable() != Universe::_out_of_memory_error_gc_overhead_limit) &&
568 (throwable() != Universe::_out_of_memory_error_realloc_objects) &&
569 (throwable() != Universe::_out_of_memory_error_retry));
570 }
571
572
573 oop Universe::gen_out_of_memory_error(oop default_err) {
574 // generate an out of memory error:
575 // - if there is a preallocated error and stack traces are available
576 // (j.l.Throwable is initialized), then return the preallocated
577 // error with a filled in stack trace, and with the message
578 // provided by the default error.
579 // - otherwise, return the default error, without a stack trace.
580 int next;
581 if ((_preallocated_out_of_memory_error_avail_count > 0) &&
582 SystemDictionary::Throwable_klass()->is_initialized()) {
583 next = (int)Atomic::add(-1, &_preallocated_out_of_memory_error_avail_count);
584 assert(next < (int)PreallocatedOutOfMemoryErrorCount, "avail count is corrupt");
585 } else {
586 next = -1;
587 }
588 if (next < 0) {
589 // all preallocated errors have been used.
590 // return default
591 return default_err;
592 } else {
593 Thread* THREAD = Thread::current();
594 Handle default_err_h(THREAD, default_err);
595 // get the error object at the slot and set set it to NULL so that the
596 // array isn't keeping it alive anymore.
597 Handle exc(THREAD, preallocated_out_of_memory_errors()->obj_at(next));
598 assert(exc() != NULL, "slot has been used already");
599 preallocated_out_of_memory_errors()->obj_at_put(next, NULL);
600
601 // use the message from the default error
602 oop msg = java_lang_Throwable::message(default_err_h());
603 assert(msg != NULL, "no message");
|
494 if (Thread::current()->is_VM_thread()) {
495 assert_pll_locked(is_locked);
496 } else {
497 assert_pll_ownership();
498 }
499 return _reference_pending_list;
500 }
501
502 void Universe::set_reference_pending_list(oop list) {
503 assert_pll_ownership();
504 _reference_pending_list = list;
505 }
506
507 bool Universe::has_reference_pending_list() {
508 assert_pll_ownership();
509 return _reference_pending_list != NULL;
510 }
511
512 oop Universe::swap_reference_pending_list(oop list) {
513 assert_pll_locked(is_locked);
514 return Atomic::xchg(&_reference_pending_list, list);
515 }
516
517 #undef assert_pll_locked
518 #undef assert_pll_ownership
519
520 void Universe::reinitialize_vtable_of(Klass* ko, TRAPS) {
521 // init vtable of k and all subclasses
522 ko->vtable().initialize_vtable(false, CHECK);
523 if (ko->is_instance_klass()) {
524 for (Klass* sk = ko->subklass();
525 sk != NULL;
526 sk = sk->next_sibling()) {
527 reinitialize_vtable_of(sk, CHECK);
528 }
529 }
530 }
531
532 void Universe::reinitialize_vtables(TRAPS) {
533 // The vtables are initialized by starting at java.lang.Object and
534 // initializing through the subclass links, so that the super
563 return ((throwable() != Universe::_out_of_memory_error_java_heap) &&
564 (throwable() != Universe::_out_of_memory_error_metaspace) &&
565 (throwable() != Universe::_out_of_memory_error_class_metaspace) &&
566 (throwable() != Universe::_out_of_memory_error_array_size) &&
567 (throwable() != Universe::_out_of_memory_error_gc_overhead_limit) &&
568 (throwable() != Universe::_out_of_memory_error_realloc_objects) &&
569 (throwable() != Universe::_out_of_memory_error_retry));
570 }
571
572
573 oop Universe::gen_out_of_memory_error(oop default_err) {
574 // generate an out of memory error:
575 // - if there is a preallocated error and stack traces are available
576 // (j.l.Throwable is initialized), then return the preallocated
577 // error with a filled in stack trace, and with the message
578 // provided by the default error.
579 // - otherwise, return the default error, without a stack trace.
580 int next;
581 if ((_preallocated_out_of_memory_error_avail_count > 0) &&
582 SystemDictionary::Throwable_klass()->is_initialized()) {
583 next = (int)Atomic::add(&_preallocated_out_of_memory_error_avail_count, -1);
584 assert(next < (int)PreallocatedOutOfMemoryErrorCount, "avail count is corrupt");
585 } else {
586 next = -1;
587 }
588 if (next < 0) {
589 // all preallocated errors have been used.
590 // return default
591 return default_err;
592 } else {
593 Thread* THREAD = Thread::current();
594 Handle default_err_h(THREAD, default_err);
595 // get the error object at the slot and set set it to NULL so that the
596 // array isn't keeping it alive anymore.
597 Handle exc(THREAD, preallocated_out_of_memory_errors()->obj_at(next));
598 assert(exc() != NULL, "slot has been used already");
599 preallocated_out_of_memory_errors()->obj_at_put(next, NULL);
600
601 // use the message from the default error
602 oop msg = java_lang_Throwable::message(default_err_h());
603 assert(msg != NULL, "no message");
|