[kaffe] CVS kaffe (hkraemer): miscellaneous small fixes

Kaffe CVS cvs-commits at kaffe.org
Sat Oct 25 06:04:02 PDT 2003


PatchSet 4123 
Date: 2003/10/25 12:52:41
Author: hkraemer
Branch: HEAD
Tag: (none) 
Log:
miscellaneous small fixes

Members: 
	ChangeLog:1.1715->1.1716 
	config/arm/common.h:1.7->1.8 
	config/arm/trampolines.c:1.5->1.6 
	config/arm/linux/jit-md.h:1.6->1.7 
	config/arm/linux/md.h:1.5->1.6 
	config/sparc/jit.h:1.7->1.8 
	include/jni.h:1.22->1.23 
	include/jni_cpp.h:1.6->1.7 
	kaffe/kaffevm/access.c:1.3->1.4 
	libraries/clib/net/Makefile.am:1.13->1.14 
	libraries/clib/net/Makefile.in:1.86->1.87 
	libraries/javalib/java/awt/MouseEvt.java:1.7->1.8 
	libraries/javalib/java/net/URLClassLoader.java:1.12->1.13 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1715 kaffe/ChangeLog:1.1716
--- kaffe/ChangeLog:1.1715	Fri Oct 24 16:42:09 2003
+++ kaffe/ChangeLog	Sat Oct 25 12:52:41 2003
@@ -1,3 +1,44 @@
+2003-10-25  Helmer Kraemer  <hkraemer at freenet.de>
+
+	* config/arm/linux/jit-md.h:
+	removed now unnecessary signal stuff, corrected the definition of
+	the FIRSTFRAME macro
+
+	* config/arm/linux/md.h:
+	include necessary signal related headers, corrected the definition
+	of the SIGNAL_ARGS macro
+	
+	* config/arm/trampolines.c: 
+	(arm_do_fixup_trampoline) create a stack frame for the trampoline
+	
+	* config/arm/common.h:
+	(sysdepCallMethod) fixed passing of 64bit parameters, made asm
+	statements volatile so gcc doesn't optimize them away
+
+	* config/sparc/jit.h:
+	(CALL_KAFFE_EXCEPTION) removed wrong quote
+
+	* kaffe/kaffevm/access.c:
+	(checkAccess) properly grant access to inherited inner classes
+	that are protected
+
+	* include/jni.h, include/jni_cpp.h:
+	added missing c++ functions for the VM Invocation Interface
+	
+	* libraries/javalib/java/awt/MouseEvt.java:
+	(computeMouseTarget) properly translate the mouse position 
+	when the mouse is inside of a container
+
+	Reported by: Ross Martin <hacker at ross.interwrx.com>
+	
+	* libraries/javalib/java/net/URLClassLoader.java:
+	(getJar) immediately return if the url denotes a local file
+	that doesn't exist
+
+	* libraries/clib/net/Makefile.am, libraries/clib/net/Makefile.in:
+	(libnet_la_LDADD) make sure that symbols starting with gnu are
+	exported
+	
 2003-10-24  Dalibor Topic <robilad at kaffe.org>
 
 	* libraries/javalib/java/util/zip/ZipInputStream.java:
Index: kaffe/config/arm/common.h
diff -u kaffe/config/arm/common.h:1.7 kaffe/config/arm/common.h:1.8
--- kaffe/config/arm/common.h:1.7	Tue Sep 30 19:50:54 2003
+++ kaffe/config/arm/common.h	Sat Oct 25 12:52:42 2003
@@ -36,76 +36,53 @@
     register int r2 asm("r2");
     register int r3 asm("r3");
     register double f0 asm("f0");
