some library fixes for kaffe.

stephen clawson sclawson at fast.cs.utah.edu
Tue Sep 29 15:57:58 PDT 1998


     Recently I've been trying to get the Spec jvm98 benchmarks
running on the latest Kaffe.  So far I've run into a couple things in
the Kaffe class libraries that I had to fix.

     The first is a patch to Hashtable.rehash.  The old code
`re-inserted' all the data from the new array, instead of from the old
array, so you loose all your hash data if it has to rehash.  Doh!

     The next fixes the StreamTokenizer so that it recognizes
alphanumeric `words', and recognizes '\u00A0' through '\u00FF' as
alphabetic according to the API spec (1.1.6, don't know if it's
changed or not lately).  The second change isn't strictly necessary,
it just sets sval to null if we're returning a token value.  It seemed
cleaner and is what Sun's implementation does.

     The last one is for the native code for System.arraycopy.  If you
pass in a zero length, we just return and don't touch the src and dst
Objects at all (in case they're null).  This is mostly a robustness
issue and brings arraycopy in line with the standard Unix behavior of
memcpy and memmove, and with the Sun java implementation.  

     After making these changes, the Jess benchmark runs sucessfully.
I'll be working on the other's this week.


steve



Index: javalib/java/util/Hashtable.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/util/Hashtable.java,v
retrieving revision 1.7
diff -u -r1.7 Hashtable.java
--- Hashtable.java	1998/09/26 09:50:25	1.7
+++ Hashtable.java	1998/09/29 22:25:37
@@ -144,8 +144,8 @@
 
     /* Go through adding all the data to the new data */
     for (int pos = oldKeys.length-1; pos >= 0; pos--) {
-      if (keys[pos] != free && keys[pos] != removed) {
-	put(keys[pos], elements[pos]);
+      if (oldKeys[pos] != free && oldKeys[pos] != removed) {
+	put(oldKeys[pos], oldElements[pos]);
       }
     }
   }
Index: javalib/java/io/StreamTokenizer.java
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/javalib/java/io/StreamTokenizer.java,v
retrieving revision 1.4
diff -u -r1.4 StreamTokenizer.java
--- StreamTokenizer.java	1998/09/09 00:11:07	1.4
+++ StreamTokenizer.java	1998/09/29 22:25:37
@@ -133,7 +133,7 @@
 	else if (lookup[chr].isAlphabetic) {
 		/* Parse the word and return */
 		buffer.setLength( 0);
-		while (lookup[chr].isAlphabetic) {
+		while (lookup[chr].isAlphabetic || lookup[chr].isNumeric) {
 			buffer.append((char)(chr & 0xFF));
 			chr = chrRead();
 		}
@@ -179,6 +179,7 @@
 	}
 	else {
 		/* Just return it as a token */
+		sval = null;
 		if (chr == 256) ttype = TT_EOF; else ttype = chr & 0xFF;
 	}
 
@@ -219,6 +220,7 @@
 public void reset() {
 	wordChars('A', 'Z');
 	wordChars('a', 'z');
+	wordChars('\u00A0', '\u00FF');
 	whitespaceChars('\u0000', '\u0020');
 	ordinaryChar(256); /* EOF */
 	parseNumbers();
Index: clib/native/System.c
===================================================================
RCS file: /home/cvspublic/kaffe/libraries/clib/native/System.c,v
retrieving revision 1.5
diff -u -r1.5 System.c
--- System.c	1998/08/29 02:30:06	1.5
+++ System.c	1998/09/29 22:25:37
@@ -55,6 +55,9 @@
 	Hjava_lang_Class* sclass;
 	Hjava_lang_Class* dclass;
 
+	if (len == 0)
+		return;
+
 	sclass = OBJECT_CLASS(src);
 	dclass = OBJECT_CLASS(dst);
 


steve

-- 
// stephen clawson				sclawson at cs.utah.edu
// university of utah			        



More information about the kaffe mailing list