[kaffe] CVS kaffe (hkraemer): minor improvements and fixes, mostly to help debugging
Kaffe CVS
cvs-commits at kaffe.org
Sat May 28 07:34:30 PDT 2005
PatchSet 6583
Date: 2005/05/28 13:41:49
Author: hkraemer
Branch: HEAD
Tag: (none)
Log:
minor improvements and fixes, mostly to help debugging
Members:
ChangeLog:1.4110->1.4111
developers/dumpClass.pl:1.2->1.3
developers/update-class-list:INITIAL->1.12
kaffe/kaffevm/code-analyse.c:1.45->1.46
kaffe/kaffevm/exception.c:1.101->1.102
kaffe/kaffevm/stackTrace.c:1.49->1.50
libraries/clib/native/String.c:INITIAL->1.17
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4110 kaffe/ChangeLog:1.4111
--- kaffe/ChangeLog:1.4110 Sat May 28 03:23:41 2005
+++ kaffe/ChangeLog Sat May 28 13:41:49 2005
@@ -1,3 +1,18 @@
+2005-05-28 Helmer Kraemer <hkraemer at freenet.de>
+
+ * developers/dumpClass.pl: add command line arguments for verbose
+ method and field info
+ * developers/update-class-list: set LC_ALL to C to get a consistent
+ sort order
+ * kaffe/kaffevm/code-analyse.c (analyzeBasicBlock): throw VerifyError
+ if bytecode contains an invalid opcode
+ * kaffe/kaffevm/exception.c (findExceptionBlockInMethod): improved
+ debug messages
+ * kaffe/kaffevm/stackTrace.c (printStackTrace): print message of
+ exception
+ * libraries/clib/native/String.c (java_lang_String_indexOf): fix bounds
+ of loop
+
2005-05-28 Kiyo Inaba <inaba at src.ricoh.co.jp>
* kaffe/kaffevm/jit3/icode.c:
Index: kaffe/developers/dumpClass.pl
diff -u kaffe/developers/dumpClass.pl:1.2 kaffe/developers/dumpClass.pl:1.3
--- kaffe/developers/dumpClass.pl:1.2 Wed Oct 13 04:39:47 1999
+++ kaffe/developers/dumpClass.pl Sat May 28 13:41:53 2005
@@ -34,7 +34,23 @@
$JavaClass::detailedMethods = 0;
## Parse the command line
-my $classFile = shift || &usage();
+my $classFile = "";
+
+foreach (@ARGV){
+ if (/--verbose-fields/) {
+ $JavaClass::detailedFields = 1;
+ }
+ elsif (/--verbose-methods/) {
+ $JavaClass::detailedMethods = 1;
+ }
+ else {
+ $classFile = $_;
+ }
+}
+
+print "$classFile\n";
+
+#$classFile!="" || &usage();
## Read/parse the class file
my $class = &JavaClass::readClass($classFile);
@@ -48,7 +64,7 @@
sub usage() {
print STDOUT "Usage:\n";
- print STDOUT " dumpClass.pl <ClassFile>\n\n";
+ print STDOUT " dumpClass.pl [--verbose-methods] [--verbose-fields] <ClassFile>\n\n";
print STDOUT " Note that '.class' will be appended if it is not specified in the file name.\n";
exit 11;
===================================================================
Checking out kaffe/developers/update-class-list
RCS: /home/cvs/kaffe/kaffe/developers/update-class-list,v
VERS: 1.12
***************
--- /dev/null Sun Aug 4 19:57:58 2002
+++ kaffe/developers/update-class-list Sat May 28 14:34:30 2005
@@ -0,0 +1,50 @@
+#! /bin/sh
+
+# by Alexandre Oliva <oliva at dcc.unicamp.br>
+# updated by Edouard G. Parmelan <egp at free.fr>
+
+# This script can be used to update the list of class files to
+# compiled into rt.jar and included in the Kaffe distribution.
+# Whenever you add or remove a file, run this script from within
+# kaffe-src/libraries/javalib
+
+# set LC_ALL to C to get the same sort order on all systems
+export LC_ALL=C
+
+if test -f Makefile.am.in &&
+ SRCDIRS=`sed -n '/^SRCDIRS *= */ s///p' < Makefile.am.in` > /dev/null; then :
+else
+ echo update-class-list must be run from within a javalib directory >&2
+ exit 1
+fi
+
+trap 'rm -f classlist pkglist macrodef; exit 1' 1 2 15
+
+find $SRCDIRS -name \*.java -print | sort > classlist
+
+
+sed 's,/[^/]*$,,' < classlist | sort | uniq > pkglist
+
+{
+ sed 's,^, $(,;s,$,_SRCS) \\,;$s, \\$,,;s,[-/],_,g' < pkglist
+
+ while read pkg; do
+ echo "${pkg}_SRCS = \\" | sed 's,[-/],_,g'
+ grep "^${pkg}/[^/]*$" < classlist | sed 's/^/ /;s/$/ \\/;$s/ \\$//'
+ done < pkglist
+} > macrodef
+
+
+rm -f classlist pkglist
+
+sed '
+/^'"Klasses_jar_SRCS"'/ {
+ p
+ r macrodef
+}
+/^'"Klasses_jar_SRCS"'/,/^$/ d
+' < Makefile.am.in > Makefile.am
+
+rm -f macrodef
+
+exit 0
Index: kaffe/kaffe/kaffevm/code-analyse.c
diff -u kaffe/kaffe/kaffevm/code-analyse.c:1.45 kaffe/kaffe/kaffevm/code-analyse.c:1.46
--- kaffe/kaffe/kaffevm/code-analyse.c:1.45 Fri May 6 15:24:27 2005
+++ kaffe/kaffe/kaffevm/code-analyse.c Sat May 28 13:41:52 2005
@@ -1937,6 +1937,15 @@
case BREAKPOINT:
INCPC(1);
break;
+ default:
+ postExceptionMessage(einfo,
+ JAVA_LANG(VerifyError),
+ "(class: %s, method: %s signature: %s) "
+ "invalid opcode",
+ meth->class->name->data,
+ meth->name->data,
+ meth->parsed_sig->signature->data);
+ goto done_fail;
}
} while (pc < meth->c.bcode.codelen && !IS_STARTOFBASICBLOCK(pc) && !IS_STARTOFEXCEPTION(pc));
Index: kaffe/kaffe/kaffevm/exception.c
diff -u kaffe/kaffe/kaffevm/exception.c:1.101 kaffe/kaffe/kaffevm/exception.c:1.102
--- kaffe/kaffe/kaffevm/exception.c:1.101 Sun May 22 15:49:46 2005
+++ kaffe/kaffe/kaffevm/exception.c Sat May 28 13:41:52 2005
@@ -632,8 +632,8 @@
uintp end_pc = eptr[i].end_pc;
uintp handler_pc = eptr[i].handler_pc;
-DBG(ELOOKUP, dprintf(" Handler %d covers %#lx-%#lx\n", i,
- (long) start_pc, (long) end_pc); );
+DBG(ELOOKUP, dprintf(" Handler %d covers %#lx-%#lx catches %s\n", i,
+ (long) start_pc, (long) end_pc, eptr[i].catch_type==NULL?"all":CLASS_CNAME(eptr[i].catch_type)););
if (_pc < start_pc || _pc >= end_pc) {
continue;
}
Index: kaffe/kaffe/kaffevm/stackTrace.c
diff -u kaffe/kaffe/kaffevm/stackTrace.c:1.49 kaffe/kaffe/kaffevm/stackTrace.c:1.50
--- kaffe/kaffe/kaffevm/stackTrace.c:1.49 Sun May 22 15:49:47 2005
+++ kaffe/kaffe/kaffevm/stackTrace.c Sat May 28 13:41:52 2005
@@ -228,6 +228,12 @@
char* class_dot_name;
errorInfo einfo;
+ if (unhand(o)->detailMessage != NULL) {
+ char *cstr = checkPtr (stringJava2C(unhand(o)->detailMessage));
+ dprintf ("%s\n", cstr);
+ KFREE(cstr);
+ }
+
vmstate = (Hjava_lang_VMThrowable*)unhand(o)->vmState;
if (vmstate == NULL) {
return;
===================================================================
Checking out kaffe/libraries/clib/native/String.c
RCS: /home/cvs/kaffe/kaffe/libraries/clib/native/String.c,v
VERS: 1.17
***************
--- /dev/null Sun Aug 4 19:57:58 2002
+++ kaffe/libraries/clib/native/String.c Sat May 28 14:34:30 2005
@@ -0,0 +1,96 @@
+/*
+ * java.lang.String.c
+ *
+ * Copyright (c) 1996, 1997
+ * Transvirtual Technologies, Inc. All rights reserved.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file.
+ */
+
+#include "config.h"
+#include "config-std.h"
+#include "config-std.h"
+#include "stringSupport.h"
+#include "java_lang_String.h"
+
+Hjava_lang_String*
+java_lang_String_intern0(Hjava_lang_String* str)
+{
+ Hjava_lang_String *ret = stringInternString(str);
+
+ if (!ret) {
+ errorInfo info;
+ postOutOfMemory(&info);
+ throwError(&info);
+ }
+ return ret;
+}
+
+
+jint
+java_lang_String_indexOf(Hjava_lang_String* str, Hjava_lang_String* pat, jint offset)
+{
+ jchar *a;
+ jchar *p;
+
+ int n;
+ int m;
+ int m2;
+ jint i, k;
+ unsigned char bs[256];
+ int *ibs;
+
+ if (pat == 0) {
+ SignalError("java.lang.NullPointerException", "");
+ }
+
+ if ( !str ) return -1;
+
+ a = &(unhand_array(unhand(str)->value)->body[unhand(str)->offset]);
+ n = unhand(str)->count;
+
+ p = &(unhand_array(unhand(pat)->value)->body[unhand(pat)->offset]);
+ m = unhand(pat)->count;
+ m2 = m * 2;
+
+ if ( m > n ) return -1;
+
+ if ( offset < 0 ) offset = 0;
+
+ if ( (m < 3) || (n < 128) || (m > 256) ) {
+ /*
+ * If the pattern is too small, iterating the searched array would be
+ * cheaper than to set up the badmatch table, or the pattern length exceeds
+ * what we can store in the badmatch table, we revert to plain old brute force
+ */
+ k = n - m+1;
+ for ( i=offset; i<k; i++ ) {
+ if ( memcmp( &a[i], p, (size_t)m2) == 0 )
+ return i;
+ }
+ }
+ else {
+ /*
+ * Otherwise we use the Quick search variant of Boyer-Moore for
+ * O(n/m) lookup. Note that the (char) cast in the badmatch table access
+ * is the justification for turning this into a native method
+ */
+
+ /* set up the badmatch table */
+ k = (m << 24) | (m<<16) | (m<<8) | m;
+ for ( i=0, ibs = (int*)bs; i<64; i++ )
+ ibs[i] = k; /* the default jump: m */
+ for ( i=0; i<m; i++ )
+ bs[ (unsigned char)p[i] ] = m-i;
+
+ k= n - m + 1;
+ for ( i=offset; i < k; ) {
+ if ( memcmp( &a[i], p, (size_t)m2) == 0 )
+ return i;
+ i += bs[ (unsigned char)a[i+m] ];
+ }
+ }
+
+ return -1;
+}
More information about the kaffe
mailing list