[kaffe] CVS kaffe (dalibor): Moved handling of uninitialized types into own module
Kaffe CVS
Kaffe Mailing List <kaffe@kaffe.org>
Sun Feb 29 10:55:02 2004
PatchSet 4475
Date: 2004/02/29 18:42:44
Author: dalibor
Branch: HEAD
Tag: (none)
Log:
Moved handling of uninitialized types into own module
2004-02-29 Dalibor Topic <robilad@kaffe.org>
* kaffe/kaffevm/verify-uninit.c,
kaffe/kaffevm/verify-uninit.h:
New files.
* kaffe/kaffevm/Makefile.am:
(libkaffevm_la_SOURCES): Added verify-uninit.c.
(noinst_HEADERS): Added verify-uninit.h.
* kaffe/kaffevm/Makefile.in:
Regenerated.
* kaffe/kaffevm/verify.c,
* kaffe/kaffevm/verify.h:
(checkUninit, pushUninit, popUninit, freeUninits):
Moved to kaffe/kaffevm/verify-uninit.c.
(sameType): Export symbol.
Members:
ChangeLog:1.2055->1.2056
kaffe/kaffevm/Makefile.am:1.50->1.51
kaffe/kaffevm/Makefile.in:1.133->1.134
kaffe/kaffevm/verify-uninit.c:INITIAL->1.1
kaffe/kaffevm/verify-uninit.h:INITIAL->1.1
kaffe/kaffevm/verify.c:1.67->1.68
kaffe/kaffevm/verify.h:1.7->1.8
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2055 kaffe/ChangeLog:1.2056
--- kaffe/ChangeLog:1.2055 Sun Feb 29 16:02:59 2004
+++ kaffe/ChangeLog Sun Feb 29 18:42:44 2004
@@ -1,5 +1,24 @@
2004-02-29 Dalibor Topic <robilad@kaffe.org>
+ * kaffe/kaffevm/verify-uninit.c,
+ kaffe/kaffevm/verify-uninit.h:
+ New files.
+
+ * kaffe/kaffevm/Makefile.am:
+ (libkaffevm_la_SOURCES): Added verify-uninit.c.
+ (noinst_HEADERS): Added verify-uninit.h.
+
+ * kaffe/kaffevm/Makefile.in:
+ Regenerated.
+
+ * kaffe/kaffevm/verify.c,
+ * kaffe/kaffevm/verify.h:
+ (checkUninit, pushUninit, popUninit, freeUninits):
+ Moved to kaffe/kaffevm/verify-uninit.c.
+ (sameType): Export symbol.
+
+2004-02-29 Dalibor Topic <robilad@kaffe.org>
+
* kaffe/kaffevm/verify.c:
Use gc_free instead of KFREE.
Index: kaffe/kaffe/kaffevm/Makefile.am
diff -u kaffe/kaffe/kaffevm/Makefile.am:1.50 kaffe/kaffe/kaffevm/Makefile.am:1.51
--- kaffe/kaffe/kaffevm/Makefile.am:1.50 Sat Feb 28 18:44:27 2004
+++ kaffe/kaffe/kaffevm/Makefile.am Sun Feb 29 18:42:46 2004
@@ -93,7 +93,8 @@
gcFuncs.c \
gcRefs.c \
verify.c \
- verify-debug.c
+ verify-debug.c \
+ verify-uninit.c
noinst_HEADERS = \
access.h \
@@ -136,7 +137,8 @@
threadData.h \
utf8const.h \
verify.h \
- verify-debug.h
+ verify-debug.h \
+ verify-uninit.h
gc-mem.c: stamp-h01
@if test ! -f $@; then rm -f stamp-h01; $(MAKE) stamp-h01; \
Index: kaffe/kaffe/kaffevm/Makefile.in
diff -u kaffe/kaffe/kaffevm/Makefile.in:1.133 kaffe/kaffe/kaffevm/Makefile.in:1.134
--- kaffe/kaffe/kaffevm/Makefile.in:1.133 Sat Feb 28 18:44:27 2004
+++ kaffe/kaffe/kaffevm/Makefile.in Sun Feb 29 18:42:46 2004
@@ -80,7 +80,7 @@
locks.lo lookup.lo object.lo readClass.lo sha-1.lo soft.lo \
stackTrace.lo stats.lo string.lo stringParsing.lo support.lo \
thread.lo utf8const.lo gcFuncs.lo gcRefs.lo verify.lo \
- verify-debug.lo
+ verify-debug.lo verify-uninit.lo
am__objects_1 = gc-mem.lo md.lo
nodist_libkaffevm_la_OBJECTS = $(am__objects_1)
libkaffevm_la_OBJECTS = $(am_libkaffevm_la_OBJECTS) \
@@ -110,6 +110,7 @@
@AMDEP_TRUE@ ./$(DEPDIR)/support.Plo ./$(DEPDIR)/thread.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/utf8const.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/verify-debug.Plo \
+@AMDEP_TRUE@ ./$(DEPDIR)/verify-uninit.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/verify.Plo
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -435,7 +436,8 @@
gcFuncs.c \
gcRefs.c \
verify.c \
- verify-debug.c
+ verify-debug.c \
+ verify-uninit.c
noinst_HEADERS = \
access.h \
@@ -478,7 +480,8 @@
threadData.h \
utf8const.h \
verify.h \
- verify-debug.h
+ verify-debug.h \
+ verify-uninit.h
CLEANFILES = so_locations
DISTCLEANFILES = gc-mem.c md.c stamp-h01 stamp-h02
@@ -588,6 +591,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8const.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verify-debug.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verify-uninit.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verify.Plo@am__quote@
.c.o:
===================================================================
Checking out kaffe/kaffe/kaffevm/verify-uninit.c
RCS: /home/cvs/kaffe/kaffe/kaffe/kaffevm/verify-uninit.c,v
VERS: 1.1
***************
--- /dev/null Sun Aug 4 19:57:58 2002
+++ kaffe/kaffe/kaffevm/verify-uninit.c Sun Feb 29 18:45:03 2004
@@ -0,0 +1,112 @@
+/*
+ * verify-uninit.c
+ *
+ * Copyright 2004
+ * Kaffe.org contributors. See ChangeLog for details. All rights reserved.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file.
+ *
+ * Code for handing of uninitialized type in the verifier.
+ */
+
+#include "verify-uninit.h"
+
+/*
+ * checkUninit()
+ * To be called when dealing with (get/put)field access. Makes sure that get/putfield and
+ * invoke* instructions have access to the instance fields of the object in question.
+ */
+bool
+checkUninit(Hjava_lang_Class* this, Type* type)
+{
+ if (type->tinfo & TINFO_UNINIT) {
+ if (type->tinfo & TINFO_UNINIT_SUPER) {
+ UninitializedType* uninit = type->data.uninit;
+ Type t;
+ t.tinfo = TINFO_CLASS;
+ t.data.class = this;
+
+ if (!sameType(&uninit->type, &t)) {
+ return false;
+ }
+ }
+ else {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+/*
+ * pushUninit()
+ * Adds an unitialized type to the list of uninitialized types.
+ *
+ * uninits is the front of the list to be added onto.
+ */
+UninitializedType*
+pushUninit(UninitializedType* uninits, const Type* type)
+{
+ UninitializedType* uninit = checkPtr(gc_malloc(sizeof(UninitializedType), GC_ALLOC_VERIFIER));
+ uninit->type = *type;
+ uninit->prev = NULL;
+
+ if (!uninits) {
+ uninit->next = NULL;
+ return uninit;
+ }
+
+ uninit->prev = NULL;
+ uninit->next = uninits;
+ uninits->prev = uninit;
+ return uninit;
+}
+
+/*
+ * popUninit()
+ * Pops an uninitialized type off of the operand stack
+ */
+void
+popUninit(const Method* method, UninitializedType* uninit, BlockInfo* binfo)
+{
+ uint32 n;
+
+ for (n = 0; n < method->localsz; n++) {
+ if (binfo->locals[n].tinfo & TINFO_UNINIT &&
+ ((UninitializedType*)binfo->locals[n].data.class) == uninit) {
+ binfo->locals[n] = uninit->type;
+ }
+ }
+
+ for (n = 0; n < binfo->stacksz; n++) {
+ if (binfo->opstack[n].tinfo & TINFO_UNINIT &&
+ ((UninitializedType*)binfo->opstack[n].data.class) == uninit) {
+ binfo->opstack[n] = uninit->type;
+ }
+ }
+
+ if (uninit->prev) {
+ uninit->prev->next = uninit->next;
+ }
+ if (uninit->next) {
+ uninit->next->prev = uninit->prev;
+ }
+
+ gc_free(uninit);
+}
+
+/*
+ * freeUninits
+ * frees a list of unitialized types
+ */
+void
+freeUninits(UninitializedType* uninits)
+{
+ UninitializedType* tmp;
+ while (uninits) {
+ tmp = uninits->next;
+ gc_free(uninits);
+ uninits = tmp;
+ }
+}
===================================================================
Checking out kaffe/kaffe/kaffevm/verify-uninit.h
RCS: /home/cvs/kaffe/kaffe/kaffe/kaffevm/verify-uninit.h,v
VERS: 1.1
***************
--- /dev/null Sun Aug 4 19:57:58 2002
+++ kaffe/kaffe/kaffevm/verify-uninit.h Sun Feb 29 18:45:04 2004
@@ -0,0 +1,41 @@
+/*
+ * verify-uninit.c
+ *
+ * Copyright 2004
+ * Kaffe.org contributors. See ChangeLog for details. All rights reserved.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file.
+ *
+ * Interface to the code for handing of uninitialized type in the verifier.
+ */
+
+#include "verify.h"
+
+/*
+ * checkUninit()
+ * To be called when dealing with (get/put)field access. Makes sure that get/putfield and
+ * invoke* instructions have access to the instance fields of the object in question.
+ */
+extern bool checkUninit(Hjava_lang_Class* this, Type* type);
+
+/*
+ * pushUninit()
+ * Adds an unitialized type to the list of uninitialized types.
+ *
+ * uninits is the front of the list to be added onto.
+ */
+extern UninitializedType* pushUninit(UninitializedType* uninits, const Type* type);
+
+/*
+ * popUninit()
+ * Pops an uninitialized type off of the operand stack
+ */
+extern void popUninit(const Method* method, UninitializedType* uninit, BlockInfo* binfo);
+
+/*
+ * freeUninits
+ * frees a list of unitialized types
+ */
+
+extern void freeUninits(UninitializedType* uninits);
Index: kaffe/kaffe/kaffevm/verify.c
diff -u kaffe/kaffe/kaffevm/verify.c:1.67 kaffe/kaffe/kaffevm/verify.c:1.68
--- kaffe/kaffe/kaffevm/verify.c:1.67 Sun Feb 29 16:03:02 2004
+++ kaffe/kaffe/kaffevm/verify.c Sun Feb 29 18:42:46 2004
@@ -36,6 +36,7 @@
#include "verify.h"
#include "verify-debug.h"
+#include "verify-uninit.h"
/*
* Returns whether the given class is "trusted" (i.e. does not require verification).
@@ -1026,12 +1027,6 @@
static SigStack* pushSig(SigStack* sigs, const char* sig);
static void freeSigStack(SigStack* sigs);
-static bool checkUninit(Hjava_lang_Class* this, Type* type);
-static UninitializedType* pushUninit(UninitializedType* uninits, const Type* type);
-static void popUninit(const Method*, UninitializedType*, BlockInfo*);
-static void freeUninits(UninitializedType* uninits);
-
-
static bool verifyMethod(errorInfo* einfo, Method* method);
static BlockInfo** verifyMethod3a(errorInfo* einfo,
Method* method,
@@ -1058,7 +1053,6 @@
static bool isReference(const Type* type);
static bool isArray(const Type* type);
-static bool sameType(Type* t1, Type* t2);
static bool sameRefType(Type* t1, Type* t2);
static void resolveType(errorInfo* einfo, Hjava_lang_Class* this, Type *type);
@@ -4732,7 +4726,6 @@
* sameType()
* returns whether two Types are effectively equivalent.
*/
-static
bool
sameType(Type* t1, Type* t2)
{
@@ -5055,105 +5048,3 @@
}
-/*
- * checkUninit()
- * To be called when dealing with (get/put)field access. Makes sure that get/putfield and
- * invoke* instructions have access to the instance fields of the object in question.
- */
-static
-bool
-checkUninit(Hjava_lang_Class* this, Type* type)
-{
- if (type->tinfo & TINFO_UNINIT) {
- if (type->tinfo & TINFO_UNINIT_SUPER) {
- UninitializedType* uninit = type->data.uninit;
- Type t;
- t.tinfo = TINFO_CLASS;
- t.data.class = this;
-
- if (!sameType(&uninit->type, &t)) {
- return false;
- }
- }
- else {
- return false;
- }
- }
-
- return true;
-}
-
-/*
- * pushUninit()
- * Adds an unitialized type to the list of uninitialized types.
- *
- * uninits is the front of the list to be added onto.
- */
-static
-UninitializedType*
-pushUninit(UninitializedType* uninits, const Type* type)
-{
- UninitializedType* uninit = checkPtr(gc_malloc(sizeof(UninitializedType), GC_ALLOC_VERIFIER));
- uninit->type = *type;
- uninit->prev = NULL;
-
- if (!uninits) {
- uninit->next = NULL;
- return uninit;
- }
-
- uninit->prev = NULL;
- uninit->next = uninits;
- uninits->prev = uninit;
- return uninit;
-}
-
-/*
- * popUninit()
- * Pops an uninitialized type off of the operand stack
- */
-static
-void
-popUninit(const Method* method, UninitializedType* uninit, BlockInfo* binfo)
-{
- uint32 n;
-
- for (n = 0; n < method->localsz; n++) {
- if (binfo->locals[n].tinfo & TINFO_UNINIT &&
- ((UninitializedType*)binfo->locals[n].data.class) == uninit) {
- binfo->locals[n] = uninit->type;
- }
- }
-
- for (n = 0; n < binfo->stacksz; n++) {
- if (binfo->opstack[n].tinfo & TINFO_UNINIT &&
- ((UninitializedType*)binfo->opstack[n].data.class) == uninit) {
- binfo->opstack[n] = uninit->type;
- }
- }
-
- if (uninit->prev) {
- uninit->prev->next = uninit->next;
- }
- if (uninit->next) {
- uninit->next->prev = uninit->prev;
- }
-
- gc_free(uninit);
-}
-
-/*
- * freeUninits
- * frees a list of unitialized types
- */
-static
-void
-freeUninits(UninitializedType* uninits)
-{
- UninitializedType* tmp;
- while (uninits) {
- tmp = uninits->next;
- gc_free(uninits);
- uninits = tmp;
- }
-}
Index: kaffe/kaffe/kaffevm/verify.h
diff -u kaffe/kaffe/kaffevm/verify.h:1.7 kaffe/kaffe/kaffevm/verify.h:1.8
--- kaffe/kaffe/kaffevm/verify.h:1.7 Sat Feb 28 18:44:28 2004
+++ kaffe/kaffe/kaffevm/verify.h Sun Feb 29 18:42:46 2004
@@ -152,6 +152,7 @@
void initVerifierPrimTypes(void);
+bool sameType(Type* t1, Type* t2);
bool verify3(Hjava_lang_Class* class, errorInfo *einfo);
/*