diff options
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 29 | ||||
-rw-r--r-- | libjava/configure.in | 3 | ||||
-rw-r--r-- | libjava/gcj/javaprims.h | 11 | ||||
-rw-r--r-- | libjava/include/default-signal.h | 4 | ||||
-rw-r--r-- | libjava/include/java-cpool.h | 18 | ||||
-rw-r--r-- | libjava/interpret.cc | 65 | ||||
-rw-r--r-- | libjava/java/lang/mprec.h | 2 | ||||
-rw-r--r-- | libjava/resolve.cc | 21 |
8 files changed, 122 insertions, 31 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 8cc21f7..3f42bfb 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,32 @@ +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. + 2000-03-24 Warren Levy <warrenl@cygnus.com> * java/math/BigInteger.java(divide): Handle the special case when diff --git a/libjava/configure.in b/libjava/configure.in index 6b8d58b..07a6faf 100644 --- a/libjava/configure.in +++ b/libjava/configure.in @@ -573,6 +573,9 @@ else fi fi +dnl FIXME: cross compilation +AC_CHECK_SIZEOF(void *) + ZLIBS= ZDEPS= ZINCS= diff --git a/libjava/gcj/javaprims.h b/libjava/gcj/javaprims.h index d2af32e..4216b4c 100644 --- a/libjava/gcj/javaprims.h +++ b/libjava/gcj/javaprims.h @@ -285,7 +285,16 @@ typedef union { 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; diff --git a/libjava/include/default-signal.h b/libjava/include/default-signal.h index 56d1cc2..0fb3d7d 100644 --- a/libjava/include/default-signal.h +++ b/libjava/include/default-signal.h @@ -13,8 +13,8 @@ details. */ #ifdef SJLJ_EXCEPTIONS -#define HANDLE_SEGV -#define HANDLE_FPE +#define HANDLE_SEGV 1 +#define HANDLE_FPE 1 #include <signal.h> diff --git a/libjava/include/java-cpool.h b/libjava/include/java-cpool.h index 602de28..c636e4c 100644 --- a/libjava/include/java-cpool.h +++ b/libjava/include/java-cpool.h @@ -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 @@ _Jv_loadInt (_Jv_word *data) 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 } diff --git a/libjava/interpret.cc b/libjava/interpret.cc index cf138e2..d6d2958 100644 --- a/libjava/interpret.cc +++ b/libjava/interpret.cc @@ -77,41 +77,60 @@ static inline void dupx (_Jv_word *sp, int n, int x) #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_InterpMethod::run (ffi_cif* cif, _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 @@ void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv) 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; diff --git a/libjava/java/lang/mprec.h b/libjava/java/lang/mprec.h index 61d9d50..4baac32 100644 --- a/libjava/java/lang/mprec.h +++ b/libjava/java/lang/mprec.h @@ -284,9 +284,11 @@ extern double rnd_prod(double, double), rnd_quot(double, double); */ #ifndef Pack_32 +#if SIZEOF_VOID_P != 8 #define Pack_32 #endif #endif +#endif #define MAX_BIGNUMS 16 diff --git a/libjava/resolve.cc b/libjava/resolve.cc index c0f51c9..ab1fafb 100644 --- a/libjava/resolve.cc +++ b/libjava/resolve.cc @@ -1045,6 +1045,13 @@ init_cif (_Jv_Utf8Const* signature, 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 @@ _Jv_InterpMethod::ncode () 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 @@ _Jv_InterpMethod::ncode () 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 @@ _Jv_JNIMethod::ncode () 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 @@ _Jv_JNIMethod::ncode () // 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); |