Re: java.util and vm/ref patch
Hi, --- java/util/jar/Manifest.java Mon Dec 3 14:53:26 2001 +++ ../classpath/java/util/jar/Manifest.javaWed Mar 20 18:09:04 2002 @@ -163,7 +163,8 @@ private static void read_main_section(Attributes attr, BufferedReader br) throws IOException { -read_version_info(attr, br); +// version info isn't mandatory at the beginning in jar spec. +// read_version_info(attr, br); read_attributes(attr, br); } Actually according to (both the old and new) spec the first Main attribute must be the Manifest-Version and it is mandatory. Which tool creates Manifest files that do not follow this? http://docs.iplanet.com/docs/manuals/signedobj/jarfile/jar.htm#426027 http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Manifest%20Specification But it probably cannot hurt to accept such faulty Manifest files. I have checked in the following: 2002-03-25 Mark Wielaard [EMAIL PROTECTED] * java/util/jar/Attributes.java (putValue(Name,String)): Make package private. * java/util/Manifest.java (read_main_section): Don't require Manifest-Version info, set to 0.0 when not found. Cheers, Mark Index: java/util/jar/Attributes.java === RCS file: /cvsroot/classpath/classpath/java/util/jar/Attributes.java,v retrieving revision 1.6 diff -u -r1.6 Attributes.java --- java/util/jar/Attributes.java 22 Jan 2002 22:27:01 - 1.6 +++ java/util/jar/Attributes.java 25 Mar 2002 20:49:24 - @@ -430,7 +430,7 @@ * @returns the old value of the attribute name or null if it didn't exist * yet */ - private String putValue(Name name, String value) + String putValue(Name name, String value) { return (String) put(name, value); } Index: java/util/jar/Manifest.java === RCS file: /cvsroot/classpath/classpath/java/util/jar/Manifest.java,v retrieving revision 1.6 diff -u -r1.6 Manifest.java --- java/util/jar/Manifest.java 22 Jan 2002 22:27:01 - 1.6 +++ java/util/jar/Manifest.java 25 Mar 2002 20:49:24 - @@ -174,10 +174,19 @@ private static void read_main_section(Attributes attr, BufferedReader br) throws IOException { -read_version_info(attr, br); +// According to the spec we should actually call read_version_info() here. read_attributes(attr, br); +// Explicitly set Manifest-Version attribute if not set in Main +// attributes of Manifest. +if (attr.getValue(Attributes.Name.MANIFEST_VERSION) == null) + attr.putValue(Attributes.Name.MANIFEST_VERSION, 0.0); } + /** + * Pedantic method that requires the next attribute in the Manifest to be + * the Manifest-Version. This follows the Manifest spec closely but + * reject some jar Manifest files out in the wild. + */ private static void read_version_info(Attributes attr, BufferedReader br) throws IOException { @@ -185,7 +194,7 @@ try { String value = expect_header(version_header, br); - attr.putValue(version_header, value); + attr.putValue(Attributes.Name.MANIFEST_VERSION, value); } catch (IOException ioe) {
Re: java.util and vm/ref patch
Hi, On Mon, 2002-03-25 at 14:44, Brian Jones wrote: If someone has the time, these patches need to be looked over to see if all or parts of them should be committed. It's part of the Intel batch we have paperwork in place for but were not broken out on Savannah previously. Everything else has already been committed or looked over. diff -w -uNr java/util/AbstractList.java ../classpath/java/util/AbstractList.java --- java/util/AbstractList.java Thu Oct 25 15:34:20 2001 +++ ../classpath/java/util/AbstractList.javaWed Mar 20 18:09:04 2002 @@ -309,10 +309,10 @@ public Object next() { checkMod(); -if (pos == size) +if (pos = size) throw new NoSuchElementException(); last = pos++; -return get(pos); +return get(last); } Bryce checked in a similar patch. diff -w -uNr java/util/Arrays.java ../classpath/java/util/Arrays.java --- java/util/Arrays.java Thu Oct 25 15:34:20 2001 +++ ../classpath/java/util/Arrays.java Wed Mar 20 18:09:04 2002 @@ -2420,7 +2420,7 @@ { int size = a.length; for (int i = 0; i size; i++) -if (equals(o, a[i])) +if (this.equals(o, a[i])) return i; return -1; } @@ -2429,7 +2429,7 @@ { int i = a.length; while (--i = 0) -if (equals(o, a[i])) +if (this.equals(o, a[i])) return i; return -1; } I checked in such a patch based on a bug report from Takashi Okamoto. diff -w -uNr java/util/Hashtable.java ../classpath/java/util/Hashtable.java --- java/util/Hashtable.javaThu Oct 25 15:34:20 2001 +++ ../classpath/java/util/Hashtable.java Wed Mar 20 18:09:04 2002 @@ -501,7 +501,6 @@ public synchronized void putAll(Map m) { Iterator itr = m.entrySet().iterator(); - for (int msize = m.size(); msize 0; msize--) { Map.Entry e = (Map.Entry) itr.next(); @@ -548,6 +547,7 @@ { // This is impossible. } +copy.size = 0; copy.buckets = new HashEntry[buckets.length]; copy.putAll(this); // Clear the caches. @@ -932,6 +932,7 @@ // Read and use capacity. buckets = new HashEntry[s.readInt()]; int len = s.readInt(); +size = 0; // Read and use key/value pairs. // TODO: should we be defensive programmers, and check for illegal nulls? @@ -1007,7 +1008,8 @@ throw new ConcurrentModificationException(); if (count == 0) throw new NoSuchElementException(); - count--; + --count; + HashEntry e = next; while (e == null) @@ -1015,6 +1017,7 @@ next = e.next; last = e; + if (type == VALUES) return e.value; if (type == KEYS) @@ -1037,7 +1040,8 @@ Hashtable.this.remove(last.key); last = null; - knownMod++; + --count; + ++knownMod; } } // class HashIterator The size = 0 parts seem to be necessary, but I don't get the other parts. diff -w -uNr java/util/LinkedList.java ../classpath/java/util/LinkedList.java --- java/util/LinkedList.java Thu Oct 25 15:34:20 2001 +++ ../classpath/java/util/LinkedList.java Wed Mar 20 18:09:04 2002 @@ -329,7 +329,7 @@ { modCount++; size++; -if (size == 0) +if (size == 1) first = last = e; else { @@ -727,6 +727,7 @@ { s.defaultReadObject(); int i = s.readInt(); +size = 0; while (--i = 0) addLastEntry(new Entry(s.readObject())); } A similar fix for the first part (addLastEntry) was checked in by Bryce. The size = 0 part seems necessary. Skipping analysis of ResourceBundle for now. diff -w -uNr java/util/WeakHashMap.java ../classpath/java/util/WeakHashMap.java --- java/util/WeakHashMap.java Wed Oct 31 09:00:30 2001 +++ ../classpath/java/util/WeakHashMap.java Wed Mar 20 18:09:04 2002 @@ -472,7 +472,7 @@ */ WeakEntry getEntry() { - final Object key = get(); + final Object key = this.get(); if (key == null) return null; return new WeakEntry(key); I checked in a patch based on a bug report from Takashi Okamoto. diff -w -uNr java/util/jar/Manifest.java ../classpath/java/util/jar/Manifest.java --- java/util/jar/Manifest.java Mon Dec 3 14:53:26 2001 +++ ../classpath/java/util/jar/Manifest.javaWed Mar 20 18:09:04 2002 @@ -163,7 +163,8 @@ private static void read_main_section(Attributes attr,
Re: java.util and vm/ref patch
Hi, Quickly going through the vm.diff. - I added some of the changes to java.lang.Class already. - java.lang.Runtime ShutdownHooks have already added by Eric. - Throwable changes are irrelevant with latest Throwable from CVS. - java.lang.Thread (contextClassLoader) changes have gone in. - The java.lang.reflect.Method changes have already been committed. Summary - it might be a good idea to look at Class, VMClassLoader and SystemClassLoader for things we missed. But mostly this is done. Cheers, Mark ___ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath
Re: java.util and vm/ref patch
Mark Wielaard [EMAIL PROTECTED] writes: Hi, Quickly going through the vm.diff. - I added some of the changes to java.lang.Class already. - java.lang.Runtime ShutdownHooks have already added by Eric. - Throwable changes are irrelevant with latest Throwable from CVS. - java.lang.Thread (contextClassLoader) changes have gone in. - The java.lang.reflect.Method changes have already been committed. Summary - it might be a good idea to look at Class, VMClassLoader and SystemClassLoader for things we missed. But mostly this is done. Okay, I'm pretty bummed about the state of Mauve in helping to make it easier to prove something works correctly in that so many tests are simply missing. This is where I'll be spending most of my energy in the forseeable future. I'm working on the beans api testing now mostly so I can learn something about it. I can see now that the measures I felt were sort of draconian on the Jikes list with respect to patches may be needed for Classpath as well just to help build up the base of tests available. Brian -- Brian Jones [EMAIL PROTECTED] ___ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath
Re: minimal hack to classpath for ORP 1.0.9
Fred Gray wrote: I did a cvs update to get your changes, and I copied the native method insertSystemProperties() from VMSystem to Runtime. ORP still crashed. *Dictionary, Hashtable, and Properties have no dependencies This is the where the chain broke. Adding the properties to the Hashtable calls Hashtable.hash(), which calls Math.abs(). That causes the static initializer for Math to be run, and it calls System.loadLibrary(). Kaboom. Man, those dependencies are annoying. Would using StrictMath.abs() in place of Math.abs() work, since StrictMath doesn't use native methods? Then again, inlining the check for absolute value saves a method call. I'll go ahead and apply that patch you suggested. The last problem is that the native method System.isWordsBigEndian() is needed by the static initializer for System before the Classpath java.lang JNI library is loaded. I enabled ORP's built-in version of this method (which takes the super-portable return false approach to the problem). At long last, Hello world! appeared. I thought, in my analysis yesterday, that System.isWordsBigEndian wouldn't be called until after System.loadLibrary(javalang), called in Object.clinit, has completed. But thinking about it more, I guess you are right - Object.clinit invokes the System class initializer, which then executes to completion before returning to Object.clinit; and System.clinit does use the native method. My patch yesterday just deleted the line in System which called loadLibrary(javalang), thinking it was redundant; I guess I was wrong, so I'll add it back in and document it this time. The last part of this message is a patch against the pristine ORP 1.0.9 release @@ -344,7 +346,6 @@ //{ java_lang_System_currentTimeMillis, (void *) Java_java_lang_System_currentTimeMillis, NI_IS_JNI }, { java_lang_System_currentTimeMillis, (void *) Java_java_lang_System_currentTimeMillis_no_extra_args, NI_IS_DIRECT }, -{ java_lang_System_isWordsBigEndian, (void *) Java_java_lang_System_isWordsBigEndian, NI_IS_JNI }, { java_lang_System_setErr, (void *) Java_java_lang_System_setErr, NI_IS_JNI }, { java_lang_System_setIn, (void *) Java_java_lang_System_setIn, NI_IS_JNI }, { java_lang_System_setOut, (void *) Java_java_lang_System_setOut, NI_IS_JNI }, The last three methods in this section of the patch have been renamed java_lang_System_setErr0, setIn0, and setOut0, because there must be a security check in Java first. You should probably fix those as well, to avoid another linkage error. -- This signature intentionally left boring. Eric Blake [EMAIL PROTECTED] BYU student, free software programmer ___ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath
Re: minimal hack to classpath for ORP 1.0.9
On Mon, Mar 25, 2002 at 12:51:22AM -0700, Eric Blake wrote: I did some shuffling and analysis, and I think the latest version in Classpath has a safe bootstrap sequence. Can you please test it for me? Thanks for all of your quick work. It _almost_ solved the problem. I did a cvs update to get your changes, and I copied the native method insertSystemProperties() from VMSystem to Runtime. ORP still crashed. *Dictionary, Hashtable, and Properties have no dependencies This is the where the chain broke. Adding the properties to the Hashtable calls Hashtable.hash(), which calls Math.abs(). That causes the static initializer for Math to be run, and it calls System.loadLibrary(). Kaboom. The simple fix for this one is to avoid calling Math.abs(). A patch to do that appears below. The last problem is that the native method System.isWordsBigEndian() is needed by the static initializer for System before the Classpath java.lang JNI library is loaded. I enabled ORP's built-in version of this method (which takes the super-portable return false approach to the problem). At long last, Hello world! appeared. The last part of this message is a patch against the pristine ORP 1.0.9 release with all of the changes I had to make to get it to work. (It includes the patch in Classpath's resource/orp-1.0.9.patch .) Thanks again for all of your help, -- Fred Gray === RCS file: /cvsroot/classpath/classpath/java/util/Hashtable.java,v retrieving revision 1.23 diff -u -r1.23 Hashtable.java --- Hashtable.java 25 Mar 2002 07:54:38 - 1.23 +++ Hashtable.java 26 Mar 2002 04:24:14 - @@ -821,7 +821,12 @@ */ private int hash(Object key) { -return Math.abs(key.hashCode() % buckets.length); +// NOTE: using Math.abs() here, attractive as it is, leads to a +// bootstrapping problem. +int hashVal = key.hashCode() % buckets.length; +if(hashVal 0) + hashVal = -hashVal; +return hashVal; } /** === === diff -ur orp-1.0.9-pristine/arch/ia32/base/root_set_enum_ia32.cpp orp-1.0.9/arch/ia32/base/root_set_enum_ia32.cpp --- orp-1.0.9-pristine/arch/ia32/base/root_set_enum_ia32.cppWed Jan 16 23:49:40 2002 +++ orp-1.0.9/arch/ia32/base/root_set_enum_ia32.cpp Sun Mar 24 17:14:46 2002 @@ -35,9 +35,6 @@ #include ../x86/x86.h #ifdef ORP_POSIX -#ifdef __linux__ -#include asm/spinlock.h -#endif #include platform2.h #endif diff -ur orp-1.0.9-pristine/base_natives/common_olv2/mon_enter_exit.cpp orp-1.0.9/base_natives/common_olv2/mon_enter_exit.cpp --- orp-1.0.9-pristine/base_natives/common_olv2/mon_enter_exit.cpp Wed Jan 16 23:49:40 2002 +++ orp-1.0.9/base_natives/common_olv2/mon_enter_exit.cpp Sun Mar 24 17:14:46 +2002 @@ -294,7 +294,7 @@ #else nop;nop;nop #endif - ::: memory + : : : memory ); #else diff -ur orp-1.0.9-pristine/base_natives/gnu_classpath/find_natives_array.cpp orp-1.0.9/base_natives/gnu_classpath/find_natives_array.cpp --- orp-1.0.9-pristine/base_natives/gnu_classpath/find_natives_array.cppWed Jan 16 23:49:40 2002 +++ orp-1.0.9/base_natives/gnu_classpath/find_natives_array.cpp Mon Mar 25 22:43:30 +2002 @@ -122,6 +122,7 @@ { java_lang_Runtime_freeMemory, (void *) Java_java_lang_Runtime_freeMemory, NI_IS_JNI }, { java_lang_Runtime_gc, (void *) Java_java_lang_Runtime_gc, NI_IS_JNI }, { java_lang_Runtime_getLibraryPath, (void *) Java_java_lang_Runtime_getLibraryPath, NI_IS_JNI }, + { java_lang_Runtime_insertSystemProperties, (void *) +Java_java_lang_Runtime_insertSystemProperties, NI_IS_JNI }, //loadLibrary is just for new classpath #ifndef OLD_VERSION_CLASSPATH { java_lang_Runtime_loadLibrary, (void *)Java_java_lang_Runtime_loadLibrary, NI_IS_JNI }, @@ -139,6 +140,7 @@ //java.lang.System native methods { java_lang_System_arraycopy, (void *)java_lang_System_arraycopy, NI_IS_RNI }, +{ java_lang_System_isWordsBigEndian, (void *) +Java_java_lang_System_isWordsBigEndian, NI_IS_JNI }, //java.lang.Thread native methods { java_lang_Thread_countStackFrames, (void *)java_lang_Thread_countStackFrames, NI_IS_RNI }, @@ -344,7 +346,6 @@ //{ java_lang_System_currentTimeMillis, (void *) Java_java_lang_System_currentTimeMillis, NI_IS_JNI }, { java_lang_System_currentTimeMillis, (void *) Java_java_lang_System_currentTimeMillis_no_extra_args, NI_IS_DIRECT }, -{ java_lang_System_isWordsBigEndian, (void *) Java_java_lang_System_isWordsBigEndian, NI_IS_JNI }, { java_lang_System_setErr, (void *) Java_java_lang_System_setErr, NI_IS_JNI }, { java_lang_System_setIn, (void *) Java_java_lang_System_setIn, NI_IS_JNI }, { java_lang_System_setOut, (void *)