[kaffe] CVS kaffe (robilad): Various small cleanups and warning fixes

Kaffe CVS cvs-commits at kaffe.org
Sat Feb 5 01:27:21 PST 2005


PatchSet 5972 
Date: 2005/02/05 09:22:37
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Various small cleanups and warning fixes

2005-02-05  Dalibor Topic  <robilad at kaffe.org>

        * kaffe/kaffevm/exception.h: Removed explicit
        prototypes for the inline functions.

        * kaffe/kaffevm/external.h: Added missing include.

        * kaffe/kaffevm/intrp/icode.h (UNINITIALIZED_STACK_SLOT):
        New contant (available for debug code).
        (check_array_index) Added additional asserts in debug
        mode.

        * kaffe/kaffevm/intrp/machine.c (engine_name): Made const.
        (check_null) Use EXPLICIT_CHECK_NULL in debug mode.
        (virtualMachine) Use UNINITIALIZED_STACK_SLOT.

        * kaffe/kaffevm/systems/unix-pthreads/jsignal.h
        (detectStackBoundaries) : Removed redundant prototype.

        * libraries/clib/native/gnu_classpath_VMSystemProperties.c
        (Java_gnu_classpath_VMSystemProperties_getKaffeLibraryPath):
        Simplified.

Members: 
	ChangeLog:1.3511->1.3512 
	kaffe/kaffevm/exception.h:1.29->1.30 
	kaffe/kaffevm/external.h:1.10->1.11 
	kaffe/kaffevm/intrp/icode.h:1.22->1.23 
	kaffe/kaffevm/intrp/machine.c:1.46->1.47 
	kaffe/kaffevm/systems/unix-pthreads/jsignal.h:1.5->1.6 
	libraries/clib/native/gnu_classpath_VMSystemProperties.c:1.2->1.3 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3511 kaffe/ChangeLog:1.3512
--- kaffe/ChangeLog:1.3511	Fri Feb  4 15:20:09 2005
+++ kaffe/ChangeLog	Sat Feb  5 09:22:37 2005
@@ -1,3 +1,26 @@
+2005-02-05  Dalibor Topic  <robilad at kaffe.org>
+
+	* kaffe/kaffevm/exception.h: Removed explicit
+	prototypes for the inline functions.
+
+	* kaffe/kaffevm/external.h: Added missing include.
+
+	* kaffe/kaffevm/intrp/icode.h (UNINITIALIZED_STACK_SLOT):
+	New contant (available for debug code).
+	(check_array_index) Added additional asserts in debug 
+	mode.
+
+	* kaffe/kaffevm/intrp/machine.c (engine_name): Made const.
+	(check_null) Use EXPLICIT_CHECK_NULL in debug mode.
+	(virtualMachine) Use UNINITIALIZED_STACK_SLOT.
+
+	* kaffe/kaffevm/systems/unix-pthreads/jsignal.h
+	(detectStackBoundaries) : Removed redundant prototype.
+
+	* libraries/clib/native/gnu_classpath_VMSystemProperties.c
+	(Java_gnu_classpath_VMSystemProperties_getKaffeLibraryPath):
+	Simplified.
+
 2005-02-04  Jim Huang  <jserv at kaffe.org>
 
 	* FAQ/FAQ.awt:
Index: kaffe/kaffe/kaffevm/exception.h
diff -u kaffe/kaffe/kaffevm/exception.h:1.29 kaffe/kaffe/kaffevm/exception.h:1.30
--- kaffe/kaffe/kaffevm/exception.h:1.29	Sun Jan 30 12:42:40 2005
+++ kaffe/kaffe/kaffevm/exception.h	Sat Feb  5 09:22:41 2005
@@ -105,17 +105,6 @@
 
 extern void initExceptions(void);
 
