[kaffe] CVS kaffe (dalibor): Moved debugging code out of verify.c

Kaffe CVS cvs-commits at kaffe.org
Sat Feb 28 10:54:02 PST 2004


PatchSet 4473 
Date: 2004/02/28 18:44:25
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Moved debugging code out of verify.c

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

        * kaffe/kaffevm/verify-debug.c,
        kaffe/kaffevm/verify-debug.h:
        New files.

        * include/errors.h,
        kaffe/kaffevm/verify.h:
        Added missing includes.

        * kaffe/kaffevm/verify.h
        (TUNSTABLE, TFLOAT, TLONG, TDOUBLE, TNULL, TOBJARR,
        TCHARARR, TBYTEARR, TBOOLARR, TSHORTARR, TINTARR,
        TLONGARR, TFLOATARR, TDOUBLEARR, isNull, isWide):
        Export symbols.

        * kaffe/kaffevm/verify.c:
        Include verify-debug.h.
        (TUNSTABLE, TFLOAT, TLONG, TDOUBLE, TNULL, TOBJARR,
        TCHARARR, TBYTEARR, TBOOLARR, TSHORTARR, TINTARR,
        TLONGARR, TFLOATARR, TDOUBLEARR, isNull, isWide):
        Export symbols.
        (printInstruction, printType, printBlock): Move to
        kaffe/kaffevm/verify-debug.c. Move prototypes to
        kaffe/kaffevm/verify-debug.h.

        * kaffe/kaffevm/Makefile.am
        (libkaffevm_la_SOURCES): Added verify-debug.c.
        (noinst_HEADERS): Added verify-debug.h.

        * kaffe/kaffevm/Makefile.in,
        libltdl/configure,
        libraries/javalib/Makefile.am,
        libraries/javalib/Makefile.in:
        Regenerated.

Members: 
	ChangeLog:1.2053->1.2054 
	include/errors.h:1.9->1.10 
	kaffe/kaffevm/Makefile.am:1.49->1.50 
	kaffe/kaffevm/Makefile.in:1.132->1.133 
	kaffe/kaffevm/verify-debug.c:INITIAL->1.1 
	kaffe/kaffevm/verify-debug.h:INITIAL->1.1 
	kaffe/kaffevm/verify.c:1.65->1.66 
	kaffe/kaffevm/verify.h:1.6->1.7 
	libltdl/configure:1.51->1.52 
	libraries/javalib/Makefile.am:INITIAL->1.171 
	libraries/javalib/Makefile.in:INITIAL->1.228 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2053 kaffe/ChangeLog:1.2054
--- kaffe/ChangeLog:1.2053	Sat Feb 28 17:03:19 2004
+++ kaffe/ChangeLog	Sat Feb 28 18:44:25 2004
@@ -1,5 +1,41 @@
 2004-02-28  Dalibor Topic <robilad at kaffe.org>
 
+	* kaffe/kaffevm/verify-debug.c,
+	kaffe/kaffevm/verify-debug.h:
+	New files.
+
+	* include/errors.h,
+	kaffe/kaffevm/verify.h:
+	Added missing includes.
+
+	* kaffe/kaffevm/verify.h
+	(TUNSTABLE, TFLOAT, TLONG, TDOUBLE, TNULL, TOBJARR,
+	TCHARARR, TBYTEARR, TBOOLARR, TSHORTARR, TINTARR,
+	TLONGARR, TFLOATARR, TDOUBLEARR, isNull, isWide):
+	Export symbols.
+	
+	* kaffe/kaffevm/verify.c:
+	Include verify-debug.h.
+	(TUNSTABLE, TFLOAT, TLONG, TDOUBLE, TNULL, TOBJARR,
+        TCHARARR, TBYTEARR, TBOOLARR, TSHORTARR, TINTARR,
+        TLONGARR, TFLOATARR, TDOUBLEARR, isNull, isWide):
+        Export symbols.
+	(printInstruction, printType, printBlock): Move to 
+	kaffe/kaffevm/verify-debug.c. Move prototypes to
+	kaffe/kaffevm/verify-debug.h.
+
+	* kaffe/kaffevm/Makefile.am
+	(libkaffevm_la_SOURCES): Added verify-debug.c.
+	(noinst_HEADERS): Added verify-debug.h.
+
+	* kaffe/kaffevm/Makefile.in,
+	libltdl/configure,
+	libraries/javalib/Makefile.am,
+	libraries/javalib/Makefile.in:
+	Regenerated.
+
+2004-02-28  Dalibor Topic <robilad at kaffe.org>
+
         * kaffe/kaffevm/verify.c
         Use getIdx and getWIdx consistently.
 
