[multiple changes]

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.

From-SVN: r32754
This commit is contained in:
Tom Tromey 2000-03-26 20:33:04 +00:00
parent 71c9404e8b
commit 99444711eb
8 changed files with 122 additions and 31 deletions

View File

@ -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

View File

@ -573,6 +573,9 @@ else
fi
fi
dnl FIXME: cross compilation
AC_CHECK_SIZEOF(void *)
ZLIBS=
ZDEPS=
ZINCS=

View File

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

View File

@ -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>

View File

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

View File

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

View File

@ -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

View File

@ -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);