[kaffe] CVS kaffe (dalibor): Replaces NEXTPC macro by inline function

Kaffe CVS cvs-commits at kaffe.org
Sat Feb 28 07:00:03 PST 2004


PatchSet 4470 
Date: 2004/02/28 14:39:13
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Replaces NEXTPC macro by inline function

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

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

Members: 
	ChangeLog:1.2050->1.2051 
	kaffe/kaffevm/verify.c:1.62->1.63 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2050 kaffe/ChangeLog:1.2051
--- kaffe/ChangeLog:1.2050	Sat Feb 28 13:15:27 2004
+++ kaffe/ChangeLog	Sat Feb 28 14:39:13 2004
@@ -1,3 +1,10 @@
+2004-02-28  Dalibor Topic <robilad at kaffe.org>
+
+        * kaffe/kaffevm/verify.c
+        (getNextPC): New static inline function.
+        (NEXTPC) Removed.
+        Replaced use of NEXTPC by getNextPC.
+
 2004-02-28    Guilhem Lavaux <guilhem at kaffe.org>
 
 	* java/text/AttributedStringIterator.java
Index: kaffe/kaffe/kaffevm/verify.c
diff -u kaffe/kaffe/kaffevm/verify.c:1.62 kaffe/kaffe/kaffevm/verify.c:1.63
--- kaffe/kaffe/kaffevm/verify.c:1.62	Fri Feb 27 18:12:53 2004
+++ kaffe/kaffe/kaffevm/verify.c	Sat Feb 28 14:39:16 2004
@@ -1402,6 +1402,16 @@
 }
 
 /*
+ * Helper function for pc access.
+ */
+static inline
+uint32
+getNextPC(const unsigned char * code, const uint32 pc)
+{
+	return (pc + insnLen[code[pc]]);
+}
+
+/*
  * verifyMethod3a()
  *     check static constraints.  section 4.8.1 of JVML Spec 2.
  *
@@ -1458,7 +1468,6 @@
 	unsigned char* code = METHOD_BYTECODE_CODE(method);
 	
 	uint32 pc = 0, newpc = 0, n = 0, idx = 0;
-#define NEXTPC (pc + insnLen[code[pc]])
 	int32 branchoffset = 0;
 	int32 low, high;
 	
@@ -1798,7 +1807,7 @@
 			ENSURE_NON_WIDE;
 			status[pc] |= END_BLOCK;
 			
-			newpc = NEXTPC;
+			newpc = getNextPC(code, pc);
 			BRANCH_IN_BOUNDS(newpc, "if<condition> = false");
 			status[newpc] |= START_BLOCK;
 			
@@ -1826,7 +1835,7 @@
 			status[newpc] |= START_BLOCK;
 			
 			/* the next instruction is a target for branching via RET */
-			pc = NEXTPC;
+			pc = getNextPC(code, pc);
 			BRANCH_IN_BOUNDS(pc, "jsr/ret");
 			status[pc] |= START_BLOCK;
 			continue;
@@ -1845,7 +1854,7 @@
 				pc += 2;
 			}
 			CHECK_LOCAL_INDEX(idx);
-			pc = NEXTPC;
+			pc = getNextPC(code, pc);
 			continue;
 			
 			
@@ -1958,7 +1967,7 @@
 			}
 		}
 		
-		pc = NEXTPC;
+		pc = getNextPC(code, pc);
 	}
 	
 	
@@ -2066,7 +2075,6 @@
 	
 	
 #undef CHECK_LOCAL_INDEX	
-#undef NEXTPC
 #undef BRANCH_IN_BOUNDS
 #undef GET_IDX
 #undef GET_WIDX




More information about the kaffe mailing list