[kaffe] CVS kaffe (guilhem): Fix for 64 bits arch running intrp + moved out some INTERPRETER

Kaffe CVS cvs-commits at kaffe.org
Sat Mar 4 10:00:16 PST 2006


PatchSet 7134 
Date: 2006/03/04 17:51:01
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Fix for 64 bits arch running intrp + moved out some INTERPRETER

	* kaffe/kaffevm/jni/jnirefs.h: Decreased the default size of the
	JNI localref table (as per JNI specification).

	* kaffe/kaffevm/intrp/methodcalls.c
	(engine_callMethod): Adjust arguments to match interpreter's
stack
	representation.
	(engine_dispatchException): New function.

	* kaffe/kaffevm/jit/methodcalls.h,
	kaffe/kaffevm/intrp/methodcalls.h,
	kaffe/kaffevm/jit/methodcalls.c
	(engine_dispatchException): New function.

	* kaffe/kaffevm/intrp/machine.c
	(virtualMachine): Really throw an error when sizeofSigMethod
	fails.

	* kaffe/kaffevm/exception.h: Exported vmExcept_jumpToHandler.

	* kaffe/kaffevm/exception.c
	(DISPATCH_EXCEPTION): Removed.
	(dispatchException): Use engine_dispatchException now.

Members: 
	ChangeLog:1.4652->1.4653 
	kaffe/kaffevm/exception.c:1.103->1.104 
	kaffe/kaffevm/exception.h:1.34->1.35 
	kaffe/kaffevm/intrp/machine.c:1.54->1.55 
	kaffe/kaffevm/intrp/methodcalls.c:1.10->1.11 
	kaffe/kaffevm/intrp/methodcalls.h:1.1->1.2 
	kaffe/kaffevm/jit/methodcalls.c:1.10->1.11 
	kaffe/kaffevm/jni/jni.c:1.39->1.40 
	kaffe/kaffevm/jni/jnirefs.h:1.3->1.4 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4652 kaffe/ChangeLog:1.4653
--- kaffe/ChangeLog:1.4652	Fri Feb 17 00:28:53 2006
+++ kaffe/ChangeLog	Sat Mar  4 17:51:01 2006
@@ -1,3 +1,29 @@
+2006-03-04  Guilhem Lavaux  <guilhem at kaffe.org>
+
+	* kaffe/kaffevm/jni/jnirefs.h: Decreased the default size of the 
+	JNI localref table (as per JNI specification).
+
+	* kaffe/kaffevm/intrp/methodcalls.c
+	(engine_callMethod): Adjust arguments to match interpreter's stack
+	representation.
+	(engine_dispatchException): New function.
+
+	* kaffe/kaffevm/jit/methodcalls.h,
+	kaffe/kaffevm/intrp/methodcalls.h,
+	kaffe/kaffevm/jit/methodcalls.c
+	(engine_dispatchException): New function.
+	
+	* kaffe/kaffevm/intrp/machine.c
+	(virtualMachine): Really throw an error when sizeofSigMethod
+	fails.
+
+	* kaffe/kaffevm/exception.h: Exported vmExcept_jumpToHandler.
+
+	* kaffe/kaffevm/exception.c
+	(DISPATCH_EXCEPTION): Removed.
+	(dispatchException): Use engine_dispatchException now.
+	
+	
 2006-02-17  Riccardo Mottola <riccardo at kaffe.org>
 	* libraries/javalib/awt-implementations/kaffe/java/awt/Choice.java,
 	libraries/javalib/awt-implementations/kaffe/java/awt/DefKeyFilter.java,
Index: kaffe/kaffe/kaffevm/exception.c
diff -u kaffe/kaffe/kaffevm/exception.c:1.103 kaffe/kaffe/kaffevm/exception.c:1.104
--- kaffe/kaffe/kaffevm/exception.c:1.103	Sun Jun 12 11:15:07 2005
+++ kaffe/kaffe/kaffevm/exception.c	Sat Mar  4 17:51:04 2006
@@ -67,10 +67,6 @@
 }
 
 #define FRAMEOBJECT(O, F, E)    (O) = vmExcept_getSyncObj((VmExceptHandler*)(F))
