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

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Sun Feb 15 06:40:04 2004


PatchSet 4422 
Date: 2004/02/15 14:24:29
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Replaced macro by static inline function

2004-02-15  Dalibor Topic <robilad@kaffe.org>

        * kaffe/kaffevm/verify.c
        (verifyErrorInVerifyMethod3b): New static inline function.
        (VERIFY_ERROR) Removed.
        Replaced use of VERIFY_ERROR by verifyErrorInVerifyMethod3b.

Members: 
	ChangeLog:1.2005->1.2006 
	kaffe/kaffevm/verify.c:1.38->1.39 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2005 kaffe/ChangeLog:1.2006
--- kaffe/ChangeLog:1.2005	Sat Feb 14 18:50:20 2004
+++ kaffe/ChangeLog	Sun Feb 15 14:24:29 2004
@@ -1,3 +1,10 @@
+2004-02-15  Dalibor Topic <robilad@kaffe.org>
+
+        * kaffe/kaffevm/verify.c
+        (verifyErrorInVerifyMethod3b): New static inline function.
+        (VERIFY_ERROR) Removed.
+        Replaced use of VERIFY_ERROR by verifyErrorInVerifyMethod3b.
+
 2004-02-14  Guilhem Lavaux <guilhem@kaffe.org>
 
 	* libraries/javalib/kjc.jar: Regenerated.
Index: kaffe/kaffe/kaffevm/verify.c
diff -u kaffe/kaffe/kaffevm/verify.c:1.38 kaffe/kaffe/kaffevm/verify.c:1.39
--- kaffe/kaffe/kaffevm/verify.c:1.38	Fri Feb 13 09:57:03 2004
+++ kaffe/kaffe/kaffevm/verify.c	Sun Feb 15 14:24:30 2004
@@ -2019,6 +2019,22 @@
 
 
 /*
+ * Helper function for error reporting in verifyMethod3b
+ */
+static inline 
+bool
+verifyErrorInVerifyMethod3b(errorInfo* einfo, const Method* method, BlockInfo* curBlock, const char * msg)
+{
+        KFREE(curBlock);
+        if (einfo->type == 0) {
+        	postExceptionMessage(einfo, JAVA_LANG(VerifyError),
+				     "in method \"%s.%s\": %s",
+				     CLASS_CNAME(method->class), METHOD_NAMED(method), msg);
+	}
+	return(false);
+}
+
+/*
  * verifyMethod3b()
  *    The Data-flow Analyzer
  *
@@ -2080,18 +2096,8 @@
 	
 	uint32 curIndex;
 	BlockInfo* curBlock;
-	BlockInfo* nextBlock;
-	
-#define VERIFY_ERROR(_MSG) \
-        KFREE(curBlock); \
-        if (einfo->type == 0) { \
-        	postExceptionMessage(einfo, JAVA_LANG(VerifyError), \
-				     "in method \"%s.%s\": %s", \
-				     CLASS_CNAME(method->class), METHOD_NAMED(method), _MSG); \
-	} \
-	return(false)
-	
-	
+	BlockInfo* nextBlock;	
+
 	uint32 pc = 0, newpc = 0, n = 0;
 	int32 high = 0, low = 0;  /* for the switching instructions */
 	
@@ -2127,12 +2133,12 @@
 		copyBlockData(method, blocks[curIndex], curBlock);
 		
 		if (curBlock->status & EXCEPTION_HANDLER && curBlock->stacksz > 0) {
-			VERIFY_ERROR("it's possible to reach an exception handler with a nonempty stack");
+			return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "it's possible to reach an exception handler with a nonempty stack");
 		}
 		
 		
 		if (!verifyBasicBlock(einfo, method, curBlock, sigs, uninits)) {
-			VERIFY_ERROR("failure to verify basic block");
+			return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "failure to verify basic block");
 		}
 		
 		
@@ -2153,7 +2159,7 @@
 				nextBlock = inWhichBlock(newpc, blocks, numBlocks);
 				
 				if (!merge(einfo, method, curBlock, nextBlock)) {
-					VERIFY_ERROR("error merging operand stacks");
+					return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "error merging operand stacks");
 				}
 				break;
 				