+
   default:
     {
       int *args = extraargs;
       int argidx = 4;
-      if (call->callsize[3] == 2) {
-	*args++ = (call->args[argidx].j) >> 32;
-	}
       for(; argidx < call->nrargs; ++argidx) {
-	if (call->callsize[argidx]) {
-	  *args++ = call->args[argidx].i;
-	  if (call->callsize[argidx] == 2)
-	    *args++ = (call->args[argidx].j) >> 32;
-	}
+        *args++ = call->args[argidx].i;
       }
     }
   case 4:
-    if (call->callsize[3]) {
-      r3 = call->args[3].i;
-      if (call->callsize[3] == 2)
-        *extraargs = (call->args[3].j) >> 32;
-    }
+    r3 = call->args[3].i;
   case 3:
-    if (call->callsize[2]) {
-      r2 = call->args[2].i;
-      if (call->callsize[2] == 2)
-        r3 = (call->args[2].j) >> 32;
-    }
+    r2 = call->args[2].i;
   case 2:
-    if (call->callsize[1]) {
-      r1 = call->args[1].i;
-      if (call->callsize[1] == 2)
-        r2 = (call->args[1].j) >> 32;
-    }
+    r1 = call->args[1].i;
   case 1:
-    if (call->callsize[0]) {
-      r0 = call->args[0].i;
-      if (call->callsize[0] == 2)
-        r1 = (call->args[0].j) >> 32;
-    }
+    r0 = call->args[0].i;
   case 0:
-    asm ("mov lr, pc\n"
-"	  mov pc, %3\n"
-        : "=r" (r0), "=r" (r1), "=f" (f0)
-	: "r" (call->function),
-	  "0" (r0), "1" (r1), "r" (r2), "r" (r3)
-	: "ip", "rfp", "sl", "fp", "lr"
-	);
-    switch(call->rettype)
+    asm volatile ("mov lr, pc\n"
+"                    mov pc, %3\n"
+                  : "=r" (r0), "=r" (r1), "=f" (f0)
+                  : "r" (call->function),
+                    "0" (r0), "1" (r1), "r" (r2), "r" (r3)
+                  : "ip", "rfp", "sl", "fp", "lr");
+    switch (call->rettype)
     {
+    case 'V':
+      break;
+
     case 'D':
-        asm("stfd %1,%0" : "=m" (call->ret->d) : "f" (f0));
-	break;
+      asm volatile ("stfd %1,%0" : "=m" (call->ret->d) : "f" (f0));
+      break;
+
     case 'F':
-	asm("stfs %1,%0" : "=m" (call->ret->f) : "f" (f0));
-	break;
-    /*
-     * XXX doesn't seem to be necessary to special case 'L',
-     * since its just another 32bit int, right !??!??
-    case 'L':
-	call->ret->l = r0;
-	break;
-	*/
+      asm volatile ("stfs %1,%0" : "=m" (call->ret->f) : "f" (f0));
+      break;
+ 
     case 'J':
-	(&call->ret->i)[1] = r1;
-	/* follow through */
+      (&call->ret->i)[1] = r1;
+      (&call->ret->i)[0] = r0;
+      break;
+
     default:
-	call->ret->i = r0;
+      call->ret->i = r0;
+      break;
     }
-    break;
-  }									
+  }
 }
 #endif
 
Index: kaffe/config/arm/trampolines.c
diff -u kaffe/config/arm/trampolines.c:1.5 kaffe/config/arm/trampolines.c:1.6
--- kaffe/config/arm/trampolines.c:1.5	Thu Sep 18 16:46:25 2003
+++ kaffe/config/arm/trampolines.c	Sat Oct 25 12:52:42 2003
@@ -46,18 +46,33 @@
 #else
 C_FUNC_NAME(arm_do_fixup_trampoline) ":				\n"
 #endif
-"	stmdb	sp!,{r0,r1,r2,r3,lr}\n"
+"	stmdb	sp!,{r0,r1,r2,r3,fp,ip,lr}\n"
+"	add	fp, sp, #28\n"
 "	mov	r0,ip\n"
 "	bl	" C_FUNC_NAME(soft_fixup_trampoline) "		\n"
