[kaffe] CVS kaffe (dalibor): Factored code from macros into inline functions

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Fri Feb 27 10:25:03 2004


PatchSet 4468 
Date: 2004/02/27 18:12:51
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Factored code from macros into inline functions

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

        * kaffe/kaffevm/verify.c
        (getIdx, getWIdx): New static inline functions.
        (GET_IDX) Use getIdx.
        (GET_WIDX) Use getWIdx.

Members: 
	ChangeLog:1.2048->1.2049 
	kaffe/kaffevm/verify.c:1.61->1.62 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2048 kaffe/ChangeLog:1.2049
--- kaffe/ChangeLog:1.2048	Fri Feb 27 16:21:18 2004
+++ kaffe/ChangeLog	Fri Feb 27 18:12:51 2004
@@ -1,6 +1,13 @@
 2004-02-27  Dalibor Topic <robilad@kaffe.org>
 
         * kaffe/kaffevm/verify.c
+        (getIdx, getWIdx): New static inline functions.
+	(GET_IDX) Use getIdx.
+	(GET_WIDX) Use getWIdx.
+
+2004-02-27  Dalibor Topic <robilad@kaffe.org>
+
+        * kaffe/kaffevm/verify.c
         (getDWord): New static inline function.
         (DWORD) Removed.
         Replaced use of DWORD by getDWord.
Index: kaffe/kaffe/kaffevm/verify.c
diff -u kaffe/kaffe/kaffevm/verify.c:1.61 kaffe/kaffe/kaffevm/verify.c:1.62
--- kaffe/kaffe/kaffevm/verify.c:1.61	Fri Feb 27 16:21:19 2004
+++ kaffe/kaffe/kaffevm/verify.c	Fri Feb 27 18:12:53 2004
@@ -1382,6 +1382,26 @@
 }
 
 /*
+ * Helper function for byte code access.
+ */
+static inline
+uint32
+getIdx(const unsigned char * code, const uint32 pc)
+{
+	return ((uint32) code[pc + 1]);
+}
+
+/*
+ * Helper function for byte code access.
+ */
+static inline
+uint32
+getWIdx(const unsigned char * code, const uint32 pc)
+{
+	return ((uint32) getWord(code, pc + 1));
+}
+
+/*
  * verifyMethod3a()
  *     check static constraints.  section 4.8.1 of JVML Spec 2.
  *
@@ -1408,15 +1428,14 @@
 	if (_IDX > pool->size) { \
 		return verifyErrorInVerifyMethod3a(einfo, method, "attempt to access a constant pool index beyond constant pool range"); \
 	}
+
 	
 #define GET_IDX(_IDX, _PC) \
-	(_IDX) = (_PC) + 1; \
-	(_IDX) = code[_IDX]; \
+	(_IDX) = getIdx(code, _PC); \
 	CHECK_POOL_IDX(_IDX)
-	
+
 #define GET_WIDX(_IDX, _PC) \
-	_IDX = (_PC) + 1; \
-	_IDX = getWord(code, _IDX); \
+	_IDX = getWIdx(code, _PC); \
 	CHECK_POOL_IDX(_IDX)
 
 #define BRANCH_IN_BOUNDS(_N, _INST) \