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 *
813 Events::log_exception(thread, "AbstractMethodError at " INTPTR_FORMAT, pc);
814 return StubRoutines::throw_AbstractMethodError_entry();
815 } else {
816 Events::log_exception(thread, "NullPointerException at vtable entry " INTPTR_FORMAT, pc);
817 return StubRoutines::throw_NullPointerException_at_call_entry();
818 }
819 } else {
820 CodeBlob* cb = CodeCache::find_blob(pc);
821
822 // If code blob is NULL, then return NULL to signal handler to report the SEGV error.
823 if (cb == NULL) return NULL;
824
825 // Exception happened in CodeCache. Must be either:
826 // 1. Inline-cache check in C2I handler blob,
827 // 2. Inline-cache check in nmethod, or
828 // 3. Implict null exception in nmethod
829
830 if (!cb->is_nmethod()) {
831 bool is_in_blob = cb->is_adapter_blob() || cb->is_method_handles_adapter_blob();
832 if (!is_in_blob) {
833 cb->print();
834 fatal(err_msg("exception happened outside interpreter, nmethods and vtable stubs at pc " INTPTR_FORMAT, pc));
835 }
836 Events::log_exception(thread, "NullPointerException in code blob at " INTPTR_FORMAT, pc);
837 // There is no handler here, so we will simply unwind.
838 return StubRoutines::throw_NullPointerException_at_call_entry();
839 }
840
841 // Otherwise, it's an nmethod. Consult its exception handlers.
842 nmethod* nm = (nmethod*)cb;
843 if (nm->inlinecache_check_contains(pc)) {
844 // exception happened inside inline-cache check code
845 // => the nmethod is not yet active (i.e., the frame
846 // is not set up yet) => use return address pushed by
847 // caller => don't push another return address
848 Events::log_exception(thread, "NullPointerException in IC check " INTPTR_FORMAT, pc);
849 return StubRoutines::throw_NullPointerException_at_call_entry();
850 }
851
852 if (nm->method()->is_method_handle_intrinsic()) {
853 // exception happened inside MH dispatch code, similar to a vtable stub
854 Events::log_exception(thread, "NullPointerException in MH adapter " INTPTR_FORMAT, pc);
|
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 *
813 Events::log_exception(thread, "AbstractMethodError at " INTPTR_FORMAT, pc);
814 return StubRoutines::throw_AbstractMethodError_entry();
815 } else {
816 Events::log_exception(thread, "NullPointerException at vtable entry " INTPTR_FORMAT, pc);
817 return StubRoutines::throw_NullPointerException_at_call_entry();
818 }
819 } else {
820 CodeBlob* cb = CodeCache::find_blob(pc);
821
822 // If code blob is NULL, then return NULL to signal handler to report the SEGV error.
823 if (cb == NULL) return NULL;
824
825 // Exception happened in CodeCache. Must be either:
826 // 1. Inline-cache check in C2I handler blob,
827 // 2. Inline-cache check in nmethod, or
828 // 3. Implict null exception in nmethod
829
830 if (!cb->is_nmethod()) {
831 bool is_in_blob = cb->is_adapter_blob() || cb->is_method_handles_adapter_blob();
832 if (!is_in_blob) {
833 // Allow normal crash reporting to handle this
834 return NULL;
835 }
836 Events::log_exception(thread, "NullPointerException in code blob at " INTPTR_FORMAT, pc);
837 // There is no handler here, so we will simply unwind.
838 return StubRoutines::throw_NullPointerException_at_call_entry();
839 }
840
841 // Otherwise, it's an nmethod. Consult its exception handlers.
842 nmethod* nm = (nmethod*)cb;
843 if (nm->inlinecache_check_contains(pc)) {
844 // exception happened inside inline-cache check code
845 // => the nmethod is not yet active (i.e., the frame
846 // is not set up yet) => use return address pushed by
847 // caller => don't push another return address
848 Events::log_exception(thread, "NullPointerException in IC check " INTPTR_FORMAT, pc);
849 return StubRoutines::throw_NullPointerException_at_call_entry();
850 }
851
852 if (nm->method()->is_method_handle_intrinsic()) {
853 // exception happened inside MH dispatch code, similar to a vtable stub
854 Events::log_exception(thread, "NullPointerException in MH adapter " INTPTR_FORMAT, pc);
|