This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libjava no-longer compiler if INTERPRETER not defined


I've checked this in:

2005-03-15 Andreas Tobler <a.tobler@schweiz.ch>

* stacktrace.cc (_Jv_StackTrace::UnwindTraceFn): Protect
interpreter-specific code with #ifdef INTERPRETER.
(_Jv_StackTrace::getLineNumberForFrame): Likewise.
(_Jv_StackTrace::FillInFrameInfo): Likewise.
(_Jv_StackTrace::non_system_trace_fn): Likewise.
* include/java-stack.h (struct _Jv_InterpFrameInfo): Protect with
#ifdef INTERPRETER. Also protect declarations that use it.
* java/lang/Class.h: Move _Jv_StackTrace friend declaration outside
#ifdef INTERPRETER block.


Thanks!

Bryce


On 14-Mar-05, at 7:12 PM, Bryce McKinlay wrote:


Thanks for fixing this, Andreas.

I'm testing this now along with some other small cleanups. I'll check them in soon.

Bryce


Andreas Tobler wrote:


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;
}





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]