summaryrefslogtreecommitdiff
path: root/libjava/interpret.cc
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-03-26 20:33:04 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-03-26 20:33:04 +0000
commit02ddd4c0408d678a216bde8231e93a5b6f8e0d47 (patch)
tree316c5bb1d7d3464e8a5a904b6040f521f3b9a97f /libjava/interpret.cc
parent246d629b7c6b4563bfb5948573defcd8f8daefbb (diff)
downloadgcc-02ddd4c0408d678a216bde8231e93a5b6f8e0d47.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32754 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/interpret.cc')
-rw-r--r--libjava/interpret.cc65
1 files changed, 45 insertions, 20 deletions
diff --git a/libjava/interpret.cc b/libjava/interpret.cc
index cf138e237ed..d6d29582ec9 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;