@@ -2163,7 +2169,7 @@
 				nextBlock = inWhichBlock(newpc, blocks, numBlocks);
 				
 				if (!merge(einfo, method, curBlock, nextBlock)) {
-					VERIFY_ERROR("error merging operand stacks");
+					return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "error merging operand stacks");
 				}
 				break;
 					
@@ -2178,7 +2184,7 @@
 				nextBlock = inWhichBlock(newpc, blocks, numBlocks);
 				
 				if (!merge(einfo, method, curBlock, nextBlock)) {
-					VERIFY_ERROR("jsr: error merging operand stacks");
+					return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "jsr: error merging operand stacks");
 				}
 	
 				/*
@@ -2197,7 +2203,7 @@
 				}
 				
 				if (!IS_ADDRESS(&curBlock->locals[n])) {
-					VERIFY_ERROR("ret instruction does not refer to a variable with type returnAddress");
+					return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "ret instruction does not refer to a variable with type returnAddress");
 				}
 				
 				newpc = curBlock->locals[n].tinfo;
@@ -2207,7 +2213,7 @@
 				
 				nextBlock = inWhichBlock(newpc, blocks, numBlocks);
 				if (!merge(einfo, method, curBlock, nextBlock)) {
-					VERIFY_ERROR("error merging opstacks when returning from a subroutine");
+					return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "error merging opstacks when returning from a subroutine");
 				}
 
 				/* 
@@ -2230,16 +2236,16 @@
 				nextBlock = inWhichBlock(newpc, blocks, numBlocks);
 				
 				if (!merge(einfo, method, curBlock, nextBlock)) {
-					VERIFY_ERROR("error merging operand stacks");
+					return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "error merging operand stacks");
 				}
 				
 				/* if the condition is false, then the next block is the one that will be executed */
 				curIndex++;
 				if (curIndex >= numBlocks) {
-					VERIFY_ERROR("execution falls off the end of a basic block");
+					return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "execution falls off the end of a basic block");
 				}
 				else if (!merge(einfo, method, curBlock, blocks[curIndex])) {
-					VERIFY_ERROR("error merging operand stacks");
+					return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "error merging operand stacks");
 				}
 				break;
 				
@@ -2254,7 +2260,7 @@
 				newpc = pc + DWORD(code, n);
 				nextBlock = inWhichBlock(newpc, blocks, numBlocks);
 				if (!merge(einfo, method, curBlock, nextBlock)) {
-					VERIFY_ERROR("error merging into the default branch of a lookupswitch instruction");
+					return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "error merging into the default branch of a lookupswitch instruction");
 				}
 				
 				/* get number of key/target pairs */
@@ -2266,7 +2272,7 @@
 					newpc = pc + DWORD(code, n+4);
 					nextBlock = inWhichBlock(newpc, blocks, numBlocks);
 					if (!merge(einfo, method, curBlock, nextBlock)) {
-						VERIFY_ERROR("error merging into a branch of a lookupswitch instruction");
+						return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "error merging into a branch of a lookupswitch instruction");
 					}
 				}
 				
@@ -2294,7 +2300,7 @@
 					newpc = pc + DWORD(code, n);
 					nextBlock = inWhichBlock(newpc, blocks, numBlocks);
 					if (!merge(einfo, method, curBlock, nextBlock)) {
-						VERIFY_ERROR("error merging into a branch of a tableswitch instruction");
+						return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "error merging into a branch of a tableswitch instruction");
 					}
 				}
 				break;
@@ -2316,10 +2322,10 @@
 					if (status[n] & IS_INSTRUCTION) break;
 				}
 				if (n == codelen) {
-					VERIFY_ERROR("execution falls off the end of a code block");
+					return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "execution falls off the end of a code block");
 				}
 				else if (!merge(einfo, method, curBlock, blocks[curIndex+1])) {
-					VERIFY_ERROR("error merging operand stacks");
+					return verifyErrorInVerifyMethod3b(einfo, method, curBlock, "error merging operand stacks");
 				}
 			}
 		
@@ -2335,7 +2341,6 @@
 	KFREE(curBlock);
 	return(true);
 	
-#undef VERIFY_ERROR
 #undef RETURN_3B
 }