1 /*
2 * Copyright (c) 1997, 2014, 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 *
741
742 JRT_ENTRY(void, SharedRuntime::throw_NullPointerException(JavaThread* thread))
743 throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_NullPointerException());
744 JRT_END
745
746 JRT_ENTRY(void, SharedRuntime::throw_NullPointerException_at_call(JavaThread* thread))
747 // This entry point is effectively only used for NullPointerExceptions which occur at inline
748 // cache sites (when the callee activation is not yet set up) so we are at a call site
749 throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_NullPointerException());
750 JRT_END
751
752 JRT_ENTRY(void, SharedRuntime::throw_StackOverflowError(JavaThread* thread))
753 // We avoid using the normal exception construction in this case because
754 // it performs an upcall to Java, and we're already out of stack space.
755 Klass* k = SystemDictionary::StackOverflowError_klass();
756 oop exception_oop = InstanceKlass::cast(k)->allocate_instance(CHECK);
757 Handle exception (thread, exception_oop);
758 if (StackTraceInThrowable) {
759 java_lang_Throwable::fill_in_stack_trace(exception);
760 }
761 throw_and_post_jvmti_exception(thread, exception);
762 JRT_END
763
764 address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread,
765 address pc,
766 SharedRuntime::ImplicitExceptionKind exception_kind)
767 {
768 address target_pc = NULL;
769
770 if (Interpreter::contains(pc)) {
771 #ifdef CC_INTERP
772 // C++ interpreter doesn't throw implicit exceptions
773 ShouldNotReachHere();
774 #else
775 switch (exception_kind) {
776 case IMPLICIT_NULL: return Interpreter::throw_NullPointerException_entry();
777 case IMPLICIT_DIVIDE_BY_ZERO: return Interpreter::throw_ArithmeticException_entry();
778 case STACK_OVERFLOW: return Interpreter::throw_StackOverflowError_entry();
779 default: ShouldNotReachHere();
780 }
|
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 *
741
742 JRT_ENTRY(void, SharedRuntime::throw_NullPointerException(JavaThread* thread))
743 throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_NullPointerException());
744 JRT_END
745
746 JRT_ENTRY(void, SharedRuntime::throw_NullPointerException_at_call(JavaThread* thread))
747 // This entry point is effectively only used for NullPointerExceptions which occur at inline
748 // cache sites (when the callee activation is not yet set up) so we are at a call site
749 throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_NullPointerException());
750 JRT_END
751
752 JRT_ENTRY(void, SharedRuntime::throw_StackOverflowError(JavaThread* thread))
753 // We avoid using the normal exception construction in this case because
754 // it performs an upcall to Java, and we're already out of stack space.
755 Klass* k = SystemDictionary::StackOverflowError_klass();
756 oop exception_oop = InstanceKlass::cast(k)->allocate_instance(CHECK);
757 Handle exception (thread, exception_oop);
758 if (StackTraceInThrowable) {
759 java_lang_Throwable::fill_in_stack_trace(exception);
760 }
761 // Increment counter for hs_err file reporting
762 Atomic::inc(&Exceptions::_stack_overflow_errors);
763 throw_and_post_jvmti_exception(thread, exception);
764 JRT_END
765
766 address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread,
767 address pc,
768 SharedRuntime::ImplicitExceptionKind exception_kind)
769 {
770 address target_pc = NULL;
771
772 if (Interpreter::contains(pc)) {
773 #ifdef CC_INTERP
774 // C++ interpreter doesn't throw implicit exceptions
775 ShouldNotReachHere();
776 #else
777 switch (exception_kind) {
778 case IMPLICIT_NULL: return Interpreter::throw_NullPointerException_entry();
779 case IMPLICIT_DIVIDE_BY_ZERO: return Interpreter::throw_ArithmeticException_entry();
780 case STACK_OVERFLOW: return Interpreter::throw_StackOverflowError_entry();
781 default: ShouldNotReachHere();
782 }
|