-"	mov	ip, r0\n"
-"	ldmia	sp!,{r0,r1,r2,r3,lr}\n"
-"	mov	pc, ip\n"
+"	str	r0, [sp, #-4]\n"
+"	ldmia	sp!,{r0,r1,r2,r3,fp,ip,lr}\n"
+"	ldr	pc, [sp, #-32]\n"
 
 	END_ASM_FUNC()
 );
 
 #else
-
+/*
+ * We need to create a seperate stack frame for the trampoline
+ * so that we consider it as a seperate function when creating
+ * a backtrace. Therefore, we have to push the fp and adjust it
+ * according to the sp afterwards (we can't use the ip for this,
+ * since that holds the method that is to be translated). Since
+ * kaffe expects the stackframe to also contain the ip (since it's
+ * normally used to save the sp), we have to push that one too,
+ * although this trampoline doesn't use it itself. Removing the
+ * stackframe is a little bit tricky, since we have to restore
+ * all registers, but need to get the tranlated code into pc.
+ * Therefore, the address of the translated code is pushed on
+ * the stack, then the registers are restored and the saved
+ * address is loaded into the pc afterwards.
+ */
 asm(
 	START_ASM_FUNC() C_FUNC_NAME(arm_do_fixup_trampoline) "\n"
 #ifdef __riscos__
@@ -65,12 +80,13 @@
 #else
 C_FUNC_NAME(arm_do_fixup_trampoline) ":				\n"
 #endif
-"	stmdb	sp!,{r0,r1,r2,r3,lr}\n"
+"	stmdb	sp!,{r0,r1,r2,r3,fp,ip,lr}\n"
+"	add	fp, sp, #28\n"
 "	mov	r0,ip\n"
 "	bl	" C_FUNC_NAME(soft_fixup_trampoline) " (PLT)	\n"
-"	mov	ip, r0\n"
-"	ldmia	sp!,{r0,r1,r2,r3,lr}\n"
-"	mov	pc, ip\n"
+"	str	r0, [sp, #-4]\n"
+"	ldmia	sp!,{r0,r1,r2,r3,fp,ip,lr}\n"
+"	ldr	pc, [sp, #-32]\n"
 
 	END_ASM_FUNC()
 );
Index: kaffe/config/arm/linux/jit-md.h
diff -u kaffe/config/arm/linux/jit-md.h:1.6 kaffe/config/arm/linux/jit-md.h:1.7
--- kaffe/config/arm/linux/jit-md.h:1.6	Tue Sep 30 19:50:54 2003
+++ kaffe/config/arm/linux/jit-md.h	Sat Oct 25 12:52:42 2003
@@ -18,34 +18,7 @@
 #include "arm/jit.h"
 
 #undef FIRSTFRAME
-#define FIRSTFRAME(f, o) (f) = *(exceptionFrame *)__builtin_frame_address(0)
-
-/**/
-/* Extra exception handling information. */
-/**/
-#if defined(HAVE_FEATURES_H)
-#include <features.h>
-#endif
-#if defined(HAVE_ASM_SIGNAL_H) && !defined(__GLIBC__)
-#include <asm/signal.h>
-#endif
-#if defined(HAVE_SIGNAL_H)
-#include <signal.h>
-#endif
-#if defined(HAVE_ASM_SIGCONTEXT_H) && !defined(__GLIBC__)
-#include <asm/sigcontext.h>
-#endif
-#if defined(HAVE_SIGCONTEXT_H)
-#include <sigcontext.h>
-#endif
-
-/*
- * newer Linux kernel actually implement SA_SIGINFO.
- * But we don't need it, so let's turn it off
- */
-#if defined(SA_SIGINFO)
-#undef SA_SIGINFO
-#endif
+#define FIRSTFRAME(f, o) (f) = *(exceptionFrame *)((uintp)__builtin_frame_address(0) - sizeof(exceptionFrame))
 
 #define EXCEPTIONPROTO SIGNAL_ARGS(sig, ctx)
 
