[kaffe] CVS kaffe (dalibor): Replaced macro by static inline function

Kaffe CVS cvs-commits at kaffe.org
Thu Feb 12 10:27:01 PST 2004


PatchSet 4419 
Date: 2004/02/12 18:11:05
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Replaced macro by static inline function

2004-02-12  Dalibor Topic <robilad at kaffe.org>

        * kaffe/kaffevm/verify.c
        (failInVerifyMethod): New static inline function.
        (FAIL) Removed.
        Replaced use of FAIL by failInVerifyMethod.
        (cleanupInVerifyMethod) Always derefence numBlocks before use.

Members: 
	ChangeLog:1.2002->1.2003 
	kaffe/kaffevm/verify.c:1.36->1.37 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2002 kaffe/ChangeLog:1.2003
--- kaffe/ChangeLog:1.2002	Thu Feb 12 17:11:41 2004
+++ kaffe/ChangeLog	Thu Feb 12 18:11:05 2004
@@ -1,6 +1,14 @@
 2004-02-12  Dalibor Topic <robilad at kaffe.org>
 
         * kaffe/kaffevm/verify.c
+        (failInVerifyMethod): New static inline function.
+        (FAIL) Removed.
+        Replaced use of FAIL by failInVerifyMethod.
+	(cleanupInVerifyMethod) Always derefence numBlocks before use.
+
+2004-02-12  Dalibor Topic <robilad at kaffe.org>
+
+        * kaffe/kaffevm/verify.c
         (cleanupInVerifyMethod): New static inline function.
         (CLEANUP) Removed.
         Replaced use of CLEANUP by cleanupInVerifyMethod.
Index: kaffe/kaffe/kaffevm/verify.c
diff -u kaffe/kaffe/kaffevm/verify.c:1.36 kaffe/kaffe/kaffevm/verify.c:1.37
--- kaffe/kaffe/kaffevm/verify.c:1.36	Thu Feb 12 17:11:43 2004
+++ kaffe/kaffe/kaffevm/verify.c	Thu Feb 12 18:11:07 2004
@@ -1224,7 +1224,7 @@
 	DBG(VERIFY3, dprintf("    cleaning up..."); );
 	KFREE(status);
 	if (blocks != NULL) {
-		while (numBlocks > 0) {
+		while (*numBlocks > 0) {
 			freeBlock(blocks[--(*numBlocks)]);
 		}
 		KFREE(blocks);
@@ -1234,6 +1234,20 @@
         DBG(VERIFY3, dprintf(" done\n"); );
 }
 
+static inline
+bool
+failInVerifyMethod(errorInfo *einfo, Method* method, uint32* status, SigStack* sigs, UninitializedType* uninits, uint32* numBlocks, BlockInfo ** blocks)
+{
+        DBG(VERIFY3, dprintf("    Verify Method 3b: %s.%s%s: FAILED\n",
+			     CLASS_CNAME(method->class), METHOD_NAMED(method), METHOD_SIGD(method)); );
+	if (einfo->type == 0) {
+		DBG(VERIFY3, dprintf("      DBG ERROR: should have raised an exception\n"); );
+		postException(einfo, JAVA_LANG(VerifyError));
+	}
+        cleanupInVerifyMethod(status, sigs, uninits, numBlocks, blocks);
+        return(false);
+}
+
 /*
  * Controls the verification of a single method.  It allocates most of the memory needed for
  * verification (when encountering JSRs, more memory will need to be allocated later),
@@ -1257,17 +1271,6 @@
 	uint32      numBlocks = 0;
 	BlockInfo** blocks    = NULL;
 	
-#define FAIL \
-        DBG(VERIFY3, dprintf("    Verify Method 3b: %s.%s%s: FAILED\n", \
-			     CLASS_CNAME(method->class), METHOD_NAMED(method), METHOD_SIGD(method)); ); \
-	if (einfo->type == 0) { \
-		DBG(VERIFY3, dprintf("      DBG ERROR: should have raised an exception\n"); ); \
-		postException(einfo, JAVA_LANG(VerifyError)); \
-	} \
-        cleanupInVerifyMethod(status, sigs, uninits, &numBlocks, blocks); \
-        return(false)
-	
-	
 	/**************************************************************************************************
 	 * Memory Allocation
 	 **************************************************************************************************/
@@ -1281,7 +1284,7 @@
 		DBG(VERIFY3, dprintf("        some kinda error finding the basic blocks in pass 3a\n"); );
 		
 		/* propagate error */
-		FAIL;
+		return failInVerifyMethod(einfo, method, status, sigs, uninits, &numBlocks, blocks);
 	}
 	
 	DBG(VERIFY3, dprintf("        done allocating memory\n"); );
@@ -1293,7 +1296,7 @@
 	DBG(VERIFY3, dprintf("    about to load initial args...\n"); );
 	if (!loadInitialArgs(method, einfo, blocks[0], &sigs, &uninits)) {
 	        /* propagate error */
-		FAIL;
+		return failInVerifyMethod(einfo, method, status, sigs, uninits, &numBlocks, blocks);
 	}
 	DBG(VERIFY3, {
 	        /* print out the local arguments */
@@ -1309,15 +1312,12 @@
 	if (!verifyMethod3b(einfo, method,
 			    status, blocks, numBlocks,
 			    &sigs, &uninits)) {
-		FAIL;
+		return failInVerifyMethod(einfo, method, status, sigs, uninits, &numBlocks, blocks);
 	}
 	
 	cleanupInVerifyMethod(status, sigs, uninits, &numBlocks, blocks);
 	DBG(VERIFY3, dprintf("    Verify Method 3b: done\n"); );
 	return(true);
-	
-
-#undef FAIL
 }
 
 




More information about the kaffe mailing list