Index: kaffe/include/errors.h
diff -u kaffe/include/errors.h:1.9 kaffe/include/errors.h:1.10
--- kaffe/include/errors.h:1.9	Sun Aug 31 22:08:58 2003
+++ kaffe/include/errors.h	Sat Feb 28 18:44:27 2004
@@ -12,6 +12,7 @@
 #ifndef __errors_h
 #define __errors_h
 
+#include "config-std.h"
 #include <stdarg.h>
 
 #define KERR_EXCEPTION			0x0001
Index: kaffe/kaffe/kaffevm/Makefile.am
diff -u kaffe/kaffe/kaffevm/Makefile.am:1.49 kaffe/kaffe/kaffevm/Makefile.am:1.50
--- kaffe/kaffe/kaffevm/Makefile.am:1.49	Thu Jan 15 02:29:30 2004
+++ kaffe/kaffe/kaffevm/Makefile.am	Sat Feb 28 18:44:27 2004
@@ -92,7 +92,8 @@
 	utf8const.c \
 	gcFuncs.c \
 	gcRefs.c \
-	verify.c
+	verify.c \
+	verify-debug.c
 
 noinst_HEADERS = \
 	access.h \
@@ -134,7 +135,8 @@
 	thread.h \
 	threadData.h \
 	utf8const.h \
-	verify.h
+	verify.h \
+	verify-debug.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.132 kaffe/kaffe/kaffevm/Makefile.in:1.133
--- kaffe/kaffe/kaffevm/Makefile.in:1.132	Mon Feb  2 16:26:14 2004
+++ kaffe/kaffe/kaffevm/Makefile.in	Sat Feb 28 18:44:27 2004
@@ -79,7 +79,8 @@
 	fp.lo gc.lo hashtab.lo inflate.lo itypes.lo jar.lo jni.lo \
 	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
+	thread.lo utf8const.lo gcFuncs.lo gcRefs.lo verify.lo \
+	verify-debug.lo
 am__objects_1 = gc-mem.lo md.lo
 nodist_libkaffevm_la_OBJECTS = $(am__objects_1)
 libkaffevm_la_OBJECTS = $(am_libkaffevm_la_OBJECTS) \
@@ -107,7 +108,9 @@
 @AMDEP_TRUE@	./$(DEPDIR)/stats.Plo ./$(DEPDIR)/string.Plo \
 @AMDEP_TRUE@	./$(DEPDIR)/stringParsing.Plo \
 @AMDEP_TRUE@	./$(DEPDIR)/support.Plo ./$(DEPDIR)/thread.Plo \
- at AMDEP_TRUE@	./$(DEPDIR)/utf8const.Plo ./$(DEPDIR)/verify.Plo
+ at AMDEP_TRUE@	./$(DEPDIR)/utf8const.Plo \
+ at AMDEP_TRUE@	./$(DEPDIR)/verify-debug.Plo \
+ at AMDEP_TRUE@	./$(DEPDIR)/verify.Plo
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
@@ -431,7 +434,8 @@
 	utf8const.c \
 	gcFuncs.c \
 	gcRefs.c \
-	verify.c
+	verify.c \
+	verify-debug.c
 
 noinst_HEADERS = \
 	access.h \
@@ -473,7 +477,8 @@
 	thread.h \
 	threadData.h \
 	utf8const.h \
-	verify.h
+	verify.h \
+	verify-debug.h
 
 CLEANFILES = so_locations
 DISTCLEANFILES = gc-mem.c md.c stamp-h01 stamp-h02
@@ -582,6 +587,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/support.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/thread.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/utf8const.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/verify-debug.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/verify.Plo at am__quote@
 
 .c.o:
===================================================================
Checking out kaffe/kaffe/kaffevm/verify-debug.c
RCS:  /home/cvs/kaffe/kaffe/kaffe/kaffevm/verify-debug.c,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/kaffe/kaffevm/verify-debug.c	Sat Feb 28 18:47:48 2004
@@ -0,0 +1,429 @@
+/*
+ * verify-debug.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.
+ *
+ * Debugging code for the verifier.
+ */
+
+#include "debug.h"
+#include "verify.h"
+
+/* for debugging */
+#if !(defined(NDEBUG) || !defined(KAFFE_VMDEBUG))
+
+/*
+ * printInstruction()
+ *     prints out a string representation of the instruction.
+ *
+ *     TODO: print out extra information with the instruction.
+ */
+void
+printInstruction(const int opcode)
+{
+#define PRINT(_OP) dprintf("%s", _OP); return;
+	
+	switch(opcode) {
+	case 0: PRINT("NOP");
+		
+	case 1: PRINT("ACONST-null");
+		
+	case 2:   PRINT("ICONST_M1");
+	case 3:   PRINT("ICONST_0");
+	case 4:   PRINT("ICONST_1");
+	case 5:   PRINT("ICONST_2");
+	case 6:   PRINT("ICONST_3");
+	case 7:   PRINT("ICONST_4");
+	case 8:   PRINT("ICONST_5");
+		
+	case 9:   PRINT("LCONST_0");
+	case 10:  PRINT("LCONST_1");
+		
+	case 11:  PRINT("FCONST_0");
+	case 12:  PRINT("FCONST_1");
+	case 13:  PRINT("FCONST_2");
+		
+	case 14:  PRINT("DCONST_0");
+	case 15:  PRINT("DCONST_1");
+		
+	case 16:  PRINT("BIPUSH");
+	case 17:  PRINT("SIPUSH");
+		
+	case 18:  PRINT("LDC");
+	case 19:  PRINT("LDC_W");
+	case 20:  PRINT("LDC2_W");
+		
+	case 21:  PRINT("ILOAD");
+	case 22:  PRINT("LLOAD");
+	case 23:  PRINT("FLOAD");
+	case 24:  PRINT("DLOAD");
+	case 25:  PRINT("ALOAD");
+		
+	case 26:  PRINT("ILOAD_0");
+	case 27:  PRINT("ILOAD_1");
+	case 28:  PRINT("ILOAD_2");
+	case 29:  PRINT("ILOAD_3");
+		
+	case 30:  PRINT("LLOAD_0");
+	case 31:  PRINT("LLOAD_1");
+	case 32:  PRINT("LLOAD_2");
+	case 33:  PRINT("LLOAD_3");
+		
+	case 34:  PRINT("FLOAD_0");
+	case 35:  PRINT("FLOAD_1");
+	case 36:  PRINT("FLOAD_2");
+	case 37:  PRINT("FLOAD_3");
+		
+	case 38:  PRINT("DLOAD_0");
+	case 39:  PRINT("DLOAD_1");
+	case 40:  PRINT("DLOAD_2");
+	case 41:  PRINT("DLOAD_3");
+		
+	case 42:  PRINT("ALOAD_0");
+	case 43:  PRINT("ALOAD_1");
+	case 44:  PRINT("ALOAD_2");
+	case 45:  PRINT("ALOAD_3");
+		
+	case 46:  PRINT("IALOAD");
+	case 47:  PRINT("LALOAD");
+	case 48:  PRINT("FALOAD");
+	case 49:  PRINT("DALOAD");
+	case 50:  PRINT("AALOAD");
+	case 51:  PRINT("BALOAD");
+	case 52:  PRINT("CALOAD");
+	case 53:  PRINT("SALOAD");
+		
+	case 54:  PRINT("ISTORE");
+	case 55:  PRINT("LSTORE");
+	case 56:  PRINT("FSTORE");
+	case 57:  PRINT("DSTORE");
+	case 58:  PRINT("ASTORE");
+		
+	case 59:  PRINT("ISTORE_0");
+	case 60:  PRINT("ISTORE_1");
+	case 61:  PRINT("ISTORE_2");
+	case 62:  PRINT("ISTORE_3");
+		
+	case 63:  PRINT("LSTORE_0");
+	case 64:  PRINT("LSTORE_1");
+	case 65:  PRINT("LSTORE_2");
+	case 66:  PRINT("LSTORE_3");
+		
+	case 67:  PRINT("FSTORE_0");
+	case 68:  PRINT("FSTORE_1");
+	case 69:  PRINT("FSTORE_2");
+	case 70:  PRINT("FSTORE_3");
+		
+	case 71:  PRINT("DSTORE_0");
+	case 72:  PRINT("DSTORE_1");
+	case 73:  PRINT("DSTORE_2");
+	case 74:  PRINT("DSTORE_3");
+		
+	case 75:  PRINT("ASTORE_0");
+	case 76:  PRINT("ASTORE_1");
+	case 77:  PRINT("ASTORE_2");
+	case 78:  PRINT("ASTORE_3");
+		
+	case 79:  PRINT("IASTORE");
+	case 80:  PRINT("LASTORE");
+	case 81:  PRINT("FASTORE");
+	case 82:  PRINT("DASTORE");
+	case 83:  PRINT("AASTORE");
+	case 84:  PRINT("BASTORE");
+	case 85:  PRINT("CASTORE");
+	case 86:  PRINT("SASTORE");
+		
+	case 87:  PRINT("POP");
+	case 88:  PRINT("POP_W");
+		
+	case 89:  PRINT("DUP");
+	case 90:  PRINT("DUP_X1");
+	case 91:  PRINT("DUP_X2");
+	case 92:  PRINT("DUP2");
+	case 93:  PRINT("DUP2_X1");
+	case 94:  PRINT("DUP2_X2");
+		
+	case 95:  PRINT("SWAP");
+		
+	case 96:  PRINT("IADD");
+	case 97:  PRINT("LADD");
+	case 98:  PRINT("FADD");
+	case 99:  PRINT("DADD");
+		
+	case 100: PRINT("ISUB");
+	case 101: PRINT("LSUB");
+	case 102: PRINT("FSUB");
+	case 103: PRINT("DSUB");
+		
+	case 104: PRINT("IMUL");
+	case 105: PRINT("LMUL");
+	case 106: PRINT("FMUL");
+	case 107: PRINT("DMUL");
+		
+	case 108: PRINT("IDIV");
+	case 109: PRINT("LDIV");
+	case 110: PRINT("FDIV");
+	case 111: PRINT("DDIV");
+		
+	case 112: PRINT("IREM");
+	case 113: PRINT("LREM");
+	case 114: PRINT("FREM");
+	case 115: PRINT("DREM");
+		
+	case 116: PRINT("INEG");
+	case 117: PRINT("LNEG");
+	case 118: PRINT("FNEG");
+	case 119: PRINT("DNEG");
+		
+	case 120: PRINT("ISHL");
+	case 121: PRINT("LSHL");
+	case 122: PRINT("FSHL");
+	case 123: PRINT("DSHL");
+		
+	case 124: PRINT("IUSHR");
+	case 125: PRINT("LUSHR");
+		
+	case 126: PRINT("IAND");
+	case 127: PRINT("LAND");
+		
+	case 128: PRINT("IOR");
+	case 129: PRINT("LOR");
+		
+	case 130: PRINT("IXOR");
+	case 131: PRINT("LXOR");
+		
+	case 132: PRINT("IINC");
+		
+	case 133: PRINT("I2L");
+	case 134: PRINT("I2F");
+	case 135: PRINT("I2D");
+	case 136: PRINT("L2I");
+	case 137: PRINT("L2F");
+	case 138: PRINT("L2D");
+	case 139: PRINT("F2I");
+	case 140: PRINT("F2L");
+	case 141: PRINT("F2D");
+	case 142: PRINT("D2I");
+	case 143: PRINT("D2L");
+	case 144: PRINT("D2F");
+	case 145: PRINT("I2B");
+	case 146: PRINT("I2C");
+	case 147: PRINT("I2S");
+		
+	case 148: PRINT("LCMP");
+	case 149: PRINT("FCMPL");
+	case 150: PRINT("FCMPG");
+	case 151: PRINT("DCMPL");
+	case 152: PRINT("DCMPG");
+		
+	case 153: PRINT("IFEQ");
+	case 154: PRINT("IFNE");
+	case 155: PRINT("IFLT");
+	case 156: PRINT("IFGE");
+	case 157: PRINT("IFGT");
+	case 158: PRINT("IFLE");
+		
+	case 159: PRINT("IF_ICMPEQ");
+	case 160: PRINT("IF_ICMPNE");
+	case 161: PRINT("IF_ICMPLT");
+	case 162: PRINT("IF_ICMPGE");
+	case 163: PRINT("IF_ICMPGT");
+	case 164: PRINT("IF_ICMPLE");
+	case 165: PRINT("IF_ACMPEQ");
+	case 166: PRINT("IF_ACMPNE");
+		
+	case 167: PRINT("GOTO");
+		
+	case 168: PRINT("JSR");
+	case 169: PRINT("RET");
+		
+	case 170: PRINT("TABLESWITCH");
+	case 171: PRINT("LOOKUPSWITCH");
+		
+	case 172: PRINT("IRETURN");
+	case 173: PRINT("LRETURN");
+	case 174: PRINT("FRETURN");
+	case 175: PRINT("DRETURN");
+	case 176: PRINT("ARETURN");
+	case 177: PRINT("RETURN");
+		
+	case 178: PRINT("GETSTATIC");
+	case 179: PRINT("PUTSTATIC");
+		
+	case 180: PRINT("GETFIELD");
+	case 181: PRINT("PUTFIELD");
+		
+	case 182: PRINT("INVOKEVIRTUAL");
+	case 183: PRINT("INVOKESPECIAL");
+	case 184: PRINT("INVOKESTATIC");
+	case 185: PRINT("INVOKEINTERFACE");
+		
+	case 187: PRINT("NEW");
+		
+	case 188: PRINT("NEWARRAY");
+	case 189: PRINT("ANEWARRAY");
+	case 190: PRINT("ARRAYLENGTH");
+		
+	case 191: PRINT("ATHROW");
+		
+	case 192: PRINT("CHECKCAST");
+	case 193: PRINT("INSTANCEOF");
+		
+	case 194: PRINT("MONITORENTER");
+	case 195: PRINT("MONITOREXIT");
+		
+	case 196: PRINT("WIDE");
+		
+	case 197: PRINT("MULTIANEWARRAY");
+		
+	case 198: PRINT("IFNULL");
+	case 199: PRINT("IFNONNULL");
+		
+	case 200: PRINT("GOTO_W");
+		
+	case 201: PRINT("JSR_W");
+		
+	case 202: PRINT("BREAKPOINT");
+		
+	case 254: PRINT("IMPDEP1");
+	case 255: PRINT("IMPDEP2");
+		
+	default:  PRINT("UNRECOGNIZED OPCODE");
+	}
+	
+#undef PRINT
+}
+void
+printType(const Type* t)
+{
+	const Hjava_lang_Class* type = t->data.class;
+	
+	dprintf("(%d)", t->tinfo);
+	switch(t->tinfo) {
+	case TINFO_SYSTEM:
+		if (type == TUNSTABLE->data.class) {
+			dprintf("TUNSTABLE");
+		}
+		else if (isWide(t)) {
+			dprintf("TWIDE");
+		}
+		else {
+			dprintf("UNKNOWN SYSTEM TYPE");
+		}
+		break;
+		
+	case TINFO_ADDR:
+		dprintf("TADDR: %d", t->data.addr);
+		break;
+		
+	case TINFO_PRIMITIVE:
+		if (type == TINT->data.class) {
+			dprintf("TINT");
+		}
+		else if (type == TLONG->data.class) {
+			dprintf("TLONG");
+		}
+		else if (type == TFLOAT->data.class) {
+			dprintf("TFLOAT");
+		}
+		else if (type == TDOUBLE->data.class) {
+			dprintf("TDOUBLE");
+		}
+		else {
+			dprintf("UKNOWN PRIMITIVE TYPE");
+		}
+		break;
+		
+	case TINFO_SIG:
+		dprintf("%s", t->data.sig);
+		break;
+		
+	case TINFO_NAME:
+		dprintf("%s", t->data.name);
+		break;
+		
+	case TINFO_CLASS:
+		if (type == NULL) {
+			dprintf("NULL");
+		}
+		else if (isNull(t)) {
+			dprintf("TNULL");
+		}
+		
+		else if (type == TCHARARR->data.class) {
+			dprintf("TCHARARR");
+		}
+		else if (type == TBOOLARR->data.class) {
+			dprintf("TBOOLARR");
+		}
+		else if (type == TBYTEARR->data.class) {
+			dprintf("TBYTEARR");
+		}
+		else if (type == TSHORTARR->data.class) {
+			dprintf("TSHORTARR");
+		}
+		else if (type == TINTARR->data.class) {
+			dprintf("TINTARR");
+		}
+		else if (type == TLONGARR->data.class) {
+			dprintf("TLONGARR");
+		}
+		else if (type == TFLOATARR->data.class) {
+			dprintf("TFLOATARR");
+		}
+		else if (type == TDOUBLEARR->data.class) {
+			dprintf("TDOUBLEARR");
+		}
+		else if (type == TOBJARR->data.class) {
+			dprintf("TOBJARR");
+		}
+		else {
+			if (type->name == NULL || CLASS_CNAME(type) == NULL) {
+				dprintf("<NULL NAME>");
+			} else {
+				dprintf("%s", CLASS_CNAME(type));
+			}
+		}
+		break;
+		
+	case TINFO_UNINIT:
+	case TINFO_UNINIT_SUPER:
+		printType(&(t->data.uninit->type));
+		break;
+		
+	default:
+		dprintf("UNRECOGNIZED TINFO");
+		break;
+	}
+}
+
+
+/*
+ * printBlock()
+ *    For debugging.  Prints out a basic block.
+ */
+void
+printBlock(const Method* method, const BlockInfo* binfo, const char* indent)
+{
+	uint32 n;
+	
+	dprintf("%slocals:\n", indent);
+	for (n = 0; n < method->localsz; n++) {
+		dprintf("%s    %d: ", indent, n);
+		printType(&binfo->locals[n]);
+		dprintf("\n");
+	}
+	dprintf("%sopstack (%d):\n", indent, binfo->stacksz);
+	for (n = 0; n < method->stacksz; n++) {
+		dprintf("%s    %d: ", indent, n);
+		printType(&binfo->opstack[n]);
+		dprintf("\n");
+	}
+}
+
+
+#endif /* !(defined(NDEBUG) || !defined(KAFFE_VMDEBUG)) */
===================================================================
Checking out kaffe/kaffe/kaffevm/verify-debug.h
RCS:  /home/cvs/kaffe/kaffe/kaffe/kaffevm/verify-debug.h,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/kaffe/kaffevm/verify-debug.h	Sat Feb 28 18:47:49 2004
@@ -0,0 +1,17 @@
+/*
+ * verify-debug.h
+ *
+ * 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 debugging code for the verifier.
+ */
+
+#ifdef KAFFE_VMDEBUG
+extern void printInstruction(const int opcode);
+extern void printType(const Type*);
+extern void printBlock(const Method* method, const BlockInfo* binfo, const char* indent);
+#endif
Index: kaffe/kaffe/kaffevm/verify.c
diff -u kaffe/kaffe/kaffevm/verify.c:1.65 kaffe/kaffe/kaffevm/verify.c:1.66
--- kaffe/kaffe/kaffevm/verify.c:1.65	Sat Feb 28 17:03:20 2004
+++ kaffe/kaffe/kaffevm/verify.c	Sat Feb 28 18:44:27 2004
@@ -35,7 +35,7 @@
 #include "soft.h"
 
 #include "verify.h"
