[kaffe] CVS kaffe (dalibor): Replaced part of macro by static inline function
Kaffe CVS
Kaffe Mailing List <kaffe@kaffe.org>
Mon Feb 16 05:39:01 2004
PatchSet 4428
Date: 2004/02/16 13:29:53
Author: dalibor
Branch: HEAD
Tag: (none)
Log:
Replaced part of macro by static inline function
2004-02-16 Dalibor Topic <robilad@kaffe.org>
* kaffe/kaffevm/verify.c
(branchInBoundsErrorInVerifyMethod3a,
checkLocalIndexErrorInVerifyMethod3a):
New static inline functions.
(BRANCH_IN_BOUNDS) Use branchInBoundsErrorInVerifyMethod3a.
(CHECK_LOCAL_INDEX) Use checkLocalIndexErrorInVerifyMethod3a.
Members:
ChangeLog:1.2011->1.2012
kaffe/kaffevm/verify.c:1.44->1.45
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2011 kaffe/ChangeLog:1.2012
--- kaffe/ChangeLog:1.2011 Sun Feb 15 19:19:58 2004
+++ kaffe/ChangeLog Mon Feb 16 13:29:53 2004
@@ -1,3 +1,12 @@
+2004-02-16 Dalibor Topic <robilad@kaffe.org>
+
+ * kaffe/kaffevm/verify.c
+ (branchInBoundsErrorInVerifyMethod3a,
+ checkLocalIndexErrorInVerifyMethod3a):
+ New static inline functions.
+ (BRANCH_IN_BOUNDS) Use branchInBoundsErrorInVerifyMethod3a.
+ (CHECK_LOCAL_INDEX) Use checkLocalIndexErrorInVerifyMethod3a.
+
2004-02-15 Dalibor Topic <robilad@kaffe.org>
* kaffe/kaffevm/verify.c
Index: kaffe/kaffe/kaffevm/verify.c
diff -u kaffe/kaffe/kaffevm/verify.c:1.44 kaffe/kaffe/kaffevm/verify.c:1.45
--- kaffe/kaffe/kaffevm/verify.c:1.44 Sun Feb 15 19:19:59 2004
+++ kaffe/kaffe/kaffevm/verify.c Mon Feb 16 13:29:54 2004
@@ -1320,7 +1320,9 @@
return(true);
}
-
+/*
+ * Helper function for error reporting in verifyMethod3a.
+ */
static inline
BlockInfo **
verifyErrorInVerifyMethod3a(errorInfo* einfo,
@@ -1336,6 +1338,39 @@
}
/*
+ * Helper function for error reporting in BRANCH_IN_BOUNDS macro in verifyMethod3a.
+ */
+static inline
+BlockInfo **
+branchInBoundsErrorInVerifyMethod3a(errorInfo* einfo,
+ Method* method,
+ int codelen,
+ int n)
+{
+ DBG(VERIFY3, dprintf("ERROR: branch to (%d) out of bound (%d) \n", n, codelen); );
+ return verifyErrorInVerifyMethod3a(einfo, method, "branch out of method code");
+}
+
+/*
+ * Helper function for error reporting in CHECK_LOCAL_INDEX macro in verifyMethod3a.
+ */
+static inline
+BlockInfo **
+checkLocalIndexErrorInVerifyMethod3a(errorInfo* einfo,
+ Method* method,
+ uint32 pc,
+ unsigned char* code,
+ int n)
+{
+ DBG(VERIFY3,
+ dprintf("ERROR: pc = %d, instruction = ", pc);
+ printInstruction(code[pc]);
+ dprintf(", localsz = %d, localindex = %d\n", method->localsz, n);
+ );
+ return verifyErrorInVerifyMethod3a(einfo, method, "attempting to access a local variable beyond local array");
+}
+
+/*
* verifyMethod3a()
* check static constraints. section 4.8.1 of JVML Spec 2.
*
@@ -1375,21 +1410,14 @@
#define BRANCH_IN_BOUNDS(_N, _INST) \
if (_N < 0 || _N >= codelen) { \
- DBG(VERIFY3, dprintf("ERROR: branch to (%d) out of bound (%d) \n", _N, codelen); ); \
- return verifyErrorInVerifyMethod3a(einfo, method, "branch out of method code"); \
+ return branchInBoundsErrorInVerifyMethod3a(einfo, method, codelen, _N); \
}
/* makes sure the index given for a local variable is within the correct index */
#define CHECK_LOCAL_INDEX(_N) \
if ((_N) >= method->localsz) { \
- DBG(VERIFY3, \
- dprintf("ERROR: pc = %d, instruction = ", pc); \
- printInstruction(code[pc]); \
- dprintf(", localsz = %d, localindex = %d\n", method->localsz, _N); \
- ); \
- return verifyErrorInVerifyMethod3a(einfo, method, "attempting to access a local variable beyond local array"); \
+ return checkLocalIndexErrorInVerifyMethod3a(einfo, method, pc, code, _N); \
}
-
constants* pool = CLASS_CONSTANTS(method->class);