[kaffe] CVS kaffe (dalibor): Replaced macro by static inline function
Kaffe CVS
Kaffe Mailing List <kaffe@kaffe.org>
Thu Feb 12 09:20:14 2004
PatchSet 4418
Date: 2004/02/12 17:11:41
Author: dalibor
Branch: HEAD
Tag: (none)
Log:
Replaced macro by static inline function
2004-02-12 Dalibor Topic <robilad@kaffe.org>
* kaffe/kaffevm/verify.c
(cleanupInVerifyMethod): New static inline function.
(CLEANUP) Removed.
Replaced use of CLEANUP by cleanupInVerifyMethod.
Members:
ChangeLog:1.2001->1.2002
kaffe/kaffevm/verify.c:1.35->1.36
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2001 kaffe/ChangeLog:1.2002
--- kaffe/ChangeLog:1.2001 Thu Feb 12 16:57:32 2004
+++ kaffe/ChangeLog Thu Feb 12 17:11:41 2004
@@ -1,6 +1,13 @@
2004-02-12 Dalibor Topic <robilad@kaffe.org>
* kaffe/kaffevm/verify.c
+ (cleanupInVerifyMethod): New static inline function.
+ (CLEANUP) Removed.
+ Replaced use of CLEANUP by cleanupInVerifyMethod.
+
+2004-02-12 Dalibor Topic <robilad@kaffe.org>
+
+ * kaffe/kaffevm/verify.c
(IS_PRIMITIVE_ARRAY): Removed unused macro.
2004-02-12 Dalibor Topic <robilad@kaffe.org>
Index: kaffe/kaffe/kaffevm/verify.c
diff -u kaffe/kaffe/kaffevm/verify.c:1.35 kaffe/kaffe/kaffevm/verify.c:1.36
--- kaffe/kaffe/kaffevm/verify.c:1.35 Thu Feb 12 16:57:33 2004
+++ kaffe/kaffe/kaffevm/verify.c Thu Feb 12 17:11:43 2004
@@ -1210,6 +1210,30 @@
return success;
}
+
+/**************************************************************************************************
+ * Memory Management Macros
+ **************************************************************************************************/
+/* to make sure we don't forget to unalloc anything...
+ * should be called during ANY EXIT FROM verifyMethod
+ */
+static inline
+void
+cleanupInVerifyMethod(uint32* status, SigStack* sigs, UninitializedType* uninits, uint32* numBlocks, BlockInfo ** blocks)
+{
+ DBG(VERIFY3, dprintf(" cleaning up..."); );
+ KFREE(status);
+ if (blocks != NULL) {
+ while (numBlocks > 0) {
+ freeBlock(blocks[--(*numBlocks)]);
+ }
+ KFREE(blocks);
+ }
+ freeSigStack(sigs);
+ freeUninits(uninits);
+ DBG(VERIFY3, dprintf(" done\n"); );
+}
+
/*
* 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),
@@ -1233,26 +1257,6 @@
uint32 numBlocks = 0;
BlockInfo** blocks = NULL;
-
- /**************************************************************************************************
- * Memory Management Macros
- **************************************************************************************************/
- /* to make sure we don't forget to unalloc anything...
- * should be called during ANY EXIT FROM THIS METHOD
- */
-#define CLEANUP \
- DBG(VERIFY3, dprintf(" cleaning up..."); ); \
- KFREE(status); \
- if (blocks != NULL) { \
- while (numBlocks > 0) { \
- freeBlock(blocks[--numBlocks]); \
- } \
- KFREE(blocks); \
- } \
- freeSigStack(sigs); \
- freeUninits(uninits); \
- DBG(VERIFY3, dprintf(" done\n"); )
-
#define FAIL \
DBG(VERIFY3, dprintf(" Verify Method 3b: %s.%s%s: FAILED\n", \
CLASS_CNAME(method->class), METHOD_NAMED(method), METHOD_SIGD(method)); ); \
@@ -1260,7 +1264,7 @@
DBG(VERIFY3, dprintf(" DBG ERROR: should have raised an exception\n"); ); \
postException(einfo, JAVA_LANG(VerifyError)); \
} \
- CLEANUP; \
+ cleanupInVerifyMethod(status, sigs, uninits, &numBlocks, blocks); \
return(false)
@@ -1308,13 +1312,12 @@
FAIL;
}
- CLEANUP;
+ cleanupInVerifyMethod(status, sigs, uninits, &numBlocks, blocks);
DBG(VERIFY3, dprintf(" Verify Method 3b: done\n"); );
return(true);
#undef FAIL
-#undef CLEANUP
}