1 /*
2 * Copyright (c) 1997, 2011, 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 *
358 note_trap(thread, Deoptimization::Reason_class_check, CHECK);
359 }
360
361 // create exception
362 THROW_MSG(vmSymbols::java_lang_ClassCastException(), message);
363 IRT_END
364
365 // exception_handler_for_exception(...) returns the continuation address,
366 // the exception oop (via TLS) and sets the bci/bcp for the continuation.
367 // The exception oop is returned to make sure it is preserved over GC (it
368 // is only on the stack if the exception was thrown explicitly via athrow).
369 // During this operation, the expression stack contains the values for the
370 // bci where the exception happened. If the exception was propagated back
371 // from a call, the expression stack contains the values for the bci at the
372 // invoke w/o arguments (i.e., as if one were inside the call).
373 IRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThread* thread, oopDesc* exception))
374
375 Handle h_exception(thread, exception);
376 methodHandle h_method (thread, method(thread));
377 constantPoolHandle h_constants(thread, h_method->constants());
378 typeArrayHandle h_extable (thread, h_method->exception_table());
379 bool should_repeat;
380 int handler_bci;
381 int current_bci = bci(thread);
382
383 // Need to do this check first since when _do_not_unlock_if_synchronized
384 // is set, we don't want to trigger any classloading which may make calls
385 // into java, or surprisingly find a matching exception handler for bci 0
386 // since at this moment the method hasn't been "officially" entered yet.
387 if (thread->do_not_unlock_if_synchronized()) {
388 ResourceMark rm;
389 assert(current_bci == 0, "bci isn't zero for do_not_unlock_if_synchronized");
390 thread->set_vm_result(exception);
391 #ifdef CC_INTERP
392 return (address) -1;
393 #else
394 return Interpreter::remove_activation_entry();
395 #endif
396 }
397
398 do {
|
1 /*
2 * Copyright (c) 1997, 2012, 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 *
358 note_trap(thread, Deoptimization::Reason_class_check, CHECK);
359 }
360
361 // create exception
362 THROW_MSG(vmSymbols::java_lang_ClassCastException(), message);
363 IRT_END
364
365 // exception_handler_for_exception(...) returns the continuation address,
366 // the exception oop (via TLS) and sets the bci/bcp for the continuation.
367 // The exception oop is returned to make sure it is preserved over GC (it
368 // is only on the stack if the exception was thrown explicitly via athrow).
369 // During this operation, the expression stack contains the values for the
370 // bci where the exception happened. If the exception was propagated back
371 // from a call, the expression stack contains the values for the bci at the
372 // invoke w/o arguments (i.e., as if one were inside the call).
373 IRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThread* thread, oopDesc* exception))
374
375 Handle h_exception(thread, exception);
376 methodHandle h_method (thread, method(thread));
377 constantPoolHandle h_constants(thread, h_method->constants());
378 bool should_repeat;
379 int handler_bci;
380 int current_bci = bci(thread);
381
382 // Need to do this check first since when _do_not_unlock_if_synchronized
383 // is set, we don't want to trigger any classloading which may make calls
384 // into java, or surprisingly find a matching exception handler for bci 0
385 // since at this moment the method hasn't been "officially" entered yet.
386 if (thread->do_not_unlock_if_synchronized()) {
387 ResourceMark rm;
388 assert(current_bci == 0, "bci isn't zero for do_not_unlock_if_synchronized");
389 thread->set_vm_result(exception);
390 #ifdef CC_INTERP
391 return (address) -1;
392 #else
393 return Interpreter::remove_activation_entry();
394 #endif
395 }
396
397 do {
|