aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2003-08-20 17:27:56 +0000
committerAndrew Haley <aph@gcc.gnu.org>2003-08-20 17:27:56 +0000
commitf2f3f409f6b69750caf647923bfc8c622f4dd991 (patch)
tree8cc9800fc859447329cd4c9ba42a32a51f71de0f /libjava
parent3e6d83ec9c6d81c8b060ca7ec9307825d4e76360 (diff)
downloadgcc-f2f3f409f6b69750caf647923bfc8c622f4dd991.zip
gcc-f2f3f409f6b69750caf647923bfc8c622f4dd991.tar.gz
gcc-f2f3f409f6b69750caf647923bfc8c622f4dd991.tar.bz2
[multiple changes]
2003-01-31 Andrew Haley <aph@redhat.com> * except.c (prepare_eh_table_type): Use new encoding for exception handlers when using -fno-assume-compiled. 2003-08-20 Andrew Haley <aph@redhat.com> * gnu/gcj/runtime/StackTrace.java (getClass): New method. * gnu/gcj/runtime/natStackTrace.cc (getClass): New method. (classAt): Break out class lookup function into getClass(). * exception.cc (PERSONALITY_FUNCTION): Use new encoding for exception handlers when using -fno-assume-compiled. From-SVN: r70605
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog8
-rw-r--r--libjava/exception.cc23
-rw-r--r--libjava/gnu/gcj/runtime/StackTrace.java2
-rw-r--r--libjava/gnu/gcj/runtime/natStackTrace.cc17
4 files changed, 39 insertions, 11 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 99c22293..892e2c1 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,11 @@
+2003-08-20 Andrew Haley <aph@redhat.com>
+
+ * gnu/gcj/runtime/StackTrace.java (getClass): New method.
+ * gnu/gcj/runtime/natStackTrace.cc (getClass): New method.
+ (classAt): Break out class lookup function into getClass().
+ * exception.cc (PERSONALITY_FUNCTION): Use new encoding for exception
+ handlers when using -fno-assume-compiled.
+
2003-08-20 Tom Tromey <tromey@redhat.com>
Fix for PR libgcj/9125:
diff --git a/libjava/exception.cc b/libjava/exception.cc
index d983f98..9647d44 100644
--- a/libjava/exception.cc
+++ b/libjava/exception.cc
@@ -15,6 +15,9 @@ details. */
#include <java/lang/Class.h>
#include <java/lang/NullPointerException.h>
+#include <gnu/gcj/runtime/StackTrace.h>
+#include <gnu/gcj/runtime/MethodRef.h>
+#include <gnu/gcj/RawData.h>
#include <gcj/cni.h>
#include <jvm.h>
@@ -335,11 +338,21 @@ PERSONALITY_FUNCTION (int version,
jclass catch_type = get_ttype_entry (context, &info, ar_filter);
- // The catch_type is either a (java::lang::Class*) or
- // is one more than a (Utf8Const*).
- if ((size_t)catch_type & 1)
- catch_type = _Jv_FindClass ((Utf8Const*)((size_t)catch_type ^ 1), NULL);
-
+ typedef struct {
+ int __attribute__ ((mode (pointer))) dummy;
+ Utf8Const *utf8;
+ } utf8_hdr;
+ utf8_hdr *p = (utf8_hdr *)catch_type;
+ if (p->dummy == -1)
+ {
+ using namespace gnu::gcj::runtime;
+ java::lang::Class *klass
+ = StackTrace::getClass ((gnu::gcj::RawData *)ip);
+ java::lang::ClassLoader *loader
+ = klass ? klass->getClassLoaderInternal () : NULL;
+ catch_type = _Jv_FindClass (p->utf8, loader);
+ }
+
if (_Jv_IsInstanceOf (xh->value, catch_type))
{
handler_switch_value = ar_filter;
diff --git a/libjava/gnu/gcj/runtime/StackTrace.java b/libjava/gnu/gcj/runtime/StackTrace.java
index 5faaa14..684ee4f 100644
--- a/libjava/gnu/gcj/runtime/StackTrace.java
+++ b/libjava/gnu/gcj/runtime/StackTrace.java
@@ -139,6 +139,8 @@ public final class StackTrace
return len;
}
+ public static native Class getClass(RawData ip);
+
private static native void update();
private static MethodRef methodAtAddress(RawData addr)
{
diff --git a/libjava/gnu/gcj/runtime/natStackTrace.cc b/libjava/gnu/gcj/runtime/natStackTrace.cc
index d39cd00..af8889b 100644
--- a/libjava/gnu/gcj/runtime/natStackTrace.cc
+++ b/libjava/gnu/gcj/runtime/natStackTrace.cc
@@ -124,6 +124,16 @@ gnu::gcj::runtime::StackTrace::getCompiledMethodRef (gnu::gcj::RawData *addr)
}
java::lang::Class *
+gnu::gcj::runtime::StackTrace::getClass (gnu::gcj::RawData *p)
+{
+ gnu::gcj::runtime::MethodRef *ref = getCompiledMethodRef (p);
+ if (ref)
+ return ref->klass;
+ else
+ return NULL;
+}
+
+java::lang::Class *
gnu::gcj::runtime::StackTrace::classAt (jint n)
{
_Jv_frame_info *frame = GET_FRAME (n);
@@ -137,12 +147,7 @@ gnu::gcj::runtime::StackTrace::classAt (jint n)
}
#endif // INTERPRETER
- gnu::gcj::runtime::MethodRef *ref
- = getCompiledMethodRef ((gnu::gcj::RawData *)frame->addr);
- if (ref)
- return ref->klass;
- else
- return NULL;
+ return getClass ((gnu::gcj::RawData *)frame->addr);
}
java::lang::String*