[kaffe] CVS kaffe (hkraemer): fixed translation of exception table in the jitter

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Mon May 24 07:25:02 2004


PatchSet 4776 
Date: 2004/05/24 13:18:51
Author: hkraemer
Branch: HEAD
Tag: (none) 
Log:
fixed translation of exception table in the jitter

Members: 
	ChangeLog:1.2347->1.2348 
	kaffe/kaffevm/jit/machine.c:1.63->1.64 
	kaffe/kaffevm/jit3/machine.c:1.50->1.51 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2347 kaffe/ChangeLog:1.2348
--- kaffe/ChangeLog:1.2347	Sun May 23 21:22:18 2004
+++ kaffe/ChangeLog	Mon May 24 13:18:51 2004
@@ -1,3 +1,10 @@
+2004-05-24  Helmer Kraemer  <hkraemer@freenet.de>
+
+	* kaffe/kaffevm/jit/machine.c (getInsnPC): skip bytes that don't start
+	an instruction
+
+	* kaffe/kaffevm/jit3/machine.c (getInsnPC): likewise
+
 2004-05-23  Dalibor Topic  <robilad@kaffe.org>
 
 	* libraries/javalib/java/net/NetworkInterface.java:
Index: kaffe/kaffe/kaffevm/jit/machine.c
diff -u kaffe/kaffe/kaffevm/jit/machine.c:1.63 kaffe/kaffe/kaffevm/jit/machine.c:1.64
--- kaffe/kaffe/kaffevm/jit/machine.c:1.63	Mon Apr  5 17:43:41 2004
+++ kaffe/kaffe/kaffevm/jit/machine.c	Mon May 24 13:18:54 2004
@@ -493,11 +493,14 @@
 {
 	int maxPC = codeInfo->codelen;
 
-	for (;pc<maxPC;pc++) {
-		int insn = INSNPC(pc);
-		if (insn!=-1) {
-			return insn;
+	while (pc < maxPC) {
+		if (IS_STARTOFINSTRUCTION(pc)) {
+			int insn = INSNPC(pc);
+			if (insn!=-1) {
+				return insn;
+			}
 		}
+		pc++;
 	}
 
 	return code->codelen;
Index: kaffe/kaffe/kaffevm/jit3/machine.c
diff -u kaffe/kaffe/kaffevm/jit3/machine.c:1.50 kaffe/kaffe/kaffevm/jit3/machine.c:1.51
--- kaffe/kaffe/kaffevm/jit3/machine.c:1.50	Mon Apr  5 17:43:41 2004
+++ kaffe/kaffe/kaffevm/jit3/machine.c	Mon May 24 13:18:54 2004
@@ -505,14 +505,16 @@
 int
 getInsnPC(int pc, codeinfo* codeInfo, nativeCodeInfo *code)
 {
-	int res;
 	int maxPc = codeInfo->codelen;
 
-	for (;pc<maxPc;pc++) {
-		res = INSNPC(pc);
-		if (res != -1) {
-			return (res);
+	while (pc < maxPc) {
+		if (IS_STARTOFINSTRUCTION(pc)) {
+			int res = INSNPC(pc);
+			if (res != -1) {
+				return (res);
+			}
 		}
+		pc ++;
 	}
 	return code->codelen;
 }
@@ -610,17 +612,7 @@
 			e->start_pc = getInsnPC(e->start_pc, codeInfo, code) + (uintp)code->code;
 			e->end_pc = getInsnPC(e->end_pc, codeInfo, code) + (uintp)code->code;
 			e->handler_pc = getInsnPC(e->handler_pc, codeInfo, code) + (uintp)code->code;
-			if (e->start_pc >= e->end_pc)
-			  fprintf(stderr, 
-				 "WARNING Bad bytecode! Illegal exception table entry:"
-				 " start_pc=%d is not lower than end_pc=%d in method %s.%s(%s)\n"
-				 "See Java Virtual Machine Specification 2nd Edition $4.7.3 for details.\n"
-				 "Please report this bug to the developers of the application you're running on kaffe.\n"
-				 "A simple fix might be to use another java compiler to build the application.\n",
-				 e->start_pc, e->end_pc,
-				 CLASS_CNAME(meth->class),
-				 meth->name->data,
-				 METHOD_SIGD(meth));
+			assert (e->start_pc <= e->end_pc);
 		}
 	}