1 /*
2 * Copyright 1998-2007 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
841 } else {
842
843 handler_address =
844 force_unwind ? NULL : nm->handler_for_exception_and_pc(exception, pc);
845
846 if (handler_address == NULL) {
847 handler_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true);
848 assert (handler_address != NULL, "must have compiled handler");
849 // Update the exception cache only when the unwind was not forced.
850 if (!force_unwind) {
851 nm->add_handler_for_exception_and_pc(exception,pc,handler_address);
852 }
853 } else {
854 assert(handler_address == SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true), "Must be the same");
855 }
856 }
857
858 thread->set_exception_pc(pc);
859 thread->set_exception_handler_pc(handler_address);
860 thread->set_exception_stack_size(0);
861 }
862
863 // Restore correct return pc. Was saved above.
864 thread->set_exception_oop(exception());
865 return handler_address;
866
867 JRT_END
868
869 // We are entering here from exception_blob
870 // If there is a compiled exception handler in this method, we will continue there;
871 // otherwise we will unwind the stack and continue at the caller of top frame method
872 // Note we enter without the usual JRT wrapper. We will call a helper routine that
873 // will do the normal VM entry. We do it this way so that we can see if the nmethod
874 // we looked up the handler for has been deoptimized in the meantime. If it has been
875 // we must not use the handler and instread return the deopt blob.
876 address OptoRuntime::handle_exception_C(JavaThread* thread) {
877 //
878 // We are in Java not VM and in debug mode we have a NoHandleMark
879 //
880 #ifndef PRODUCT
|
1 /*
2 * Copyright 1998-2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
841 } else {
842
843 handler_address =
844 force_unwind ? NULL : nm->handler_for_exception_and_pc(exception, pc);
845
846 if (handler_address == NULL) {
847 handler_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true);
848 assert (handler_address != NULL, "must have compiled handler");
849 // Update the exception cache only when the unwind was not forced.
850 if (!force_unwind) {
851 nm->add_handler_for_exception_and_pc(exception,pc,handler_address);
852 }
853 } else {
854 assert(handler_address == SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true), "Must be the same");
855 }
856 }
857
858 thread->set_exception_pc(pc);
859 thread->set_exception_handler_pc(handler_address);
860 thread->set_exception_stack_size(0);
861
862 // Check if the exception PC is a MethodHandle call.
863 thread->set_is_method_handle_exception(nm->is_method_handle_return(pc));
864 }
865
866 // Restore correct return pc. Was saved above.
867 thread->set_exception_oop(exception());
868 return handler_address;
869
870 JRT_END
871
872 // We are entering here from exception_blob
873 // If there is a compiled exception handler in this method, we will continue there;
874 // otherwise we will unwind the stack and continue at the caller of top frame method
875 // Note we enter without the usual JRT wrapper. We will call a helper routine that
876 // will do the normal VM entry. We do it this way so that we can see if the nmethod
877 // we looked up the handler for has been deoptimized in the meantime. If it has been
878 // we must not use the handler and instread return the deopt blob.
879 address OptoRuntime::handle_exception_C(JavaThread* thread) {
880 //
881 // We are in Java not VM and in debug mode we have a NoHandleMark
882 //
883 #ifndef PRODUCT
|