-
-
-#define DISPATCH_EXCEPTION(F, H, E) vmExcept_setPC((VmExceptHandler *)(F), (H));  \
-                                    vmExcept_jumpToHandler((VmExceptHandler *)(F)); /* Does not return */
 #else
 
 #define DISPATCH_EXCEPTION(F,H,E) thread_data->exceptObj = NULL;\
@@ -112,7 +108,7 @@
 	eh->frame.jni.fp = fp;
 }
 
-static void
+void
 vmExcept_jumpToHandler(VmExceptHandler* frame)
 {
 	JTHREAD_LONGJMP(frame->jbuf, 1);
@@ -457,7 +453,7 @@
 		/* If handler found, call it */
 		if (foundHandler) {
 			thread_data->needOnStack = STACK_HIGH;
-			DISPATCH_EXCEPTION(frame->fp, handler, eobj); /* doesn't return */
+			engine_dispatchException(frame->fp, handler, eobj); /* doesn't return */
 		}
 
 #if defined(ENABLE_JVMPI)
Index: kaffe/kaffe/kaffevm/exception.h
diff -u kaffe/kaffe/kaffevm/exception.h:1.34 kaffe/kaffe/kaffevm/exception.h:1.35
--- kaffe/kaffe/kaffevm/exception.h:1.34	Wed Aug 10 21:17:48 2005
+++ kaffe/kaffe/kaffevm/exception.h	Sat Mar  4 17:51:04 2006
@@ -116,6 +116,7 @@
 void vmExcept_setSyncObj(VmExceptHandler* eh, struct Hjava_lang_Object* syncobj);
 void vmExcept_setPC(volatile VmExceptHandler* eh, u4 pc);
 u4 vmExcept_getPC(const VmExceptHandler* eh);
+void vmExcept_jumpToHandler(VmExceptHandler* frame);
 
 #endif
 
Index: kaffe/kaffe/kaffevm/intrp/machine.c
diff -u kaffe/kaffe/kaffevm/intrp/machine.c:1.54 kaffe/kaffe/kaffevm/intrp/machine.c:1.55
--- kaffe/kaffe/kaffevm/intrp/machine.c:1.54	Wed Sep 28 02:02:14 2005
+++ kaffe/kaffe/kaffevm/intrp/machine.c	Sat Mar  4 17:51:04 2006
@@ -250,7 +250,8 @@
 	/* Calculate number of arguments */
 	idx = sizeofSigMethod(meth, false);
 	if (idx == -1) {
-		throwError(&einfo);
+	  postException(&einfo,  JAVA_LANG(InternalError));
+	  throwError(&einfo);
 	}
 	idx += (methaccflags & ACC_STATIC ? 0 : 1);
 
Index: kaffe/kaffe/kaffevm/intrp/methodcalls.c
diff -u kaffe/kaffe/kaffevm/intrp/methodcalls.c:1.10 kaffe/kaffe/kaffevm/intrp/methodcalls.c:1.11
--- kaffe/kaffe/kaffevm/intrp/methodcalls.c:1.10	Tue Jul  5 17:20:40 2005
+++ kaffe/kaffe/kaffevm/intrp/methodcalls.c	Sat Mar  4 17:51:04 2006
@@ -26,6 +26,7 @@
 #include "soft.h"
 #include "external.h"
 #include "jni_i.h"
+#include "exception.h"
 
 void *
 engine_buildTrampoline (Method *meth, void **where, errorInfo *einfo UNUSED)
@@ -84,7 +85,36 @@
 	Method *meth = (Method *)call->function;
 
 	if ((meth->accflags & ACC_NATIVE) == 0) {
-		virtualMachine(meth, (slots*)(call->args+2), (slots*)call->ret, THREAD_DATA()); 
+	  jint i;
+	  jint numArgs;
+	  errorInfo einfo;
+
+	  /* Calculate number of arguments */
+	  numArgs = sizeofSigMethod(meth, false);
+	  if (numArgs == -1) {
+	    postException(&einfo,  JAVA_LANG(InternalError));
+	    throwError(&einfo);
+	  }
+	  numArgs += (meth->accflags & ACC_STATIC ? 0 : 1);
+
+	  jvalue *newargs = (jvalue *)alloca(sizeof(jvalue) * numArgs);
+	  jvalue *curarg = newargs;
+	  for (i = 2; i < call->nrargs; i++, curarg++)
+	    {
+	      switch (call->calltype[i])
+		{
+		case 'J':
+		case 'D':
+		  *curarg = call->args[i];
+		  curarg++;
+		  break;
+		default:
+		  *curarg = call->args[i];
+		  break;
+		}
+	    }
+	  virtualMachine(meth, (slots*)newargs, (slots*)call->ret, THREAD_DATA()); 
+	    
 	}
 	else {
 		Hjava_lang_Object* syncobj = 0;
@@ -189,3 +219,10 @@
 
 }
 
+void engine_dispatchException(uintp framePointer,
+			      uintp handler, 
+			      struct Hjava_lang_Throwable *throwable)
+{
+  vmExcept_setPC((VmExceptHandler *)framePointer, handler);
+  vmExcept_jumpToHandler((VmExceptHandler *)framePointer); /* Does not return */
+}
Index: kaffe/kaffe/kaffevm/intrp/methodcalls.h
diff -u kaffe/kaffe/kaffevm/intrp/methodcalls.h:1.1 kaffe/kaffe/kaffevm/intrp/methodcalls.h:1.2
--- kaffe/kaffe/kaffevm/intrp/methodcalls.h:1.1	Thu Aug 19 19:29:03 2004
+++ kaffe/kaffe/kaffevm/intrp/methodcalls.h	Sat Mar  4 17:51:04 2006
@@ -20,6 +20,10 @@
 
 void engine_callMethod (callMethodInfo *call);
 
+void engine_dispatchException(uintp framePointer,
+			      uintp handler, 
+			      struct Hjava_lang_Throwable *throwable);
+
 /*
  * extra args the engine wants to pass when using callMethodA / callMethodV
  */
Index: kaffe/kaffe/kaffevm/jit/methodcalls.c
diff -u kaffe/kaffe/kaffevm/jit/methodcalls.c:1.10 kaffe/kaffe/kaffevm/jit/methodcalls.c:1.11
--- kaffe/kaffe/kaffevm/jit/methodcalls.c:1.10	Sat May  7 16:20:11 2005
+++ kaffe/kaffe/kaffevm/jit/methodcalls.c	Sat Mar  4 17:51:07 2006
@@ -197,3 +197,14 @@
 	  call->ret->j = 0;
 	sysdepCallMethod (call);
 }
