Index: boehm.cc =================================================================== RCS file: /cvs/gcc/gcc/libjava/boehm.cc,v retrieving revision 1.35 diff -u -r1.35 boehm.cc --- boehm.cc 6 Dec 2002 23:41:36 -0000 1.35 +++ boehm.cc 25 Dec 2002 15:44:18 -0000 @@ -108,7 +108,7 @@ MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c3label); p = (ptr_t) c->superclass; MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c4label); - for (int i = 0; i < c->constants.size; ++i) + for (int i = c->constants.size - 1; i >= 0; i--) { /* FIXME: We could make this more precise by using the tags -KKT */ p = (ptr_t) c->constants.data[i].p; @@ -144,7 +144,7 @@ { // Scan each method in the cases where `methods' really // points to a methods structure. - for (int i = 0; i < c->method_count; ++i) + for (int i = c->method_count - 1; i >= 0; i--) { p = (ptr_t) c->methods[i].name; MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, @@ -158,7 +158,7 @@ // Mark all the fields. p = (ptr_t) c->fields; MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c8label); - for (int i = 0; i < c->field_count; ++i) + for (int i = c->field_count - 1; i >= 0; i--) { _Jv_Field* field = &c->fields[i]; @@ -194,7 +194,7 @@ MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c9label); p = (ptr_t) c->interfaces; MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cAlabel); - for (int i = 0; i < c->interface_count; ++i) + for (int i = c->interface_count - 1; i > 0; i--) { p = (ptr_t) c->interfaces[i]; MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cClabel); @@ -203,6 +203,8 @@ MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cBlabel); p = (ptr_t) c->arrayclass; MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cDlabel); + p = (ptr_t) c->protectionDomain; + MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cPlabel); #ifdef INTERPRETER if (_Jv_IsInterpretedClass (c)) @@ -212,32 +214,38 @@ p = (ptr_t) ic->interpreted_methods; MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic, cElabel); - for (int i = 0; i < c->method_count; i++) - { - p = (ptr_t) ic->interpreted_methods[i]; - MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic, \ - cFlabel); - - // Mark the direct-threaded code. - if ((c->methods[i].accflags - & java::lang::reflect::Modifier::NATIVE) == 0) - { - _Jv_InterpMethod *im - = (_Jv_InterpMethod *) ic->interpreted_methods[i]; - if (im) - { - p = (ptr_t) im->prepared; - MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic, \ - cFlabel); - } - } - - // The interpreter installs a heap-allocated trampoline - // here, so we'll mark it. - p = (ptr_t) c->methods[i].ncode; - MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, - cm3label); - } + { + const ptr_t *p_ic_interpreted_methods = (ptr_t *) ic->interpreted_methods; + const _Jv_Method *p_c_methods = c->methods; + for (int i = c->method_count - 1; i >= 0; i--) + { + p = p_ic_interpreted_methods[i]; + + MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic, \ + cFlabel); + + const _Jv_Method *m = &p_c_methods[i]; + + // Mark the direct-threaded code. + if ((m->accflags + & java::lang::reflect::Modifier::NATIVE) == 0) + { + const _Jv_InterpMethod *im = (_Jv_InterpMethod *) p; + if (im) + { + p = (ptr_t) im->prepared; + MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic, \ + cFlabel); + } + } + + // The interpreter installs a heap-allocated trampoline + // here, so we'll mark it. + p = (ptr_t) m->ncode; + MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, + cm3label); + } + } p = (ptr_t) ic->field_initializers; MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic, cGlabel); @@ -261,7 +269,7 @@ jfieldID field = JvGetFirstInstanceField (klass); jint max = JvNumInstanceFields (klass); - for (int i = 0; i < max; ++i) + for (int i = max - 1; i >= 0; i--) { if (JvFieldIsRef (field)) { @@ -307,12 +315,14 @@ p = (ptr_t) klass; MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, &(dt -> clas), o2label); - for (int i = 0; i < JvGetArrayLength (array); ++i) - { - jobject obj = elements (array)[i]; - p = (ptr_t) obj; - MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, array, e2label); - } + { + ptr_t *pp = (ptr_t *) elements (array); + for (int i = JvGetArrayLength (array) - 1; i >= 0; i--) + { + p = pp[i]; + MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, array, e2label); + } + } return mark_stack_ptr; } Index: verify.cc =================================================================== RCS file: /cvs/gcc/gcc/libjava/verify.cc,v retrieving revision 1.48 diff -u -r1.48 verify.cc --- verify.cc 5 Dec 2002 02:23:57 -0000 1.48 +++ verify.cc 25 Dec 2002 15:44:20 -0000 @@ -3164,7 +3164,9 @@ void _Jv_VerifyMethod (_Jv_InterpMethod *meth) { +/* _Jv_BytecodeVerifier v (meth); v.verify_instructions (); +*/ } #endif /* INTERPRETER */ Index: gnu/gcj/runtime/natVMClassLoader.cc =================================================================== RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/runtime/natVMClassLoader.cc,v retrieving revision 1.1 diff -u -r1.1 natVMClassLoader.cc --- gnu/gcj/runtime/natVMClassLoader.cc 11 Dec 2002 03:15:14 -0000 1.1 +++ gnu/gcj/runtime/natVMClassLoader.cc 25 Dec 2002 15:44:20 -0000 @@ -46,7 +46,7 @@ { using namespace ::java::lang; Runtime *rt = Runtime::getRuntime(); - jboolean loaded = rt->loadLibraryInternal (so_base_name); + jboolean loaded = false; // rt->loadLibraryInternal (so_base_name); jint nd = so_base_name->lastIndexOf ('-'); if (nd == -1) Index: java/lang/StringBuffer.java =================================================================== RCS file: /cvs/gcc/gcc/libjava/java/lang/StringBuffer.java,v retrieving revision 1.13 diff -u -r1.13 StringBuffer.java --- java/lang/StringBuffer.java 22 Jan 2002 22:40:16 -0000 1.13 +++ java/lang/StringBuffer.java 25 Dec 2002 15:44:21 -0000 @@ -308,26 +308,27 @@ } } - /** Get the specified array of characters. - * The characters will be copied into the array you pass in. - * @param srcOffset the index to start copying from in the - * StringBuffer. - * @param srcEnd the number of characters to copy. - * @param dst the array to copy into. - * @param dstOffset the index to start copying into dst. - * @exception NullPointerException if dst is null. - * @exception IndexOutOfBoundsException if any source or target - * indices are out of range. - * @see java.lang.System#arraycopy(java.lang.Object,int,java.lang.Object,int,int) + /** + * Get the specified array of characters. srcOffset - srcEnd + * characters will be copied into the array you pass in. + * + * @param srcOffset the index to start copying from (inclusive) + * @param srcEnd the index to stop copying from (exclusive) + * @param dst the array to copy into + * @param dstOffset the index to start copying into + * @throws NullPointerException if dst is null + * @throws IndexOutOfBoundsException if any source or target indices are + * out of range (while unspecified, source problems cause a + * StringIndexOutOfBoundsException, and dest problems cause an + * ArrayIndexOutOfBoundsException) + * @see System#arraycopy(Object, int, Object, int, int) */ - public synchronized void getChars (int srcOffset, int srcEnd, - char[] dst, int dstOffset) + public synchronized void getChars(int srcOffset, int srcEnd, + char[] dst, int dstOffset) { - if (srcOffset < 0 || srcOffset > srcEnd) - throw new StringIndexOutOfBoundsException (srcOffset); int todo = srcEnd - srcOffset; - if (srcEnd > count || dstOffset + todo > count) - throw new StringIndexOutOfBoundsException (srcEnd); + if (srcOffset < 0 || srcEnd > count || todo < 0) + throw new StringIndexOutOfBoundsException(); System.arraycopy(value, srcOffset, dst, dstOffset, todo); } Index: java/lang/natObject.cc =================================================================== RCS file: /cvs/gcc/gcc/libjava/java/lang/natObject.cc,v retrieving revision 1.23 diff -u -r1.23 natObject.cc --- java/lang/natObject.cc 21 Oct 2002 01:50:14 -0000 1.23 +++ java/lang/natObject.cc 25 Dec 2002 15:44:22 -0000 @@ -532,7 +532,7 @@ unsigned duration = MIN_SLEEP_USECS << (n - yield_limit); if (n >= 15 + yield_limit || duration > MAX_SLEEP_USECS) duration = MAX_SLEEP_USECS; - java::lang::Thread::sleep(0, duration); + usleep(duration); } } Index: java/net/URLClassLoader.java =================================================================== RCS file: /cvs/gcc/gcc/libjava/java/net/URLClassLoader.java,v retrieving revision 1.12 diff -u -r1.12 URLClassLoader.java --- java/net/URLClassLoader.java 11 Dec 2002 02:13:51 -0000 1.12 +++ java/net/URLClassLoader.java 25 Dec 2002 15:44:23 -0000 @@ -238,7 +238,7 @@ CodeSource getCodeSource() { Certificate[] certs = getCertificates(); - if (certs != null) + if (certs == null) return loader.noCertCodeSource; else return new CodeSource(loader.baseURL, certs); @@ -271,14 +271,26 @@ abstract InputStream getInputStream() throws IOException; } + /** + * Returns the given URL with a canonicalized file path name when it + * is has the file protocol. Otherwise (or when the file part of the + * URL couldn't be canonicalized) it returns the original String. + * It makes sure that if the original file part ended with a file + * separator that the new file part also ends with a separator. + */ static URL getCanonicalFileURL(URL url) { if ("file".equals(url.getProtocol())) { try { - File f = new File(url.getFile()).getCanonicalFile(); - url = new URL("file", "", f.toString()); + String f = url.getFile(); + File file = new File(f).getCanonicalFile(); + String cf = file.toString().replace(File.separatorChar, '/'); + if ((f.endsWith("/") || f.endsWith(File.separator)) + && !cf.endsWith("/")) + cf += "/"; + url = new URL("file", "", cf); } catch (IOException ignore) { Index: java/net/URLStreamHandler.java =================================================================== RCS file: /cvs/gcc/gcc/libjava/java/net/URLStreamHandler.java,v retrieving revision 1.13 diff -u -r1.13 URLStreamHandler.java --- java/net/URLStreamHandler.java 22 Nov 2002 16:48:52 -0000 1.13 +++ java/net/URLStreamHandler.java 25 Dec 2002 15:44:24 -0000 @@ -436,7 +436,7 @@ // ignores a non-default port if host is null or "". That is inconsistent // with the spec since the result of this method is spec'ed so it can be // used to construct a new URL that is equivalent to the original. - boolean port_needed = port >= 0 && port != getDefaultPort(); + boolean port_needed = port > 0 && port != getDefaultPort(); if (port_needed) sb.append(':').append(port); Index: java/util/Properties.java =================================================================== RCS file: /cvs/gcc/gcc/libjava/java/util/Properties.java,v retrieving revision 1.13 diff -u -r1.13 Properties.java --- java/util/Properties.java 18 Jun 2002 15:39:57 -0000 1.13 +++ java/util/Properties.java 25 Dec 2002 15:44:24 -0000 @@ -540,6 +540,7 @@ case '=': case ':': buffer.append('\\').append(c); + break; default: if (c < ' ' || c > '~') { Index: java/util/zip/ZipFile.java =================================================================== RCS file: /cvs/gcc/gcc/libjava/java/util/zip/ZipFile.java,v retrieving revision 1.19 diff -u -r1.19 ZipFile.java --- java/util/zip/ZipFile.java 3 Dec 2002 22:06:31 -0000 1.19 +++ java/util/zip/ZipFile.java 25 Dec 2002 15:44:24 -0000 @@ -136,6 +136,7 @@ this.name = file.getName(); } + private final byte[] ebs = new byte[24]; /** * Read an unsigned short in little endian byte order. * @exception IOException if a i/o error occured. @@ -143,9 +144,8 @@ */ private final int readLeShort(DataInput di) throws IOException { - byte[] b = new byte[2]; - di.readFully(b); - return (b[0] & 0xff) | (b[1] & 0xff) << 8; + di.readFully(ebs, 0, 2); + return (ebs[0] & 0xff) | (ebs[1] & 0xff) << 8; } /** @@ -155,10 +155,9 @@ */ private final int readLeInt(DataInput di) throws IOException { - byte[] b = new byte[4]; - di.readFully(b); - return ((b[0] & 0xff) | (b[1] & 0xff) << 8) - | ((b[2] & 0xff) | (b[3] & 0xff) << 8) << 16; + di.readFully(ebs, 0, 4); + return ((ebs[0] & 0xff) | (ebs[1] & 0xff) << 8) + | ((ebs[2] & 0xff) | (ebs[3] & 0xff) << 8) << 16; } /** @@ -192,7 +191,6 @@ entries = new Hashtable(count); raf.seek(centralOffset); - byte[] ebs = new byte[24]; ByteArrayInputStream ebais = new ByteArrayInputStream(ebs); DataInputStream edip = new DataInputStream(ebais); for (int i = 0; i < count; i++) @@ -202,7 +200,7 @@ if (raf.skipBytes(CENHOW - CENVEM) != CENHOW - CENVEM) throw new EOFException(name); - raf.readFully(ebs); + raf.readFully(ebs, 0, 24); ebais.reset(); int method = readLeShort(edip); int dostime = readLeInt(edip);