* PR java/30742: ResourceBundle regression
@ 2007-02-10 14:19 Andrew Haley
0 siblings, 0 replies; only message in thread
From: Andrew Haley @ 2007-02-10 14:19 UTC (permalink / raw)
To: java-patches
Fixes a thinko of mone.
Andrew.
2007-02-10 Andrew Haley <aph@redhat.com>
PR java/30742
* gnu/classpath/natVMStackWalker.cc (GET_CALLING_CLASS): New.
(getCallingClass): Call GET_CALLING_CLASS.
(getCallingClassLoader): Likewise.
Index: natVMStackWalker.cc
===================================================================
--- natVMStackWalker.cc (revision 121765)
+++ natVMStackWalker.cc (working copy)
@@ -1,6 +1,6 @@
// natVMStackWalker.cc
-/* Copyright (C) 2006 Free Software Foundation
+/* Copyright (C) 2006, 2007 Free Software Foundation
This file is part of libgcj.
@@ -19,6 +19,32 @@
#include <java/lang/ClassLoader.h>
#include <java/lang/Class.h>
+// Return the class of the method that contains PC.
+// This is a macro not a function, since defining it as one would
+// introduce an extra frame on the stack. */
+#define GET_CALLING_CLASS(PC) \
+({ \
+ void *f = _Unwind_FindEnclosingFunction (PC); \
+ \
+ /* FIXME: it might well be a good idea to cache pc values here in \
+ order to avoid repeated invocations of \
+ _Unwind_FindEnclosingFunction, which is quite expensive. On the \
+ other hand, which not simply write a caching version of \
+ _Unwind_FindEnclosingFunction itself? That would probably be \
+ worthwhile. */ \
+ \
+ _Jv_StackTrace::UpdateNCodeMap (); \
+ jclass klass = (jclass) _Jv_StackTrace::ncodeMap->get ((jobject) f); \
+ \
+ /* If the caller is a compiled frame and the caller of the caller is \
+ an interpreted frame then klass will be null and we need to \
+ unwind the stack. */ \
+ if (!klass) \
+ klass = _Jv_StackTrace::GetStackWalkerCallingClass (); \
+ \
+ klass; \
+ })
+
JArray<jclass> *
gnu::classpath::VMStackWalker::getClassContext(void)
{
@@ -40,25 +66,7 @@
gnu::classpath::VMStackWalker::getCallingClass(::gnu::gcj::RawData *pc)
{
_Jv_InitClass (&::gnu::classpath::VMStackWalker::class$);
- void *f = _Unwind_FindEnclosingFunction (pc);
-
- // FIXME: it might well be a good idea to cache pc values here in
- // order to avoid repeated invocations of
- // _Unwind_FindEnclosingFunction, which is quite expensive. On the
- // other hand, which not simply write a caching version of
- // _Unwind_FindEnclosingFunction itself? That would probably be
- // worthwhile.
-
- _Jv_StackTrace::UpdateNCodeMap ();
- jclass klass = (jclass) _Jv_StackTrace::ncodeMap->get ((jobject) f);
-
- // If the caller is a compiled frame and the caller of the caller
- // is an interpreted frame then klass will be null and we need to
- // unwind the stack.
- if (klass == NULL)
- klass = _Jv_StackTrace::GetStackWalkerCallingClass ();
-
- return klass;
+ return GET_CALLING_CLASS(pc);
}
::java::lang::ClassLoader *
@@ -80,7 +88,7 @@
gnu::classpath::VMStackWalker::getCallingClassLoader(::gnu::gcj::RawData *pc)
{
_Jv_InitClass (&::gnu::classpath::VMStackWalker::class$);
- return getCallingClass (pc)->getClassLoaderInternal ();
+ return GET_CALLING_CLASS(pc)->getClassLoaderInternal ();
}
::java::lang::ClassLoader *
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-02-10 14:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-10 14:19 PR java/30742: ResourceBundle regression Andrew Haley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).