summaryrefslogtreecommitdiff
path: root/libjava/interpret-run.cc
diff options
context:
space:
mode:
authorkgallowa <kgallowa@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-16 00:05:39 +0000
committerkgallowa <kgallowa@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-16 00:05:39 +0000
commit721a9630e2f08aeb4f20dd1c133f9ac9a1081d13 (patch)
tree7b7a9e88310e312e8a488c89edfc65e8dd555cfc /libjava/interpret-run.cc
parentc2f47e150f3c68a813f92460462c2e70155f2c67 (diff)
downloadgcc-721a9630e2f08aeb4f20dd1c133f9ac9a1081d13.tar.gz
2007-02-15 Kyle Galloway <kgallowa@redhat.com>
* interpret.cc (_Jv_InterpMethod::check_handler): New method. * interpret-run.cc: Change the catch section to report exception events and to use the new check_handler method. * include/java-interp.h (_Jv_InterpMethod): Add check_handler. * gnu/gcj/jvmti/ExceptionEvent.java: New file. * gnu/gcj/jvmti/ExceptionEvent.h: New file. * gnu/gcj/jvmti/natExceptionEvent.cc: New file. * libjava/classpath/lib/gnu/gcj/jvmti/ExceptionEvent.class: New file. * sources.am: Added ExceptionEvent.java. * Makefile.am: Added natExceptionEvent.cc * Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122019 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/interpret-run.cc')
-rw-r--r--libjava/interpret-run.cc67
1 files changed, 31 insertions, 36 deletions
diff --git a/libjava/interpret-run.cc b/libjava/interpret-run.cc
index 8a4d204090f..b98092efb1a 100644
--- a/libjava/interpret-run.cc
+++ b/libjava/interpret-run.cc
@@ -2540,43 +2540,38 @@ details. */
}
catch (java::lang::Throwable *ex)
{
-#ifdef DIRECT_THREADED
- void *logical_pc = (void *) ((insn_slot *) pc - 1);
-#else
- int logical_pc = pc - 1 - meth->bytecode ();
+#ifdef DEBUG
+ // This needs to be done before the pc is changed.
+ jlong throw_loc = meth->insn_index (pc);
+#endif
+ // Check if the exception is handled and, if so, set the pc to the start
+ // of the appropriate catch block.
+ if (meth->check_handler (&pc, meth, ex))
+ {
+ sp = stack;
+ sp++->o = ex; // Push exception.
+#ifdef DEBUG
+ if (JVMTI_REQUESTED_EVENT (Exception))
+ {
+ using namespace gnu::gcj::jvmti;
+ jlong throw_meth = reinterpret_cast<jlong> (meth->get_method ());
+ jlong catch_loc = meth->insn_index (pc);
+ ExceptionEvent::postExceptionEvent (thread, throw_meth,
+ throw_loc, ex, throw_meth,
+ catch_loc);
+ }
+#endif
+ NEXT_INSN;
+ }
+#ifdef DEBUG
+ if (JVMTI_REQUESTED_EVENT (Exception))
+ {
+ using namespace gnu::gcj::jvmti;
+ jlong throw_meth = reinterpret_cast<jlong> (meth->get_method ());
+ ExceptionEvent::postExceptionEvent (thread, throw_meth, throw_loc,
+ ex, NULL, NULL);
+ }
#endif
- _Jv_InterpException *exc = meth->exceptions ();
- jclass exc_class = ex->getClass ();
-
- for (int i = 0; i < meth->exc_count; i++)
- {
- if (PCVAL (exc[i].start_pc) <= logical_pc
- && logical_pc < PCVAL (exc[i].end_pc))
- {
-#ifdef DIRECT_THREADED
- jclass handler = (jclass) exc[i].handler_type.p;
-#else
- jclass handler = NULL;
- if (exc[i].handler_type.i != 0)
- handler = (_Jv_Linker::resolve_pool_entry (meth->defining_class,
- exc[i].handler_type.i)).clazz;
-#endif /* DIRECT_THREADED */
-
- if (handler == NULL || handler->isAssignableFrom (exc_class))
- {
-
-#ifdef DIRECT_THREADED
- pc = (insn_slot *) exc[i].handler_pc.p;
-#else
- pc = meth->bytecode () + exc[i].handler_pc.i;
-#endif /* DIRECT_THREADED */
- sp = stack;
- sp++->o = ex; // Push exception.
- NEXT_INSN;
- }
- }
- }
-
// No handler, so re-throw.
throw ex;
}