-
+#include "verify-debug.h"
 
 /*
  * Returns whether the given class is "trusted" (i.e. does not require verification).
@@ -933,19 +933,19 @@
  * types for type checking (pass 3b)
  */
 static Type  verify_UNSTABLE;
-static Type* TUNSTABLE = &verify_UNSTABLE;
+Type* TUNSTABLE = &verify_UNSTABLE;
 
 static Type  verify_INT;
-static Type* TINT = &verify_INT;
+Type* TINT = &verify_INT;
        
 static Type  verify_FLOAT;
-static Type* TFLOAT = &verify_FLOAT;
+Type* TFLOAT = &verify_FLOAT;
        
 static Type  verify_LONG;
-static Type* TLONG = &verify_LONG;
+Type* TLONG = &verify_LONG;
        
 static Type  verify_DOUBLE;
-static Type* TDOUBLE = &verify_DOUBLE;
+Type* TDOUBLE = &verify_DOUBLE;
 
 /* used for the second space of LONGs and DOUBLEs
  * in local variables or on the operand stack
@@ -953,7 +953,6 @@
 static Type  _WIDE;
 static Type* TWIDE = &_WIDE;
 
-static inline
 bool
 isWide(const Type * tinfo)
 {
@@ -962,7 +961,7 @@
 
 static Type  verify_NULL;
 static Type* TNULL = &verify_NULL;
-static inline
+
 bool
 isNull(const Type * tinfo)
 {
@@ -971,59 +970,51 @@
 
 static const char* OBJECT_SIG  = "Ljava/lang/Object;";
 static Type  verify_OBJ;
-static Type* TOBJ = &verify_OBJ;
+Type* TOBJ = &verify_OBJ;
 
 static const char* OBJARR_SIG = "[Ljava/lang/Object;";
 static Type  verify_OBJARR;
-static Type* TOBJARR = &verify_OBJARR;
-
+Type* TOBJARR = &verify_OBJARR;
 
 static const char* STRING_SIG = "Ljava/lang/String;";
 static Type  verify_STRING;
 static Type* TSTRING = &verify_STRING;
 
-
 static const char* CHARARR_SIG = "[C";
 static Type  verify_CHARARR;
-static Type* TCHARARR = &verify_CHARARR;
+Type* TCHARARR = &verify_CHARARR;
 
 static const char* BYTEARR_SIG = "[B";
 static Type  verify_BYTEARR;
-static Type* TBYTEARR = &verify_BYTEARR;
+Type* TBYTEARR = &verify_BYTEARR;
 
 static const char* BOOLARR_SIG = "[Z";
 static Type  verify_BOOLARR;
-static Type* TBOOLARR = &verify_BOOLARR;
+Type* TBOOLARR = &verify_BOOLARR;
 
 static const char* SHORTARR_SIG = "[S";
 static Type  verify_SHORTARR;
-static Type* TSHORTARR = &verify_SHORTARR;
+Type* TSHORTARR = &verify_SHORTARR;
 
 static const char* INTARR_SIG = "[I";
 static Type  verify_INTARR;
-static Type* TINTARR = &verify_INTARR;
+Type* TINTARR = &verify_INTARR;
 
 static const char* LONGARR_SIG = "[J";
 static Type  verify_LONGARR;
-static Type* TLONGARR = &verify_LONGARR;
+Type* TLONGARR = &verify_LONGARR;
 
 static const char* FLOATARR_SIG = "[F";
 static Type  verify_FLOATARR;
-static Type* TFLOATARR = &verify_FLOATARR;
+Type* TFLOATARR = &verify_FLOATARR;
 
 static const char* DOUBLEARR_SIG = "[D";
 static Type  verify_DOUBLEARR;
-static Type* TDOUBLEARR = &verify_DOUBLEARR;
+Type* TDOUBLEARR = &verify_DOUBLEARR;
 
 /***********************************************************************************
  * Methods for Pass 3 Verification
  ***********************************************************************************/