Index: kaffe/config/arm/linux/md.h
diff -u kaffe/config/arm/linux/md.h:1.5 kaffe/config/arm/linux/md.h:1.6
--- kaffe/config/arm/linux/md.h:1.5	Tue Sep 30 19:50:54 2003
+++ kaffe/config/arm/linux/md.h	Sat Oct 25 12:52:42 2003
@@ -15,16 +15,31 @@
 #include "arm/common.h"
 #include "arm/threads.h"
 
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
+#ifdef HAVE_SIGCONTEXT_H
+#include <sigcontext.h>
+#endif
+
+/*
+ * newer Linux kernel actually implement SA_SIGINFO.
+ * But we don't need it, so let's turn it off
+ */
+#if defined(SA_SIGINFO)
+#undef SA_SIGINFO
+#endif
 
 /* Function prototype for signal handlers */
 #if defined(HAVE_STRUCT_SIGCONTEXT_STRUCT) && !defined(__GLIBC__)
 /* Linux < 2.1.1 */
 #define	SIGNAL_ARGS(sig, ctx) \
-	int sig, struct sigcontext_struct ctx
+	int sig, int arm_r1, int arm_r2, int arm_r3, struct sigcontext_struct ctx
 #elif defined(HAVE_STRUCT_SIGCONTEXT) || defined(__GLIBC__)
 /* Linux >= 2.1.1  or Linux 2.0.x with glibc2 */
 #define	SIGNAL_ARGS(sig, ctx) \
-	int sig, struct sigcontext ctx
+	int sig, int arm_r1, int arm_r2, int arm_r3, struct sigcontext ctx
 #else
 #error Do not know how to define SIGNAL_ARGS
 #endif
Index: kaffe/config/sparc/jit.h
diff -u kaffe/config/sparc/jit.h:1.7 kaffe/config/sparc/jit.h:1.8
--- kaffe/config/sparc/jit.h:1.7	Sun Oct  5 00:21:51 2003
+++ kaffe/config/sparc/jit.h	Sat Oct 25 12:52:43 2003
@@ -66,7 +66,7 @@
 "		mov %2,%%fp \n"						\
 "		jmpl %1,%%g0 \n"					\
 "		restore	%0,0,%%o0 \n"					\
-	" : : "r" (o1=(int)(O)), "r" (o2=(int)(H)), "r" (o3=(int)(F))); \
+	: : "r" (o1=(int)(O)), "r" (o2=(int)(H)), "r" (o3=(int)(F))); \
         asm volatile("" : : "r"(o1), "r"(o2), "r"(o3)); 		\
 } while (0)
 
Index: kaffe/include/jni.h
diff -u kaffe/include/jni.h:1.22 kaffe/include/jni.h:1.23
--- kaffe/include/jni.h:1.22	Sat Aug 30 23:57:09 2003
+++ kaffe/include/jni.h	Sat Oct 25 12:52:39 2003
@@ -324,7 +324,7 @@
 	void*	reserved1;
 	void*	reserved2;
 	jint	(*DestroyJavaVM)		(JavaVM*);
-	jint	(*AttachCurrentThread)		(JavaVM*, JNIEnv**, ThreadAttachArgs*);
+	jint	(*AttachCurrentThread)		(JavaVM*, void**, ThreadAttachArgs*);
 	jint	(*DetachCurrentThread)		(JavaVM*);
 	jint	(*GetEnv)			(JavaVM*, void**, jint);
 	void*	reserved3; // AttachCurrentThreadAsDaemon
