This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: libjava no-longer compiler if INTERPRETER not defined
- From: Andreas Tobler <toa at pop dot agri dot ch>
- To: Richard Earnshaw <Richard dot Earnshaw at buzzard dot freeserve dot co dot uk>
- Cc: Bryce McKinlay <mckinlay at redhat dot com>, gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Date: Sun, 13 Mar 2005 17:03:21 +0100
- Subject: Re: libjava no-longer compiler if INTERPRETER not defined
- References: <200503130050.j2D0ohhv000199@merlin.buzzard.freeserve.co.uk>
The attached patch lets at least compile the tree and I can even run
some tests.
I test it on darwin with interpreter=no. I can also build on other
platforms where I have no interpreter support yet.
Though, I'm not sure if the patch is correct.
Andreas
Index: stacktrace.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/stacktrace.cc,v
retrieving revision 1.2
diff -u -r1.2 stacktrace.cc
--- stacktrace.cc 12 Mar 2005 16:00:38 -0000 1.2
+++ stacktrace.cc 13 Mar 2005 16:01:35 -0000
@@ -120,6 +120,7 @@
// the java code and not the interpreter itself. This assumes a 1:1
// correspondance between call frames in the interpreted stack and occurances
// of _Jv_InterpMethod::run() on the native stack.
+#ifdef INTERPRETER
if (func_addr == (_Unwind_Ptr) &_Jv_InterpMethod::run)
{
state->frames[pos].type = frame_interpreter;
@@ -128,6 +129,7 @@
state->interp_frame = state->interp_frame->next;
}
else
+#endif
{
state->frames[pos].type = frame_native;
state->frames[pos].ip = (void *) _Unwind_GetIP (context);
@@ -174,6 +176,7 @@
_Jv_StackTrace::getLineNumberForFrame(_Jv_StackFrame *frame, NameFinder *finder,
jstring *sourceFileName, jint *lineNum)
{
+#ifdef INTERPRETER
if (frame->type == frame_interpreter)
{
_Jv_InterpMethod *interp_meth = frame->interp.meth;
@@ -183,6 +186,7 @@
*lineNum = interp_meth->get_source_line(frame->interp.pc);
return;
}
+#endif
// Use dladdr() to determine in which binary the address IP resides.
#if defined (HAVE_DLFCN_H) && defined (HAVE_DLADDR)
extern char **_Jv_argv;
@@ -245,12 +249,14 @@
}
}
}
+#ifdef INTERPRETER
else if (frame->type == frame_interpreter)
{
_Jv_InterpMethod *interp_meth = frame->interp.meth;
klass = interp_meth->defining_class;
meth = interp_meth->self;
}
+#endif
else
JvFail ("Unknown frame type");
@@ -495,11 +501,13 @@
if (frame->klass)
{
classLoader = frame->klass->getClassLoaderInternal();
+#ifdef INTERPRETER
if (classLoader != NULL && classLoader != ClassLoader::systemClassLoader)
{
state->trace_data = (void *) classLoader;
return _URC_NORMAL_STOP;
}
+#endif
}
return _URC_NO_REASON;
Index: java/lang/Class.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/Class.h,v
retrieving revision 1.79
diff -u -r1.79 Class.h
--- java/lang/Class.h 10 Mar 2005 19:02:19 -0000 1.79
+++ java/lang/Class.h 13 Mar 2005 16:01:36 -0000
@@ -472,8 +472,8 @@
friend class ::_Jv_ClassReader;
friend class ::_Jv_InterpClass;
friend class ::_Jv_InterpMethod;
- friend class ::_Jv_StackTrace;
#endif
+ friend class ::_Jv_StackTrace;
#ifdef JV_MARKOBJ_DECL
friend JV_MARKOBJ_DECL;
Index: include/java-stack.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/java-stack.h,v
retrieving revision 1.2
diff -u -r1.2 java-stack.h
--- include/java-stack.h 10 Mar 2005 19:02:19 -0000 1.2
+++ include/java-stack.h 13 Mar 2005 16:01:36 -0000
@@ -71,7 +71,9 @@
jint length; // length of FRAMES
jint pos; // current position in FRAMES
_Jv_StackFrame *frames; // array of stack frame data to be filled.
+#ifdef INTERPRETER
_Jv_InterpFrame *interp_frame; // current frame in the interpreter stack.
+#endif
_Jv_TraceFn trace_function; // function to call back after each frame
// is enumerated. May be NULL.
void *trace_data; // additional state data for trace_function.
@@ -84,8 +86,10 @@
Thread *thread = Thread::currentThread();
// Check for NULL currentThread(), in case an exception is created
// very early during the runtime startup.
+#ifdef INTERPRETER
if (thread)
interp_frame = (_Jv_InterpFrame *) thread->interp_frame;
+#endif
trace_function = NULL;
trace_data = NULL;
}