1 /* |
1 /* |
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
613 if (next < 0) { |
613 if (next < 0) { |
614 // all preallocated errors have been used. |
614 // all preallocated errors have been used. |
615 // return default |
615 // return default |
616 return default_err; |
616 return default_err; |
617 } else { |
617 } else { |
|
618 Thread* THREAD = Thread::current(); |
|
619 Handle default_err_h(THREAD, default_err); |
618 // get the error object at the slot and set set it to NULL so that the |
620 // get the error object at the slot and set set it to NULL so that the |
619 // array isn't keeping it alive anymore. |
621 // array isn't keeping it alive anymore. |
620 oop exc = preallocated_out_of_memory_errors()->obj_at(next); |
622 Handle exc(THREAD, preallocated_out_of_memory_errors()->obj_at(next)); |
621 assert(exc != NULL, "slot has been used already"); |
623 assert(exc() != NULL, "slot has been used already"); |
622 preallocated_out_of_memory_errors()->obj_at_put(next, NULL); |
624 preallocated_out_of_memory_errors()->obj_at_put(next, NULL); |
623 |
625 |
624 // use the message from the default error |
626 // use the message from the default error |
625 oop msg = java_lang_Throwable::message(default_err); |
627 oop msg = java_lang_Throwable::message(default_err_h()); |
626 assert(msg != NULL, "no message"); |
628 assert(msg != NULL, "no message"); |
627 java_lang_Throwable::set_message(exc, msg); |
629 java_lang_Throwable::set_message(exc(), msg); |
628 |
630 |
629 // populate the stack trace and return it. |
631 // populate the stack trace and return it. |
630 java_lang_Throwable::fill_in_stack_trace_of_preallocated_backtrace(exc); |
632 java_lang_Throwable::fill_in_stack_trace_of_preallocated_backtrace(exc); |
631 return exc; |
633 return exc(); |
632 } |
634 } |
633 } |
635 } |
634 |
636 |
635 intptr_t Universe::_non_oop_bits = 0; |
637 intptr_t Universe::_non_oop_bits = 0; |
636 |
638 |