+
+void
+engine_dispatchException (uintp framePointer, uintp handler, 
+			  struct Hjava_lang_Throwable *throwable)
+{
+  /* I do not like the following line. I think that the interpreter
+   * can be adapted so that we do not need to include that line in the JIT.
+   */
+  THREAD_DATA()->exceptObj = NULL;
+  CALL_KAFFE_EXCEPTION(framePointer, handler, throwable);
+}
Index: kaffe/kaffe/kaffevm/jni/jni.c
diff -u kaffe/kaffe/kaffevm/jni/jni.c:1.39 kaffe/kaffe/kaffevm/jni/jni.c:1.40
--- kaffe/kaffe/kaffevm/jni/jni.c:1.39	Thu Aug 18 22:31:32 2005
+++ kaffe/kaffe/kaffevm/jni/jni.c	Sat Mar  4 17:51:07 2006
@@ -318,6 +318,7 @@
 
 	if (obj != NULL)
 	  ADD_REF(obj);
+
 	END_EXCEPTION_HANDLING();
 	return (obj);
 }
Index: kaffe/kaffe/kaffevm/jni/jnirefs.h
diff -u kaffe/kaffe/kaffevm/jni/jnirefs.h:1.3 kaffe/kaffe/kaffevm/jni/jnirefs.h:1.4
--- kaffe/kaffe/kaffevm/jni/jnirefs.h:1.3	Sat May 14 21:46:36 2005
+++ kaffe/kaffe/kaffevm/jni/jnirefs.h	Sat Mar  4 17:51:07 2006
@@ -14,7 +14,7 @@
 
 #include "gtypes.h"
 
-#define	DEFAULT_JNIREFS_NUMBER 61
+#define	DEFAULT_JNIREFS_NUMBER 16
 
 typedef struct _jnirefs {
 	int				next;




More information about the kaffe mailing list