@@ -547,6 +547,12 @@
 
 struct JavaVM_ {
 	const struct JNIInvokeInterface*	functions;
+#ifdef __cplusplus
+        jint    DestroyJavaVM(void);
+        jint    AttachCurrentThread(void**, ThreadAttachArgs*);
+        jint    DetachCurrentThread(void);
+        jint    GetEnv(void**, jint);
+#endif
 };
 
 struct JavaVMInitArgs {
Index: kaffe/include/jni_cpp.h
diff -u kaffe/include/jni_cpp.h:1.6 kaffe/include/jni_cpp.h:1.7
--- kaffe/include/jni_cpp.h:1.6	Mon Aug 25 19:14:34 2003
+++ kaffe/include/jni_cpp.h	Sat Oct 25 12:52:39 2003
@@ -1206,4 +1206,23 @@
 	return (functions->ExceptionCheck(this));
 }
 
+inline jint JavaVM::DestroyJavaVM(void)
+{
+	return (functions->DestroyJavaVM(this));
+}
+
+inline jint JavaVM::AttachCurrentThread(void** env, ThreadAttachArgs* args)
+{
+	return (functions->AttachCurrentThread(this, env, args));
+}
+
+inline jint JavaVM::DetachCurrentThread(void)
+{
+	return (functions->DetachCurrentThread(this));
+}
+
+inline jint JavaVM::GetEnv(void** envPtr, jint version)
+{
+	return (functions->GetEnv(this, envPtr, version));
+}
 #endif
Index: kaffe/kaffe/kaffevm/access.c
diff -u kaffe/kaffe/kaffevm/access.c:1.3 kaffe/kaffe/kaffevm/access.c:1.4
--- kaffe/kaffe/kaffevm/access.c:1.3	Mon Sep 22 15:31:24 2003
+++ kaffe/kaffe/kaffevm/access.c	Sat Oct 25 12:52:38 2003
@@ -106,6 +106,8 @@
 		/* Same class. */
 		class_acc = 1;
 		slot_acc = 1;
