summaryrefslogtreecommitdiff
path: root/libjava/interpret-run.cc
diff options
context:
space:
mode:
authorkseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-04 01:04:11 +0000
committerkseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4>2007-05-04 01:04:11 +0000
commit6b971ede6683befb352a8ebd194f89424b49caf2 (patch)
treea8f4058c8d5dc274f095fb50893c2f74cfe875a2 /libjava/interpret-run.cc
parentb24655ef32d2caa4129f97dff97e12d308230f2c (diff)
downloadgcc-6b971ede6683befb352a8ebd194f89424b49caf2.tar.gz
* include/jvmti-int.h (_Jv_ReportJVMTIExceptionThrow):
Declare. * interpret.cc (_Jv_ReportJVMTIExceptionThrow): New function. (find_catch_location): New function. (REPORT_EXCEPTION): New macro. (throw_internal_error): Use REPORT_EXCEPTION. (throw_incompatible_class_change_error): Likewise. (throw_null_pointer_exception): Likewise. (throw_class_format_error): Likewise. * interpret-run.cc (INTERP_REPORT_EXCEPTION)[DEBUG]: Set to REPORT_EXCEPTION. (INTERP_REPORT_EXCEPTION)[!DEBUG]: Make nop. (insn_new): Use INTERP_REPORT_EXCEPTION. (insn_athrow): Likewise. Remove previous JVMTI exception notifications. Add JVMTI ExceptionCatch notificatin. * jni.cc (_Jv_PopSystemFrame): Notify JVMTI clients of exception throw. * gnu/gcj/jvmti/ExceptionEvent.java: Removed. * gnu/gcj/jvmti/ExceptionEvent.h: Removed. * classpath/lib/gnu/gcj/jvmti/ExceptionEvent.class: Removed. * gnu/classpath/jdwp/natVMVirtualMachine.cc (jdwpExceptionCB): New function. (jdwpVMInitCB): Set Exception event handler and enable. * sources.am: Regenerated. * Makefile.in: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124406 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/interpret-run.cc')
-rw-r--r--libjava/interpret-run.cc43
1 files changed, 21 insertions, 22 deletions
diff --git a/libjava/interpret-run.cc b/libjava/interpret-run.cc
index f95198186e7..9be08df488b 100644
--- a/libjava/interpret-run.cc
+++ b/libjava/interpret-run.cc
@@ -377,7 +377,9 @@ details. */
} \
while (0)
-#else
+#undef INTERP_REPORT_EXCEPTION
+#define INTERP_REPORT_EXCEPTION(Jthrowable) REPORT_EXCEPTION (Jthrowable)
+#else // !DEBUG
#undef NEXT_INSN
#define NEXT_INSN goto *((pc++)->insn)
#define REWRITE_INSN(INSN,SLOT,VALUE) \
@@ -386,7 +388,10 @@ details. */
pc[-1].SLOT = VALUE; \
} \
while (0)
-#endif
+
+#undef INTERP_REPORT_EXCEPTION
+#define INTERP_REPORT_EXCEPTION(Jthrowable) /* not needed when not debugging */
+#endif // !DEBUG
#define INTVAL() ((pc++)->int_val)
#define AVAL() ((pc++)->datum)
@@ -2355,7 +2360,11 @@ details. */
/* VM spec, section 3.11.5 */
if ((klass->getModifiers() & Modifier::ABSTRACT)
|| klass->isInterface())
- throw new java::lang::InstantiationException;
+ {
+ jthrowable t = new java::lang::InstantiationException;
+ INTERP_REPORT_EXCEPTION (t);
+ throw t;
+ }
jobject res = _Jv_AllocObject (klass);
PUSHA (res);
@@ -2422,7 +2431,9 @@ details. */
insn_athrow:
{
jobject value = POPA();
- throw static_cast<jthrowable>(value);
+ jthrowable t = static_cast<jthrowable> (value);
+ INTERP_REPORT_EXCEPTION (t);
+ throw t;
}
NEXT_INSN;
@@ -2639,10 +2650,6 @@ details. */
}
catch (java::lang::Throwable *ex)
{
-#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))
@@ -2650,27 +2657,19 @@ details. */
sp = stack;
sp++->o = ex; // Push exception.
#ifdef DEBUG
- if (JVMTI_REQUESTED_EVENT (Exception))
+ if (JVMTI_REQUESTED_EVENT (ExceptionCatch))
{
using namespace gnu::gcj::jvmti;
- jlong throw_meth = reinterpret_cast<jlong> (meth->get_method ());
+ jlong catch_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);
+ _Jv_JVMTI_PostEvent (JVMTI_EVENT_EXCEPTION_CATCH, thread,
+ _Jv_GetCurrentJNIEnv (), catch_meth,
+ catch_loc, ex);
}
#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
+
// No handler, so re-throw.
throw ex;
}