-static inline bool vmExcept_isJNIFrame(VmExceptHandler* eh) __UNUSED__;
-static inline bool vmExcept_JNIContains(VmExceptHandler* eh, uintp fp) __UNUSED__;
-static inline void vmExcept_setJNIFrame(VmExceptHandler* eh, uintp fp) __UNUSED__;
-static inline struct _methods* vmExcept_getMeth(VmExceptHandler* eh) __UNUSED__;
-static inline void vmExcept_setMeth(VmExceptHandler* eh, struct _methods* m) __UNUSED__;
-static inline void vmExcept_setSyncObj(VmExceptHandler* eh, struct Hjava_lang_Object* syncobj) __UNUSED__;
-static inline struct Hjava_lang_Object* vmExcept_getSyncObj(VmExceptHandler* eh) __UNUSED__;
-static inline void vmExcept_setPC(volatile VmExceptHandler* eh, u4 pc) __UNUSED__;
-static inline u4 vmExcept_getPC(const VmExceptHandler* eh) __UNUSED__;
-static inline void vmExcept_jumpToHandler(VmExceptHandler* frame) __UNUSED__ NONRETURNING;
-
 static inline bool
 vmExcept_isJNIFrame(VmExceptHandler* eh)
 {
Index: kaffe/kaffe/kaffevm/external.h
diff -u kaffe/kaffe/kaffevm/external.h:1.10 kaffe/kaffe/kaffevm/external.h:1.11
--- kaffe/kaffe/kaffevm/external.h:1.10	Tue Dec 21 16:51:05 2004
+++ kaffe/kaffe/kaffevm/external.h	Sat Feb  5 09:22:41 2005
@@ -12,6 +12,7 @@
 #ifndef __external_h
 #define __external_h
 
+#include "java_lang_ClassLoader.h"
 #include "gtypes.h"
 
 #define	MAXSTUBLEN	1024
Index: kaffe/kaffe/kaffevm/intrp/icode.h
diff -u kaffe/kaffe/kaffevm/intrp/icode.h:1.22 kaffe/kaffe/kaffevm/intrp/icode.h:1.23
--- kaffe/kaffe/kaffevm/intrp/icode.h:1.22	Fri Feb  4 14:43:23 2005
+++ kaffe/kaffe/kaffevm/intrp/icode.h	Sat Feb  5 09:22:42 2005
@@ -15,6 +15,10 @@
 #include "slots.h"
 #include "soft.h"
 
+#if defined(KAFFE_VMDEBUG)
+static const int32 UNINITIALIZED_STACK_SLOT = 0x00c0ffee;
+#endif
+
 #define	move_long_const(t, c)			(t)[0].v.tlong = (c)
 #define	add_long(t, f1, f2)			(t)[0].v.tlong = (f1)[0].v.tlong + (f2)[0].v.tlong
 #define	sub_long(t, f1, f2)			(t)[0].v.tlong = (f1)[0].v.tlong - (f2)[0].v.tlong
@@ -319,6 +323,23 @@
 {
 	const jint array_index = index_slot->v.tint;
 	const void* array_reference = array_slot->v.taddr;
+
+#if defined(KAFFE_VMDEBUG)
+	/* Make sure that array reference is valid.
+	 * Check for NULL first. 
+	 *
+	 * The check only works in debug mode, as on most 
+	 * platforms we rely on the MMU to detect NULL.
+	 */
+	assert(array_reference != NULL);
+	/* Then check if array_reference 
+	 * comes from an uninitialized stack slot.
+	 *
+	 * The check only works in debug mode, as then the 
+	 * stack is filled with 0xc0ffee.
+	 */
+	assert(array_reference != (void *) UNINITIALIZED_STACK_SLOT);
+#endif
 
 	if (array_index < 0 ||
 	    array_index >= ARRAY_SIZE(array_reference))
Index: kaffe/kaffe/kaffevm/intrp/machine.c
diff -u kaffe/kaffe/kaffevm/intrp/machine.c:1.46 kaffe/kaffe/kaffevm/intrp/machine.c:1.47
--- kaffe/kaffe/kaffevm/intrp/machine.c:1.46	Sun Jan 30 18:21:40 2005
+++ kaffe/kaffe/kaffevm/intrp/machine.c	Sat Feb  5 09:22:42 2005
@@ -52,7 +52,7 @@
 /*
  * Define information about this engine.
  */
-char* engine_name = "Interpreter";
+const char* engine_name = "Interpreter";
 
 #define	define_insn(code)	break;					\
 				case code:				\
@@ -79,7 +79,12 @@
 /* For JIT3 compatibility */
 #define check_array_store(a,b)		softcall_checkarraystore(a,b)
 #define explicit_check_null(x,obj,y)	EXPLICIT_CHECK_NULL(x,obj,y)
+
+#if defined(KAFFE_VMDEBUG)
+#define check_null(x,obj,y)		EXPLICIT_CHECK_NULL(x,obj,y)
+#else
 #define check_null(x,obj,y)		CHECK_NULL(x,obj,y)
+#endif
 #define check_div(x,obj,y)
 #define check_div_long(x,obj,y)
 
@@ -161,7 +166,7 @@
 	{
 	    int32 *p = (int32 *) &lcl[meth->localsz + meth->stacksz];
 	    while (p-- > (int32*)lcl)
-		*p = 0x00c0ffee;
+		*p = UNINITIALIZED_STACK_SLOT;
 	}
 #endif
 
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/jsignal.h
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/jsignal.h:1.5 kaffe/kaffe/kaffevm/systems/unix-pthreads/jsignal.h:1.6
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/jsignal.h:1.5	Wed Dec 29 16:27:43 2004
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/jsignal.h	Sat Feb  5 09:22:42 2005
@@ -43,6 +43,4 @@
 void blockAsyncSignals(void);
 void unblockAndCheckSignal(int sig);
 
-void detectStackBoundaries(jthread_t jtid, int mainThreadStackSize);
-
 #endif /* UNIXJTHREAD_SIGNAL_H */
Index: kaffe/libraries/clib/native/gnu_classpath_VMSystemProperties.c
diff -u kaffe/libraries/clib/native/gnu_classpath_VMSystemProperties.c:1.2 kaffe/libraries/clib/native/gnu_classpath_VMSystemProperties.c:1.3
--- kaffe/libraries/clib/native/gnu_classpath_VMSystemProperties.c:1.2	Tue Dec 21 02:43:11 2004
+++ kaffe/libraries/clib/native/gnu_classpath_VMSystemProperties.c	Sat Feb  5 09:22:42 2005
@@ -131,7 +131,10 @@
 Java_gnu_classpath_VMSystemProperties_getKaffeLibraryPath (JNIEnv *env,
                                                            jclass klass __attribute__((__unused__)))
 {
-  return (*env)->NewStringUTF(env, getLibraryPath());
+  const char * path;
+
+  path = getLibraryPath();
+  return (*env)->NewStringUTF(env, path);
 }
 
 JNIEXPORT jstring JNICALL




More information about the kaffe mailing list