This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Patch: IA-64 port
- To: Java Patch List <java-patches at sourceware dot cygnus dot com>
- Subject: Patch: IA-64 port
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 26 Mar 2000 13:30:28 -0700
- Reply-To: tromey at cygnus dot com
I'm checking in the appended patch. It implements a port of libgcj to
the IA-64. Hans Boehm wrote most of this; I just added some minor
cleanups.
2000-03-26 Tom Tromey <tromey@cygnus.com>
* java/lang/mprec.h: Use SIZEOF_VOID_P.
* interpret.cc: Use SIZEOF_VOID_P.
* include/java-cpool.h (_Jv_storeLong): Use SIZEOF_VOID_P.
(_Jv_loadLong): Likewise.
(_Jv_storeDouble): Likewise.
* configure: Rebuilt.
* configure.in: Check size of void*.
* resolve.cc (ncode): Use FFI_PREP_RAW_CLOSURE and FFI_RAW_SIZE.
2000-03-26 Hans Boehm <boehm@acm.org>
* include/java-cpool.h (_Jv_storeLong, _Jv_loadLong,
_Jv_storeDouble, _Jv_loadDouble): Define differently on 64 bit
machine.
* java/lang/ieeefp.h: Define __IEEE_BIG_ENDIAN or
__IEEE_LITTLE_ENDIAN appropriately on IA64.
* java/lang/mprec.h: Don't define Pack_32 on 64 bit machine.
* javaprims.h (_Jv_word): Added `l' and `d' entries in 64 bit
case.
* resolve.cc (FFI_PREP_RAW_CLOSURE): New define.
(FFI_RAW_SIZE): Likewise.
(_Jv_InterpMethod::ncode): Use them.
* interpret.cc (PUSHL, PUSHD, POPL, POPD, LOADL, LOADD, STOREL,
STORED): Define differently on a 64 bit machine.
(continue1): Use ffi_java_raw_call when appropriate.
Tom
Index: configure.in
===================================================================
RCS file: /cvs/java/libgcj/libjava/configure.in,v
retrieving revision 1.53
diff -u -r1.53 configure.in
--- configure.in 2000/03/04 21:50:19 1.53
+++ configure.in 2000/03/26 20:27:18
@@ -573,6 +573,9 @@
fi
fi
+dnl FIXME: cross compilation
+AC_CHECK_SIZEOF(void *)
+
ZLIBS=
ZDEPS=
ZINCS=
Index: interpret.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/interpret.cc,v
retrieving revision 1.14
diff -u -r1.14 interpret.cc
--- interpret.cc 2000/03/07 19:55:24 1.14
+++ interpret.cc 2000/03/26 20:27:21
@@ -77,41 +77,60 @@
#define PUSHA(V) (sp++)->o = (V)
#define PUSHI(V) (sp++)->i = (V)
#define PUSHF(V) (sp++)->f = (V)
-#define PUSHL(V) do { _Jv_word2 w2; w2.l=(V); \
- (sp++)->ia[0] = w2.ia[0]; \
- (sp++)->ia[0] = w2.ia[1]; } while (0)
-#define PUSHD(V) do { _Jv_word2 w2; w2.d=(V); \
- (sp++)->ia[0] = w2.ia[0]; \
- (sp++)->ia[0] = w2.ia[1]; } while (0)
+#if SIZEOF_VOID_P == 8
+# define PUSHL(V) (sp->l = (V), sp += 2)
+# define PUSHD(V) (sp->d = (V), sp += 2)
+#else
+# define PUSHL(V) do { _Jv_word2 w2; w2.l=(V); \
+ (sp++)->ia[0] = w2.ia[0]; \
+ (sp++)->ia[0] = w2.ia[1]; } while (0)
+# define PUSHD(V) do { _Jv_word2 w2; w2.d=(V); \
+ (sp++)->ia[0] = w2.ia[0]; \
+ (sp++)->ia[0] = w2.ia[1]; } while (0)
+#endif
#define POPA() ((--sp)->o)
#define POPI() ((jint) (--sp)->i) // cast since it may be promoted
#define POPF() ((jfloat) (--sp)->f)
-#define POPL() ({ _Jv_word2 w2; \
+#if SIZEOF_VOID_P == 8
+# define POPL() (sp -= 2, (jlong) sp->l)
+# define POPD() (sp -= 2, (jdouble) sp->d)
+#else
+# define POPL() ({ _Jv_word2 w2; \
w2.ia[1] = (--sp)->ia[0]; \
w2.ia[0] = (--sp)->ia[0]; w2.l; })
-#define POPD() ({ _Jv_word2 w2; \
+# define POPD() ({ _Jv_word2 w2; \
w2.ia[1] = (--sp)->ia[0]; \
w2.ia[0] = (--sp)->ia[0]; w2.d; })
+#endif
#define LOADA(I) (sp++)->o = locals[I].o
#define LOADI(I) (sp++)->i = locals[I].i
#define LOADF(I) (sp++)->f = locals[I].f
-#define LOADL(I) do { jint __idx = (I); \
- (sp++)->ia[0] = locals[__idx].ia[0]; \
- (sp++)->ia[0] = locals[__idx+1].ia[0]; \
- } while (0)
-#define LOADD(I) LOADL(I)
-
+#if SIZEOF_VOID_P == 8
+# define LOADL(I) (sp->l = locals[I].l, sp += 2)
+# define LOADD(I) (sp->d = locals[I].d, sp += 2)
+#else
+# define LOADL(I) do { jint __idx = (I); \
+ (sp++)->ia[0] = locals[__idx].ia[0]; \
+ (sp++)->ia[0] = locals[__idx+1].ia[0]; \
+ } while (0)
+# define LOADD(I) LOADL(I)
+#endif
#define STOREA(I) locals[I].o = (--sp)->o
#define STOREI(I) locals[I].i = (--sp)->i
#define STOREF(I) locals[I].f = (--sp)->f
-#define STOREL(I) do { jint __idx = (I); \
- locals[__idx+1].ia[0] = (--sp)->ia[0]; \
- locals[__idx].ia[0] = (--sp)->ia[0]; \
- } while (0)
-#define STORED(I) STOREL(I)
+#if SIZEOF_VOID_P == 8
+# define STOREL(I) (sp -= 2, locals[I].l = sp->l)
+# define STORED(I) (sp -= 2, locals[I].d = sp->d)
+#else
+# define STOREL(I) do { jint __idx = (I); \
+ locals[__idx+1].ia[0] = (--sp)->ia[0]; \
+ locals[__idx].ia[0] = (--sp)->ia[0]; \
+ } while (0)
+# define STORED(I) STOREL(I)
+#endif
#define PEEKI(I) (locals+(I))->i
#define PEEKA(I) (locals+(I))->o
@@ -199,7 +218,7 @@
_Jv_word *locals = inv->local_base ();
/* Go straight at it! the ffi raw format matches the internal
- stack representation exactly. At leat, that's the idea.
+ stack representation exactly. At least, that's the idea.
*/
memcpy ((void*) locals, (void*) args, args_raw_size);
@@ -693,7 +712,13 @@
jdouble rvalue;
+#if FFI_NATIVE_RAW_API
+ /* We assume that this is only implemented if it's correct */
+ /* to use it here. On a 64 bit machine, it never is. */
ffi_raw_call (cif, fun, (void*)&rvalue, raw);
+#else
+ ffi_java_raw_call (cif, fun, (void*)&rvalue, raw);
+#endif
int rtype = cif->rtype->type;
Index: resolve.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/resolve.cc,v
retrieving revision 1.16
diff -u -r1.16 resolve.cc
--- resolve.cc 2000/03/07 19:55:24 1.16
+++ resolve.cc 2000/03/26 20:27:24
@@ -1045,6 +1045,13 @@
return item_count;
}
+#if FFI_NATIVE_RAW_API
+# define FFI_PREP_RAW_CLOSURE ffi_prep_raw_closure
+# define FFI_RAW_SIZE ffi_raw_size
+#else
+# define FFI_PREP_RAW_CLOSURE ffi_prep_java_raw_closure
+# define FFI_RAW_SIZE ffi_java_raw_size
+#endif
/* we put this one here, and not in interpret.cc because it
* calls the utility routines count_arguments
@@ -1083,7 +1090,7 @@
ffi_closure_fun fun;
- args_raw_size = ffi_raw_size (&closure->cif);
+ args_raw_size = FFI_RAW_SIZE (&closure->cif);
JvAssert ((self->accflags & Modifier::NATIVE) == 0);
@@ -1099,10 +1106,10 @@
fun = (ffi_closure_fun)&_Jv_InterpMethod::run_normal;
}
- ffi_prep_raw_closure (&closure->closure,
- &closure->cif,
- fun,
- (void*) this);
+ FFI_PREP_RAW_CLOSURE (&closure->closure,
+ &closure->cif,
+ fun,
+ (void*)this);
self->ncode = (void*)closure;
return self->ncode;
@@ -1134,7 +1141,7 @@
ffi_closure_fun fun;
- args_raw_size = ffi_raw_size (&closure->cif);
+ args_raw_size = FFI_RAW_SIZE (&closure->cif);
// Initialize the argument types and CIF that represent the actual
// underlying JNI function.
@@ -1161,7 +1168,7 @@
// interpreted code use JNI.
fun = (ffi_closure_fun) &_Jv_JNIMethod::call;
- ffi_prep_raw_closure (&closure->closure,
+ FFI_PREP_RAW_CLOSURE (&closure->closure,
&closure->cif,
fun,
(void*) this);
Index: gcj/javaprims.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/gcj/javaprims.h,v
retrieving revision 1.7
diff -u -r1.7 javaprims.h
--- javaprims.h 2000/03/07 19:55:24 1.7
+++ javaprims.h 2000/03/26 20:27:25
@@ -285,7 +285,16 @@
jint ia[1]; // Half of _Jv_word2.
void* p;
- // these are things we will store in the constant
+ // We use __LP64__ and not SIZEOF_VOID_P here because we want
+ // something that will be predefined by the compiler. FIXME -- this
+ // definition probably shouldn't appear here anyway.
+#ifdef __LP64__
+ // We can safely put a long or a double in here without increasing
+ // the size of _Jv_Word; we take advantage of this in the interpreter.
+ jlong l;
+ jdouble d;
+#endif
+
jclass clazz;
jstring string;
struct _Jv_Field *field;
Index: include/default-signal.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/include/default-signal.h,v
retrieving revision 1.5
diff -u -r1.5 default-signal.h
--- default-signal.h 2000/03/07 19:55:25 1.5
+++ default-signal.h 2000/03/26 20:27:25
@@ -13,8 +13,8 @@
#ifdef SJLJ_EXCEPTIONS
-#define HANDLE_SEGV
-#define HANDLE_FPE
+#define HANDLE_SEGV 1
+#define HANDLE_FPE 1
#include <signal.h>
Index: include/java-cpool.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/include/java-cpool.h,v
retrieving revision 1.5
diff -u -r1.5 java-cpool.h
--- java-cpool.h 2000/03/07 19:55:25 1.5
+++ java-cpool.h 2000/03/26 20:27:25
@@ -1,6 +1,6 @@
// java-cpool.h - Constant pool parsing header. -*- c++ -*-
-/* Copyright (C) 1999 Free Software Foundation
+/* Copyright (C) 1999, 2000 Free Software Foundation
This file is part of libgcj.
@@ -80,37 +80,53 @@
extern inline void
_Jv_storeLong (_Jv_word *data, jlong l)
{
+#if SIZEOF_VOID_P == 8
+ data[0].l = l;
+#else
_Jv_word2 tmp;
tmp.l = l;
data[0].ia[0] = tmp.ia[0];
data[1].ia[0] = tmp.ia[1];
+#endif
}
extern inline jlong
_Jv_loadLong (_Jv_word *data)
{
+#if SIZEOF_VOID_P == 8
+ return data -> l;
+#else
_Jv_word2 tmp;
tmp.ia[0] = data[0].ia[0];
tmp.ia[1] = data[1].ia[0];
return tmp.l;
+#endif
}
extern inline void
_Jv_storeDouble (_Jv_word *data, jdouble d)
{
+#if SIZEOF_VOID_P == 8
+ data[0].d = d;
+#else
_Jv_word2 tmp;
tmp.d = d;
data[0].ia[0] = tmp.ia[0];
data[1].ia[0] = tmp.ia[1];
+#endif
}
extern inline jdouble
_Jv_loadDouble (_Jv_word *data)
{
+#if SIZEOF_VOID_P == 8
+ return data -> d;
+#else
_Jv_word2 tmp;
tmp.ia[0] = data[0].ia[0];
tmp.ia[1] = data[1].ia[0];
return tmp.d;
+#endif
}
Index: java/lang/mprec.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/mprec.h,v
retrieving revision 1.4
diff -u -r1.4 mprec.h
--- mprec.h 2000/01/10 20:02:47 1.4
+++ mprec.h 2000/03/26 20:27:26
@@ -284,7 +284,9 @@
*/
#ifndef Pack_32
+#if SIZEOF_VOID_P != 8
#define Pack_32
+#endif
#endif
#endif