This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
PATCH: Building libgcj with --disable-interpreter fails
- From: Rainer Orth <ro at techfak dot uni-bielefeld dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Thu, 5 Jul 2007 21:13:07 +0200 (MEST)
- Subject: PATCH: Building libgcj with --disable-interpreter fails
I've recently tried to get libjava to build again on mips-sgi-irix6.5.
After working around PR libgcj/28190 with a fixincludes hack, I had to
fix two problems:
* I need a new mips-sgi-irix6* clause in configure.host to set the correct
sysdeps_dir and disable the interpreter (which cannot work since only the
O32 ABI has closure support in libffi):
Thu Jun 28 12:31:42 2007 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* configure.host (mips-sgi-irix6*): Set sysdeps_dir.
Disable interpreter.
Index: libjava/configure.host
===================================================================
--- libjava/configure.host (revision 126209)
+++ libjava/configure.host (working copy)
@@ -254,6 +254,11 @@ EOF
sysdeps_dir=x86-64
DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
;;
+ mips-sgi-irix6* )
+ sysdeps_dir=mips
+ # disable interpreter, no closure support for N32 and N64 ABIs
+ libgcj_interpreter=no
+ ;;
mips*-*-linux* )
sysdeps_dir=mips
can_unwind_signal=yes
I'm currently running a bootstrap on the 4.2 branch, where this patch may
be enough to get libgcj working again (as it did in 4.1).
* The much bigger problem on mainline was that with libgcj_interpreter=no
several files didn't compile any longer. By trial and error I've
determined the following patch which fixes the compile problem.
Unfortunately, libgcj.so doesn't link any longer (what a surprise :-),
and I don't know the code well enough to determine how to fix this.
Since my IRIX hosts are quite slow, I tried to verify this patch on
i386-pc-solaris2.10 (libgcj builds, but fails to link due to PR
target/32462) and sparc-sun-solaris2.10 (libgcj builds, but fails to link
due to many missing symbols) with --disable-interpreter.
What's the best way to approach this?
Rainer
-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University
Wed Jul 4 19:25:45 2007 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* include/java-interp.h (_Jv_FrameType): Always define.
* jvmti.cc: Wrap in INTERPRETER.
* gnu/classpath/jdwp/natVMFrame.cc: Likewise.
* gnu/classpath/jdwp/natVMMethod.cc: Likewise.
* gnu/classpath/jdwp/natVMVirtualMachine.cc: Likewise.
* gnu/gcj/jvmti/natBreakpoint.cc: Likewise.
* java/lang/natClass.cc (releaseClosures): Only define if
USE_LIBFFI && FFI_CLOSURES.
(registerClosure): Likewise.
(_Jv_GetInterpClassSourceFile): Wrap body in INTERPRETER.
* java/lang/reflect/natVMProxy.cc: Fix typo.
Wrap in USE_LIBFFI && FFI_CLOSURES.
(run_proxy): Wrap frame_desc in INTERPRETER.
(ncode): Return NULL if !INTERPRETER.
* stacktrace.cc (UnwindTraceFn): Only use interp_frame if
INTERPRETER.
Index: libjava/stacktrace.cc
===================================================================
--- libjava/stacktrace.cc (revision 125953)
+++ libjava/stacktrace.cc (working copy)
@@ -143,9 +143,11 @@ _Jv_StackTrace::UnwindTraceFn (struct _U
if (_Jv_is_proxy (func_addr))
{
state->frames[pos].type = frame_proxy;
+#ifdef INTERPRETER
state->frames[pos].proxyClass = state->interp_frame->proxyClass;
state->frames[pos].proxyMethod = state->interp_frame->proxyMethod;
state->interp_frame = state->interp_frame->next_interp;
+#endif
}
else
{
Index: libjava/include/java-interp.h
===================================================================
--- libjava/include/java-interp.h (revision 125953)
+++ libjava/include/java-interp.h (working copy)
@@ -15,6 +15,14 @@ details. */
#include <java-cpool.h>
#include <gnu/gcj/runtime/NameFinder.h>
+// This is used even if INTERPRETER is not defined.
+enum _Jv_FrameType
+{
+ frame_native,
+ frame_interpreter,
+ frame_proxy
+};
+
#ifdef INTERPRETER
#pragma interface
@@ -373,13 +381,6 @@ public:
}
};
-enum _Jv_FrameType
-{
- frame_native,
- frame_interpreter,
- frame_proxy
-};
-
// The composite call stack as represented by a linked list of frames
class _Jv_Frame
{
Index: libjava/jvmti.cc
===================================================================
--- libjava/jvmti.cc (revision 125953)
+++ libjava/jvmti.cc (working copy)
@@ -41,6 +41,8 @@ details. */
#include <java/util/concurrent/locks/ReentrantReadWriteLock.h>
#include <java/net/URL.h>
+#ifdef INTERPRETER
+
static void check_enabled_events (void);
static void check_enabled_event (jvmtiEvent);
@@ -2623,3 +2625,5 @@ _Jv_JVMTI_PostEvent (jvmtiEvent type, jt
_envListLock->readLock ()->unlock ();
va_end (args);
}
+
+#endif // INTERPRETER
Index: libjava/gnu/classpath/jdwp/natVMFrame.cc
===================================================================
--- libjava/gnu/classpath/jdwp/natVMFrame.cc (revision 125953)
+++ libjava/gnu/classpath/jdwp/natVMFrame.cc (working copy)
@@ -37,6 +37,8 @@ details. */
#include <gnu/classpath/jdwp/value/Value.h>
#include <gnu/classpath/jdwp/value/VoidValue.h>
+#ifdef INTERPRETER
+
using namespace java::lang;
using namespace gnu::classpath::jdwp;
using namespace gnu::classpath::jdwp::exception;
@@ -336,3 +338,5 @@ gnu::classpath::jdwp::VMFrame::setValue
}
}
}
+
+#endif // INTERPRETER
Index: libjava/gnu/classpath/jdwp/natVMMethod.cc
===================================================================
--- libjava/gnu/classpath/jdwp/natVMMethod.cc (revision 125953)
+++ libjava/gnu/classpath/jdwp/natVMMethod.cc (working copy)
@@ -22,6 +22,8 @@ details. */
#include <gnu/classpath/jdwp/util/LineTable.h>
#include <gnu/classpath/jdwp/util/VariableTable.h>
+#ifdef INTERPRETER
+
using namespace java::lang;
#define CHECK_INTERP_CLASS() \
@@ -189,3 +191,5 @@ gnu::classpath::jdwp::VMMethod::getVaria
return jdwp_vtable;
}
+
+#endif // INTERPRETER
Index: libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc
===================================================================
--- libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc (revision 125953)
+++ libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc (working copy)
@@ -60,6 +60,8 @@ details. */
#include <gnu/gcj/jvmti/Breakpoint.h>
#include <gnu/gcj/jvmti/BreakpointManager.h>
+#ifdef INTERPRETER
+
using namespace java::lang;
using namespace gnu::classpath::jdwp::event;
using namespace gnu::classpath::jdwp::util;
@@ -1157,3 +1159,5 @@ jdwpVMInitCB (MAYBE_UNUSED jvmtiEnv *env
using namespace gnu::classpath::jdwp::event;
gnu::classpath::jdwp::Jdwp::notify (new VmInitEvent (thread));
}
+
+#endif // INTERPRETER
Index: libjava/gnu/gcj/jvmti/natBreakpoint.cc
===================================================================
--- libjava/gnu/gcj/jvmti/natBreakpoint.cc (revision 125953)
+++ libjava/gnu/gcj/jvmti/natBreakpoint.cc (working copy)
@@ -19,6 +19,8 @@ details. */
#include <gnu/gcj/jvmti/Breakpoint.h>
#include <gnu/gcj/jvmti/BreakpointManager.h>
+#ifdef INTERPRETER
+
static _Jv_InterpMethod *
get_interp_method (jlong method)
{
@@ -71,3 +73,5 @@ _Jv_RewriteBreakpointInsn (jmethodID mid
}
}
#endif // DIRECT_THREADED
+
+#endif // INTERPRETER
Index: libjava/java/lang/natClass.cc
===================================================================
--- libjava/java/lang/natClass.cc (revision 125953)
+++ libjava/java/lang/natClass.cc (working copy)
@@ -671,6 +671,7 @@ java::lang::Class::finalize (void)
engine->unregister(this);
}
+#if defined USE_LIBFFI && FFI_CLOSURES
void
_Jv_ClosureList::releaseClosures (_Jv_ClosureList **closures)
{
@@ -692,6 +693,7 @@ _Jv_ClosureList::registerClosure (jclass
this->next = *closures;
*closures = this;
}
+#endif // USE_LIBFFI && FFI_CLOSURES
// This implements the initialization process for a class. From Spec
// section 12.4.2.
@@ -2068,12 +2070,14 @@ _Jv_GetClassState (jclass klass)
jstring
_Jv_GetInterpClassSourceFile (jclass klass)
{
+#ifdef INTERPRETER
if (_Jv_IsInterpretedClass (klass))
{
_Jv_InterpClass *iclass =
reinterpret_cast<_Jv_InterpClass *> (klass->aux_info);
return iclass->source_file_name;
}
+#endif
return NULL;
}
Index: libjava/java/lang/reflect/natVMProxy.cc
===================================================================
--- libjava/java/lang/reflect/natVMProxy.cc (revision 125953)
+++ libjava/java/lang/reflect/natVMProxy.cc (working copy)
@@ -13,7 +13,7 @@ details. */
// create closures to provide a fast "cut-through" way to generate
// proxy classes. Instead of generating bytecode and then
// interpreting that, we copy the method definitions for each of the
-// methods we're supposed to be prxying and generate a libffi closure
+// methods we're supposed to be proxying and generate a libffi closure
// for each one.
#include <config.h>
@@ -61,6 +61,7 @@ details. */
#include <java/lang/Boolean.h>
#include <java/lang/Character.h>
+#if defined USE_LIBFFI && FFI_CLOSURES
using namespace java::lang::reflect;
using namespace java::lang;
@@ -331,7 +332,9 @@ run_proxy (ffi_cif *cif,
// than about Proxy.class itself. FRAME_DESC has a destructor so it
// cleans up automatically when this proxy invocation returns.
Thread *thread = Thread::currentThread();
+#ifdef INTERPRETER
_Jv_InterpFrame frame_desc (self->self, thread, proxyClass);
+#endif
// The method to invoke is saved in $Proxy0.m[method_index].
// FIXME: We could somewhat improve efficiency by storing a pointer
@@ -402,6 +405,7 @@ run_proxy (ffi_cif *cif,
static void *
ncode (int method_index, jclass klass, _Jv_Method *self, closure_fun fun)
{
+#ifdef INTERPRETER
using namespace java::lang::reflect;
jboolean staticp = (self->accflags & Modifier::STATIC) != 0;
@@ -432,5 +436,10 @@ ncode (int method_index, jclass klass, _
code);
self->ncode = code;
+#else
+ self->ncode = NULL;
+#endif // INTERPRETER
return self->ncode;
}
+
+#endif // USE_LIBFFI && FFI_CLOSURES