1 /*
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.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
303 "this klass should have been initialized during VM initialization");
304 // create instance - do not call constructor since we may have no
305 // (java) stack space left (should assert constructor is empty)
306 Handle exception;
307 oop exception_oop = klass->allocate_instance(CHECK_(exception));
308 exception = Handle(THREAD, exception_oop);
309 if (StackTraceInThrowable) {
310 java_lang_Throwable::fill_in_stack_trace(exception);
311 }
312 return exception;
313 }
314
315 // Special handling for stack overflow: since we don't have any (java) stack
316 // space left we use the pre-allocated & pre-initialized StackOverflowError
317 // klass to create an stack overflow error instance. We do not call its
318 // constructor for the same reason (it is empty, anyway).
319 IRT_ENTRY(void, InterpreterRuntime::throw_StackOverflowError(JavaThread* thread))
320 Handle exception = get_preinitialized_exception(
321 SystemDictionary::StackOverflowError_klass(),
322 CHECK);
323 THROW_HANDLE(exception);
324 IRT_END
325
326
327 IRT_ENTRY(void, InterpreterRuntime::create_exception(JavaThread* thread, char* name, char* message))
328 // lookup exception klass
329 TempNewSymbol s = SymbolTable::new_symbol(name, CHECK);
330 if (ProfileTraps) {
331 if (s == vmSymbols::java_lang_ArithmeticException()) {
332 note_trap(thread, Deoptimization::Reason_div0_check, CHECK);
333 } else if (s == vmSymbols::java_lang_NullPointerException()) {
334 note_trap(thread, Deoptimization::Reason_null_check, CHECK);
335 }
336 }
337 // create exception
338 Handle exception = Exceptions::new_exception(thread, s, message);
339 thread->set_vm_result(exception());
340 IRT_END
341
342
|
1 /*
2 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
303 "this klass should have been initialized during VM initialization");
304 // create instance - do not call constructor since we may have no
305 // (java) stack space left (should assert constructor is empty)
306 Handle exception;
307 oop exception_oop = klass->allocate_instance(CHECK_(exception));
308 exception = Handle(THREAD, exception_oop);
309 if (StackTraceInThrowable) {
310 java_lang_Throwable::fill_in_stack_trace(exception);
311 }
312 return exception;
313 }
314
315 // Special handling for stack overflow: since we don't have any (java) stack
316 // space left we use the pre-allocated & pre-initialized StackOverflowError
317 // klass to create an stack overflow error instance. We do not call its
318 // constructor for the same reason (it is empty, anyway).
319 IRT_ENTRY(void, InterpreterRuntime::throw_StackOverflowError(JavaThread* thread))
320 Handle exception = get_preinitialized_exception(
321 SystemDictionary::StackOverflowError_klass(),
322 CHECK);
323 // Increment counter for hs_err file reporting
324 Atomic::inc(&Exceptions::_stack_overflow_errors);
325 THROW_HANDLE(exception);
326 IRT_END
327
328
329 IRT_ENTRY(void, InterpreterRuntime::create_exception(JavaThread* thread, char* name, char* message))
330 // lookup exception klass
331 TempNewSymbol s = SymbolTable::new_symbol(name, CHECK);
332 if (ProfileTraps) {
333 if (s == vmSymbols::java_lang_ArithmeticException()) {
334 note_trap(thread, Deoptimization::Reason_div0_check, CHECK);
335 } else if (s == vmSymbols::java_lang_NullPointerException()) {
336 note_trap(thread, Deoptimization::Reason_null_check, CHECK);
337 }
338 }
339 // create exception
340 Handle exception = Exceptions::new_exception(thread, s, message);
341 thread->set_vm_result(exception());
342 IRT_END
343
344
|