-#ifdef KAFFE_VMDEBUG
-static void printInstruction(const int opcode);
-static void printType(const Type*);
-static void printBlock(const Method* method, const BlockInfo* binfo, const char* indent);
-#endif
-
 static BlockInfo*         createBlock(const Method* method);
 static void               copyBlockData(const Method* method, BlockInfo* fromBlock, BlockInfo* toBlock);
 static void               copyBlockState(const Method* method, BlockInfo* fromBlock, BlockInfo* toBlock);
@@ -5166,424 +5157,3 @@
 		uninits = tmp;
 	}
 }
-
-
-
-/* for debugging */
-#if !(defined(NDEBUG) || !defined(KAFFE_VMDEBUG))
-
-/*
- * printInstruction()
- *     prints out a string representation of the instruction.
- *
- *     TODO: print out extra information with the instruction.
- */
-static
-void
-printInstruction(const int opcode)
-{
-#define PRINT(_OP) dprintf("%s", _OP); return;
-	
-	switch(opcode) {
-	case 0: PRINT("NOP");
-		
-	case 1: PRINT("ACONST-null");
-		
-	case 2:   PRINT("ICONST_M1");
-	case 3:   PRINT("ICONST_0");
-	case 4:   PRINT("ICONST_1");
-	case 5:   PRINT("ICONST_2");
-	case 6:   PRINT("ICONST_3");
-	case 7:   PRINT("ICONST_4");
-	case 8:   PRINT("ICONST_5");
-		
-	case 9:   PRINT("LCONST_0");
-	case 10:  PRINT("LCONST_1");
-		
-	case 11:  PRINT("FCONST_0");
-	case 12:  PRINT("FCONST_1");
-	case 13:  PRINT("FCONST_2");
-		
-	case 14:  PRINT("DCONST_0");
-	case 15:  PRINT("DCONST_1");
-		
-	case 16:  PRINT("BIPUSH");
-	case 17:  PRINT("SIPUSH");
-		
-	case 18:  PRINT("LDC");
-	case 19:  PRINT("LDC_W");
-	case 20:  PRINT("LDC2_W");
-		
-	case 21:  PRINT("ILOAD");
-	case 22:  PRINT("LLOAD");
-	case 23:  PRINT("FLOAD");
-	case 24:  PRINT("DLOAD");
-	case 25:  PRINT("ALOAD");
-		
-	case 26:  PRINT("ILOAD_0");
-	case 27:  PRINT("ILOAD_1");
-	case 28:  PRINT("ILOAD_2");
-	case 29:  PRINT("ILOAD_3");
-		
-	case 30:  PRINT("LLOAD_0");
-	case 31:  PRINT("LLOAD_1");
-	case 32:  PRINT("LLOAD_2");
-	case 33:  PRINT("LLOAD_3");
-		
-	case 34:  PRINT("FLOAD_0");
-	case 35:  PRINT("FLOAD_1");
-	case 36:  PRINT("FLOAD_2");
-	case 37:  PRINT("FLOAD_3");
-		
-	case 38:  PRINT("DLOAD_0");
-	case 39:  PRINT("DLOAD_1");
-	case 40:  PRINT("DLOAD_2");
-	case 41:  PRINT("DLOAD_3");
-		
-	case 42:  PRINT("ALOAD_0");
-	case 43:  PRINT("ALOAD_1");
-	case 44:  PRINT("ALOAD_2");
-	case 45:  PRINT("ALOAD_3");
-		
-	case 46:  PRINT("IALOAD");
-	case 47:  PRINT("LALOAD");
-	case 48:  PRINT("FALOAD");
-	case 49:  PRINT("DALOAD");
-	case 50:  PRINT("AALOAD");
-	case 51:  PRINT("BALOAD");
-	case 52:  PRINT("CALOAD");
-	case 53:  PRINT("SALOAD");
-		
-	case 54:  PRINT("ISTORE");
-	case 55:  PRINT("LSTORE");
-	case 56:  PRINT("FSTORE");
-	case 57:  PRINT("DSTORE");
-	case 58:  PRINT("ASTORE");
-		
-	case 59:  PRINT("ISTORE_0");
-	case 60:  PRINT("ISTORE_1");
-	case 61:  PRINT("ISTORE_2");
-	case 62:  PRINT("ISTORE_3");
-		
-	case 63:  PRINT("LSTORE_0");
-	case 64:  PRINT("LSTORE_1");
-	case 65:  PRINT("LSTORE_2");
-	case 66:  PRINT("LSTORE_3");
-		
-	case 67:  PRINT("FSTORE_0");
-	case 68:  PRINT("FSTORE_1");
-	case 69:  PRINT("FSTORE_2");
-	case 70:  PRINT("FSTORE_3");
-		
-	case 71:  PRINT("DSTORE_0");
-	case 72:  PRINT("DSTORE_1");
-	case 73:  PRINT("DSTORE_2");
-	case 74:  PRINT("DSTORE_3");
-		
-	case 75:  PRINT("ASTORE_0");
-	case 76:  PRINT("ASTORE_1");
-	case 77:  PRINT("ASTORE_2");
-	case 78:  PRINT("ASTORE_3");
-		
-	case 79:  PRINT("IASTORE");
-	case 80:  PRINT("LASTORE");
-	case 81:  PRINT("FASTORE");
-	case 82:  PRINT("DASTORE");
-	case 83:  PRINT("AASTORE");
-	case 84:  PRINT("BASTORE");
-	case 85:  PRINT("CASTORE");
-	case 86:  PRINT("SASTORE");
-		
-	case 87:  PRINT("POP");
-	case 88:  PRINT("POP_W");
-		
-	case 89:  PRINT("DUP");
-	case 90:  PRINT("DUP_X1");
-	case 91:  PRINT("DUP_X2");
-	case 92:  PRINT("DUP2");
-	case 93:  PRINT("DUP2_X1");
-	case 94:  PRINT("DUP2_X2");
-		
-	case 95:  PRINT("SWAP");
-		
-	case 96:  PRINT("IADD");
-	case 97:  PRINT("LADD");
-	case 98:  PRINT("FADD");
-	case 99:  PRINT("DADD");
-		
-	case 100: PRINT("ISUB");
-	case 101: PRINT("LSUB");
-	case 102: PRINT("FSUB");
-	case 103: PRINT("DSUB");
-		
-	case 104: PRINT("IMUL");
-	case 105: PRINT("LMUL");
-	case 106: PRINT("FMUL");
-	case 107: PRINT("DMUL");
-		
-	case 108: PRINT("IDIV");
-	case 109: PRINT("LDIV");
-	case 110: PRINT("FDIV");
-	case 111: PRINT("DDIV");
-		
-	case 112: PRINT("IREM");
-	case 113: PRINT("LREM");
-	case 114: PRINT("FREM");
-	case 115: PRINT("DREM");
-		
-	case 116: PRINT("INEG");
-	case 117: PRINT("LNEG");
-	case 118: PRINT("FNEG");
-	case 119: PRINT("DNEG");
-		
-	case 120: PRINT("ISHL");
-	case 121: PRINT("LSHL");
-	case 122: PRINT("FSHL");
-	case 123: PRINT("DSHL");
-		
-	case 124: PRINT("IUSHR");
-	case 125: PRINT("LUSHR");
-		
-	case 126: PRINT("IAND");
-	case 127: PRINT("LAND");
-		
-	case 128: PRINT("IOR");
-	case 129: PRINT("LOR");
-		
-	case 130: PRINT("IXOR");
-	case 131: PRINT("LXOR");
-		
-	case 132: PRINT("IINC");
-		
-	case 133: PRINT("I2L");
-	case 134: PRINT("I2F");
-	case 135: PRINT("I2D");
-	case 136: PRINT("L2I");
-	case 137: PRINT("L2F");
-	case 138: PRINT("L2D");
-	case 139: PRINT("F2I");
-	case 140: PRINT("F2L");
-	case 141: PRINT("F2D");
-	case 142: PRINT("D2I");
-	case 143: PRINT("D2L");
-	case 144: PRINT("D2F");
-	case 145: PRINT("I2B");
-	case 146: PRINT("I2C");
-	case 147: PRINT("I2S");
-		
-	case 148: PRINT("LCMP");
-	case 149: PRINT("FCMPL");
-	case 150: PRINT("FCMPG");
-	case 151: PRINT("DCMPL");
-	case 152: PRINT("DCMPG");
-		
-	case 153: PRINT("IFEQ");
-	case 154: PRINT("IFNE");
-	case 155: PRINT("IFLT");
-	case 156: PRINT("IFGE");
-	case 157: PRINT("IFGT");
-	case 158: PRINT("IFLE");

*** Patch too long, truncated ***




More information about the kaffe mailing list