+
+		return 1;
 	}
 	else if( target->accflags & ACC_PUBLIC )
 	{
@@ -116,7 +118,29 @@
 	{
 		class_acc = 1;
 	}
+	else if( (target->this_inner_index >= 0) &&
+		 (target->accflags & ACC_PROTECTED) )
+	{
+		/* check whether target is non private innerclass of superclass */
+		innerClass *ic = &target->inner_classes[target->this_inner_index];
+
+		if( ic->outer_class )
+		{
+			Hjava_lang_Class *outer;
+			errorInfo einfo;
 
+			outer = getClass(ic->outer_class, target, &einfo);
+			if( outer != NULL )
+			{
+				class_acc = instanceof(outer, context);
+			}
+			else
+			{
+				discardErrorInfo(&einfo);
+			}
+		}
+	}
+	
 	if((context->packageLength == target->packageLength) &&
 	    !strncmp(context->name->data,
 		     target->name->data,
@@ -147,7 +171,7 @@
 		 same_package &&
 		 (target->this_inner_index >= 0) )
 	{
-		slot_acc = 1;
+ 		slot_acc = 1;
 	}
 	else if( context->this_inner_index >= 0 )
 	{
Index: kaffe/libraries/clib/net/Makefile.am
diff -u kaffe/libraries/clib/net/Makefile.am:1.13 kaffe/libraries/clib/net/Makefile.am:1.14
--- kaffe/libraries/clib/net/Makefile.am:1.13	Sat Aug 30 14:18:25 2003
+++ kaffe/libraries/clib/net/Makefile.am	Sat Oct 25 12:52:40 2003
@@ -10,7 +10,7 @@
 
 AM_CPPFLAGS = -I$(top_srcdir)/kaffe -I$(top_builddir)/include
 
-libnet_la_LDFLAGS = $(KLIBFLAGS) -module -release $(KVER) -export-symbols-regex "^([Jj]ava|kaffe)_"
+libnet_la_LDFLAGS = $(KLIBFLAGS) -module -release $(KVER) -export-symbols-regex "^([Jj]ava|kaffe|gnu)_"
 libnet_la_LIBADD = $(NET_LIBS)  $(top_builddir)/replace/libreplace.la
 libnet_la_SOURCES = \
 	InetAddressImpl.c \
Index: kaffe/libraries/clib/net/Makefile.in
diff -u kaffe/libraries/clib/net/Makefile.in:1.86 kaffe/libraries/clib/net/Makefile.in:1.87
--- kaffe/libraries/clib/net/Makefile.in:1.86	Sun Aug 31 22:09:15 2003
+++ kaffe/libraries/clib/net/Makefile.in	Sat Oct 25 12:52:40 2003
@@ -251,7 +251,7 @@
 
 AM_CPPFLAGS = -I$(top_srcdir)/kaffe -I$(top_builddir)/include
 
-libnet_la_LDFLAGS = $(KLIBFLAGS) -module -release $(KVER) -export-symbols-regex "^([Jj]ava|kaffe)_"
+libnet_la_LDFLAGS = $(KLIBFLAGS) -module -release $(KVER) -export-symbols-regex "^([Jj]ava|kaffe|gnu)_"
 libnet_la_LIBADD = $(NET_LIBS)  $(top_builddir)/replace/libreplace.la
 libnet_la_SOURCES = \
 	InetAddressImpl.c \
Index: kaffe/libraries/javalib/java/awt/MouseEvt.java
diff -u kaffe/libraries/javalib/java/awt/MouseEvt.java:1.7 kaffe/libraries/javalib/java/awt/MouseEvt.java:1.8
--- kaffe/libraries/javalib/java/awt/MouseEvt.java:1.7	Wed Feb 19 15:27:23 2003
+++ kaffe/libraries/javalib/java/awt/MouseEvt.java	Sat Oct 25 12:52:39 2003
@@ -58,10 +58,9 @@
 static Component computeMouseTarget ( Container toplevel, int x, int y ) {
 	Container  cntr;
 	Component  c, tgt;
-	int        i, xm = 0, ym = 0, u, v;
+	int        i, xm = 0, ym = 0;
 	
 	tgt = cntr = toplevel;
-	xMouseTgt = yMouseTgt = 0;
 
 	// This is a workaround for no-native-wm Frames with childs extending the Frame size
 	// (the Frame deco border is no separate Component, just "protected" by the Frame insets)
@@ -77,8 +76,8 @@
 		if ( ((c.flags & Component.IS_SHOWING) == Component.IS_SHOWING) &&
 		     (x >= c.x) && (y >= c.y) && (x <= (c.x+c.width)) && (y <= (c.y+c.height)) ) {
 
-			u = x - c.x;
-			v = y - c.y;
+			int u = x - c.x;
+			int v = y - c.y;
 
 			if ( c.contains( u, v) ){  // contains() might be reimplemented
 
@@ -104,8 +103,6 @@
 					// so it gets the event, whether it cn handle
 					// it, or not.
 					tgt = c;
-					xMouseTgt = xm;
-					yMouseTgt = ym;
 
 					break;
 				}
@@ -113,7 +110,10 @@
 		}
 		i++;
 	}
-	
+
+	xMouseTgt = xm;
+	yMouseTgt = ym;
+
 	return tgt;
 }
 
Index: kaffe/libraries/javalib/java/net/URLClassLoader.java
diff -u kaffe/libraries/javalib/java/net/URLClassLoader.java:1.12 kaffe/libraries/javalib/java/net/URLClassLoader.java:1.13
--- kaffe/libraries/javalib/java/net/URLClassLoader.java:1.12	Sat Sep 13 21:30:14 2003
+++ kaffe/libraries/javalib/java/net/URLClassLoader.java	Sat Oct 25 12:52:40 2003
@@ -227,6 +227,8 @@
 			jarFiles.put(url, file);
 			return file;
 		    }
+
+		    return null;
 		}
 
 		// Download JAR file




More information about the kaffe mailing list