From java-patches-return-344-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Mon Jan 03 13:52:22 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 26556 invoked by alias); 3 Jan 2000 13:52:22 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 26537 invoked from network); 3 Jan 2000 13:52:19 -0000 Message-ID: <3870A964.4420@fernuni-hagen.de> Date: Mon, 03 Jan 2000 14:51:32 +0100 From: Joerg Brunsmann Organization: Fernuniversitaet Hagen - Software Engineering (Praktische Informatik III) X-Mailer: Mozilla 3.04 (X11; I; SunOS 5.7 sun4u) MIME-Version: 1.0 To: java-patches@sourceware.cygnus.com Subject: Re: FAQ -- building snapshots? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit This patch removes some inconsistencies in faq.html and it adds a new FAQ entry. Please also find attached the referenced file "build-snapshot.html". BTW: the file FAQ.html and the directory "new" in "htdocs/" can be deleted, I think. *** faq.html.orig Mon Jan 3 12:06:21 2000 --- faq.html Mon Jan 3 14:27:36 2000 *************** *** 61,100 **** the support?
  • Does GCJ support using straight C native methods ala JNI? CNI looks kind of hard to use.
  • !
  • Why does GCJ use CNI?
  • !
  • What is the state of AWT support?
  • !
  • How about support for Swing ?
  • !
  • What support is there for RMI ?
  • !
  • Can I use any code from other OpenSource projects to supplement libgcj's current features ?
  • !
  • What features of the Java language are/arn't supported
  • !
  • Build Issues
    1. Linker bug on Solaris
  • Gcj Compile/Link Questions
    1. Why do I get undefined reference to `main' errors? !
    2. 4.2 Can GCJ only handle source code?
    3. "gcj -C" Doesnt seem to work like javac/jikes. Whats going on?
    4. Where does GCJ look for files? !
    5. How does gcj resolve wether to compile .class or .java files? -
    6. How do I increase the runtime's initial and maximum - heap sizes?
  • Runtime Questions
    1. My program is dumping core! What's going on?
    2. When I run the debugger I get a SEGV in the GC! What's going on? !
    3. Can I profile Garbage Collection? !
    4. How do I increase the runtime's initial and maximum heap sizes? !
    5. How can I profile my application?
  • Programing Issues
      --- 61,103 ---- the support?
    1. Does GCJ support using straight C native methods ala JNI? CNI looks kind of hard to use.
    2. !
    3. Why does GCJ use CNI?
    4. !
    5. What is the state of AWT support?
    6. !
    7. How about support for Swing ?
    8. !
    9. What support is there for RMI ?
    10. !
    11. Can I use any code from other OpenSource projects to supplement libgcj's current features ?
    12. !
    13. What features of the Java language are/arn't supported
    !
  • Build Issues
      +
    1. I need something more recent than the last release; how + should I build it?
    2. Linker bug on Solaris
  • Gcj Compile/Link Questions
    1. Why do I get undefined reference to `main' errors? !
    2. Can GCJ only handle source code?
    3. "gcj -C" Doesnt seem to work like javac/jikes. Whats going on?
    4. Where does GCJ look for files? !
    5. How does gcj resolve wether to compile .class or .java files?
  • Runtime Questions
    1. My program is dumping core! What's going on?
    2. When I run the debugger I get a SEGV in the GC! What's going on? !
    3. I have just compiled and benchmarked my Java application ! and it seems to be running slower than than XXX JIT JVM. Is there ! anything I can do to make it go faster?< !
    4. Can I profile Garbage Collection? !
    5. How do I increase the runtime's initial and maximum heap sizes? !
    6. How can I profile my application?
  • Programing Issues
      *************** *** 169,175 **** --- 172,177 ---- *************** *** 201,226 **** all of those native methods yourself, and make sure they behave exactly as Sun's do. Note that they're undocumented! -
      -
       
      -
       
      -
       
      To date Reflection is not supported, although all the required metadata is included in Class.h.
      -
      -
      -
      -
       
      -
      -
      -
      -
      -
      -
      -
      -
      -

      2.2 Does GCJ support using straight C native methods --- 203,212 ---- all of those native methods yourself, and make sure they behave exactly as Sun's do. Note that they're undocumented!
       
      +
      To date Reflection is not supported, although all the required metadata is included in Class.h.

      2.2 Does GCJ support using straight C native methods *************** *** 256,262 ****
      !

      2.3 Why does GCJ use CNI?

      Per Bothner explains

      --- 242,248 ----
      !

      2.3 Why does GCJ use CNI?

      Per Bothner explains

      *************** *** 275,281 ****

      !

      2.4 What is the state of AWT support?

      No support is currently in place for AWT. Prior Art which could be used for this all require JNI. Possible starting points follow: --- 261,267 ----

      !

      2.4 What is the state of AWT support?

      No support is currently in place for AWT. Prior Art which could be used for this all require JNI. Possible starting points follow: *************** *** 399,405 ****
      !

      2.7 Can I contribute code from other Free Software projects to supplement libgcj's current features?

      Can someone point me to some difinitive words --- 385,391 ----
      !

      2.7 Can I use any code from other OpenSource projects to supplement libgcj's current features?

      Can someone point me to some difinitive words *************** *** 413,419 ****
      !

      2.8 What features of the Java language are/arn't supported.

      At the moment GCJ supports all Java language constructs as per the Java language Specification --- 399,405 ----
      !

      2.8 What features of the Java language are/aren't supported.

      At the moment GCJ supports all Java language constructs as per the Java language Specification *************** *** 431,439 ****
      -

       

      Java Feature Support

      !

      3.1 Linker bug on Solaris

      There is a known problem with the --- 417,436 ---- + +
      +
      +

      3.1 I need something more recent than the last release; how should I build it?

      +
      +

      +

      Please read here. +
      +

      +
      +
      !

      3.2 Linker bug on Solaris

      There is a known problem with the *************** collect2: ld returned 1 exit status *** 519,525 ****
       
      !

      4.3 "gcj -C" Doesnt seem to work like javac/jikes. Whats going on?

      --- 516,522 ----
       
      !

      4.3 "gcj -C" Doesnt seem to work like javac/jikes. Whats going on?

      *************** collect2: ld returned 1 exit status *** 642,648 ****
       
      !

      5.3 Can I profile Garbage Collection?

      It is possible to turn on verbose GC output by supressing the -DSILENT flag during build. One way to do this is to comment out the line with --- 639,645 ----
       
      !

      5.4 Can I profile Garbage Collection?

      It is possible to turn on verbose GC output by supressing the -DSILENT flag during build. One way to do this is to comment out the line with *************** collect2: ld returned 1 exit status *** 655,661 ****
       
      !

      5.4 How do I increase the runtime's initial and maximum heap sizes?

      Some programs that allocate many small, short-lived objects can cause --- 652,658 ----
       
      !

      5.5 How do I increase the runtime's initial and maximum heap sizes?

      Some programs that allocate many small, short-lived objects can cause *************** collect2: ld returned 1 exit status *** 667,673 ****
      !

      5.5 How can I profile my application?

      Support for this is currently lagging. Only single threaded Java code may be used by the profiler (gprof). POSIX threads seem to be incompatible --- 664,670 ----
      !

      5.6 How can I profile my application?

      Support for this is currently lagging. Only single threaded Java code may be used by the profiler (gprof). POSIX threads seem to be incompatible *************** collect2: ld returned 1 exit status *** 685,691 ****

      6.1 Are there any examples of how to use CNI?

      Tom Tromey has created a couple ! of simple ezamples here and here.

      Another CNI example may be found here (thanks to Glenn Chambers!): http://sourceware.cygnus.com/ml/java-discuss/1999-q3/msg00534.html --- 682,688 ----

      6.1 Are there any examples of how to use CNI?

      Tom Tromey has created a couple ! of simple examples here and here.

      Another CNI example may be found here (thanks to Glenn Chambers!): http://sourceware.cygnus.com/ml/java-discuss/1999-q3/msg00534.html -----------------build-snapshot.html------------------- How to build GCJ/LIBGCJ snapshots

      Howto build and run libgcj/gcj snapshots

      1. Get a GCC snapshots from 
      
      ftp://gcc.cygnus.com/pub/egcs/snapshots/index.html
      
      They are made about once a week. 
      
      2. Get a Libgcj snapshots from
      
      ftp://sourceware.cygnus.com/pub/java/snapshot
      
      They are made nightly.
      
      3. Make a compile directory
      
        $ mkdir compile
      
      4. Move the snapshots into the compile dir, e.g.
      
        $ cd compile
        $ mv ../egcs-19991110.tar.gz .
        $ mv ../libgcj-snapshot-1999-11-12.tar.gz .
        $ gunzip *.gz
        $ tar xfv *.tar
        $ ln -s egcs-19991102 egcs
        $ ln -s libgcj-snapshot-1999-11-12 libgcj
      
      5. Compile and install egcs/gcj
      
        $ cd egcs
        $ mkdir objdir
        $ cd objdir
        $ ../configure --enable-threads=posix --prefix=/home/joerg/gcc \ 
           --enable-java-gc=boehm --with-as=/opt/gnu/bin/as \
           --with-ld=/opt/gnu/bin/ld
        $ make bootstrap
        $ make install
      
      If you compile under Linux you could omit the last two options. Under
      Solaris you'll need them. If you omit '--prefix' the compiled source will 
      be installed under /usr/local. For more information about installing 
      egcs and/or configuration options see:
      
      
      http://egcs.cygnus.com/install/index.html
      
      6. Set the Path to the newly installed gcc
      
        $ setenv PATH /home/joerg/gcc/bin:$PATH
      
      Be sure to use the path with you gave the configure script
      with '--prefix'.
      
      Test the existence with
      
        $ gcj -v
      
      7. Compile and install libgcj
      
       $ cd ../libgcj
       $ mkdir objdir
       $ cd objdir
       $ ../configure --enable-threads=posix --prefix=/home/joerg/libgcj \
         --enable-java-gc=boehm --with-as=/opt/gnu/bin/as --with-ld=/opt/gnu/bin/ld
      
      Again, the last two options are needed for Solaris.
      
       $ make
       $ make install
      
      Make sure you configured both gcj and libgjc with the same garbarge collector 
      and with the same thread package. If you use the default for gcj/egcs (no 
      configure option) you have to use --enable-java-gc=no for libgcj.
      
      8. Adjust your environment
      
      Edit a file env.csh:
      
      setenv PATH /home/joerg/gcc/bin:$PATH
      setenv LD_LIBRARY_PATH /home/joerg/libgcj/lib
      setenv CLASSPATH /home/joerg/libgcj/share/libgcj.zip
      
        $ source env.csh
      
      9. If gcj complains about a missing libgcj.spec file copy it into your current directory
        
        $ cp /home/joerg/libgcj/lib/libgcj.spec .
      
      10. Edit a file HelloWorld.java
      
        public class HelloWorld {
          public static void main(String [] args) {
            System.out.println("Hello");
          }
        }
      
      11. Compile and run HelloWorld
      
       $ gcj --main=HelloWorld -o HelloWorld HelloWorld.java
       $ ./HelloWorld
      
      From java-patches-return-345-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Mon Jan 03 20:18:20 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 19209 invoked by alias); 3 Jan 2000 20:18:19 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 19176 invoked from network); 3 Jan 2000 20:18:06 -0000 To: Java Patch List Subject: Patch: better control of Mauve tests X-Zippy: What a COINCIDENCE! I'm an authorized ``SNOOTS OF THE STARS'' dealer!! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 03 Jan 2000 13:20:23 -0700 Message-ID: <87k8lqoqk8.fsf@cygnus.com> Lines: 39 I'm committing the appended patch. It changes the test suite to give better control over Mauve tests; now you can select which tests to run from the `dejagnu' command line. 1999-12-31 Tom Tromey * libjava.mauve/mauve.exp (mauve_compute_uses): Let user select specific tests to run. Tom Index: libjava.mauve/mauve.exp =================================================================== RCS file: /cvs/java/libgcj/libjava/testsuite/libjava.mauve/mauve.exp,v retrieving revision 1.6 diff -u -r1.6 mauve.exp --- mauve.exp 1999/07/31 23:52:52 1.6 +++ mauve.exp 2000/01/03 20:10:51 @@ -10,7 +10,7 @@ # maps source file names onto list of objects required for link. proc mauve_compute_uses {aName} { upvar $aName uses - global env + global env runtests set fd [open classes r] set line [read $fd] @@ -21,6 +21,11 @@ continue } set item [join [split $item .] /].java + + # User might have specified "mauve.exp=something.java". + if {! [runtest_file_p $runtests $item]} { + continue + } # Look for Uses line in source file. set fd [open $env(MAUVEDIR)/$item r] From java-patches-return-346-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Tue Jan 04 08:47:46 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 16469 invoked by alias); 4 Jan 2000 08:47:45 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 16367 invoked from network); 4 Jan 2000 08:46:32 -0000 To: Java Patch List Subject: Patch: reflection support X-Zippy: It's today's SPECIAL! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 04 Jan 2000 01:46:20 -0700 Message-ID: <87hfguns0z.fsf@cygnus.com> Lines: 1456 X-Mailer: Gnus v5.5/Emacs 20.3 I'm checking in this jumbo patch. It: * Implements most of java.lang.reflect (perhaps all of it) * Implements nearly all of the reflection methods in java.lang.Class * Fixes a couple bugs in the existing reflection code * Fixes a couple minor portability bugs (define _GNU_SOURCE always, remove the `#pragma's from array.h -- this last one allows "-g" builds to work again for me) This code compiles, and at least partly works, but it is largely untested. It currently fails on the one Mauve Method.invoke test, but I've been having major problems debugging (compiler and debugger failures on alternate days), so I'm just committing it. As far as I know it won't break anything that already works. In case this seeming instability worries you, my plan for the next few days is to write Mauve tests for the new functionality, and get the debugging done too. 2000-01-04 Tom Tromey * java/lang/reflect/natConstructor.cc (newInstance): Pass declaring class as return_type argument to _Jv_CallNonvirtualMethodA. * java/lang/reflect/natMethod.cc (_Jv_CallNonvirtualMethodA): In constructor case, create object and use it as `this' argument. * java/lang/Class.h (_getConstructors): Declare. (_getFields): Declare. * java/lang/Class.java (getConstructors): Wrote. (_getConstructors): New native method. (getDeclaredConstructors): Wrote. (_getFields): Declare new native method. * java/lang/natClass.cc (_Jv_LookupInterfaceMethod): Removed incorrect comment. (getMethod): Work correctly when class is primitive. (getDeclaredMethods): Likewise. Compute offset using `method', not `mptr'. (getDeclaredMethod): Likewise. (getConstructor): Wrote. (ConstructorClass): New define. (getDeclaredConstructor): Wrote. (_getConstructors): New method. (_getFields): New method. (getFields): Wrote. * Makefile.in: Rebuilt. * Makefile.am (AM_CXXFLAGS): Added -D_GNU_SOURCE. * prims.cc: Remove `#pragma implementation'. * gcj/array.h: Remove `#pragma interface'. * prims.cc (_Jv_equaln): New function. * java/lang/Class.java (getSignature): Declare. * resolve.cc (_Jv_LookupDeclaredMethod): Moved to natClass.cc. * java/lang/natClass.cc (_Jv_LookupDeclaredMethod): Moved from resolve.cc. (getSignature): New method. (getDeclaredMethod): Wrote. (getMethod): Wrote. Include StringBuffer.h. * java/lang/Class.h (Class): Added _Jv_FromReflectedConstructor as a friend. Unconditionally declare _Jv_LookupDeclaredMethod as a friend. (getSignature): Declare. * include/jvm.h (_Jv_GetTypesFromSignature): Declare. (_Jv_equaln): Declare. (_Jv_CallNonvirtualMethodA): Declare. * Makefile.in: Rebuilt. * Makefile.am (nat_source_files): Added natConstructor.cc. (java/lang/reflect/Constructor.h): New target. * java/lang/reflect/natConstructor.cc: New file. * java/lang/reflect/Constructor.java (newInstance): Now native. (declaringClass): Renamed from decl_class. (offset): Renamed from index. (getType): New native method. (getModifiers): Now native. (getParameterTypes): Call getType if required. (hashCode): Include hash code from declaring class. (modifiers): Removed. (toString): Call getType if required. * gcj/method.h (_Jv_FromReflectedConstructor): New function. * java/lang/reflect/natMethod.cc (hack_call): New method. Removed `#if 0' around FFI code. Include . (invoke): Use _Jv_CallNonvirtualMethodA. Throw IllegalArgumentException when argument object and class disagree. (_Jv_GetTypesFromSignature): New function. (getType): Use it. (ObjectClass): New define. (_Jv_CallNonvirtualMethodA): New function. * java/lang/reflect/Method.java (hack_trampoline): New method. (hack_call): New native method. 1999-12-21 Per Bothner * java/lang/natClass.cc (getDeclaredMethods): Correctly compute offset in new Method. Tom Index: Makefile.am =================================================================== RCS file: /cvs/java/libgcj/libjava/Makefile.am,v retrieving revision 1.39 diff -u -r1.39 Makefile.am --- Makefile.am 1999/12/20 02:18:11 1.39 +++ Makefile.am 2000/01/04 08:39:01 @@ -74,8 +74,10 @@ EH_COMMON_INCLUDE = @EH_COMMON_INCLUDE@ WARNINGS = -W -Wall +## We need _GNU_SOURCE defined for some Linux builds. It doesn't hurt +## to always define it. AM_CXXFLAGS = -fno-rtti -fvtable-thunks @LIBGCJ_CXXFLAGS@ @EXCEPTIONSPEC@ \ - $(WARNINGS) + $(WARNINGS) -D_GNU_SOURCE if USING_GCC AM_CFLAGS = @LIBGCJ_CFLAGS@ $(WARNINGS) else @@ -229,6 +231,12 @@ -friend 'jstring _Jv_AllocString (jsize);' \ $(basename $<) +java/lang/reflect/Constructor.h: java/lang/reflect/Constructor.class libgcj.zip + $(GCJH) -classpath $(top_builddir) \ + -friend 'jmethodID _Jv_FromReflectedConstructor (java::lang::reflect::Constructor *);' \ + -friend 'java::lang::Class;' \ + $(basename $<) + java/lang/reflect/Field.h: java/lang/reflect/Field.class libgcj.zip $(GCJH) -classpath $(top_builddir) \ -friend 'jfieldID _Jv_FromReflectedField (java::lang::reflect::Field *);' \ @@ -797,6 +805,7 @@ java/lang/natSystem.cc \ java/lang/natThread.cc \ java/lang/reflect/natArray.cc \ +java/lang/reflect/natConstructor.cc \ java/lang/reflect/natField.cc \ java/lang/reflect/natMethod.cc \ java/net/natInetAddress.cc \ Index: prims.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/prims.cc,v retrieving revision 1.14 diff -u -r1.14 prims.cc --- prims.cc 1999/11/25 00:36:51 1.14 +++ prims.cc 2000/01/04 08:39:14 @@ -16,8 +16,6 @@ #include #include -#pragma implementation "gcj/array.h" - #include #include #include @@ -133,6 +131,26 @@ register unsigned char* ptr = (unsigned char*) a->data; register unsigned char* limit = ptr + a->length; for (;; i++, sptr++) + { + int ch = UTF8_GET (ptr, limit); + if (i == len) + return ch < 0; + if (ch != *sptr) + return false; + } + return true; +} + +/* Like _Jv_equal, but stop after N characters. */ +jboolean +_Jv_equaln (Utf8Const *a, jstring str, jint n) +{ + jint len = str->length(); + jint i = 0; + jchar *sptr = _Jv_GetStringChars (str); + register unsigned char* ptr = (unsigned char*) a->data; + register unsigned char* limit = ptr + a->length; + for (; n-- > 0; i++, sptr++) { int ch = UTF8_GET (ptr, limit); if (i == len) Index: resolve.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/resolve.cc,v retrieving revision 1.6 diff -u -r1.6 resolve.cc --- resolve.cc 1999/09/10 22:03:05 1.6 +++ resolve.cc 2000/01/04 08:39:24 @@ -321,21 +321,6 @@ } } -_Jv_Method* -_Jv_LookupDeclaredMethod (jclass klass, _Jv_Utf8Const *name, - _Jv_Utf8Const *signature) -{ - for (; klass; klass = klass->getSuperclass()) - { - _Jv_Method *meth = _Jv_GetMethodLocal (klass, name, signature); - - if (meth) - return meth; - } - - return NULL; -} - /** FIXME: this is a terribly inefficient algorithm! It would improve things if compiled classes to know vtable offset, and _Jv_Method had a field for this. Index: gcj/array.h =================================================================== RCS file: /cvs/java/libgcj/libjava/gcj/array.h,v retrieving revision 1.2 diff -u -r1.2 array.h --- array.h 1999/10/22 19:43:40 1.2 +++ array.h 2000/01/04 08:39:28 @@ -11,8 +11,6 @@ #ifndef __GCJ_ARRAY_H__ #define __GCJ_ARRAY_H__ -#pragma interface - #include extern "Java" { Index: gcj/method.h =================================================================== RCS file: /cvs/java/libgcj/libjava/gcj/method.h,v retrieving revision 1.1 diff -u -r1.1 method.h --- method.h 1999/09/10 22:03:06 1.1 +++ method.h 2000/01/04 08:39:28 @@ -18,4 +18,11 @@ ((char *) method->declaringClass->methods + method->offset); } +extern inline jmethodID +_Jv_FromReflectedConstructor (java::lang::reflect::Constructor *constructor) +{ + return (jmethodID) + ((char *) constructor->declaringClass->methods + constructor->offset); +} + #endif /* __GCJ_METHOD_H__ */ Index: include/jvm.h =================================================================== RCS file: /cvs/java/libgcj/libjava/include/jvm.h,v retrieving revision 1.8 diff -u -r1.8 jvm.h --- jvm.h 1999/12/06 06:33:56 1.8 +++ jvm.h 2000/01/04 08:39:32 @@ -53,6 +53,7 @@ _Jv_Utf8Const *_Jv_makeUtf8Const (jstring string); extern jboolean _Jv_equalUtf8Consts (_Jv_Utf8Const *, _Jv_Utf8Const *); extern jboolean _Jv_equal (_Jv_Utf8Const *, jstring, jint); +extern jboolean _Jv_equaln (_Jv_Utf8Const *, jstring, jint); #define StringClass _CL_Q34java4lang6String extern java::lang::Class StringClass; @@ -161,6 +162,13 @@ java::lang::ClassLoader *loader); extern jclass _Jv_FindClassFromSignature (char *, java::lang::ClassLoader *loader); +extern void _Jv_GetTypesFromSignature (jmethodID method, + jclass declaringClass, + JArray **arg_types_out, + jclass *return_type_out); +extern jobject _Jv_CallNonvirtualMethodA (jobject, jclass, + jmethodID, jboolean, + JArray *, jobjectArray); extern jobject _Jv_NewMultiArray (jclass, jint ndims, jint* dims) __attribute__((__malloc__)); Index: java/lang/Class.h =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/Class.h,v retrieving revision 1.7 diff -u -r1.7 Class.h --- Class.h 1999/09/10 22:03:08 1.7 +++ Class.h 2000/01/04 08:39:37 @@ -1,6 +1,6 @@ // Class.h - Header file for java.lang.Class. -*- c++ -*- -/* Copyright (C) 1998, 1999 Cygnus Solutions +/* Copyright (C) 1998, 1999, 2000 Cygnus Solutions This file is part of libgcj. @@ -94,12 +94,16 @@ java::lang::reflect::Field *getField (jstring); private: + jint _getFields (JArray *result, jint offset); + JArray *_getConstructors (jboolean); java::lang::reflect::Field *getField (jstring, jint); public: JArray *getFields (void); JArray *getInterfaces (void); + void getSignature (java::lang::StringBuffer *buffer); + static jstring getSignature (JArray *); java::lang::reflect::Method *getMethod (jstring, JArray *); JArray *getMethods (void); @@ -156,6 +160,8 @@ // Friend functions implemented in natClass.cc. friend _Jv_Method *_Jv_GetMethodLocal (jclass klass, _Jv_Utf8Const *name, _Jv_Utf8Const *signature); + friend _Jv_Method* _Jv_LookupDeclaredMethod (jclass, _Jv_Utf8Const *, + _Jv_Utf8Const*); friend void _Jv_InitClass (jclass klass); friend jfieldID JvGetFirstInstanceField (jclass); @@ -166,6 +172,7 @@ friend jobject _Jv_JNI_ToReflectedField (_Jv_JNIEnv *, jclass, jfieldID); friend jfieldID _Jv_FromReflectedField (java::lang::reflect::Field *); friend jmethodID _Jv_FromReflectedMethod (java::lang::reflect::Method *); + friend jmethodID _Jv_FromReflectedConstructor (java::lang::reflect::Constructor *); friend class _Jv_PrimClass; @@ -190,8 +197,6 @@ #ifdef INTERPRETER friend jboolean _Jv_IsInterpretedClass (jclass); friend void _Jv_InitField (jobject, jclass, _Jv_Field*); - friend _Jv_Method* _Jv_LookupDeclaredMethod (jclass, _Jv_Utf8Const *, - _Jv_Utf8Const*); friend int _Jv_DetermineVTableIndex (jclass, _Jv_Utf8Const *, _Jv_Utf8Const*); friend void _Jv_InitField (jobject, jclass, int); Index: java/lang/Class.java =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/Class.java,v retrieving revision 1.3 diff -u -r1.3 Class.java --- Class.java 1999/08/18 14:16:41 1.3 +++ Class.java 2000/01/04 08:39:37 @@ -1,6 +1,6 @@ // Class.java - Representation of a Java class. -/* Copyright (C) 1998, 1999 Cygnus Solutions +/* Copyright (C) 1998, 1999, 2000 Cygnus Solutions This file is part of libgcj. @@ -36,14 +36,27 @@ public native Constructor getConstructor (Class[] parameterTypes) throws NoSuchMethodException, SecurityException; - public native Constructor[] getConstructors () throws SecurityException; - public native Class[] getDeclaredClasses () throws SecurityException; + // This is used to implement getConstructors and + // getDeclaredConstructors. + private native Constructor[] _getConstructors (boolean declared) + throws SecurityException; + public Constructor[] getConstructors () throws SecurityException + { + return _getConstructors (false); + } + public native Constructor getDeclaredConstructor (Class[] parameterTypes) throws NoSuchMethodException, SecurityException; - public native Constructor[] getDeclaredConstructors () - throws SecurityException; + + public native Class[] getDeclaredClasses () throws SecurityException; + + public Constructor[] getDeclaredConstructors () throws SecurityException + { + return _getConstructors (true); + } + public native Field getDeclaredField (String fieldName) throws NoSuchFieldException, SecurityException; public native Field[] getDeclaredFields () throws SecurityException; @@ -69,9 +82,14 @@ throw new NoSuchFieldException(fieldName); return fld; } + + private native Field[] _getFields (Field[] result, int offset); public native Field[] getFields () throws SecurityException; public native Class[] getInterfaces (); + + private final native void getSignature (StringBuffer buffer); + private static final native String getSignature (Class[] parameterTypes); public native Method getMethod (String methodName, Class[] parameterTypes) throws NoSuchMethodException, SecurityException; Index: java/lang/natClass.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/natClass.cc,v retrieving revision 1.8 diff -u -r1.8 natClass.cc --- natClass.cc 1999/11/18 07:19:00 1.8 +++ natClass.cc 2000/01/04 08:39:41 @@ -1,6 +1,6 @@ // natClass.cc - Implementation of java.lang.Class native methods. -/* Copyright (C) 1998, 1999 Cygnus Solutions +/* Copyright (C) 1998, 1999, 2000 Cygnus Solutions This file is part of libgcj. @@ -38,6 +38,7 @@ #include #include #include +#include #include @@ -55,6 +56,8 @@ extern java::lang::Class MethodClass; #define FieldClass _CL_Q44java4lang7reflect5Field extern java::lang::Class FieldClass; +#define ConstructorClass _CL_Q44java4lang7reflect11Constructor +extern java::lang::Class ConstructorClass; // Some constants we use to look up the class initializer. static _Jv_Utf8Const *void_signature = _Jv_makeUtf8Const ("()V", 3); @@ -96,27 +99,95 @@ } java::lang::reflect::Constructor * -java::lang::Class::getConstructor (JArray *) +java::lang::Class::getConstructor (JArray *param_types) { - JvFail ("java::lang::Class::getConstructor not implemented"); + jstring partial_sig = getSignature (param_types); + jint hash = partial_sig->hashCode (); + + int i = isPrimitive () ? 0 : method_count; + while (--i >= 0) + { + // FIXME: access checks. + if (_Jv_equalUtf8Consts (methods[i].name, init_name) + && _Jv_equal (methods[i].signature, partial_sig, hash)) + { + // Found it. For getConstructor, the constructor must be + // public. + using namespace java::lang::reflect; + if (Modifier::isPublic(methods[i].accflags)) + break; + Constructor *cons = new Constructor (); + cons->offset = (char *) (&methods[i]) - (char *) methods; + cons->declaringClass = this; + return cons; + } + } + JvThrow (new java::lang::NoSuchMethodException); } JArray * -java::lang::Class::getConstructors (void) +java::lang::Class::_getConstructors (jboolean declared) { - JvFail ("java::lang::Class::getConstructors not implemented"); + // FIXME: this method needs access checks. + + int numConstructors = 0; + int max = isPrimitive () ? 0 : method_count; + int i; + for (i = max; --i >= 0; ) + { + _Jv_Method *method = &methods[i]; + if (method->name == NULL + && ! _Jv_equalUtf8Consts (method->name, init_name)) + continue; + if (declared + && ! java::lang::reflect::Modifier::isPublic(method->accflags)) + continue; + numConstructors++; + } + JArray *result + = (JArray *) + JvNewObjectArray (numConstructors, &ConstructorClass, NULL); + java::lang::reflect::Constructor** cptr = elements (result); + for (i = 0; i < max; i++) + { + _Jv_Method *method = &methods[i]; + if (method->name == NULL + && ! _Jv_equalUtf8Consts (method->name, init_name)) + continue; + if (declared + && ! java::lang::reflect::Modifier::isPublic(method->accflags)) + continue; + java::lang::reflect::Constructor *cons + = new java::lang::reflect::Constructor (); + cons->offset = (char *) method - (char *) methods; + cons->declaringClass = this; + *cptr++ = cons; + } + return result; } java::lang::reflect::Constructor * -java::lang::Class::getDeclaredConstructor (JArray *) +java::lang::Class::getDeclaredConstructor (JArray *param_types) { - JvFail ("java::lang::Class::getDeclaredConstructor not implemented"); -} + jstring partial_sig = getSignature (param_types); + jint hash = partial_sig->hashCode (); -JArray * -java::lang::Class::getDeclaredConstructors (void) -{ - JvFail ("java::lang::Class::getDeclaredConstructors not implemented"); + int i = isPrimitive () ? 0 : method_count; + while (--i >= 0) + { + // FIXME: access checks. + if (_Jv_equalUtf8Consts (methods[i].name, init_name) + && _Jv_equal (methods[i].signature, partial_sig, hash)) + { + // Found it. + using namespace java::lang::reflect; + Constructor *cons = new Constructor (); + cons->offset = (char *) (&methods[i]) - (char *) methods; + cons->declaringClass = this; + return cons; + } + } + JvThrow (new java::lang::NoSuchMethodException); } java::lang::reflect::Field * @@ -187,18 +258,67 @@ return result; } +void +java::lang::Class::getSignature (java::lang::StringBuffer *buffer) +{ + if (isPrimitive()) + buffer->append((jchar) method_count); + else + { + jstring name = getName(); + if (name->charAt(0) != '[') + buffer->append((jchar) 'L'); + buffer->append(name); + if (name->charAt(0) != '[') + buffer->append((jchar) ';'); + } +} + +// This doesn't have to be native. It is an implementation detail +// only called from the C++ code, though, so maybe this is clearer. +jstring +java::lang::Class::getSignature (JArray *param_types) +{ + java::lang::StringBuffer *buf = new java::lang::StringBuffer (); + buf->append((jchar) '('); + jclass *v = elements (param_types); + for (int i = 0; i < param_types->length; ++i) + v[i]->getSignature(buf); + buf->append((jchar) ')'); + return buf->toString(); +} + java::lang::reflect::Method * -java::lang::Class::getDeclaredMethod (jstring, JArray *) +java::lang::Class::getDeclaredMethod (jstring name, + JArray *param_types) { - JvFail ("java::lang::Class::getDeclaredMethod not implemented"); + jstring partial_sig = getSignature (param_types); + jint p_len = partial_sig->length(); + _Jv_Utf8Const *utf_name = _Jv_makeUtf8Const (name); + int i = isPrimitive () ? 0 : method_count; + while (--i >= 0) + { + // FIXME: access checks. + if (_Jv_equalUtf8Consts (methods[i].name, utf_name) + && _Jv_equaln (methods[i].signature, partial_sig, p_len)) + { + // Found it. + using namespace java::lang::reflect; + Method *rmethod = new Method (); + rmethod->offset = (char*) (&methods[i]) - (char*) methods; + rmethod->declaringClass = this; + } + } + JvThrow (new java::lang::NoSuchMethodException); } JArray * java::lang::Class::getDeclaredMethods (void) { int numMethods = 0; + int max = isPrimitive () ? 0 : method_count; int i; - for (i = method_count; --i >= 0; ) + for (i = max; --i >= 0; ) { _Jv_Method *method = &methods[i]; if (method->name == NULL @@ -211,15 +331,16 @@ = (JArray *) JvNewObjectArray (numMethods, &MethodClass, NULL); java::lang::reflect::Method** mptr = elements (result); - for (i = 0; i < method_count; i++) + for (i = 0; i < max; i++) { _Jv_Method *method = &methods[i]; if (method->name == NULL || _Jv_equalUtf8Consts (method->name, clinit_name) || _Jv_equalUtf8Consts (method->name, init_name)) continue; - java::lang::reflect::Method* rmethod = new java::lang::reflect::Method (); - rmethod->offset = (char*) mptr - (char*) elements (result); + java::lang::reflect::Method* rmethod + = new java::lang::reflect::Method (); + rmethod->offset = (char*) method - (char*) methods; rmethod->declaringClass = this; *mptr++ = rmethod; } @@ -258,10 +379,58 @@ return NULL; // Placate compiler. } +jint +java::lang::Class::_getFields (JArray *result, + jint offset) +{ + int count = 0; + for (int i = 0; i < field_count; i++) + { + _Jv_Field *field = &fields[i]; + if (! (field->getModifiers() & java::lang::reflect::Modifier::PUBLIC)) + continue; + ++count; + + if (result != NULL) + { + java::lang::reflect::Field *rfield + = new java::lang::reflect::Field (); + rfield->offset = (char *) field - (char *) fields; + rfield->declaringClass = this; + rfield->name = _Jv_NewStringUtf8Const (field->name); + (elements (result))[offset + i] = rfield; + } + } + jclass superclass = getSuperclass(); + if (superclass != NULL) + { + int s_count = superclass->_getFields (result, offset); + count += s_count; + offset += s_count; + } + for (int i = 0; i < interface_count; ++i) + { + int f_count = interfaces[i]->_getFields (result, offset); + count += f_count; + offset += f_count; + } + return count; +} + JArray * java::lang::Class::getFields (void) { - JvFail ("java::lang::Class::getFields not implemented"); + using namespace java::lang::reflect; + + int count = _getFields (NULL, 0); + + JArray *result + = ((JArray *) + JvNewObjectArray (count, &FieldClass, NULL)); + + _getFields (result, 0); + + return result; } JArray * @@ -275,9 +444,30 @@ } java::lang::reflect::Method * -java::lang::Class::getMethod (jstring, JArray *) +java::lang::Class::getMethod (jstring name, JArray *param_types) { - JvFail ("java::lang::Class::getMethod not implemented"); + jstring partial_sig = getSignature (param_types); + jint p_len = partial_sig->length(); + _Jv_Utf8Const *utf_name = _Jv_makeUtf8Const (name); + for (Class *klass = this; klass; klass = klass->getSuperclass()) + { + int i = klass->isPrimitive () ? 0 : klass->method_count; + while (--i >= 0) + { + // FIXME: access checks. + if (_Jv_equalUtf8Consts (klass->methods[i].name, utf_name) + && _Jv_equaln (klass->methods[i].signature, partial_sig, p_len)) + { + // Found it. + using namespace java::lang::reflect; + Method *rmethod = new Method (); + rmethod->offset = (char*) (&klass->methods[i]) - (char*) methods; + rmethod->declaringClass = klass; + return rmethod; + } + } + } + JvThrow (new java::lang::NoSuchMethodException); } JArray * @@ -494,6 +684,8 @@ // Some class-related convenience functions. // +// Find a method declared in the class. If it is not declared locally +// (or if it is inherited), return NULL. _Jv_Method * _Jv_GetMethodLocal (jclass klass, _Jv_Utf8Const *name, _Jv_Utf8Const *signature) @@ -507,6 +699,21 @@ return NULL; } +_Jv_Method * +_Jv_LookupDeclaredMethod (jclass klass, _Jv_Utf8Const *name, + _Jv_Utf8Const *signature) +{ + for (; klass; klass = klass->getSuperclass()) + { + _Jv_Method *meth = _Jv_GetMethodLocal (klass, name, signature); + + if (meth) + return meth; + } + + return NULL; +} + // NOTE: MCACHE_SIZE should be a power of 2 minus one. #define MCACHE_SIZE 1023 @@ -553,16 +760,6 @@ _Jv_LookupInterfaceMethod (jclass klass, _Jv_Utf8Const *name, _Jv_Utf8Const *signature) { - // FIXME: can't do this until we have a working class loader. - // This probably isn't the right thing to do anyway, since we can't - // call a method of a class until the class is linked. But this - // captures the general idea. - // klass->getClassLoader()->resolveClass(klass); - // - // KKT: This is unnessecary, exactly for the reason you present: - // _Jv_LookupInterfaceMethod is only called on object instances, and - // such have already been initialized (which includes resolving). - void *ncode = _Jv_FindMethodInCache (klass, name, signature); if (ncode != 0) return ncode; Index: java/lang/reflect/Constructor.java =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/reflect/Constructor.java,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Constructor.java --- Constructor.java 1999/04/07 14:52:39 1.1.1.1 +++ Constructor.java 2000/01/04 08:39:41 @@ -28,12 +28,12 @@ if (! (obj instanceof Constructor)) return false; Constructor c = (Constructor) obj; - return decl_class == c.decl_class && index == c.index; + return declaringClass == c.declaringClass && offset == c.offset; } public Class getDeclaringClass () { - return decl_class; + return declaringClass; } public Class[] getExceptionTypes () @@ -41,40 +41,39 @@ return (Class[]) exception_types.clone(); } - public int getModifiers () - { - return modifiers; - } + public native int getModifiers (); public String getName () - { - return decl_class.getName(); - } + { + return declaringClass.getName(); + } public Class[] getParameterTypes () { + if (parameter_types == null) + getType (); return (Class[]) parameter_types.clone(); } public int hashCode () { // FIXME. - return getName().hashCode(); + return getName().hashCode() + declaringClass.getName().hashCode(); } + + // Update cached values from method descriptor in class. + private native void getType (); - // FIXME: this must be native. Should share implementation with - // Method.invoke. - public Object newInstance (Object[] args) + public native Object newInstance (Object[] args) throws InstantiationException, IllegalAccessException, - IllegalArgumentException, InvocationTargetException - { - return null; - } + IllegalArgumentException, InvocationTargetException; public String toString () { + if (parameter_types == null) + getType (); StringBuffer b = new StringBuffer (); - b.append(Modifier.toString(modifiers)); + b.append(Modifier.toString(getModifiers())); b.append(" "); b.append(getName()); b.append("("); @@ -88,19 +87,19 @@ return b.toString(); } - // Can't create these. FIXME. + // Can't create these. private Constructor () { } // Declaring class. - private Class decl_class; + private Class declaringClass; + // Exception types. private Class[] exception_types; - // Modifiers. - private int modifiers; // Parameter types. private Class[] parameter_types; - // Index of this method in declaring class' method table. - private int index; + + // Offset in bytes from the start of declaringClass's methods array. + private int offset; } Index: java/lang/reflect/Method.java =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/reflect/Method.java,v retrieving revision 1.3 diff -u -r1.3 Method.java --- Method.java 1999/12/20 23:05:21 1.3 +++ Method.java 2000/01/04 08:39:46 @@ -10,6 +10,8 @@ package java.lang.reflect; +import gnu.gcj.RawData; + /** * @author Tom Tromey * @date December 12, 1998 @@ -17,7 +19,7 @@ /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 * "The Java Language Specification", ISBN 0-201-63451-1 * plus online API docs for JDK 1.2 beta from http://www.javasoft.com. - * Status: Incomplete: invoke() needs to be finished. + * Status: Complete, but not correct: access checks aren't done. */ public final class Method extends AccessibleObject implements Member @@ -65,6 +67,30 @@ // FIXME. return name.hashCode() + declaringClass.getName().hashCode(); } + + // This is used to perform an actual method call via ffi. + private static final native void hack_call (RawData cif, + RawData method, + RawData ret_value, + RawData values); + + // Perform an ffi call while capturing exceptions. We have to do + // this because we can't catch Java exceptions from C++. + static final Throwable hack_trampoline (RawData cif, + RawData method, + RawData ret_value, + RawData values) + { + try + { + hack_call (cif, method, ret_value, values); + } + catch (Throwable x) + { + return x; + } + return null; + } public native Object invoke (Object obj, Object[] args) throws IllegalAccessException, IllegalArgumentException, Index: java/lang/reflect/natConstructor.cc =================================================================== RCS file: natConstructor.cc diff -N natConstructor.cc --- /dev/null Tue May 5 13:32:27 1998 +++ natConstructor.cc Tue Jan 4 00:39:46 2000 @@ -0,0 +1,53 @@ +// natConstructor.cc - Native code for Constructor class. + +/* Copyright (C) 1999, 2000 Cygnus Solutions + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +jint +java::lang::reflect::Constructor::getModifiers () +{ + return _Jv_FromReflectedConstructor (this)->accflags; +} + +void +java::lang::reflect::Constructor::getType () +{ + _Jv_GetTypesFromSignature (_Jv_FromReflectedConstructor (this), + declaringClass, + ¶meter_types, + NULL); +} + +jobject +java::lang::reflect::Constructor::newInstance (jobjectArray args) +{ + if (parameter_types == NULL) + getType (); + + using namespace java::lang::reflect; + if (Modifier::isAbstract (declaringClass->getModifiers())) + JvThrow (new InstantiationException); + + jmethodID meth = _Jv_FromReflectedConstructor (this); + // In the constructor case the return type is the type of the + // constructor. + return _Jv_CallNonvirtualMethodA (NULL, declaringClass, meth, true, + parameter_types, args); +} Index: java/lang/reflect/natMethod.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/reflect/natMethod.cc,v retrieving revision 1.3 diff -u -r1.3 natMethod.cc --- natMethod.cc 1999/09/10 22:03:08 1.3 +++ natMethod.cc 2000/01/04 08:39:46 @@ -1,6 +1,6 @@ // natMethod.cc - Native code for Method class. -/* Copyright (C) 1998, 1999 Cygnus Solutions +/* Copyright (C) 1998, 1999, 2000 Cygnus Solutions This file is part of libgcj. @@ -8,14 +8,13 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details. */ -// This is about 90% done. Search for FIXME to see what remains. - #include #include #include #include +#include #include #include @@ -32,14 +31,15 @@ #include #include #include +#include +#define ObjectClass _CL_Q34java4lang6Object +extern java::lang::Class ObjectClass; #define ClassClass _CL_Q34java4lang5Class extern java::lang::Class ClassClass; #include -#if 0 - #include #define VoidClass _CL_Q34java4lang4Void @@ -144,38 +144,226 @@ return r; } + +// Actually perform an FFI call. +void +java::lang::reflect::Method::hack_call (gnu::gcj::RawData *rcif, + gnu::gcj::RawData *rmethod, + gnu::gcj::RawData *rret_value, + gnu::gcj::RawData *rvalues) +{ + ffi_cif *cif = (ffi_cif *) rcif; + void (*method) (...) = (void (*) (...)) rmethod; + void *ret_value = (void *) rret_value; + void **values = (void **) rvalues; + + ffi_call (cif, method, ret_value, values); +} -// FIXME: the body of this method should be a separate function so -// that Constructor can use it too. jobject -java::lang::reflect::Method::invoke (jobject obj, - jobjectArray args) +java::lang::reflect::Method::invoke (jobject obj, jobjectArray args) { - // FIXME: we need to be a friend of Class here. - _Jv_Method *meth = decl_class->methods[index]; - if (! java::lang::reflect::Modifier::isStatic(modifiers)) + if (parameter_types == NULL) + getType (); + + jmethodID meth = _Jv_FromReflectedMethod (this); + if (! java::lang::reflect::Modifier::isStatic(meth->accflags)) { jclass k = obj ? obj->getClass() : NULL; - if (! obj || ! decl_class->isAssignableFrom(k)) + if (! obj) JvThrow (new java::lang::NullPointerException); + if (! declaringClass->isAssignableFrom(k)) + JvThrow (new java::lang::IllegalArgumentException); // FIXME: access checks. - meth = _Jv_LookupMethod (k, meth->name, meth->signature); + + // Find the possibly overloaded method based on the runtime type + // of the object. + meth = _Jv_LookupDeclaredMethod (k, meth->name, meth->signature); + } + + return _Jv_CallNonvirtualMethodA (obj, return_type, meth, false, + parameter_types, args); +} + +jint +java::lang::reflect::Method::getModifiers () +{ + return _Jv_FromReflectedMethod (this)->accflags; +} + +jstring +java::lang::reflect::Method::getName () +{ + if (name == NULL) + name = _Jv_NewStringUtf8Const (_Jv_FromReflectedMethod (this)->name); + return name; +} + +/* Internal method to set return_type and parameter_types fields. */ + +void +java::lang::reflect::Method::getType () +{ + _Jv_GetTypesFromSignature (_Jv_FromReflectedMethod (this), + declaringClass, + ¶meter_types, + &return_type); +} + +void +_Jv_GetTypesFromSignature (jmethodID method, + jclass declaringClass, + JArray **arg_types_out, + jclass *return_type_out) +{ + + _Jv_Utf8Const* sig = method->signature; + java::lang::ClassLoader *loader = declaringClass->getClassLoader(); + char *ptr = sig->data; + int numArgs = 0; + /* First just count the number of parameters. */ + for (; ; ptr++) + { + switch (*ptr) + { + case 0: + case ')': + case 'V': + break; + case '[': + case '(': + continue; + case 'B': + case 'C': + case 'D': + case 'F': + case 'S': + case 'I': + case 'J': + case 'Z': + numArgs++; + continue; + case 'L': + numArgs++; + do + ptr++; + while (*ptr != ';' && ptr[1] != '\0'); + continue; + } + break; } + JArray *args = (JArray *) + JvNewObjectArray (numArgs, &ClassClass, NULL); + jclass* argPtr = elements (args); + for (ptr = sig->data; *ptr != '\0'; ptr++) + { + int num_arrays = 0; + jclass type; + for (; *ptr == '['; ptr++) + num_arrays++; + switch (*ptr) + { + default: + return; + case ')': + argPtr = return_type_out; + continue; + case '(': + continue; + case 'V': + case 'B': + case 'C': + case 'D': + case 'F': + case 'S': + case 'I': + case 'J': + case 'Z': + type = _Jv_FindClassFromSignature(ptr, loader); + break; + case 'L': + type = _Jv_FindClassFromSignature(ptr, loader); + do + ptr++; + while (*ptr != ';' && ptr[1] != '\0'); + break; + } + + // FIXME: 2'nd argument should be "current loader" + while (--num_arrays >= 0) + type = _Jv_FindArrayClass (type, 0); + // ARGPTR can be NULL if we are processing the return value of a + // call from Constructor. + if (argPtr) + *argPtr++ = type; + } + *arg_types_out = args; +} + +// This is a very rough analog of the JNI CallNonvirtualMethodA +// functions. It handles both Methods and Constructors, and it can +// handle any return type. In the Constructor case, the `obj' +// argument is unused and should be NULL; also, the `return_type' is +// the class that the constructor will construct. +jobject +_Jv_CallNonvirtualMethodA (jobject obj, + jclass return_type, + jmethodID meth, + jboolean is_constructor, + JArray *parameter_types, + jobjectArray args) +{ + JvAssert (! is_constructor || ! obj); + JvAssert (! is_constructor || ! return_type); + // FIXME: access checks. if (parameter_types->length != args->length) JvThrow (new java::lang::IllegalArgumentException); + // See whether call needs an object as the first argument. A + // constructor does need a `this' argument, but it is one we create. + jboolean needs_this = false; + if (is_constructor + || ! java::lang::reflect::Modifier::isStatic(meth->accflags)) + needs_this = true; + + int param_count = parameter_types->length; + if (needs_this) + ++param_count; + ffi_type *rtype = get_ffi_type (return_type); - ffi_type **argtypes = (ffi_type **) alloca (parameter_types->length + ffi_type **argtypes = (ffi_type **) alloca (param_count * sizeof (ffi_type *)); - jobject *paramelts = elements (parameter_types); + jclass *paramelts = elements (parameter_types); jobject *argelts = elements (args); + // FIXME: at some point the compiler is going to add extra arguments + // to some functions. In particular we are going to do this for + // handling access checks in reflection. We must add these hidden + // arguments here. + + // Special case for the `this' argument of a constructor. Note that + // the JDK 1.2 docs specify that the new object must be allocated + // before argument conversions are done. + if (is_constructor) + { + // FIXME: must special-case String, arrays, maybe others here. + obj = JvAllocObject (return_type); + } + + int i = 0; int size = 0; - for (int i = 0; i < parameter_types->length; ++i) + if (needs_this) + { + // The `NULL' type is `Object'. + argtypes[i++] = get_ffi_type (NULL); + size += sizeof (jobject); + } + + for (; i < param_count; ++i) { jclass k = argelts[i] ? argelts[i]->getClass() : NULL; argtypes[i] = get_ffi_type (k); @@ -196,7 +384,7 @@ } ffi_cif cif; - if (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, parameter_types->length, + if (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, param_count, rtype, argtypes) != FFI_OK) { // FIXME: throw some kind of VirtualMachineError here. @@ -212,8 +400,15 @@ Where += sizeof (Type); \ } while (0) - for (int i = 0; i < parameter_types->length; ++i) + i = 0; + if (needs_this) { + COPY (p, obj, jobject); + ++i; + } + + for (; i < param_count; ++i) + { java::lang::Number *num = (java::lang::Number *) paramelts[i]; if (paramelts[i] == JvPrimClass (byte)) COPY (p, num->byteValue(), jbyte); @@ -228,7 +423,8 @@ else if (paramelts[i] == JvPrimClass (double)) COPY (p, num->doubleValue(), jdouble); else if (paramelts[i] == JvPrimClass (boolean)) - COPY (p, ((java::lang::Boolean *) argelts[i])->booleanValue(), jboolean); + COPY (p, ((java::lang::Boolean *) argelts[i])->booleanValue(), + jboolean); else if (paramelts[i] == JvPrimClass (char)) COPY (p, ((java::lang::Character *) argelts[i])->charValue(), jchar); else @@ -237,12 +433,18 @@ COPY (p, argelts[i], jobject); } } + + // FIXME: initialize class here. - // FIXME: exception handling. + // Largest possible value. Hopefully it is aligned! + jdouble ret_value; java::lang::Throwable *ex; - jdouble ret_value; // Largest possible value. Hopefully - // it is aligned! - ex = TRAMP_CALL (ffi_call (&cif, meth->ncode, &ret_value, (void *) values)); + using namespace java::lang; + using namespace java::lang::reflect; + ex = Method::hack_trampoline ((gnu::gcj::RawData *) &cif, + (gnu::gcj::RawData *) meth->ncode, + (gnu::gcj::RawData *) &ret_value, + (gnu::gcj::RawData *) values); if (ex) JvThrow (new InvocationTargetException (ex)); @@ -269,119 +471,9 @@ r = NULL; else { - JvAssert (! return_type->isPrimitive()); - r = VAL (java::lang::Object, jobject); + JvAssert (return_type == NULL || ! return_type->isPrimitive()); + r = * (Object **) &ret_value; } return r; -} - -#else /* 0 */ - -jobject -java::lang::reflect::Method::invoke (jobject, jobjectArray) -{ - JvFail ("not enabled yet"); -} - -#endif /* 0 */ - -jint -java::lang::reflect::Method::getModifiers () -{ - return _Jv_FromReflectedMethod (this)->accflags; -} - -jstring -java::lang::reflect::Method::getName () -{ - if (name == NULL) - name = _Jv_NewStringUtf8Const (_Jv_FromReflectedMethod (this)->name); - return name; -} - -/* Internal method to set return_type and parameter_types fields. */ - -void -java::lang::reflect::Method::getType () -{ - _Jv_Utf8Const* sig = _Jv_FromReflectedMethod (this)->signature; - java::lang::ClassLoader *loader = declaringClass->getClassLoader(); - char *ptr = sig->data; - int numArgs = 0; - /* First just count the number of parameters. */ - for (; ; ptr++) - { - switch (*ptr) - { - case 0: - case ')': - case 'V': - break; - case '[': - case '(': - continue; - case 'B': - case 'C': - case 'D': - case 'F': - case 'S': - case 'I': - case 'J': - case 'Z': - numArgs++; - continue; - case 'L': - numArgs++; - do - ptr++; - while (*ptr != ';' && ptr[1] != '\0'); - continue; - } - break; - } - - JArray *args = (JArray *) - JvNewObjectArray (numArgs, &ClassClass, NULL); - jclass* argPtr = elements (args); - for (ptr = sig->data; *ptr != '\0'; ptr++) - { - int num_arrays = 0; - jclass type; - for (; *ptr == '['; ptr++) - num_arrays++; - switch (*ptr) - { - default: - return; - case ')': - argPtr = &return_type; - continue; - case '(': - continue; - case 'V': - case 'B': - case 'C': - case 'D': - case 'F': - case 'S': - case 'I': - case 'J': - case 'Z': - type = _Jv_FindClassFromSignature(ptr, loader); - break; - case 'L': - type = _Jv_FindClassFromSignature(ptr, loader); - do - ptr++; - while (*ptr != ';' && ptr[1] != '\0'); - break; - } - - // FIXME: 2'nd argument should be "current loader" - while (--num_arrays >= 0) - type = _Jv_FindArrayClass (type, 0); - *argPtr++ = type; - } - parameter_types = args; } From java-patches-return-347-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Tue Jan 04 22:37:34 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 30088 invoked by alias); 4 Jan 2000 22:37:34 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 30062 invoked from network); 4 Jan 2000 22:37:32 -0000 Date: Tue, 4 Jan 2000 14:37:31 -0800 (PST) From: Warren Levy To: java-patches@sourceware.cygnus.com Subject: Patch: java.net.DatagramSocketImpl Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Folks, I'm committing the following minor change to java.net. Naturally, if anyone sees a problem (or areas of further concern, please followup). Thanks go to Anthony Green for finding this one. --warrenl 2000-01-04 Warren Levy * java/net/natPlainDatagramSocketImpl.cc (peek): Removed unnecesary comment. (receive): Set the sender's address in the DatagramPacket. Index: java/net/natPlainDatagramSocketImpl.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/java/net/natPlainDatagramSocketImpl.cc,v retrieving revision 1.15 diff -u -p -r1.15 natPlainDatagramSocketImpl.cc --- natPlainDatagramSocketImpl.cc 1999/12/17 05:11:28 1.15 +++ natPlainDatagramSocketImpl.cc 2000/01/04 22:34:49 @@ -1,4 +1,4 @@ -/* Copyright (C) 1999 Cygnus Solutions +/* Copyright (C) 1999, 2000 Cygnus Solutions This file is part of libgcj. @@ -242,7 +242,6 @@ java::net::PlainDatagramSocketImpl::peek #endif else goto error; - // FIXME: Multicast: s->address = new InetAddress (raddr, NULL); i->address = raddr; return rport; error: @@ -335,7 +334,7 @@ java::net::PlainDatagramSocketImpl::rece #endif else goto error; - // FIXME: Multicast: s->address = new InetAddress (raddr, NULL); + p->setAddress (new InetAddress (raddr, NULL)); p->setPort (rport); p->setLength ((jint) retlen); return; From java-patches-return-348-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Tue Jan 04 23:06:28 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 5533 invoked by alias); 4 Jan 2000 23:06:27 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 5473 invoked from network); 4 Jan 2000 23:06:08 -0000 To: Java Patch List Subject: Patch: libffi Makefile X-Zippy: I don't know WHY I said that.. I think it came from the FILLINGS in my rear molars.. X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 04 Jan 2000 16:08:46 -0700 Message-ID: <87d7rho2o1.fsf@cygnus.com> Lines: 13 X-Mailer: Gnus v5.5/Emacs 20.3 I'm checking in a patch which simply rebuilds the libffi Makefile.in with a newer automake. This is currently a bad situation, since libffi requires an unreleased automake, but unfortunately a fix is not easy -- it requires an automake release, which is done strictly on volunteer time... 2000-01-04 Tom Tromey * Makefile.in: Rebuilt with newer automake. I'm not appending the patch since it isn't useful to read. Tom From java-patches-return-349-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 05 16:28:26 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 28228 invoked by alias); 5 Jan 2000 16:28:26 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 28131 invoked from network); 5 Jan 2000 16:28:00 -0000 To: Java Patch List Subject: Patch: reflection bug fix X-Zippy: LOOK!!! I'm WALKING in my SLEEP again!! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 05 Jan 2000 09:30:16 -0700 Message-ID: <879024o50n.fsf@cygnus.com> Lines: 137 X-Mailer: Gnus v5.5/Emacs 20.3 I'm checking in this patch. It fixes a couple bugs in the reflection code discovered by the Mauve tests I wrote yesterday. 2000-01-04 Tom Tromey * java/lang/Class.h (getSignature): Updated. * java/lang/Class.java (getSignature): Updated. * java/lang/natClass.cc (getSignature): Added `is_constructor' argument. (getConstructor): Ensure constructor is public. (_getConstructors): Check for public-ness of constructor when `declared' is false, not when it is true. Tom Index: java/lang/Class.h =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/Class.h,v retrieving revision 1.8 diff -u -r1.8 Class.h --- Class.h 2000/01/04 08:46:52 1.8 +++ Class.h 2000/01/05 05:24:48 @@ -103,7 +103,7 @@ JArray *getInterfaces (void); void getSignature (java::lang::StringBuffer *buffer); - static jstring getSignature (JArray *); + static jstring getSignature (JArray *, jboolean is_constructor); java::lang::reflect::Method *getMethod (jstring, JArray *); JArray *getMethods (void); Index: java/lang/Class.java =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/Class.java,v retrieving revision 1.4 diff -u -r1.4 Class.java --- Class.java 2000/01/04 08:46:52 1.4 +++ Class.java 2000/01/05 05:24:48 @@ -89,7 +89,8 @@ public native Class[] getInterfaces (); private final native void getSignature (StringBuffer buffer); - private static final native String getSignature (Class[] parameterTypes); + private static final native String getSignature (Class[] parameterTypes, + boolean is_construtor); public native Method getMethod (String methodName, Class[] parameterTypes) throws NoSuchMethodException, SecurityException; Index: java/lang/natClass.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/natClass.cc,v retrieving revision 1.9 diff -u -r1.9 natClass.cc --- natClass.cc 2000/01/04 08:46:52 1.9 +++ natClass.cc 2000/01/05 05:24:53 @@ -101,7 +101,7 @@ java::lang::reflect::Constructor * java::lang::Class::getConstructor (JArray *param_types) { - jstring partial_sig = getSignature (param_types); + jstring partial_sig = getSignature (param_types, true); jint hash = partial_sig->hashCode (); int i = isPrimitive () ? 0 : method_count; @@ -114,7 +114,7 @@ // Found it. For getConstructor, the constructor must be // public. using namespace java::lang::reflect; - if (Modifier::isPublic(methods[i].accflags)) + if (! Modifier::isPublic(methods[i].accflags)) break; Constructor *cons = new Constructor (); cons->offset = (char *) (&methods[i]) - (char *) methods; @@ -139,7 +139,7 @@ if (method->name == NULL && ! _Jv_equalUtf8Consts (method->name, init_name)) continue; - if (declared + if (! declared && ! java::lang::reflect::Modifier::isPublic(method->accflags)) continue; numConstructors++; @@ -154,7 +154,7 @@ if (method->name == NULL && ! _Jv_equalUtf8Consts (method->name, init_name)) continue; - if (declared + if (! declared && ! java::lang::reflect::Modifier::isPublic(method->accflags)) continue; java::lang::reflect::Constructor *cons @@ -169,7 +169,7 @@ java::lang::reflect::Constructor * java::lang::Class::getDeclaredConstructor (JArray *param_types) { - jstring partial_sig = getSignature (param_types); + jstring partial_sig = getSignature (param_types, true); jint hash = partial_sig->hashCode (); int i = isPrimitive () ? 0 : method_count; @@ -277,7 +277,8 @@ // This doesn't have to be native. It is an implementation detail // only called from the C++ code, though, so maybe this is clearer. jstring -java::lang::Class::getSignature (JArray *param_types) +java::lang::Class::getSignature (JArray *param_types, + jboolean is_constructor) { java::lang::StringBuffer *buf = new java::lang::StringBuffer (); buf->append((jchar) '('); @@ -285,6 +286,8 @@ for (int i = 0; i < param_types->length; ++i) v[i]->getSignature(buf); buf->append((jchar) ')'); + if (is_constructor) + buf->append((jchar) 'V'); return buf->toString(); } @@ -292,7 +295,7 @@ java::lang::Class::getDeclaredMethod (jstring name, JArray *param_types) { - jstring partial_sig = getSignature (param_types); + jstring partial_sig = getSignature (param_types, false); jint p_len = partial_sig->length(); _Jv_Utf8Const *utf_name = _Jv_makeUtf8Const (name); int i = isPrimitive () ? 0 : method_count; @@ -446,7 +449,7 @@ java::lang::reflect::Method * java::lang::Class::getMethod (jstring name, JArray *param_types) { - jstring partial_sig = getSignature (param_types); + jstring partial_sig = getSignature (param_types, false); jint p_len = partial_sig->length(); _Jv_Utf8Const *utf_name = _Jv_makeUtf8Const (name); for (Class *klass = this; klass; klass = klass->getSuperclass()) From java-patches-return-350-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 05 17:22:04 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 3398 invoked by alias); 5 Jan 2000 17:22:04 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 3372 invoked from network); 5 Jan 2000 17:21:55 -0000 To: Java Patch List Subject: Patch: Constructor invocation X-Zippy: I'm GLAD I remembered to XEROX all my UNDERSHIRTS!! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 05 Jan 2000 10:24:46 -0700 Message-ID: <877lhoo2ht.fsf@cygnus.com> Lines: 63 X-Mailer: Gnus v5.5/Emacs 20.3 I'm committing this patch. It fixes a potential bug in method invocation regarding the size of booleans, and it changes the invocation code to understand that the constructor method itself "returns" void. 2000-01-05 Tom Tromey * java/lang/reflect/natMethod.cc (get_ffi_type): Test size of jboolean and select correct ffi type on that basis. (_Jv_CallNonvirtualMethodA): Handle `void' return type. Constructor call always has `void' return type. Tom Index: java/lang/reflect/natMethod.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/reflect/natMethod.cc,v retrieving revision 1.4 diff -u -r1.4 natMethod.cc --- natMethod.cc 2000/01/04 08:46:52 1.4 +++ natMethod.cc 2000/01/05 17:20:53 @@ -131,8 +131,14 @@ r = &ffi_type_double; else if (klass == JvPrimClass (boolean)) { - // FIXME. - r = &ffi_type_sint8; + // On some platforms a bool is a byte, on others an int. + if (sizeof (jboolean) == sizeof (jbyte)) + r = &ffi_type_sint8; + else + { + JvAssert (sizeof (jboolean) == sizeof (jint)); + r = &ffi_type_sint32; + } } else if (klass == JvPrimClass (char)) r = &ffi_type_uint16; @@ -333,7 +339,12 @@ if (needs_this) ++param_count; - ffi_type *rtype = get_ffi_type (return_type); + ffi_type *rtype; + // A constructor itself always returns void. + if (is_constructor || return_type == JvPrimClass (void)) + rtype = &ffi_type_void; + else + rtype = get_ffi_type (return_type); ffi_type **argtypes = (ffi_type **) alloca (param_count * sizeof (ffi_type *)); @@ -451,7 +462,9 @@ jobject r; #define VAL(Wrapper, Type) (new Wrapper (* (Type *) &ret_value)) - if (return_type == JvPrimClass (byte)) + if (is_constructor) + r = obj; + else if (return_type == JvPrimClass (byte)) r = VAL (java::lang::Byte, jbyte); else if (return_type == JvPrimClass (short)) r = VAL (java::lang::Short, jshort); From java-patches-return-351-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 05 22:22:51 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 22688 invoked by alias); 5 Jan 2000 22:22:49 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 22436 invoked from network); 5 Jan 2000 22:22:29 -0000 To: Java Patch List Subject: Patch: reflection bug fixes X-Zippy: ..I must be a VETERINARIAN.. X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 05 Jan 2000 15:24:09 -0700 Message-ID: <8766x8nomu.fsf@cygnus.com> Lines: 252 X-Mailer: Gnus v5.5/Emacs 20.3 I'm committing this patch. It fixes a number of bugs in the new reflection code (most of which were pointed out by the Mauve hacking I did today). It also implements a few more reflection methods; I think only Class.getClasses() is missing now. 2000-01-05 Tom Tromey * java/lang/Class.h (_getMethods): Declare. * java/lang/Class.java (_getMethods): Declare. * java/lang/natClass.cc (getDeclaringClass): Always return NULL. (getDeclaredClasses): Always return empty array. (_getMethods): New method. (getMethods): Wrote. (getDeclaredMethod): Return `rmethod'. (finit_name): New global. (getDeclaredMethods): Check for finit_name. (_getMethods): Likewise. (getMethod): Only return public methods. Tom Index: java/lang/Class.h =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/Class.h,v retrieving revision 1.9 diff -u -r1.9 Class.h --- Class.h 2000/01/05 16:35:20 1.9 +++ Class.h 2000/01/05 22:13:42 @@ -105,6 +105,8 @@ void getSignature (java::lang::StringBuffer *buffer); static jstring getSignature (JArray *, jboolean is_constructor); java::lang::reflect::Method *getMethod (jstring, JArray *); + jint _getMethods (JArray *result, + jint offset); JArray *getMethods (void); jint getModifiers (void) Index: java/lang/Class.java =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/Class.java,v retrieving revision 1.5 diff -u -r1.5 Class.java --- Class.java 2000/01/05 16:35:20 1.5 +++ Class.java 2000/01/05 22:13:42 @@ -94,6 +94,7 @@ public native Method getMethod (String methodName, Class[] parameterTypes) throws NoSuchMethodException, SecurityException; + private native int _getMethods (Method[] result, int offset); public native Method[] getMethods () throws SecurityException; public native int getModifiers (); Index: java/lang/natClass.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/natClass.cc,v retrieving revision 1.10 diff -u -r1.10 natClass.cc --- natClass.cc 2000/01/05 16:35:20 1.10 +++ natClass.cc 2000/01/05 22:13:51 @@ -63,6 +63,7 @@ static _Jv_Utf8Const *void_signature = _Jv_makeUtf8Const ("()V", 3); static _Jv_Utf8Const *clinit_name = _Jv_makeUtf8Const ("", 8); static _Jv_Utf8Const *init_name = _Jv_makeUtf8Const ("", 6); +static _Jv_Utf8Const *finit_name = _Jv_makeUtf8Const ("$finit$", 7); @@ -310,6 +311,7 @@ Method *rmethod = new Method (); rmethod->offset = (char*) (&methods[i]) - (char*) methods; rmethod->declaringClass = this; + return rmethod; } } JvThrow (new java::lang::NoSuchMethodException); @@ -326,7 +328,8 @@ _Jv_Method *method = &methods[i]; if (method->name == NULL || _Jv_equalUtf8Consts (method->name, clinit_name) - || _Jv_equalUtf8Consts (method->name, init_name)) + || _Jv_equalUtf8Consts (method->name, init_name) + || _Jv_equalUtf8Consts (method->name, finit_name)) continue; numMethods++; } @@ -339,7 +342,8 @@ _Jv_Method *method = &methods[i]; if (method->name == NULL || _Jv_equalUtf8Consts (method->name, clinit_name) - || _Jv_equalUtf8Consts (method->name, init_name)) + || _Jv_equalUtf8Consts (method->name, init_name) + || _Jv_equalUtf8Consts (method->name, finit_name)) continue; java::lang::reflect::Method* rmethod = new java::lang::reflect::Method (); @@ -370,16 +374,19 @@ java::lang::Class::getDeclaredClasses (void) { checkMemberAccess (java::lang::reflect::Member::DECLARED); - JvFail ("java::lang::Class::getDeclaredClasses not implemented"); - return NULL; // Placate compiler. + // Until we have inner classes, it always makes sense to return an + // empty array. + JArray *result + = (JArray *) JvNewObjectArray (0, &ClassClass, NULL); + return result; } -// This is marked as unimplemented in the JCL book. jclass java::lang::Class::getDeclaringClass (void) { - JvFail ("java::lang::Class::getDeclaringClass unimplemented"); - return NULL; // Placate compiler. + // Until we have inner classes, it makes sense to always return + // NULL. + return NULL; } jint @@ -463,6 +470,11 @@ { // Found it. using namespace java::lang::reflect; + + // Method must be public. + if (! Modifier::isPublic (methods[i].accflags)) + break; + Method *rmethod = new Method (); rmethod->offset = (char*) (&klass->methods[i]) - (char*) methods; rmethod->declaringClass = klass; @@ -473,10 +485,118 @@ JvThrow (new java::lang::NoSuchMethodException); } +// This is a very slow implementation, since it re-scans all the +// methods we've already listed to make sure we haven't duplicated a +// method. It also over-estimates the required size, so we have to +// shrink the result array later. +jint +java::lang::Class::_getMethods (JArray *result, + jint offset) +{ + jint count = 0; + + // First examine all local methods + for (int i = isPrimitive () ? 0 : method_count; --i >= 0; ) + { + _Jv_Method *method = &methods[i]; + if (method->name == NULL + || _Jv_equalUtf8Consts (method->name, clinit_name) + || _Jv_equalUtf8Consts (method->name, init_name) + || _Jv_equalUtf8Consts (method->name, finit_name)) + continue; + // Only want public methods. + if (! java::lang::reflect::Modifier::isPublic (method->accflags)) + continue; + + // This is where we over-count the slots required if we aren't + // filling the result for real. + if (result != NULL) + { + jboolean add = true; + java::lang::reflect::Method **mp = elements (result); + // If we already have a method with this name and signature, + // then ignore this one. This can happen with virtual + // methods. + for (int j = 0; j < offset; ++j) + { + _Jv_Method *meth_2 = _Jv_FromReflectedMethod (mp[j]); + if (_Jv_equalUtf8Consts (method->name, meth_2->name) + && _Jv_equalUtf8Consts (method->signature, + meth_2->signature)) + { + add = false; + break; + } + } + if (! add) + continue; + } + + if (result != NULL) + { + using namespace java::lang::reflect; + Method *rmethod = new Method (); + rmethod->offset = (char *) method - (char *) methods; + rmethod->declaringClass = this; + Method **mp = elements (result); + mp[offset + count] = rmethod; + } + ++count; + } + offset += count; + + // Now examine superclasses. + if (getSuperclass () != NULL) + { + jint s_count = getSuperclass()->_getMethods (result, offset); + offset += s_count; + count += s_count; + } + + // Finally, examine interfaces. + for (int i = 0; i < interface_count; ++i) + { + int f_count = interfaces[i]->_getMethods (result, offset); + count += f_count; + offset += f_count; + } + + return count; +} + JArray * java::lang::Class::getMethods (void) { - JvFail ("java::lang::Class::getMethods not implemented"); + using namespace java::lang::reflect; + + // FIXME: security checks. + + // This will overestimate the size we need. + jint count = _getMethods (NULL, 0); + + JArray *result + = ((JArray *) JvNewObjectArray (count, &MethodClass, NULL)); + + // When filling the array for real, we get the actual count. Then + // we resize the array. + jint real_count = _getMethods (result, 0); + + if (real_count != count) + { + JArray *r2 + = ((JArray *) JvNewObjectArray (real_count, &MethodClass, + NULL)); + + Method **destp = elements (r2); + Method **srcp = elements (result); + + for (int i = 0; i < real_count; ++i) + *destp++ = *srcp++; + + result = r2; + } + + return result; } jboolean From java-patches-return-352-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 05 22:29:09 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 27631 invoked by alias); 5 Jan 2000 22:29:08 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 27496 invoked from network); 5 Jan 2000 22:28:56 -0000 To: Java Patch List Subject: Patch: decl fix in Class.h X-Zippy: UH-OH!! I think KEN is OVER-DUE on his R.V. PAYMENTS and HE'S having a NERVOUS BREAKDOWN too!! Ha ha. X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 05 Jan 2000 15:31:00 -0700 Message-ID: <874scsnobf.fsf@cygnus.com> Lines: 35 X-Mailer: Gnus v5.5/Emacs 20.3 I'm committing this patch. It fixes a silly thinko, where I put a decl in a public section instead of a private section. 2000-01-05 Tom Tromey * java/lang/Class.h (_getMethods): Correctly declare as private, not public. Tom Index: java/lang/Class.h =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/Class.h,v retrieving revision 1.10 diff -u -r1.10 Class.h --- Class.h 2000/01/05 22:22:10 1.10 +++ Class.h 2000/01/05 22:24:37 @@ -97,6 +97,8 @@ jint _getFields (JArray *result, jint offset); JArray *_getConstructors (jboolean); java::lang::reflect::Field *getField (jstring, jint); + jint _getMethods (JArray *result, + jint offset); public: JArray *getFields (void); @@ -105,8 +107,6 @@ void getSignature (java::lang::StringBuffer *buffer); static jstring getSignature (JArray *, jboolean is_constructor); java::lang::reflect::Method *getMethod (jstring, JArray *); - jint _getMethods (JArray *result, - jint offset); JArray *getMethods (void); jint getModifiers (void) From java-patches-return-353-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 05 22:51:44 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 11834 invoked by alias); 5 Jan 2000 22:51:44 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 11414 invoked from network); 5 Jan 2000 22:51:24 -0000 To: Java Patch List Subject: Patch: include missing header X-Zippy: It's the RINSE CYCLE!! They've ALL IGNORED the RINSE CYCLE!! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 05 Jan 2000 15:54:19 -0700 Message-ID: <87zoukm8o4.fsf@cygnus.com> Lines: 24 X-Mailer: Gnus v5.5/Emacs 20.3 I'm committing this patch. It changes natClass.cc to include a header it needs. I don't know why this wasn't caught earlier. 2000-01-05 Tom Tromey * java/lang/natClass.cc: Include . Tom Index: java/lang/natClass.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/natClass.cc,v retrieving revision 1.11 diff -u -r1.11 natClass.cc --- natClass.cc 2000/01/05 22:22:10 1.11 +++ natClass.cc 2000/01/05 22:50:44 @@ -39,6 +39,7 @@ #include #include #include +#include #include From java-patches-return-354-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Thu Jan 06 00:55:06 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 28917 invoked by alias); 6 Jan 2000 00:55:06 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 28786 invoked from network); 6 Jan 2000 00:54:51 -0000 To: Java Patch List Subject: Patch: even more reflection fixes X-Zippy: Somewhere in DOWNTOWN BURBANK a prostitute is OVERCOOKING a LAMB CHOP!! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 05 Jan 2000 17:57:42 -0700 Message-ID: <87wvpom2yh.fsf@cygnus.com> Lines: 136 X-Mailer: Gnus v5.5/Emacs 20.3 I'm committing this patch. It fixes a Class.getMethod() bug that escaped me earlier, and it makes Method.invoke actually work (one of the Mauve invoke tests still fails, but that will have to wait for tomorrow). 2000-01-05 Tom Tromey * java/lang/natClass.cc (getMethod): Compute offset relative to `klass's methods table, not `this's table. * java/lang/reflect/natMethod.cc (_Jv_CallNonvirtualMethodA): In unwrapping/widening case, check whether `k' is null, not whether it is primitive. Initialize `num' from `argelts', not `paramelts'. Correct create and pass arguments to ffi_call. Don't let presence of `this' argument affect index used to look in argument arrays. (COPY): Set appropriate element in `values' vector. Tom Index: java/lang/natClass.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/natClass.cc,v retrieving revision 1.12 diff -u -r1.12 natClass.cc --- natClass.cc 2000/01/05 22:52:54 1.12 +++ natClass.cc 2000/01/06 00:49:57 @@ -477,7 +477,8 @@ break; Method *rmethod = new Method (); - rmethod->offset = (char*) (&klass->methods[i]) - (char*) methods; + rmethod->offset = ((char *) (&klass->methods[i]) + - (char *) klass->methods); rmethod->declaringClass = klass; return rmethod; } Index: java/lang/reflect/natMethod.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/reflect/natMethod.cc,v retrieving revision 1.5 diff -u -r1.5 natMethod.cc --- natMethod.cc 2000/01/05 17:23:34 1.5 +++ natMethod.cc 2000/01/06 00:50:00 @@ -374,21 +374,21 @@ size += sizeof (jobject); } - for (; i < param_count; ++i) + for (int arg = 0; i < param_count; ++i, ++arg) { - jclass k = argelts[i] ? argelts[i]->getClass() : NULL; + jclass k = argelts[arg] ? argelts[arg]->getClass() : NULL; argtypes[i] = get_ffi_type (k); - if (paramelts[i]->isPrimitive()) + if (paramelts[arg]->isPrimitive()) { - if (! argelts[i] - || ! k->isPrimitive () - || ! can_widen (k, paramelts[i])) + if (! argelts[arg] + || ! k + || ! can_widen (k, paramelts[arg])) JvThrow (new java::lang::IllegalArgumentException); - size += paramelts[i]->size(); + size += paramelts[arg]->size(); } else { - if (argelts[i] && ! paramelts[i]->isAssignableFrom (k)) + if (argelts[arg] && ! paramelts[arg]->isAssignableFrom (k)) JvThrow (new java::lang::IllegalArgumentException); size += sizeof (jobject); } @@ -401,13 +401,14 @@ // FIXME: throw some kind of VirtualMachineError here. } - char *values = (char *) alloca (size); - char *p = values; + char *p = (char *) alloca (size); + void **values = (void **) alloca (param_count * sizeof (void *)); #define COPY(Where, What, Type) \ do { \ Type val = (What); \ memcpy ((Where), &val, sizeof (Type)); \ + values[i] = (Where); \ Where += sizeof (Type); \ } while (0) @@ -418,30 +419,30 @@ ++i; } - for (; i < param_count; ++i) + for (int arg = 0; i < param_count; ++i, ++arg) { - java::lang::Number *num = (java::lang::Number *) paramelts[i]; - if (paramelts[i] == JvPrimClass (byte)) + java::lang::Number *num = (java::lang::Number *) argelts[arg]; + if (paramelts[arg] == JvPrimClass (byte)) COPY (p, num->byteValue(), jbyte); - else if (paramelts[i] == JvPrimClass (short)) + else if (paramelts[arg] == JvPrimClass (short)) COPY (p, num->shortValue(), jshort); - else if (paramelts[i] == JvPrimClass (int)) + else if (paramelts[arg] == JvPrimClass (int)) COPY (p, num->intValue(), jint); - else if (paramelts[i] == JvPrimClass (long)) + else if (paramelts[arg] == JvPrimClass (long)) COPY (p, num->longValue(), jlong); - else if (paramelts[i] == JvPrimClass (float)) + else if (paramelts[arg] == JvPrimClass (float)) COPY (p, num->floatValue(), jfloat); - else if (paramelts[i] == JvPrimClass (double)) + else if (paramelts[arg] == JvPrimClass (double)) COPY (p, num->doubleValue(), jdouble); - else if (paramelts[i] == JvPrimClass (boolean)) - COPY (p, ((java::lang::Boolean *) argelts[i])->booleanValue(), + else if (paramelts[arg] == JvPrimClass (boolean)) + COPY (p, ((java::lang::Boolean *) argelts[arg])->booleanValue(), jboolean); - else if (paramelts[i] == JvPrimClass (char)) - COPY (p, ((java::lang::Character *) argelts[i])->charValue(), jchar); + else if (paramelts[arg] == JvPrimClass (char)) + COPY (p, ((java::lang::Character *) argelts[arg])->charValue(), jchar); else { - JvAssert (! paramelts[i]->isPrimitive()); - COPY (p, argelts[i], jobject); + JvAssert (! paramelts[arg]->isPrimitive()); + COPY (p, argelts[arg], jobject); } } From java-patches-return-355-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Thu Jan 06 03:29:17 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 11981 invoked by alias); 6 Jan 2000 03:29:16 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 11956 invoked from network); 6 Jan 2000 03:29:16 -0000 Date: Wed, 5 Jan 2000 19:29:14 -0800 Message-Id: <200001060329.TAA28928@hoser.cygnus.com> From: Anthony Green To: GChambers@provsol.com CC: java-patches@sourceware.cygnus.com In-reply-to: (message from Glenn Chambers on Wed, 29 Dec 1999 14:08:59 -0500) Subject: Re: Update CNI examples in FAQ X-Organization: Cygnus Solutions, Sunnyvale, California X-URL: http://www.cygnus.com/~green References: > Wed Dec 22 13:12:06 1999 Glenn Chambers (gchambers@provsol.com) > > * faq.html: Renumber section 5; fix minor typos; correct > attribution of CNI examples; add JNI example reference. > * cni-2.txt: Fix typo: this example is for version 2.96. Thanks - I've comitted this. Sorry it took so long - it is _very_ much appreciated. AG -- Anthony Green Cygnus Solutions Sunnyvale, California From java-patches-return-356-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Thu Jan 06 03:33:12 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 12302 invoked by alias); 6 Jan 2000 03:33:11 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 12269 invoked from network); 6 Jan 2000 03:33:10 -0000 Date: Wed, 5 Jan 2000 19:33:08 -0800 Message-Id: <200001060333.TAA28940@hoser.cygnus.com> From: Anthony Green To: joerg.brunsmann@FernUni-Hagen.de CC: java-patches@sourceware.cygnus.com In-reply-to: <3870A964.4420@fernuni-hagen.de> (message from Joerg Brunsmann on Mon, 03 Jan 2000 14:51:32 +0100) Subject: Re: FAQ -- building snapshots? X-Organization: Cygnus Solutions, Sunnyvale, California X-URL: http://www.cygnus.com/~green References: <3870A964.4420@fernuni-hagen.de> Joerg wrote: > This patch removes some inconsistencies in faq.html and > it adds a new FAQ entry. Thanks! This is great. I've added a ChangeLog entry and committed it. AG -- Anthony Green Cygnus Solutions Sunnyvale, California From java-patches-return-357-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Thu Jan 06 03:37:14 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 12787 invoked by alias); 6 Jan 2000 03:37:14 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 12762 invoked from network); 6 Jan 2000 03:37:13 -0000 Date: Wed, 5 Jan 2000 19:37:11 -0800 Message-Id: <200001060337.TAA28945@hoser.cygnus.com> From: Anthony Green To: joerg.brunsmann@FernUni-Hagen.de CC: java-patches@sourceware.cygnus.com In-reply-to: <3870A964.4420@fernuni-hagen.de> (message from Joerg Brunsmann on Mon, 03 Jan 2000 14:51:32 +0100) Subject: Re: FAQ -- building snapshots? X-Organization: Cygnus Solutions, Sunnyvale, California X-URL: http://www.cygnus.com/~green References: <3870A964.4420@fernuni-hagen.de> Joerg wrote: > Please also find attached the referenced file "build-snapshot.html". Actually - I do have one question about step 9. You should never have to do this. Does this happen often? You also shouldn't have to set CLASSPATH. gcj will know where to look. AG -- Anthony Green Cygnus Solutions Sunnyvale, California From java-patches-return-358-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Thu Jan 06 10:32:11 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 26681 invoked by alias); 6 Jan 2000 10:32:11 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 26660 invoked from network); 6 Jan 2000 10:32:10 -0000 Message-ID: <38746F00.755D@fernuni-hagen.de> Date: Thu, 06 Jan 2000 11:31:28 +0100 From: Joerg Brunsmann Organization: Fernuniversitaet Hagen - Software Engineering (Praktische Informatik III) X-Mailer: Mozilla 3.04 (X11; I; SunOS 5.7 sun4u) MIME-Version: 1.0 To: Anthony Green CC: java-patches@sourceware.cygnus.com Subject: Re: FAQ -- building snapshots? References: <3870A964.4420@fernuni-hagen.de> <200001060337.TAA28945@hoser.cygnus.com> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Encoded: Changed encoding from 8bit for 7bit transmission Anthony Green wrote: > Actually - I do have one question about step 9. You should never have > to do this. Does this happen often? For me always, both on Solaris and Linux. Is it due to the fact that I don't install into /usr/local? > You also shouldn't have to set CLASSPATH. gcj will know where to look. $ gcj -c -o Worker.o Worker.java gcj: libgcj.spec: Datei oder Verzeichnis nicht gefunden [which means file or directory not found] $ gcj --main=3DWebServer -L/home/joerg/libgcj/lib -o WebServer Worker.o Log= .o WebServer.java WebServer.java:0: Can't find default package `java.lang'. Check the CLASSPA= TH environment variable and the access to the archives. J=F6rg From java-patches-return-359-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Thu Jan 06 13:47:35 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 26162 invoked by alias); 6 Jan 2000 13:47:35 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 26137 invoked from network); 6 Jan 2000 13:47:34 -0000 Date: Thu, 6 Jan 2000 05:47:31 -0800 Message-Id: <200001061347.FAA29670@hoser.cygnus.com> From: Anthony Green To: joerg.brunsmann@FernUni-Hagen.de CC: java-patches@sourceware.cygnus.com In-reply-to: <38746F00.755D@fernuni-hagen.de> (message from Joerg Brunsmann on Thu, 06 Jan 2000 11:31:28 +0100) Subject: Re: FAQ -- building snapshots? X-Organization: Cygnus Solutions, Sunnyvale, California X-URL: http://www.cygnus.com/~green References: <3870A964.4420@fernuni-hagen.de> <200001060337.TAA28945@hoser.cygnus.com> <38746F00.755D@fernuni-hagen.de> Joerg wrote: > For me always, both on Solaris and Linux. Is it due to the fact that > I don't install into /usr/local? All of these problems show up because you're not installing gcc and libgcc in the same place. I'll fix build-snapshot.html. AG -- Anthony Green Cygnus Solutions Sunnyvale, California From java-patches-return-360-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Thu Jan 06 13:57:54 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 28019 invoked by alias); 6 Jan 2000 13:57:54 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 27994 invoked from network); 6 Jan 2000 13:57:49 -0000 Date: Thu, 6 Jan 2000 05:57:47 -0800 Message-Id: <200001061357.FAA29673@hoser.cygnus.com> From: Anthony Green To: joerg.brunsmann@FernUni-Hagen.de CC: java-patches@sourceware.cygnus.com In-reply-to: <38746F00.755D@fernuni-hagen.de> (message from Joerg Brunsmann on Thu, 06 Jan 2000 11:31:28 +0100) Subject: Re: FAQ -- building snapshots? X-Organization: Cygnus Solutions, Sunnyvale, California X-URL: http://www.cygnus.com/~green References: <3870A964.4420@fernuni-hagen.de> <200001060337.TAA28945@hoser.cygnus.com> <38746F00.755D@fernuni-hagen.de> Joerg wrote: > For me always, both on Solaris and Linux. Is it due to the fact that > I don't install into /usr/local? I'm about to commit this... 2000-01-06 Anthony Green * build-snapshot.html: Install gcc and gcj in the same place. Don't need to specify gc when building compiler. Index: build-snapshot.html =================================================================== RCS file: /cvs/java/htdocs/build-snapshot.html,v retrieving revision 1.1 diff -u -r1.1 build-snapshot.html --- build-snapshot.html 2000/01/06 13:45:14 1.1 +++ build-snapshot.html 2000/01/06 13:55:52 @@ -73,8 +73,7 @@ $ mkdir objdir $ cd objdir $ ../configure --enable-threads=posix --prefix=/home/joerg/gcc \ - --enable-java-gc=boehm --with-as=/opt/gnu/bin/as \ - --with-ld=/opt/gnu/bin/ld + --with-as=/opt/gnu/bin/as --with-ld=/opt/gnu/bin/ld $ make bootstrap $ make install @@ -114,17 +113,20 @@ $ cd ../libgcj $ mkdir objdir $ cd objdir - $ ../configure --enable-threads=posix --prefix=/home/joerg/libgcj \ + $ ../configure --enable-threads=posix --prefix=/home/joerg/gcc \ --enable-java-gc=boehm --with-as=/opt/gnu/bin/as --with-ld=/opt/gnu/bin/ld Again, the last two options are needed for Solaris. +Be sure to use the same prefix option as you did for gcc, otherwise +gcj won't be able to find the special files it needs from libgcj. + $ make $ make install + +Make sure you configured both gcj and libgjc with the same thread +package. -Make sure you configured both gcj and libgjc with the same garbarge collector -and with the same thread package. If you use the default for gcj/egcs (no -configure option) you have to use --enable-java-gc=no for libgcj. @@ -137,28 +139,17 @@ Edit a file env.csh: setenv PATH /home/joerg/gcc/bin:$PATH -setenv LD_LIBRARY_PATH /home/joerg/libgcj/lib -setenv CLASSPATH /home/joerg/libgcj/share/libgcj.zip +setenv LD_LIBRARY_PATH /home/joerg/gcc/lib $ source env.csh - - -

      -9. If gcj complains about a missing libgcj.spec file copy it into your current directory
      -  
      -  $ cp /home/joerg/libgcj/lib/libgcj.spec .
      -
      - - -
      -10. Edit a file HelloWorld.java
      +9. Edit a file HelloWorld.java
       
         public class HelloWorld {
           public static void main(String [] args) {
      @@ -172,7 +163,7 @@
       
       
       
      -11. Compile and run HelloWorld
      +10. Compile and run HelloWorld
       
        $ gcj --main=HelloWorld -o HelloWorld HelloWorld.java
        $ ./HelloWorld
      
      From java-patches-return-361-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Thu Jan 06 18:17:00 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 4306 invoked by alias); 6 Jan 2000 18:16:59 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 4281 invoked from network); 6 Jan 2000 18:16:49 -0000
      To: Java Patch List  
      Subject: Patch: this morning's reflection fixes
      X-Zippy:  Now I'm being INVOLUNTARILY shuffled closer to the CLAM DIP
       with the BROKEN PLASTIC FORKS in it!!
      X-Attribution:  Tom
      Bcc:
      Reply-To:  tromey@cygnus.com
      From:  Tom Tromey 
      Date: 06 Jan 2000 11:19:54 -0700
      Message-ID: <87vh57m59x.fsf@cygnus.com>
      Lines: 46
      X-Mailer: Gnus v5.5/Emacs 20.3
      
      I'm committing the appended patch.  This fixes the remaining Mauve
      reflection failures; now the java.lang.Class.reflection and
      java.lang.reflect.Method.invoke tests pass completely.
      
      2000-01-06  Tom Tromey  
      
      	* java/lang/natClass.cc (_getConstructors): Correctly check
      	whether method name is the init name.
      	(getMethod): Look at accflags on method in `klass', not `this'.
      
      Tom
      
      Index: java/lang/natClass.cc
      ===================================================================
      RCS file: /cvs/java/libgcj/libjava/java/lang/natClass.cc,v
      retrieving revision 1.13
      diff -u -r1.13 natClass.cc
      --- natClass.cc	2000/01/06 00:56:21	1.13
      +++ natClass.cc	2000/01/06 18:15:45
      @@ -139,7 +139,7 @@
           {
             _Jv_Method *method = &methods[i];
             if (method->name == NULL
      -	  && ! _Jv_equalUtf8Consts (method->name, init_name))
      +	  || ! _Jv_equalUtf8Consts (method->name, init_name))
       	continue;
             if (! declared
       	  && ! java::lang::reflect::Modifier::isPublic(method->accflags))
      @@ -154,7 +154,7 @@
           {
             _Jv_Method *method = &methods[i];
             if (method->name == NULL
      -	  && ! _Jv_equalUtf8Consts (method->name, init_name))
      +	  || ! _Jv_equalUtf8Consts (method->name, init_name))
       	continue;
             if (! declared
       	  && ! java::lang::reflect::Modifier::isPublic(method->accflags))
      @@ -473,7 +473,7 @@
       	      using namespace java::lang::reflect;
       
       	      // Method must be public.
      -	      if (! Modifier::isPublic (methods[i].accflags))
      +	      if (! Modifier::isPublic (klass->methods[i].accflags))
       		break;
       
       	      Method *rmethod = new Method ();
      
      From java-patches-return-362-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Fri Jan 07 20:21:51 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 31213 invoked by alias); 7 Jan 2000 20:21:51 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 31177 invoked from network); 7 Jan 2000 20:21:35 -0000
      To: Java Patch List  
      Subject: Patch: Class.getClasses()
      X-Zippy:  CHUBBY CHECKER owns my BUILDING!
      X-Attribution:  Tom
      Bcc:
      Reply-To:  tromey@cygnus.com
      From:  Tom Tromey 
      Date: 07 Jan 2000 13:23:56 -0700
      Message-ID: <87iu15my03.fsf@cygnus.com>
      Lines: 31
      X-Mailer: Gnus v5.5/Emacs 20.3
      
      I'm committing this patch.  It implements Class.getClasses (to the
      extent that we currently can).  I now believe all the reflection code
      exists and works correctly.  On to other things.
      
      2000-01-07  Tom Tromey  
      
      	* java/lang/natClass.cc (getClasses): Wrote.
      
      Tom
      
      Index: java/lang/natClass.cc
      ===================================================================
      RCS file: /cvs/java/libgcj/libjava/java/lang/natClass.cc,v
      retrieving revision 1.14
      diff -u -r1.14 natClass.cc
      --- natClass.cc	2000/01/06 18:18:15	1.14
      +++ natClass.cc	2000/01/07 20:17:49
      @@ -367,8 +367,11 @@
       JArray *
       java::lang::Class::getClasses (void)
       {
      -  // FIXME: implement.
      -  return NULL;
      +  // Until we have inner classes, it always makes sense to return an
      +  // empty array.
      +  JArray *result
      +    = (JArray *) JvNewObjectArray (0, &ClassClass, NULL);
      +  return result;
       }
       
       JArray *
      
      From java-patches-return-363-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Fri Jan 07 20:39:49 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 32626 invoked by alias); 7 Jan 2000 20:39:49 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 32607 invoked from network); 7 Jan 2000 20:39:44 -0000
      To: Java Patch List  
      Subject: Patch: mauve ClassTest
      X-Zippy:  CONGRATULATIONS!  Now should I make thinly veiled comments about
       DIGNITY, self-esteem and finding TRUE FUN in your RIGHT VENTRICLE??
      X-Attribution:  Tom
      Bcc:
      Reply-To:  tromey@cygnus.com
      From:  Tom Tromey 
      Date: 07 Jan 2000 13:43:11 -0700
      Message-ID: <87hfgpmx40.fsf@cygnus.com>
      Lines: 31
      X-Mailer: Gnus v5.5/Emacs 20.3
      
      I'm committing this patch.
      It reenables the ClassTest test; we now at least stub out the method
      which previously caused this not to compile.
      
      2000-01-07  Tom Tromey  
      
      	* mauve-libgcj: Don't disable ClassTest.
      
      Tom
      
      Index: mauve-libgcj
      ===================================================================
      RCS file: /cvs/java/libgcj/libjava/mauve-libgcj,v
      retrieving revision 1.11
      diff -u -r1.11 mauve-libgcj
      --- mauve-libgcj	1999/12/21 23:50:01	1.11
      +++ mauve-libgcj	2000/01/07 20:38:42
      @@ -11,8 +11,6 @@
       java.lang.String.hash
       # We support 1.2 for this test.
       java.lang.reflect.Modifier.toString12
      -# We don't have the URL function in Class yet.
      -!java.lang.Class.ClassTest
       !java.math
       !java.rmi
       !java.security
      @@ -25,3 +23,4 @@
       !java.text.AttributedCharacterIterator
       !java.text.resources
       !java.text.DateFormat
      +!java.net
      
      From java-patches-return-364-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Fri Jan 07 20:41:58 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 451 invoked by alias); 7 Jan 2000 20:41:58 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 426 invoked from network); 7 Jan 2000 20:41:58 -0000
      Date: Fri, 7 Jan 2000 12:41:57 -0800 (PST)
      Message-Id: <200001072041.MAA00291@ferrule.cygnus.com>
      From: Tom Tromey 
      To: tromey@cygnus.com
      Cc: Java Patch List 
      Subject: Re: Patch: mauve ClassTest
      In-Reply-To: <87hfgpmx40.fsf@cygnus.com>
      References: <87hfgpmx40.fsf@cygnus.com>
      X-Zippy:  When you get your PH.D. will you get able to work at BURGER KING?
      X-Attribution:  Tom
      
      >>>>> "Tom" == Tom Tromey  writes:
      
      Tom> I'm committing this patch.
      Tom> It reenables the ClassTest test; we now at least stub out the method
      Tom> which previously caused this not to compile.
      
      I'm not actually committing the second hunk of this patch.
      That was a temporary hack I made...
      
      Tom
      
      From java-patches-return-365-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 09 22:19:07 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 18457 invoked by alias); 9 Jan 2000 22:19:06 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 18432 invoked from network); 9 Jan 2000 22:19:05 -0000
      Date: Sun, 9 Jan 2000 14:19:04 -0800
      Message-Id: <200001092219.OAA18242@hoser.cygnus.com>
      From: Anthony Green 
      To: java-patches@sourceware.cygnus.com
      Subject: Patches for java.lang.String
      X-Organization: Cygnus Solutions, Sunnyvale, California
      X-URL: http://www.cygnus.com/~green
      
      
      I'm committing the following changes to natString.cc based on mauve
      test results:
      
      2000-01-09  Anthony Green  
      
      	    * java/lang/natString.cc (init): Test for overflow condition
      	    during out of bounds check.
      	    (getChars): Throw StringIndexOutOfBoundsException, not
      	    ArrayIndexOutOfBoundsException.
      	    (getBytes): Ditto.
      	    (regionMatches): Obey case option during string comparison.
      
      
      Index: libjava/java/lang/natString.cc
      ===================================================================
      RCS file: /cvs/java/libgcj/libjava/java/lang/natString.cc,v
      retrieving revision 1.8
      diff -u -r1.8 natString.cc
      --- natString.cc	1999/12/02 19:59:30	1.8
      +++ natString.cc	2000/01/09 22:13:18
      @@ -328,7 +328,8 @@
         if (! chars)
           JvThrow (new NullPointerException);
         jsize data_size = JvGetArrayLength (chars);
      -  if (offset < 0 || count < 0 || offset + count > data_size)
      +  if (offset < 0 || count < 0 || offset + count < 0
      +      || offset + count > data_size)
           JvThrow (new StringIndexOutOfBoundsException());
         jcharArray array;
         jchar *pdst;
      @@ -451,7 +452,7 @@
         jint dst_length = JvGetArrayLength (dst);
         if (srcBegin < 0 || srcBegin > srcEnd || srcEnd > count
             || dstBegin < 0 || dstBegin + (srcEnd-srcBegin) > dst_length)
      -    JvThrow (new java::lang::ArrayIndexOutOfBoundsException());
      +    JvThrow (new java::lang::StringIndexOutOfBoundsException());
         register jchar *dPtr = elements (dst) + dstBegin;
         register jchar *sPtr = JvGetStringChars (this) + srcBegin;
         register jint i = srcEnd-srcBegin;
      @@ -501,7 +502,7 @@
         jint dst_length = JvGetArrayLength (dst);
         if (srcBegin < 0 || srcBegin > srcEnd || srcEnd > count
             || dstBegin < 0 || dstBegin + (srcEnd-srcBegin) > dst_length)
      -    JvThrow (new java::lang::ArrayIndexOutOfBoundsException());
      +    JvThrow (new java::lang::StringIndexOutOfBoundsException());
         register jbyte *dPtr = elements (dst) + dstBegin;
         register jchar *sPtr = JvGetStringChars (this) + srcBegin;
         register jint i = srcEnd-srcBegin;
      @@ -591,19 +592,25 @@
         register jchar *tptr = JvGetStringChars (this) + toffset;
         register jchar *optr = JvGetStringChars (other) + ooffset;
         register jint i = len;
      -  while (--i >= 0)
      -    {
      -      jchar tch = *tptr++;
      -      jchar och = *optr++;
      -      if (tch != och)
      -	return false;
      -      if (ignoreCase
      -	  && (java::lang::Character::toLowerCase (tch)
      -	      != java::lang::Character::toLowerCase (och))
      -	  && (java::lang::Character::toUpperCase (tch)
      -	      != java::lang::Character::toUpperCase (och)))
      -	return false;
      -    }
      +  if (ignoreCase)
      +    while (--i >= 0)
      +      {
      +	jchar tch = *tptr++;
      +	jchar och = *optr++;
      +	if ((java::lang::Character::toLowerCase (tch)
      +	     != java::lang::Character::toLowerCase (och))
      +	    && (java::lang::Character::toUpperCase (tch)
      +		!= java::lang::Character::toUpperCase (och)))
      +	  return false;
      +      }
      +  else
      +    while (--i >= 0)
      +      {
      +	jchar tch = *tptr++;
      +	jchar och = *optr++;
      +	if (tch != och)
      +	  return false;
      +      }
         return true;
       }
      
      -- 
      Anthony Green                                               Cygnus Solutions
                                                             Sunnyvale, California
      
      From java-patches-return-366-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 09 22:24:25 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 19727 invoked by alias); 9 Jan 2000 22:24:24 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 19702 invoked from network); 9 Jan 2000 22:24:23 -0000
      Date: Sun, 9 Jan 2000 14:24:21 -0800
      Message-Id: <200001092224.OAA18258@hoser.cygnus.com>
      From: Anthony Green 
      To: java-patches@sourceware.cygnus.com
      Subject: Enable interpreter by default for IA-32
      X-Organization: Cygnus Solutions, Sunnyvale, California
      X-URL: http://www.cygnus.com/~green
      
      
      I'm about to commit the following change, which enables the
      interpreter by default for IA-32.  I've been using it like this for
      some time now.
      
      2000-01-09  Anthony Green  
      
      	    * configure.host (ligcj_interpreter): New variable.  Enable
      	    interpreter by default on IA-32.
      	    * configure.in:  Examine libgcj_interpreter.
      	    * configure: Rebuilt.
      
      Index: libjava/configure.host
      ===================================================================
      RCS file: /cvs/java/libgcj/libjava/configure.host,v
      retrieving revision 1.6
      diff -u -r1.6 configure.host
      --- configure.host	1999/11/19 19:13:42	1.6
      +++ configure.host	2000/01/09 22:20:20
      @@ -24,6 +24,7 @@
       libgcj_cxxflags=
       libgcj_javaflags=
       libgcj_sjlj=
      +libgcj_interpreter=
       
       case "${target_optspace}:${host}" in
         yes:*)
      @@ -58,6 +59,7 @@
       	;;
         i686-*|i586-*)
       	libgcj_flags="${libgcj_flags} -ffloat-store"
      +	libgcj_interpreter=yes
       	DIVIDESPEC=-fno-use-divide-subroutine
       	;;
         sparc-*)
      Index: libjava/configure.in
      ===================================================================
      RCS file: /cvs/java/libgcj/libjava/configure.in,v
      retrieving revision 1.44
      diff -u -r1.44 configure.in
      --- configure.in	1999/12/20 05:55:34	1.44
      +++ configure.in	2000/01/09 22:20:22
      @@ -61,8 +61,13 @@
       AC_ARG_ENABLE(interpreter,
       [  --enable-interpreter    enable interpreter],
         if test "$enable_interpreter" = yes; then
      -     AC_DEFINE(INTERPRETER)
      +    # This can also be set in configure.host.
      +    libgcj_interpreter=yes
         fi)
      +
      +if test "$libgcj_interpreter" = yes; then
      +   AC_DEFINE(INTERPRETER)
      +fi
       
       EXCEPTIONSPEC=
       dnl See if we should use setjmp/longjmp exceptions
      Index: libjava/configure
      ===================================================================
      RCS file: /cvs/java/libgcj/libjava/configure,v
      retrieving revision 1.46
      diff -u -r1.46 configure
      --- configure	1999/12/20 05:55:34	1.46
      +++ configure	2000/01/09 22:20:34
      @@ -2422,14 +2422,19 @@
       if test "${enable_interpreter+set}" = set; then
         enableval="$enable_interpreter"
         if test "$enable_interpreter" = yes; then
      -     cat >> confdefs.h <<\EOF
      +    # This can also be set in configure.host.
      +    libgcj_interpreter=yes
      +  fi
      +fi
      +
      +
      +if test "$libgcj_interpreter" = yes; then
      +   cat >> confdefs.h <<\EOF
       #define INTERPRETER 1
       EOF
       
      -  fi
       fi
       
      -
       EXCEPTIONSPEC=
       # Check whether --enable-sjlj-exceptions or --disable-sjlj-exceptions was given.
       if test "${enable_sjlj_exceptions+set}" = set; then
      @@ -2455,18 +2460,18 @@
       fi   
       
       echo $ac_n "checking for data_start""... $ac_c" 1>&6
      -echo "configure:2459: checking for data_start" >&5
      +echo "configure:2464: checking for data_start" >&5
       LIBDATASTARTSPEC=
       NEEDS_DATA_START=
       cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:2475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         echo "$ac_t""found it" 1>&6
       else
      @@ -2522,7 +2527,7 @@
       esac
       
       echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
      -echo "configure:2526: checking how to run the C preprocessor" >&5
      +echo "configure:2531: checking how to run the C preprocessor" >&5
       # On Suns, sometimes $CPP names a directory.
       if test -n "$CPP" && test -d "$CPP"; then
         CPP=
      @@ -2537,13 +2542,13 @@
         # On the NeXT, cc -E runs the code through the compiler's parser,
         # not just through cpp.
         cat > conftest.$ac_ext <
       Syntax Error
       EOF
       ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
      -{ (eval echo configure:2547: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
      +{ (eval echo configure:2552: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
       ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
       if test -z "$ac_err"; then
         :
      @@ -2554,13 +2559,13 @@
         rm -rf conftest*
         CPP="${CC-cc} -E -traditional-cpp"
         cat > conftest.$ac_ext <
       Syntax Error
       EOF
       ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
      -{ (eval echo configure:2564: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
      +{ (eval echo configure:2569: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
       ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
       if test -z "$ac_err"; then
         :
      @@ -2571,13 +2576,13 @@
         rm -rf conftest*
         CPP="${CC-cc} -nologo -E"
         cat > conftest.$ac_ext <
       Syntax Error
       EOF
       ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
      -{ (eval echo configure:2581: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
      +{ (eval echo configure:2586: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
       ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
       if test -z "$ac_err"; then
         :
      @@ -2602,7 +2607,7 @@
       echo "$ac_t""$CPP" 1>&6
       
       cat > conftest.$ac_ext <
       EOF
      @@ -2617,7 +2622,7 @@
       rm -f conftest*
       
       cat > conftest.$ac_ext <
       EOF
      @@ -2632,7 +2637,7 @@
       rm -f conftest*
       
       cat > conftest.$ac_ext <
       EOF
      @@ -2647,7 +2652,7 @@
       rm -f conftest*
       
       cat > conftest.$ac_ext <
       EOF
      @@ -2664,7 +2669,7 @@
       
       
       cat > conftest.$ac_ext <
       EOF
      @@ -2679,7 +2684,7 @@
       rm -f conftest*
       
       cat > conftest.$ac_ext <
       EOF
      @@ -2717,7 +2722,7 @@
       libsubdir=.libs
       
       echo $ac_n "checking for garbage collector to use""... $ac_c" 1>&6
      -echo "configure:2721: checking for garbage collector to use" >&5
      +echo "configure:2726: checking for garbage collector to use" >&5
       # Check whether --enable-java-gc or --disable-java-gc was given.
       if test "${enable_java_gc+set}" = set; then
         enableval="$enable_java_gc"
      @@ -2767,7 +2772,7 @@
       
       
       echo $ac_n "checking for threads package to use""... $ac_c" 1>&6
      -echo "configure:2771: checking for threads package to use" >&5
      +echo "configure:2776: checking for threads package to use" >&5
       # Check whether --enable-threads or --disable-threads was given.
       if test "${enable_threads+set}" = set; then
         enableval="$enable_threads"
      @@ -2947,12 +2952,12 @@
          for ac_func in strerror ioctl select fstat open fsync sleep
       do
       echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
      -echo "configure:2951: checking for $ac_func" >&5
      +echo "configure:2956: checking for $ac_func" >&5
       if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:2984: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_$ac_func=yes"
       else
      @@ -3002,12 +3007,12 @@
          for ac_func in gmtime_r localtime_r readdir_r getpwuid_r getcwd
       do
       echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
      -echo "configure:3006: checking for $ac_func" >&5
      +echo "configure:3011: checking for $ac_func" >&5
       if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:3039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_$ac_func=yes"
       else
      @@ -3057,12 +3062,12 @@
          for ac_func in access stat mkdir rename rmdir unlink realpath
       do
       echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
      -echo "configure:3061: checking for $ac_func" >&5
      +echo "configure:3066: checking for $ac_func" >&5
       if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:3094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_$ac_func=yes"
       else
      @@ -3112,12 +3117,12 @@
          for ac_func in inet_aton inet_addr
       do
       echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
      -echo "configure:3116: checking for $ac_func" >&5
      +echo "configure:3121: checking for $ac_func" >&5
       if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:3149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_$ac_func=yes"
       else
      @@ -3167,12 +3172,12 @@
          for ac_func in inet_pton uname inet_ntoa
       do
       echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
      -echo "configure:3171: checking for $ac_func" >&5
      +echo "configure:3176: checking for $ac_func" >&5
       if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:3204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_$ac_func=yes"
       else
      @@ -3223,12 +3228,12 @@
          for ac_func in gethostbyname_r
       do
       echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
      -echo "configure:3227: checking for $ac_func" >&5
      +echo "configure:3232: checking for $ac_func" >&5
       if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:3260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_$ac_func=yes"
       else
      @@ -3278,7 +3283,7 @@
            # We look for the one that returns `int'.
            # Hopefully this check is robust enough.
            cat > conftest.$ac_ext <
       EOF
      @@ -3298,7 +3303,7 @@
            *" -D_REENTRANT "*) ;;
            *)
       		echo $ac_n "checking whether gethostbyname_r declaration requires -D_REENTRANT""... $ac_c" 1>&6
      -echo "configure:3302: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
      +echo "configure:3307: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5
       if eval "test \"`echo '$''{'libjava_cv_gethostbyname_r_needs_reentrant'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
      @@ -3311,14 +3316,14 @@
       cross_compiling=$ac_cv_prog_cxx_cross
       
       	  cat > conftest.$ac_ext <
       int main() {
       gethostbyname_r("", 0, 0);
       ; return 0; }
       EOF
      -if { (eval echo configure:3322: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
      +if { (eval echo configure:3327: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
         rm -rf conftest*
         libjava_cv_gethostbyname_r_needs_reentrant=no
       else
      @@ -3328,14 +3333,14 @@
         		CPPFLAGS_SAVE="$CPPFLAGS"
       		CPPFLAGS="$CPPFLAGS -D_REENTRANT"
       		cat > conftest.$ac_ext <
       int main() {
       gethostbyname_r("", 0, 0);
       ; return 0; }
       EOF
      -if { (eval echo configure:3339: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
      +if { (eval echo configure:3344: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
         rm -rf conftest*
         libjava_cv_gethostbyname_r_needs_reentrant=yes
       else
      @@ -3370,12 +3375,12 @@
            esac
       
            echo $ac_n "checking for struct hostent_data""... $ac_c" 1>&6
      -echo "configure:3374: checking for struct hostent_data" >&5
      +echo "configure:3379: checking for struct hostent_data" >&5
       if eval "test \"`echo '$''{'libjava_cv_struct_hostent_data'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         	cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then
      +if { (eval echo configure:3395: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
         rm -rf conftest*
         libjava_cv_struct_hostent_data=yes
       else
      @@ -3415,12 +3420,12 @@
          for ac_func in gethostbyaddr_r
       do
       echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
      -echo "configure:3419: checking for $ac_func" >&5
      +echo "configure:3424: checking for $ac_func" >&5
       if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:3452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_$ac_func=yes"
       else
      @@ -3470,7 +3475,7 @@
            # We look for the one that returns `int'.
            # Hopefully this check is robust enough.
            cat > conftest.$ac_ext <
       EOF
      @@ -3494,12 +3499,12 @@
          for ac_func in gethostname
       do
       echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
      -echo "configure:3498: checking for $ac_func" >&5
      +echo "configure:3503: checking for $ac_func" >&5
       if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:3531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_$ac_func=yes"
       else
      @@ -3546,7 +3551,7 @@
       EOF
       
            cat > conftest.$ac_ext <
       EOF
      @@ -3577,12 +3582,12 @@
             for ac_func in pthread_mutexattr_settype pthread_mutexattr_setkind_np
       do
       echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
      -echo "configure:3581: checking for $ac_func" >&5
      +echo "configure:3586: checking for $ac_func" >&5
       if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:3614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_$ac_func=yes"
       else
      @@ -3635,12 +3640,12 @@
             for ac_func in sched_yield
       do
       echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
      -echo "configure:3639: checking for $ac_func" >&5
      +echo "configure:3644: checking for $ac_func" >&5
       if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:3672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_$ac_func=yes"
       else
      @@ -3685,7 +3690,7 @@
       else
         echo "$ac_t""no" 1>&6
       echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
      -echo "configure:3689: checking for sched_yield in -lrt" >&5
      +echo "configure:3694: checking for sched_yield in -lrt" >&5
       ac_lib_var=`echo rt'_'sched_yield | sed 'y%./+-%__p_%'`
       if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
      @@ -3693,7 +3698,7 @@
         ac_save_LIBS="$LIBS"
       LIBS="-lrt  $LIBS"
       cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:3713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_lib_$ac_lib_var=yes"
       else
      @@ -3730,7 +3735,7 @@
         echo "$ac_t""no" 1>&6
       
       	  echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6
      -echo "configure:3734: checking for sched_yield in -lposix4" >&5
      +echo "configure:3739: checking for sched_yield in -lposix4" >&5
       ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'`
       if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
      @@ -3738,7 +3743,7 @@
         ac_save_LIBS="$LIBS"
       LIBS="-lposix4  $LIBS"
       cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:3758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_lib_$ac_lib_var=yes"
       else
      @@ -3785,7 +3790,7 @@
             # We can save a little space at runtime if the mutex has m_count
             # or __m_count.  This is a nice hack for Linux.
             cat > conftest.$ac_ext <
       int main() {
      @@ -3794,7 +3799,7 @@
               
       ; return 0; }
       EOF
      -if { (eval echo configure:3798: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
      +if { (eval echo configure:3803: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
         rm -rf conftest*
         cat >> confdefs.h <<\EOF
       #define PTHREAD_MUTEX_HAVE_M_COUNT 1
      @@ -3806,7 +3811,7 @@
         rm -rf conftest*
         
       	cat > conftest.$ac_ext <
       int main() {
      @@ -3815,7 +3820,7 @@
       	  
       ; return 0; }
       EOF
      -if { (eval echo configure:3819: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
      +if { (eval echo configure:3824: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
         rm -rf conftest*
         cat >> confdefs.h <<\EOF
       #define PTHREAD_MUTEX_HAVE___M_COUNT 1
      @@ -3835,12 +3840,12 @@
          for ac_func in gettimeofday time ftime
       do
       echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
      -echo "configure:3839: checking for $ac_func" >&5
      +echo "configure:3844: checking for $ac_func" >&5
       if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:3872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_$ac_func=yes"
       else
      @@ -3894,12 +3899,12 @@
          for ac_func in memmove
       do
       echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
      -echo "configure:3898: checking for $ac_func" >&5
      +echo "configure:3903: checking for $ac_func" >&5
       if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:3931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_$ac_func=yes"
       else
      @@ -3952,12 +3957,12 @@
          for ac_func in memcpy
       do
       echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
      -echo "configure:3956: checking for $ac_func" >&5
      +echo "configure:3961: checking for $ac_func" >&5
       if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:3989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_$ac_func=yes"
       else
      @@ -4028,7 +4033,7 @@
          #--------------------------------------------------------------------
       
          echo $ac_n "checking for socket libraries""... $ac_c" 1>&6
      -echo "configure:4032: checking for socket libraries" >&5
      +echo "configure:4037: checking for socket libraries" >&5
       if eval "test \"`echo '$''{'gcj_cv_lib_sockets'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
      @@ -4036,12 +4041,12 @@
            gcj_checkBoth=0
            unset ac_cv_func_connect
            echo $ac_n "checking for connect""... $ac_c" 1>&6
      -echo "configure:4040: checking for connect" >&5
      +echo "configure:4045: checking for connect" >&5
       if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:4073: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_connect=yes"
       else
      @@ -4087,7 +4092,7 @@
            if test "$gcj_checkSocket" = 1; then
       	 unset ac_cv_func_connect
       	 echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
      -echo "configure:4091: checking for main in -lsocket" >&5
      +echo "configure:4096: checking for main in -lsocket" >&5
       ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
       if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
      @@ -4095,14 +4100,14 @@
         ac_save_LIBS="$LIBS"
       LIBS="-lsocket  $LIBS"
       cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:4111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_lib_$ac_lib_var=yes"
       else
      @@ -4129,12 +4134,12 @@
       	 LIBS="$LIBS -lsocket -lnsl"
       	 unset ac_cv_func_accept
       	 echo $ac_n "checking for accept""... $ac_c" 1>&6
      -echo "configure:4133: checking for accept" >&5
      +echo "configure:4138: checking for accept" >&5
       if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:4166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_accept=yes"
       else
      @@ -4184,12 +4189,12 @@
            gcj_oldLibs=$LIBS
            LIBS="$LIBS $gcj_cv_lib_sockets"
            echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
      -echo "configure:4188: checking for gethostbyname" >&5
      +echo "configure:4193: checking for gethostbyname" >&5
       if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:4221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_gethostbyname=yes"
       else
      @@ -4230,7 +4235,7 @@
       else
         echo "$ac_t""no" 1>&6
       echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
      -echo "configure:4234: checking for main in -lnsl" >&5
      +echo "configure:4239: checking for main in -lnsl" >&5
       ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
       if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
      @@ -4238,14 +4243,14 @@
         ac_save_LIBS="$LIBS"
       LIBS="-lnsl  $LIBS"
       cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:4254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_lib_$ac_lib_var=yes"
       else
      @@ -4277,7 +4282,7 @@
       
          if test "$with_system_zlib" = yes; then
             echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6
      -echo "configure:4281: checking for deflate in -lz" >&5
      +echo "configure:4286: checking for deflate in -lz" >&5
       ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'`
       if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
      @@ -4285,7 +4290,7 @@
         ac_save_LIBS="$LIBS"
       LIBS="-lz  $LIBS"
       cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:4305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_lib_$ac_lib_var=yes"
       else
      @@ -4325,7 +4330,7 @@
          # requires -ldl.
          if test "$GC" = boehm; then
             echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
      -echo "configure:4329: checking for main in -ldl" >&5
      +echo "configure:4334: checking for main in -ldl" >&5
       ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'`
       if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
      @@ -4333,14 +4338,14 @@
         ac_save_LIBS="$LIBS"
       LIBS="-ldl  $LIBS"
       cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:4349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_lib_$ac_lib_var=yes"
       else
      @@ -4460,7 +4465,7 @@
       # See if gcj supports -fuse-divide-subroutine.  gcc 2.95 does not, and
       # we want to continue to support that version.
       echo $ac_n "checking whether gcj supports -fuse-divide-subroutine""... $ac_c" 1>&6
      -echo "configure:4464: checking whether gcj supports -fuse-divide-subroutine" >&5
      +echo "configure:4469: checking whether gcj supports -fuse-divide-subroutine" >&5
       cat > conftest.java << 'END'
       public class conftest { }
       END
      @@ -4480,17 +4485,17 @@
       do
       ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
       echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
      -echo "configure:4484: checking for $ac_hdr" >&5
      +echo "configure:4489: checking for $ac_hdr" >&5
       if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <
       EOF
       ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
      -{ (eval echo configure:4494: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
      +{ (eval echo configure:4499: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
       ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
       if test -z "$ac_err"; then
         rm -rf conftest*
      @@ -4520,17 +4525,17 @@
       do
       ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
       echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
      -echo "configure:4524: checking for $ac_hdr" >&5
      +echo "configure:4529: checking for $ac_hdr" >&5
       if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <
       EOF
       ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
      -{ (eval echo configure:4534: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
      +{ (eval echo configure:4539: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
       ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
       if test -z "$ac_err"; then
         rm -rf conftest*
      @@ -4558,12 +4563,12 @@
       
       
       echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
      -echo "configure:4562: checking for ANSI C header files" >&5
      +echo "configure:4567: checking for ANSI C header files" >&5
       if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <
       #include 
      @@ -4571,7 +4576,7 @@
       #include 
       EOF
       ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
      -{ (eval echo configure:4575: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
      +{ (eval echo configure:4580: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
       ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
       if test -z "$ac_err"; then
         rm -rf conftest*
      @@ -4588,7 +4593,7 @@
       if test $ac_cv_header_stdc = yes; then
         # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
       cat > conftest.$ac_ext <
       EOF
      @@ -4606,7 +4611,7 @@
       if test $ac_cv_header_stdc = yes; then
         # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
       cat > conftest.$ac_ext <
       EOF
      @@ -4627,7 +4632,7 @@
         :
       else
         cat > conftest.$ac_ext <
       #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
      @@ -4638,7 +4643,7 @@
       exit (0); }
       
       EOF
      -if { (eval echo configure:4642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
      +if { (eval echo configure:4647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
       then
         :
       else
      @@ -4662,12 +4667,12 @@
       fi
       
       echo $ac_n "checking for ssize_t""... $ac_c" 1>&6
      -echo "configure:4666: checking for ssize_t" >&5
      +echo "configure:4671: checking for ssize_t" >&5
       if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <
       #if STDC_HEADERS
      @@ -4696,9 +4701,9 @@
       
       
       echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6
      -echo "configure:4700: checking for in_addr_t" >&5
      +echo "configure:4705: checking for in_addr_t" >&5
       cat > conftest.$ac_ext <
       #if STDC_HEADERS
      @@ -4712,7 +4717,7 @@
       in_addr_t foo;
       ; return 0; }
       EOF
      -if { (eval echo configure:4716: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
      +if { (eval echo configure:4721: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
         rm -rf conftest*
         cat >> confdefs.h <<\EOF
       #define HAVE_IN_ADDR_T 1
      @@ -4728,16 +4733,16 @@
       rm -f conftest*
       
       echo $ac_n "checking whether struct ip_mreq is in netinet/in.h""... $ac_c" 1>&6
      -echo "configure:4732: checking whether struct ip_mreq is in netinet/in.h" >&5
      +echo "configure:4737: checking whether struct ip_mreq is in netinet/in.h" >&5
       cat > conftest.$ac_ext <
       int main() {
       struct ip_mreq mreq;
       ; return 0; }
       EOF
      -if { (eval echo configure:4741: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
      +if { (eval echo configure:4746: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
         rm -rf conftest*
         cat >> confdefs.h <<\EOF
       #define HAVE_STRUCT_IP_MREQ 1
      @@ -4753,16 +4758,16 @@
       rm -f conftest*
       
       echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6
      -echo "configure:4757: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
      +echo "configure:4762: checking whether struct sockaddr_in6 is in netinet/in.h" >&5
       cat > conftest.$ac_ext <
       int main() {
       struct sockaddr_in6 addr6;
       ; return 0; }
       EOF
      -if { (eval echo configure:4766: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
      +if { (eval echo configure:4771: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
         rm -rf conftest*
         cat >> confdefs.h <<\EOF
       #define HAVE_INET6 1
      @@ -4778,16 +4783,16 @@
       rm -f conftest*
       
       echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6
      -echo "configure:4782: checking for socklen_t in sys/socket.h" >&5
      +echo "configure:4787: checking for socklen_t in sys/socket.h" >&5
       cat > conftest.$ac_ext <
       int main() {
       socklen_t x = 5;
       ; return 0; }
       EOF
      -if { (eval echo configure:4791: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
      +if { (eval echo configure:4796: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
         rm -rf conftest*
         cat >> confdefs.h <<\EOF
       #define HAVE_SOCKLEN_T 1
      @@ -4803,16 +4808,16 @@
       rm -f conftest*
       
       echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6
      -echo "configure:4807: checking for tm_gmtoff in struct tm" >&5
      +echo "configure:4812: checking for tm_gmtoff in struct tm" >&5
       cat > conftest.$ac_ext <
       int main() {
       struct tm tim; tim.tm_gmtoff = 0;
       ; return 0; }
       EOF
      -if { (eval echo configure:4816: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
      +if { (eval echo configure:4821: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
         rm -rf conftest*
         cat >> confdefs.h <<\EOF
       #define STRUCT_TM_HAS_GMTOFF 1
      @@ -4825,16 +4830,16 @@
         rm -rf conftest*
         echo "$ac_t""no" 1>&6
          echo $ac_n "checking for global timezone variable""... $ac_c" 1>&6
      -echo "configure:4829: checking for global timezone variable" >&5
      +echo "configure:4834: checking for global timezone variable" >&5
                   cat > conftest.$ac_ext <
       int main() {
       long z2 = timezone;
       ; return 0; }
       EOF
      -if { (eval echo configure:4838: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
      +if { (eval echo configure:4843: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
         rm -rf conftest*
         cat >> confdefs.h <<\EOF
       #define HAVE_TIMEZONE 1
      @@ -4854,19 +4859,19 @@
       # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
       # for constant arguments.  Useless!
       echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
      -echo "configure:4858: checking for working alloca.h" >&5
      +echo "configure:4863: checking for working alloca.h" >&5
       if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <
       int main() {
       char *p = alloca(2 * sizeof(int));
       ; return 0; }
       EOF
      -if { (eval echo configure:4870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:4875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         ac_cv_header_alloca_h=yes
       else
      @@ -4887,12 +4892,12 @@
       fi
       
       echo $ac_n "checking for alloca""... $ac_c" 1>&6
      -echo "configure:4891: checking for alloca" >&5
      +echo "configure:4896: checking for alloca" >&5
       if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:4929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         ac_cv_func_alloca_works=yes
       else
      @@ -4952,12 +4957,12 @@
       
       
       echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
      -echo "configure:4956: checking whether alloca needs Cray hooks" >&5
      +echo "configure:4961: checking whether alloca needs Cray hooks" >&5
       if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&6
      -echo "configure:4986: checking for $ac_func" >&5
      +echo "configure:4991: checking for $ac_func" >&5
       if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
      +if { (eval echo configure:5019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
         rm -rf conftest*
         eval "ac_cv_func_$ac_func=yes"
       else
      @@ -5037,7 +5042,7 @@
       fi
       
       echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
      -echo "configure:5041: checking stack direction for C alloca" >&5
      +echo "configure:5046: checking stack direction for C alloca" >&5
       if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
      @@ -5045,7 +5050,7 @@
         ac_cv_c_stack_direction=0
       else
         cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
      +if { (eval echo configure:5073: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
       then
         ac_cv_c_stack_direction=1
       else
      @@ -5091,7 +5096,7 @@
       # Extract the first word of "$ac_prog", so it can be a program name with args.
       set dummy $ac_prog; ac_word=$2
       echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
      -echo "configure:5095: checking for $ac_word" >&5
      +echo "configure:5100: checking for $ac_word" >&5
       if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then
         echo $ac_n "(cached) $ac_c" 1>&6
       else
      
      -- 
      Anthony Green                                               Cygnus Solutions
                                                             Sunnyvale, California
      
      From java-patches-return-367-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 09 22:59:09 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 24680 invoked by alias); 9 Jan 2000 22:59:08 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 24633 invoked from network); 9 Jan 2000 22:59:06 -0000
      Date: Sun, 9 Jan 2000 14:59:03 -0800
      Message-Id: <200001092259.OAA18286@hoser.cygnus.com>
      From: Anthony Green 
      To: java-patches@sourceware.cygnus.com, gcc-patches@gcc.gnu.org
      Subject: java patches for string concatonation
      X-Organization: Cygnus Solutions, Sunnyvale, California
      X-URL: http://www.cygnus.com/~green
      
      
      Here are a pair of patches - one for the compiler and one for the
      runtime.  Once reviewed they should be committed at the same time.
      
      When gcj sees string concatonation with the "+" operator, and the
      first operand (op1) is either a String reference or a string literal,
      we emit a call to `new StringBuffer(op1)' and append op2.  If op1 is
      null then this constructor should be throwing a NullPointerException,
      however, right now it is filling the buffer with "null".
      
      I've appended two patches below.  One is to libgcj's StringBuffer
      implementation.  It removes the special case for null arguments so it
      will throw a NullPointerException in those cases.
      
      The second is a compiler patch.  It will only call `new
      StringBuffer(op1)' if it knows op1 is a constant.  If there's any
      chance that it may be null, we have to use `new
      StringBuffer().append(op1)'.
      
      Note the old comment in StringBuffer.java:
      
      -      // Note: nowhere does it say that we should handle a null
      -      // argument here.  In fact, the JCL implies that we should not.
      -      // But this leads to an asymmetry: `null + ""' will fail, while
      -      // `"" + null' will work.
      
      The compiler change corrects this problem.  The behaviour is
      symmetrical now, and the bytecode output is identical to jikes'.
      Sun's javac does something slightly different, but exhibits the same
      behaviour.
      
      
      2000-01-09  Anthony Green  
      
      	    * java/lang/StringBuffer.java (StringBuffer): Don't special case
      	    null argument.
      
      Index: libjava/java/lang/StringBuffer.java
      ===================================================================
      RCS file: /cvs/java/libgcj/libjava/java/lang/StringBuffer.java,v
      retrieving revision 1.2
      diff -u -r1.2 StringBuffer.java
      --- StringBuffer.java	1999/04/30 09:30:53	1.2
      +++ StringBuffer.java	2000/01/09 22:27:32
      @@ -241,12 +241,9 @@
       
         public StringBuffer (String str)
           {
      -      // Note: nowhere does it say that we should handle a null
      -      // argument here.  In fact, the JCL implies that we should not.
      -      // But this leads to an asymmetry: `null + ""' will fail, while
      -      // `"" + null' will work.
      -      if (str == null)
      -      str = "null";
      +      // The documentation is not clear, but experimentation with
      +      // other implementations indicates that StringBuffer(null)
      +      // should throw a NullPointerException.
             count = str.length();
             // JLS: The initial capacity of the string buffer is 16 plus the
             // length of the argument string.
      
      
      
      2000-01-09  Anthony Green  
      
      	    * parse.y (build_string_concatenation): Only use
      	    StringBuffer(String) shortcut if String arg is constant.
      
      Index: gcc/java/parse.y
      ===================================================================
      RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
      retrieving revision 1.128
      diff -u -r1.128 parse.y
      --- parse.y	2000/01/07 20:28:11	1.128
      +++ parse.y	2000/01/09 22:33:04
      @@ -10222,9 +10222,9 @@
         if (!IS_CRAFTED_STRING_BUFFER_P (op1))
           {
             /* Two solutions here: 
      -       1) OP1 is a string reference, we call new StringBuffer(OP1)
      +	 1) OP1 is a constant string reference, we call new StringBuffer(OP1)
      	  2) OP1 is something else, we call new StringBuffer().append(OP1). */
      -      if (JSTRING_TYPE_P (TREE_TYPE (op1)))
      +      if (TREE_CONSTANT (op1) && JSTRING_TYPE_P (TREE_TYPE (op1)))
             op1 = BUILD_STRING_BUFFER (op1);
             else
             {
      
      -- 
      Anthony Green                                               Cygnus Solutions
                                                             Sunnyvale, California
      
      From java-patches-return-368-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Mon Jan 10 01:13:25 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 3679 invoked by alias); 10 Jan 2000 01:13:24 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 3628 invoked from network); 10 Jan 2000 01:13:23 -0000
      Date: Sun, 9 Jan 2000 17:13:20 -0800 (PST)
      Message-Id: <200001100113.RAA03328@ferrule.cygnus.com>
      From: Tom Tromey 
      To: Anthony Green 
      Cc: java-patches@sourceware.cygnus.com, gcc-patches@gcc.gnu.org
      Subject: Re: java patches for string concatonation
      In-Reply-To: <200001092259.OAA18286@hoser.cygnus.com>
      References: <200001092259.OAA18286@hoser.cygnus.com>
      X-Zippy:  Well, I'm a classic ANAL RETENTIVE!!  And I'm looking for a way to
       VICARIOUSLY experience some reason to LIVE!!
      X-Attribution:  Tom
      
      Anthony> When gcj sees string concatonation with the "+" operator, and
      Anthony> the first operand (op1) is either a String reference or a
      Anthony> string literal, we emit a call to `new StringBuffer(op1)' and
      Anthony> append op2.  If op1 is null then this constructor should be
      Anthony> throwing a NullPointerException, however, right now it is
      Anthony> filling the buffer with "null".
      
      The libgcj side is fine provided that the compiler side goes in too.
      
      Eventually I think we should stop using StringBuffer to implement
      string concatenation, and instead use something faster.  For example,
      we could use a StringBuffer-like class (that would also be used by the
      StringBuffer implementation) which does not have any synchronization.
      
      We could even allocate the buffer on the stack in some siuations, or
      perhaps partially allocate it on the stack (and revert to the heap on
      overflow).
      
      Tom
      
      From java-patches-return-369-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Mon Jan 10 02:12:36 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 11046 invoked by alias); 10 Jan 2000 02:12:35 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 11027 invoked from network); 10 Jan 2000 02:12:35 -0000
      Message-ID: <387940FE.570FF7A7@sigma6.com>
      Date: Sun, 09 Jan 2000 21:16:30 -0500
      From: Jeff Sturm 
      Organization: sigma6
      X-Mailer: Mozilla 4.04 [en] (WinNT; I)
      MIME-Version: 1.0
      To: Tom Tromey 
      CC: java-patches@sourceware.cygnus.com
      Subject: Re: java patches for string concatonation
      References: <200001092259.OAA18286@hoser.cygnus.com> <200001100113.RAA03328@ferrule.cygnus.com>
      Content-Type: text/plain; charset=us-ascii
      Content-Transfer-Encoding: 7bit
      
      Tom Tromey wrote:
      > Eventually I think we should stop using StringBuffer to implement
      > string concatenation, and instead use something faster.  For example,
      > we could use a StringBuffer-like class (that would also be used by the
      > StringBuffer implementation) which does not have any synchronization.
      
      For native compilation, I agree.  However, using anything but
      StringBuffer would jeopardize compatibility in the bytecode compiler. 
      So if this optimization is done at the tree level it may have to be
      switched off for bytecode generation.
      
      Another possible way to improve string concatenation is to have the
      compiler guess at the eventual buffer size, or a reasonable upper bound,
      rather than allocating 16 bytes by default.
      
      > We could even allocate the buffer on the stack in some siuations, or
      > perhaps partially allocate it on the stack (and revert to the heap on
      > overflow).
      
      Stack allocation is an interesting idea but perhaps not so useful for
      string concatenation... in many cases the stack buffer would have to be
      copied to permanent heap storage when constructing the String object.
      
      --
      Jeff Sturm
      jsturm@sigma6.com
      
      From java-patches-return-370-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Mon Jan 10 16:40:04 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 20038 invoked by alias); 10 Jan 2000 16:40:03 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 19986 invoked from network); 10 Jan 2000 16:40:02 -0000
      From: Alexandre Petit-Bianco 
      MIME-Version: 1.0
      Content-Type: text/plain; charset=us-ascii
      Content-Transfer-Encoding: 7bit
      Message-ID: <14458.2912.86739.757934@deliverance.cygnus.com>
      Date: Mon, 10 Jan 2000 08:40:00 -0800 (PST)
      To: Anthony Green 
      Cc: java-patches@sourceware.cygnus.com, gcc-patches@gcc.gnu.org
      Subject: Re: java patches for string concatonation
      In-Reply-To: <200001092259.OAA18286@hoser.cygnus.com>
      References: <200001092259.OAA18286@hoser.cygnus.com>
      X-Mailer: VM 6.62 under Emacs 19.34.1
      X-Organization: Cygnus Solutions, Sunnyvale CA, USA.
      X-URL: http://www.serialhacker.org
      
      
      Anthony Green writes:
      
      > Index: gcc/java/parse.y
      > ===================================================================
      > RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
      > retrieving revision 1.128
      > diff -u -r1.128 parse.y
      
      OK to go. Thanks Anthony.
      
      ./A
      
      From java-patches-return-371-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Mon Jan 10 19:49:26 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 26136 invoked by alias); 10 Jan 2000 19:49:26 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 26110 invoked from network); 10 Jan 2000 19:49:19 -0000
      To: Java Patch List  
      Subject: Patch: portability fixes from Jeff Sturm
      X-Zippy:  I'm thinking about DIGITAL READ-OUT systems and
       computer-generated IMAGE FORMATIONS..
      X-Attribution:  Tom
      Bcc:
      Reply-To:  tromey@cygnus.com
      From:  Tom Tromey 
      Date: 10 Jan 2000 12:52:45 -0700
      Message-ID: <874scl901e.fsf@cygnus.com>
      Lines: 126
      X-Mailer: Gnus v5.5/Emacs 20.3
      
      I'm checking in the appended patch, which fixes some HP build
      problems.
      
      2000-01-10  Jeff Sturm  
      
      	* java/lang/natMath.cc (pow): Cast args to `double', not
      	`jdouble'.
      	(atan2): Likewise.
      	(IEEEremainder): Likewise.
      	* java/lang/mprec.h: Don't wrap includes in `extern "C"'.
      	* java/lang/fdlibm.h: Don't wrap includes in `extern "C"'.
      
      Tom
      
      Index: java/lang/fdlibm.h
      ===================================================================
      RCS file: /cvs/java/libgcj/libjava/java/lang/fdlibm.h,v
      retrieving revision 1.2
      diff -u -r1.2 fdlibm.h
      --- fdlibm.h	1999/06/24 20:41:47	1.2
      +++ fdlibm.h	2000/01/10 19:44:27
      @@ -2,7 +2,7 @@
       /* @(#)fdlibm.h 5.1 93/09/24 */
       /*
        * ====================================================
      - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
      + * Copyright (C) 1993, 2000 by Sun Microsystems, Inc. All rights reserved.
        *
        * Developed at SunPro, a Sun Microsystems, Inc. business.
        * Permission to use, copy, modify, and distribute this
      @@ -12,10 +12,6 @@
        */
       
       
      -#ifdef __cplusplus
      -extern "C" {
      -#endif
      -
       #include 
       #include 
       
      @@ -47,6 +43,10 @@
       /* These typedefs are true for the targets running Java. */
       
       #define _IEEE_LIBM
      +
      +#ifdef __cplusplus
      +extern "C" {
      +#endif
       
       /*
        * ANSI/POSIX
      Index: java/lang/mprec.h
      ===================================================================
      RCS file: /cvs/java/libgcj/libjava/java/lang/mprec.h,v
      retrieving revision 1.3
      diff -u -r1.3 mprec.h
      --- mprec.h	1999/07/12 09:40:07	1.3
      +++ mprec.h	2000/01/10 19:44:32
      @@ -2,7 +2,7 @@
        *
        * The author of this software is David M. Gay.
        *
      - * Copyright (c) 1991 by AT&T.
      + * Copyright (c) 1991, 2000 by AT&T.
        *
        * Permission to use, copy, modify, and distribute this software for any
        * purpose without fee is hereby granted, provided that this entire notice
      @@ -26,10 +26,6 @@
       	dmg@research.att.com or research!dmg
        */
       
      -#ifdef __cplusplus
      -extern "C" {
      -#endif
      -
       #include 
       #include "ieeefp.h"
       
      @@ -51,6 +47,9 @@
       #include 
       #endif
       
      +#ifdef __cplusplus
      +extern "C" {
      +#endif
       
       /* ISO C9X int type declarations */
       
      Index: java/lang/natMath.cc
      ===================================================================
      RCS file: /cvs/java/libgcj/libjava/java/lang/natMath.cc,v
      retrieving revision 1.2
      diff -u -r1.2 natMath.cc
      --- natMath.cc	1999/09/10 22:03:08	1.2
      +++ natMath.cc	2000/01/10 19:44:32
      @@ -1,4 +1,4 @@
      -/* Copyright (C) 1998, 1999  Cygnus Solutions
      +/* Copyright (C) 1998, 1999, 2000  Cygnus Solutions
       
          This file is part of libgcj.
       
      @@ -59,7 +59,7 @@
       
       jdouble java::lang::Math::atan2(jdouble y, jdouble x)
       {
      -  return (jdouble)::atan2((jdouble)y, (jdouble)x);
      +  return (jdouble)::atan2((double)y, (double)x);
       }  
       
       jdouble java::lang::Math::log(jdouble x)
      @@ -79,12 +79,12 @@
       
       jdouble java::lang::Math::pow(jdouble y, jdouble x)
       {
      -  return (jdouble)::pow((jdouble)y, (jdouble)x);
      +  return (jdouble)::pow((double)y, (double)x);
       }  
       
       jdouble java::lang::Math::IEEEremainder(jdouble y, jdouble x)
       {
      -  return (jdouble)::__ieee754_remainder((jdouble)y, (jdouble)x);
      +  return (jdouble)::__ieee754_remainder((double)y, (double)x);
       }  
       
       jdouble java::lang::Math::abs(jdouble x)
      
      From java-patches-return-372-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Tue Jan 11 18:58:37 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 9488 invoked by alias); 11 Jan 2000 18:58:36 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 9350 invoked from network); 11 Jan 2000 18:58:24 -0000
      To: Java Patch List  
      Subject: Patch: new test
      X-Zippy:  Do you have exactly what I want in a plaid poindexter bar bat??
      X-Attribution:  Tom
      Bcc:
      Reply-To:  tromey@cygnus.com
      From:  Tom Tromey 
      Date: 11 Jan 2000 12:02:35 -0700
      Message-ID: <87wvpg77p0.fsf@cygnus.com>
      Lines: 35
      X-Mailer: Gnus v5.5/Emacs 20.3
      
      I'm committing this patch, which adds a new regression test.
      This test program currently segvs on my machine.
      
      2000-01-11  Tom Tromey  
      
      	* libjava.lang/klass.out: New file.
      	* libjava.lang/klass.java: New file.
      
      Tom
      
      Index: libjava.lang/klass.java
      ===================================================================
      RCS file: klass.java
      diff -N klass.java
      --- /dev/null	Tue May  5 13:32:27 1998
      +++ klass.java	Tue Jan 11 10:55:49 2000
      @@ -0,0 +1,10 @@
      +public class klass
      +{
      +  public static void main (String[] args)
      +  {
      +    Class ic1 = Integer.TYPE;
      +    int[] foo = new int[3];
      +    Class ic2 = foo.getClass().getComponentType();
      +    System.out.println(ic1.equals(ic2));
      +  }
      +}
      Index: libjava.lang/klass.out
      ===================================================================
      RCS file: klass.out
      diff -N klass.out
      --- /dev/null	Tue May  5 13:32:27 1998
      +++ klass.out	Tue Jan 11 10:55:49 2000
      @@ -0,0 +1 @@
      +true
      
      From java-patches-return-373-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 12 21:13:13 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 23594 invoked by alias); 12 Jan 2000 21:13:13 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 23575 invoked from network); 12 Jan 2000 21:13:07 -0000
      To: Java Patch List  
      Cc: Kresten Krab Thorup  
      Subject: _Jv_FindClass
      X-Zippy:  I'm not available for comment..
      X-Attribution:  Tom
      Bcc:
      Reply-To:  tromey@cygnus.com
      From:  Tom Tromey 
      Date: 12 Jan 2000 14:17:51 -0700
      Message-ID: <87g0w36lc0.fsf@cygnus.com>
      Lines: 14
      X-Mailer: Gnus v5.5/Emacs 20.3
      
      In _Jv_FindClass I see this:
      
      	  // if "loader" delegateted the loadClass operation
      	  // to another loader, register explicitly
      	  // that he is also an initiating loader of the
      	  // given class.  	  
      
      	  if (klass && (klass->getClassLoader () != loader))
      	    _Jv_RegisterInitiatingLoader (klass, 0);
      
      Shouldn't the second argument to _Jv_RegisterInitiatingLoader be
      `loader'?
      
      Tom
      
      From java-patches-return-374-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Thu Jan 13 12:27:00 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 28218 invoked by alias); 13 Jan 2000 12:26:59 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 28197 invoked from network); 13 Jan 2000 12:26:57 -0000
      To: tromey@cygnus.com
      Cc: Java Patch List 
      Subject: Re: _Jv_FindClass
      References: <87g0w36lc0.fsf@cygnus.com>
      From: Kresten Krab Thorup 
      Date: 13 Jan 2000 13:26:49 +0100
      In-Reply-To: Tom Tromey's message of "12 Jan 2000 14:17:51 -0700"
      Message-ID: 
      Lines: 42
      X-Mailer: Gnus v5.7/Emacs 20.5
      Mime-Version: 1.0
      Content-Type: text/plain; charset=US-ASCII
      Content-Transfer-Encoding: 7bit
      
      Tom Tromey  writes:
      
      > In _Jv_FindClass I see this:
      > 
      > 	  // if "loader" delegateted the loadClass operation
      > 	  // to another loader, register explicitly
      > 	  // that he is also an initiating loader of the
      > 	  // given class.  	  
      > 
      > 	  if (klass && (klass->getClassLoader () != loader))
      > 	    _Jv_RegisterInitiatingLoader (klass, 0);
      > 
      > Shouldn't the second argument to _Jv_RegisterInitiatingLoader be
      > `loader'?
      
      It seems like you're right.
      
      I don't remember the details, but here are some comments off the top
      of my head.
      
      Loader `NULL' represents the bootstrap loader, i.e. the non-existent
      loader for the classes linked into the application.
      
      Every class has a number of initiating loaders, and one of these is
      the loader that actually did the loading (the defining loader).
      Often, a class loader will delegate to the boot loader (in case of all
      the linked-in classes), and thus the original loader needs to also be
      registered.
      
      The result of getClassLoader() is the defining loader.
      
      The defining loader is implicitly an initiating loader, so it is not
      explicitly registered in the table for initiating loaders in the GCJ
      runtime. 
      
      
      -- Kresten
      
       Kresten Krab Thorup           "I like my eggs ploded"
       Department of Computer Science, University of Aarhus
       Aabogade 34, DK-8200 Aarhus N, Denmark
       +45 8942 5665 (office), +45 2343 4626 (mobile)
      
      From java-patches-return-375-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Thu Jan 13 18:13:06 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 1448 invoked by alias); 13 Jan 2000 18:13:06 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 1413 invoked from network); 13 Jan 2000 18:12:57 -0000
      To: Java Patch List  
      Subject: Patch: classloader fix
      X-Zippy:  If elected, Zippy pledges to each and every American
       a 55-year-old houseboy...
      X-Attribution:  Tom
      Bcc:
      Reply-To:  tromey@cygnus.com
      From:  Tom Tromey 
      Date: 13 Jan 2000 11:12:08 -0700
      Message-ID: <8766wx7sef.fsf@cygnus.com>
      Lines: 55
      X-Mailer: Gnus v5.5/Emacs 20.3
      
      This patch fixes the ClassLoader buglet I found yesterday.  The bug is
      that we erroneously register the system class loader, and not the
      actual initiating class loader, as one of class' initiating class
      loaders.  I'm checking it in.
      
      2000-01-13  Tom Tromey  
      
      	* java/lang/natClassLoader.cc (_Jv_FindClass): Register `loader',
      	not system loader, as initiating loader.
      
      
      Tom
      
      Index: java/lang/natClassLoader.cc
      ===================================================================
      RCS file: /cvs/java/libgcj/libjava/java/lang/natClassLoader.cc,v
      retrieving revision 1.12
      diff -u -r1.12 natClassLoader.cc
      --- natClassLoader.cc	1999/10/22 19:43:41	1.12
      +++ natClassLoader.cc	2000/01/13 18:09:36
      @@ -1,6 +1,6 @@
       // natClassLoader.cc - Implementation of java.lang.ClassLoader native methods.
       
      -/* Copyright (C) 1999  Cygnus Solutions
      +/* Copyright (C) 1999, 2000  Cygnus Solutions
       
          This file is part of libgcj.
       
      @@ -437,13 +437,11 @@
       	  // Load using a user-defined loader, jvmspec 5.3.2
       	  klass = loader->loadClass(sname, false);
       
      -	  // if "loader" delegateted the loadClass operation
      -	  // to another loader, register explicitly
      -	  // that he is also an initiating loader of the
      -	  // given class.  	  
      -
      +	  // If "loader" delegated the loadClass operation to another
      +	  // loader, explicitly register that it is also an initiating
      +	  // loader of the given class.
       	  if (klass && (klass->getClassLoader () != loader))
      -	    _Jv_RegisterInitiatingLoader (klass, 0);
      +	    _Jv_RegisterInitiatingLoader (klass, loader);
       	}
             else 
       	{
      @@ -454,7 +452,7 @@
       	      sys = java::lang::ClassLoader::getSystemClassLoader ();
       	    }
       
      -	  // Load using the bootstrap loader jmspec 5.3.1.
      +	  // Load using the bootstrap loader jvmspec 5.3.1.
       	  klass = sys->loadClass (sname, false); 
       
       	  // Register that we're an initiating loader.
      
      From java-patches-return-376-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Thu Jan 13 21:08:26 2000
      Return-Path: 
      Delivered-To: listarch-java-patches@sourceware.cygnus.com
      Received: (qmail 2996 invoked by alias); 13 Jan 2000 21:08:26 -0000
      Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm
      Precedence: bulk
      List-Subscribe: 
      List-Archive: 
      List-Post: 
      List-Help: , 
      Sender: java-patches-owner@sourceware.cygnus.com
      Delivered-To: mailing list java-patches@sourceware.cygnus.com
      Received: (qmail 2958 invoked from network); 13 Jan 2000 21:08:24 -0000
      Date: Thu, 13 Jan 2000 17:07:59 -0500
      From: gchambers@linuxbox
      Message-Id: <200001132207.RAA17346@linuxbox.provsol.com>
      To: java-patches@sourceware.cygnus.com
      Subject: -fno-rtti documentation patch
      Cc: gchambers@provsol.com
      
      Here's a patch to update the FAQ to mention -fno-rtti for CNI C++ source.
      
      Index: ChangeLog
      ===================================================================
      RCS file: /cvs/java/htdocs/ChangeLog,v
      retrieving revision 1.16
      diff -h -r1.16 ChangeLog
      0a1,4
      > 2000-01-06  Glenn Chambers 
      > 	* faq.html: Add text about -fno-rtti.
      > 	Fix bogus close-tag left behind in my last edit.
      > 
      Index: faq.html
      ===================================================================
      RCS file: /cvs/java/htdocs/faq.html,v
      retrieving revision 1.9
      diff -h -r1.9 faq.html
      87a88
      >             
    1. I'm getting link errors! 556a558,571 >
      >
       
      >
      >
      >
      >

      4.6 I'm getting link errors

      >
      >
      >

      If you get errors at link time that refer to > 'undefined reference to `java::lang::Object type_info function', > verify that you have compiled any CNI C++ files with the > -fno_rtti option. >

      >
      683c698 <

      Glenn Chambers has created a couple --- >

      Glenn Chambers has created a couple 686a702,705 >

      >

      > Note that you must compile the C++ files used for CNI with the > -fno-rtti option. From java-patches-return-377-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sat Jan 15 16:11:53 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 23422 invoked by alias); 15 Jan 2000 16:11:53 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 23403 invoked from network); 15 Jan 2000 16:11:51 -0000 X-Authentication-Warning: cc42593-a.taylor1.mi.home.com: jsturm owned process doing -bs Date: Sat, 15 Jan 2000 11:03:23 -0500 (EST) From: Jeff Sturm X-Sender: jsturm@cc42593-a.taylor1.mi.home.com To: java-patches@sourceware.cygnus.com Subject: Patches for java.io.StreamTokenizer In-Reply-To: <387FAF38.7A990182@sigma6.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII The patch below prevents an infinite loop in StreamTokenizer. (Attempting to unread(-1) on a PushbackReader causes the next read to return 65535. I thought this was a bug in PushbackReader, but other implementations seem to do the same thing. I guess the consequence of unread(-1) is simply undefined.) There are other problems in StreamTokenizer that probably can't be fixed by a small patch. For example, "-." is incorrectly read as a number, causing NumberFormatException. IMHO the body of nextToken() needs to be reimplemented as a FSM. Would it be worthwhile to rewrite this class, or can we consider getting it from the Classpath project instead? 2000-01-15 Jeff Sturm * java/io/StreamTokenizer.java (nextToken): Avoid unread(TT_EOF). Index: StreamTokenizer.java =================================================================== RCS file: /cvs/java/libgcj/libjava/java/io/StreamTokenizer.java,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 StreamTokenizer.java --- StreamTokenizer.java 1999/04/07 14:52:36 1.1.1.1 +++ StreamTokenizer.java 2000/01/15 15:38:03 @@ -179,7 +179,7 @@ // Throw away \n if in combination with \r. if (ch == '\r' && (ch = in.read()) != '\n') - in.unread(ch); + if (ch != TT_EOF) in.unread(ch); if (eolSignificant) return (ttype = TT_EOL); } @@ -192,7 +192,7 @@ { // Read ahead to see if this is an ordinary '-' rather than numeric. ch = in.read(); - in.unread(ch); + if (ch != TT_EOF) in.unread(ch); if (isNumeric(ch) && ch != '-') ch = '-'; else @@ -209,7 +209,7 @@ else tokbuf.append((char) ch); - in.unread(ch); + if (ch != TT_EOF) in.unread(ch); ttype = TT_NUMBER; nval = Double.valueOf(tokbuf.toString()).doubleValue(); } @@ -219,7 +219,7 @@ tokbuf.append((char) ch); while (isAlphabetic(ch = in.read()) || isNumeric(ch)) tokbuf.append((char) ch); - in.unread(ch); + if (ch != TT_EOF) in.unread(ch); ttype = TT_WORD; sval = tokbuf.toString(); if (lowerCase) @@ -229,7 +229,7 @@ { while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF) ; - in.unread(ch); + if (ch != TT_EOF) in.unread(ch); return nextToken(); // Recursive, but not too deep in normal cases. } else if (isQuote(ch)) @@ -277,7 +277,7 @@ } } - in.unread(nextch); + if (nextch != TT_EOF) in.unread(nextch); } tokbuf.append((char) ch); @@ -285,7 +285,7 @@ // Throw away matching quote char. if (ch != ttype) - in.unread(ch); + if (ch != TT_EOF) in.unread(ch); sval = tokbuf.toString(); } @@ -296,7 +296,7 @@ { while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF) ; - in.unread(ch); + if (ch != TT_EOF) in.unread(ch); return nextToken(); // Recursive, but not too deep in normal cases } else if (ch == '*' && slashStar) @@ -308,16 +308,15 @@ if ((ch = in.read()) == '/') break; else - in.unread(ch); + if (ch != TT_EOF) in.unread(ch); else if (ch == '\n' || ch == '\r') { lineNumber++; if (ch == '\r' && (ch = in.read()) != '\n') - in.unread(ch); + if (ch != TT_EOF) in.unread(ch); } else if (ch == TT_EOF) { - in.unread(ch); break; } } @@ -325,7 +324,7 @@ } else { - in.unread(ch); + if (ch != TT_EOF) in.unread(ch); ch = '/'; } -- Jeff Sturm jsturm@sigma6.com From java-patches-return-378-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 16 02:10:39 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 8722 invoked by alias); 16 Jan 2000 02:10:39 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 8691 invoked from network); 16 Jan 2000 02:10:37 -0000 Date: Sat, 15 Jan 2000 18:10:35 -0800 (PST) Message-Id: <200001160210.SAA05948@ferrule.cygnus.com> From: Tom Tromey To: java-patches@sourceware.cygnus.com, gchambers@provsol.com Subject: Re: -fno-rtti documentation patch In-Reply-To: <200001132207.RAA17346@linuxbox.provsol.com> References: <200001132207.RAA17346@linuxbox.provsol.com> X-Zippy: Can I have an IMPULSE ITEM instead? X-Attribution: Tom >>>>> "Glenn" == gchambers writes: Glenn> Here's a patch to update the FAQ to mention -fno-rtti for CNI Glenn> C++ source. I checked this in. Two minor nits: 1. Please make context (-c) or uni- (-u) diffs. These are much easier to read 2. You need a blank line between the ChangeLog header and the body of the entry. Thanks a lot! Tom From java-patches-return-379-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 16 03:07:36 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 12301 invoked by alias); 16 Jan 2000 03:07:36 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 12274 invoked from network); 16 Jan 2000 03:07:35 -0000 Date: Sat, 15 Jan 2000 19:07:32 -0800 (PST) Message-Id: <200001160307.TAA06130@ferrule.cygnus.com> From: Tom Tromey To: Jeff Sturm Cc: java-patches@sourceware.cygnus.com Subject: Re: Patches for java.io.StreamTokenizer In-Reply-To: References: <387FAF38.7A990182@sigma6.com> X-Zippy: .. the HIGHWAY is made out of LIME JELLO and my HONDA is a barbequed OYSTER! Yum! X-Attribution: Tom >>>>> "Jeff" == Jeff Sturm writes: Jeff> The patch below prevents an infinite loop in StreamTokenizer. Jeff> (Attempting to unread(-1) on a PushbackReader causes the next Jeff> read to return 65535. I thought this was a bug in Jeff> PushbackReader, but other implementations seem to do the same Jeff> thing. I guess the consequence of unread(-1) is simply Jeff> undefined.) The JCL book says that PushbackReader.unread() pushes back the low-order 2 bytes of the argument. The online JDK 1.2 docs say nothing. Jeff> There are other problems in StreamTokenizer that probably can't Jeff> be fixed by a small patch. For example, "-." is incorrectly Jeff> read as a number, causing NumberFormatException. IMHO the body Jeff> of nextToken() needs to be reimplemented as a FSM. Would it be Jeff> worthwhile to rewrite this class, or can we consider getting it Jeff> from the Classpath project instead? The current plan is to choose between libgcj and Classpath classes on a case-by-case basis -- assuming RMS gives his ok to the whole process (I don't have a clue why it is taking so long). What I'd really like to see are Mauve tests that we can use to help make the determination. My only problems with this patch are coding style bugs: Jeff> if (ch == '\r' && (ch = in.read()) != '\n') Jeff> - in.unread(ch); Jeff> + if (ch != TT_EOF) in.unread(ch); We don't put the body on the same line as the "if" (there are a few of these in the patch). Also, nested if's required braces. Jeff> else Jeff> - in.unread(ch); Jeff> + if (ch != TT_EOF) in.unread(ch); Here the "if" should be on the same line as the "else". Jeff> if (ch == '\r' && (ch = in.read()) != '\n') Jeff> - in.unread(ch); Jeff> + if (ch != TT_EOF) in.unread(ch); Here you should just add another "&&" clause to the "if". (Warning in advance: the "&&" must come after a line break, not before.) If you make these changes, I'll check this in. Thanks, Tom From java-patches-return-380-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 16 17:29:51 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 20029 invoked by alias); 16 Jan 2000 17:29:50 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 20010 invoked from network); 16 Jan 2000 17:29:48 -0000 X-Authentication-Warning: cc42593-a.taylor1.mi.home.com: jsturm owned process doing -bs Date: Sun, 16 Jan 2000 12:33:53 -0500 (EST) From: Jeff Sturm X-Sender: jsturm@cc42593-a.taylor1.mi.home.com To: Tom Tromey cc: java-patches@sourceware.cygnus.com Subject: Re: Patches for java.io.StreamTokenizer In-Reply-To: <200001160307.TAA06130@ferrule.cygnus.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Sat, 15 Jan 2000, Tom Tromey wrote: > My only problems with this patch are coding style bugs: OK... here's my 2nd take: 2000-01-16 Jeff Sturm * java/io/StreamTokenizer.java (nextToken): Avoid unread(TT_EOF). Index: StreamTokenizer.java =================================================================== RCS file: /cvs/java/libgcj/libjava/java/io/StreamTokenizer.java,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 StreamTokenizer.java --- StreamTokenizer.java 1999/04/07 14:52:36 1.1.1.1 +++ StreamTokenizer.java 2000/01/16 17:18:37 @@ -179,7 +179,10 @@ // Throw away \n if in combination with \r. if (ch == '\r' && (ch = in.read()) != '\n') - in.unread(ch); + { + if (ch != TT_EOF) + in.unread(ch); + } if (eolSignificant) return (ttype = TT_EOL); } @@ -192,7 +195,8 @@ { // Read ahead to see if this is an ordinary '-' rather than numeric. ch = in.read(); - in.unread(ch); + if (ch != TT_EOF) + in.unread(ch); if (isNumeric(ch) && ch != '-') ch = '-'; else @@ -209,7 +213,8 @@ else tokbuf.append((char) ch); - in.unread(ch); + if (ch != TT_EOF) + in.unread(ch); ttype = TT_NUMBER; nval = Double.valueOf(tokbuf.toString()).doubleValue(); } @@ -219,7 +224,8 @@ tokbuf.append((char) ch); while (isAlphabetic(ch = in.read()) || isNumeric(ch)) tokbuf.append((char) ch); - in.unread(ch); + if (ch != TT_EOF) + in.unread(ch); ttype = TT_WORD; sval = tokbuf.toString(); if (lowerCase) @@ -229,7 +235,8 @@ { while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF) ; - in.unread(ch); + if (ch != TT_EOF) + in.unread(ch); return nextToken(); // Recursive, but not too deep in normal cases. } else if (isQuote(ch)) @@ -277,14 +284,15 @@ } } - in.unread(nextch); + if (nextch != TT_EOF) + in.unread(nextch); } tokbuf.append((char) ch); } // Throw away matching quote char. - if (ch != ttype) + if (ch != ttype && ch != TT_EOF) in.unread(ch); sval = tokbuf.toString(); @@ -296,7 +304,8 @@ { while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF) ; - in.unread(ch); + if (ch != TT_EOF) + in.unread(ch); return nextToken(); // Recursive, but not too deep in normal cases } else if (ch == '*' && slashStar) @@ -305,19 +314,23 @@ { ch = in.read(); if (ch == '*') - if ((ch = in.read()) == '/') - break; - else - in.unread(ch); + { + if ((ch = in.read()) == '/') + break; + else if (ch != TT_EOF) + in.unread(ch); + } else if (ch == '\n' || ch == '\r') { lineNumber++; if (ch == '\r' && (ch = in.read()) != '\n') - in.unread(ch); + { + if (ch != TT_EOF) + in.unread(ch); + } } else if (ch == TT_EOF) { - in.unread(ch); break; } } @@ -325,7 +338,8 @@ } else { - in.unread(ch); + if (ch != TT_EOF) + in.unread(ch); ch = '/'; } From java-patches-return-381-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 16 19:32:02 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 3085 invoked by alias); 16 Jan 2000 19:32:02 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 3058 invoked from network); 16 Jan 2000 19:32:00 -0000 Date: Sun, 16 Jan 2000 11:31:57 -0800 Message-Id: <200001161931.LAA24665@hoser.cygnus.com> From: Anthony Green To: java-patches@sourceware.cygnus.com Subject: new test case X-Organization: Cygnus Solutions, Sunnyvale, California X-URL: http://www.cygnus.com/~green New test case. It appears to be fixed already. 2000-01-16 Anthony Green * libjava.lang/pr109.out: New file. * libjava.lang/pr109.java: New file. Index: libjava/testsuite/libjava.lang/pr109.java =================================================================== RCS file: pr109.java diff -N pr109.java --- /dev/null Tue May 5 13:32:27 1998 +++ pr109.java Sun Jan 16 11:30:06 2000 @@ -0,0 +1,25 @@ +// PR 109 + +// Running the test code produces the output "0" instead of the +// expected "01234". + +// The break statement exits both for-loops (not just the innermost +// one) if the (single statement) body of the outer for-loop is not +// enclosed in braces. Affects more deeply nested loops in the same +// way. + +public class pr109 +{ + public static void main (String argv[]) + { + int i, j; + + for (i = 0; i < 5; i++) + for (j = 0; j < 2; j++) + { + if (j == 1) + break; + System.out.print (i); + } + } +} Index: libjava/testsuite/libjava.lang/pr109.out =================================================================== RCS file: pr109.out diff -N pr109.out --- /dev/null Tue May 5 13:32:27 1998 +++ pr109.out Sun Jan 16 11:30:06 2000 @@ -0,0 +1 @@ +01234 From java-patches-return-382-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 16 19:54:31 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 6263 invoked by alias); 16 Jan 2000 19:54:31 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 6237 invoked from network); 16 Jan 2000 19:54:30 -0000 Date: Sun, 16 Jan 2000 11:54:27 -0800 Message-Id: <200001161954.LAA24686@hoser.cygnus.com> From: Anthony Green To: java-patches@sourceware.cygnus.com Subject: More new test code X-Organization: Cygnus Solutions, Sunnyvale, California X-URL: http://www.cygnus.com/~green More test code... 2000-01-16 Anthony Green * libjava.lang/pr83.out: New file. * libjava.lang/pr83.java: New file. Index: libjava/testsuite/libjava.lang/pr83.java =================================================================== RCS file: pr83.java diff -N pr83.java --- /dev/null Tue May 5 13:32:27 1998 +++ pr83.java Sun Jan 16 11:53:39 2000 @@ -0,0 +1,39 @@ +// PR 83 + +/* + * test that caught null pointers exceptions in finalizers work correctly + * and that local variables are accessible in null pointer exception handlers. + */ +import java.io.*; + +public class pr83 { + + static String s; + + public static void main(String[] args) { + System.out.println(tryfinally() + s); + } + + public static String tryfinally() { + String yuck = null; + String local_s = null; + + try { + return "This is "; + } finally { + try { + local_s = "Perfect"; + /* trigger null pointer exception */ + String x = yuck.toLowerCase(); + } catch (Exception _) { + /* + * when the null pointer exception is caught, we must still + * be able to access local_s. + * Our return address for the finally clause must also still + * be intact. + */ + s = local_s; + } + } + } +} Index: libjava/testsuite/libjava.lang/pr83.out =================================================================== RCS file: pr83.out diff -N pr83.out --- /dev/null Tue May 5 13:32:27 1998 +++ pr83.out Sun Jan 16 11:53:39 2000 @@ -0,0 +1 @@ +This is Perfect From java-patches-return-383-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 16 20:25:27 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 9351 invoked by alias); 16 Jan 2000 20:25:26 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 9326 invoked from network); 16 Jan 2000 20:25:25 -0000 Date: Sun, 16 Jan 2000 12:25:22 -0800 Message-Id: <200001162025.MAA24726@hoser.cygnus.com> From: Anthony Green To: java-patches@sourceware.cygnus.com Subject: testsuite patch: handle regexp match files X-Organization: Cygnus Solutions, Sunnyvale, California X-URL: http://www.cygnus.com/~green libjava.lang contained partial support for regexp match files. This finishes off the job. 2000-01-16 Anthony Green * libjava.lang/lang.exp: Handle regexp matches correctly. Index: libjava/testsuite/libjava.lang/lang.exp =================================================================== RCS file: /cvs/java/libgcj/libjava/testsuite/libjava.lang/lang.exp,v retrieving revision 1.1 diff -u -r1.1 lang.exp --- lang.exp 1999/10/04 03:30:54 1.1 +++ lang.exp 2000/01/16 20:22:38 @@ -1,11 +1,11 @@ global srcdir subdir -catch "glob -nocomplain ${srcdir}/${subdir}/*.out" srcfiles +catch "glob -nocomplain ${srcdir}/${subdir}/*.xpo ${srcdir}/${subdir}/*.out" srcfiles verbose "srcfiles are $srcfiles" set prefix "" foreach x $srcfiles { - regsub "\\.out$" $x "" prefix + regsub "\\.(out|xpo)$" $x "" prefix set bname [file tail $prefix] if [file exists $srcdir/$subdir/${bname}.xpo] { -- Anthony Green Red Hat Sunnyvale, California From java-patches-return-384-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 16 20:29:18 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 9563 invoked by alias); 16 Jan 2000 20:29:18 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 9538 invoked from network); 16 Jan 2000 20:29:18 -0000 Date: Sun, 16 Jan 2000 12:29:15 -0800 Message-Id: <200001162029.MAA24729@hoser.cygnus.com> From: Anthony Green To: java-patches@sourceware.cygnus.com Subject: More new test code X-Organization: Cygnus Solutions, Sunnyvale, California X-URL: http://www.cygnus.com/~green More new test code. Uses regexp matching. 2000-01-16 Anthony Green * libjava.lang/pr93.xpo: New file. * libjava.lang/pr93.java: New file. Index: libjava/testsuite/libjava.lang/pr93.java =================================================================== RCS file: pr93.java diff -N pr93.java --- /dev/null Tue May 5 13:32:27 1998 +++ pr93.java Sun Jan 16 12:26:51 2000 @@ -0,0 +1,24 @@ +// PR 93 + +// Programs compiled with current libgcj dump core sometime after +// garbage collection. + +public class pr93 +{ + public static void main(String[] args) { + java.util.Random generator = new java.util.Random(); + Runtime runtime = Runtime.getRuntime(); + + System.out.println("free memory = " + runtime.freeMemory()); + System.out.println("total memory = " + runtime.totalMemory()); + + for (int n = 0; n < 10000; n++) { + byte[] junk = new byte[(generator.nextInt() & 0x7fffffff) % 512]; + } + + runtime.gc(); + + System.out.println("free memory = " + runtime.freeMemory()); + System.out.println("total memory = " + runtime.totalMemory()); + } +} Index: libjava/testsuite/libjava.lang/pr93.xpo =================================================================== RCS file: pr93.xpo diff -N pr93.xpo --- /dev/null Tue May 5 13:32:27 1998 +++ pr93.xpo Sun Jan 16 12:26:51 2000 @@ -0,0 +1,4 @@ +free memory = [0-9]* +total memory = [0-9]* +free memory = [0-9]* +total memory = [0-9]* From java-patches-return-385-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 16 21:00:04 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 12605 invoked by alias); 16 Jan 2000 21:00:04 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 12565 invoked from network); 16 Jan 2000 21:00:03 -0000 Date: Sun, 16 Jan 2000 12:59:59 -0800 Message-Id: <200001162059.MAA24759@hoser.cygnus.com> From: Anthony Green To: java-patches@sourceware.cygnus.com Subject: Still more test code X-Organization: Cygnus Solutions, Sunnyvale, California X-URL: http://www.cygnus.com/~green 2000-01-16 Anthony Green * libjava.lang/pr133.out: New file. * libjava.lang/pr133.java: New file. * libjava.lang/pr100.xpo: New file. * libjava.lang/pr100.java: New file. Index: libjava/testsuite/libjava.lang/pr100.java =================================================================== RCS file: pr100.java diff -N pr100.java --- /dev/null Tue May 5 13:32:27 1998 +++ pr100.java Sun Jan 16 12:58:03 2000 @@ -0,0 +1,13 @@ +// PR 100 + +// Second call to hashcode causes SEGV when dynamically linking. + +public class pr100 +{ + public static void main(String[] args) { + pr100 ht = new pr100(); + + System.err.println(ht.hashCode()); + System.err.println(ht.getClass().hashCode()); + } +} Index: libjava/testsuite/libjava.lang/pr100.xpo =================================================================== RCS file: pr100.xpo diff -N pr100.xpo --- /dev/null Tue May 5 13:32:27 1998 +++ pr100.xpo Sun Jan 16 12:58:03 2000 @@ -0,0 +1,2 @@ +[0-9]+ +[0-9]+ Index: libjava/testsuite/libjava.lang/pr133.java =================================================================== RCS file: pr133.java diff -N pr133.java --- /dev/null Tue May 5 13:32:27 1998 +++ pr133.java Sun Jan 16 12:58:03 2000 @@ -0,0 +1,34 @@ +// PR 133 + +// System.exit(0) appears to hang the program. + +public class pr133 { + public static void main(String argv[]) + { + String name; + + if (argv.length == 0) { + name = "Rocket J. Squirrel"; + } else { + name = argv[0]; + } + + new pr133(name).identifySelf(); + System.out.println("goodbye"); + + System.exit(0); + } + + public pr133 (String name) + { + v_name = name; + } + + public void identifySelf() + { + System.out.println("This is a pr133 instance named " + v_name); + System.out.println("Leaving identifySelf()..."); + } + + private String v_name; +} Index: libjava/testsuite/libjava.lang/pr133.out =================================================================== RCS file: pr133.out diff -N pr133.out --- /dev/null Tue May 5 13:32:27 1998 +++ pr133.out Sun Jan 16 12:58:03 2000 @@ -0,0 +1,3 @@ +This is a pr133 instance named Rocket J. Squirrel +Leaving identifySelf()... +goodbye From java-patches-return-386-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 16 21:12:02 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 13090 invoked by alias); 16 Jan 2000 21:12:02 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 13064 invoked from network); 16 Jan 2000 21:12:01 -0000 Date: Sun, 16 Jan 2000 13:11:57 -0800 (PST) Message-Id: <200001162111.NAA06726@ferrule.cygnus.com> From: Tom Tromey To: Anthony Green Cc: java-patches@sourceware.cygnus.com Subject: Re: new test case In-Reply-To: <200001161931.LAA24665@hoser.cygnus.com> References: <200001161931.LAA24665@hoser.cygnus.com> X-Zippy: .. Now KEN and BARBIE are PERMANENTLY ADDICTED to MIND-ALTERING DRUGS.. X-Attribution: Tom >>>>> "Anthony" == Anthony Green writes: Anthony> New test case. It appears to be fixed already. Cool, thanks. Anthony> 2000-01-16 Anthony Green Anthony> * libjava.lang/pr109.out: New file. Anthony> * libjava.lang/pr109.java: New file. I think we should put something like "test for PR libgcj/109" into these ChangeLog entries so that the commit message for tests ends up in the PR as well. Comments? Tom From java-patches-return-387-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 16 21:18:21 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 13380 invoked by alias); 16 Jan 2000 21:18:21 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 13355 invoked from network); 16 Jan 2000 21:18:21 -0000 Date: Sun, 16 Jan 2000 13:18:18 -0800 Message-Id: <200001162118.NAA24794@hoser.cygnus.com> From: Anthony Green To: tromey@cygnus.com CC: java-patches@sourceware.cygnus.com In-reply-to: <200001162111.NAA06726@ferrule.cygnus.com> (message from Tom Tromey on Sun, 16 Jan 2000 13:11:57 -0800 (PST)) Subject: Re: new test case X-Organization: Cygnus Solutions, Sunnyvale, California X-URL: http://www.cygnus.com/~green References: <200001161931.LAA24665@hoser.cygnus.com> <200001162111.NAA06726@ferrule.cygnus.com> Tom wrote: > I think we should put something like "test for PR libgcj/109" into > these ChangeLog entries so that the commit message for tests ends up > in the PR as well. Comments? Ah yes. I forgot about this. BTW - I'm looking at why Thread_1 is failing. The expected output is: test 0 daemon done joined active count = 2 test 1 true still alive: false test 2 interrupted But I can't imagine why we are expecting "active count = 2". I think "active count = 0" is correct. AG -- Anthony Green Red Hat Sunnyvale, California From java-patches-return-388-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 16 21:20:18 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 13740 invoked by alias); 16 Jan 2000 21:20:18 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 13715 invoked from network); 16 Jan 2000 21:20:18 -0000 Date: Sun, 16 Jan 2000 13:20:14 -0800 (PST) Message-Id: <200001162120.NAA06739@ferrule.cygnus.com> From: Tom Tromey To: Anthony Green Cc: tromey@cygnus.com, java-patches@sourceware.cygnus.com Subject: Re: new test case In-Reply-To: <200001162118.NAA24794@hoser.cygnus.com> References: <200001161931.LAA24665@hoser.cygnus.com> <200001162111.NAA06726@ferrule.cygnus.com> <200001162118.NAA24794@hoser.cygnus.com> X-Zippy: Pardon me, but do you know what it means to be TRULY ONE with your BOOTH! X-Attribution: Tom >>>>> "Anthony" == Anthony Green writes: Anthony> BTW - I'm looking at why Thread_1 is failing. I think Thread_1 is buggy. The last time I looked at it seriously, I noticed it had race conditions. Simply deleting it might be the most reasonable approach. Tom From java-patches-return-389-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 16 21:32:19 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 14329 invoked by alias); 16 Jan 2000 21:32:19 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 14304 invoked from network); 16 Jan 2000 21:32:18 -0000 Date: Sun, 16 Jan 2000 13:32:15 -0800 (PST) Message-Id: <200001162132.NAA06753@ferrule.cygnus.com> From: Tom Tromey To: Jeff Sturm Cc: Tom Tromey , java-patches@sourceware.cygnus.com Subject: Re: Patches for java.io.StreamTokenizer In-Reply-To: References: <200001160307.TAA06130@ferrule.cygnus.com> X-Zippy: OVER the underpass! UNDER the overpass! Around the FUTURE and BEYOND REPAIR!! X-Attribution: Tom >>>>> "Jeff" == Jeff Sturm writes: Jeff> 2000-01-16 Jeff Sturm Jeff> * java/io/StreamTokenizer.java (nextToken): Avoid unread(TT_EOF). I checked this in. Thanks. Tom From java-patches-return-390-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Sun Jan 16 23:33:57 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 29271 invoked by alias); 16 Jan 2000 23:33:57 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 29252 invoked from network); 16 Jan 2000 23:33:55 -0000 Message-ID: <388255CC.9F94D842@albatross.co.nz> Date: Mon, 17 Jan 2000 12:35:41 +1300 From: Bryce McKinlay X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.3.25 i686) X-Accept-Language: en MIME-Version: 1.0 To: Tom Tromey CC: Anthony Green , java-patches@sourceware.cygnus.com Subject: Re: new test case References: <200001161931.LAA24665@hoser.cygnus.com> <200001162111.NAA06726@ferrule.cygnus.com> <200001162118.NAA24794@hoser.cygnus.com> <200001162120.NAA06739@ferrule.cygnus.com> Content-Type: multipart/alternative; boundary="------------911584F66199FB60478AE253" --------------911584F66199FB60478AE253 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Tom Tromey wrote: > >>>>> "Anthony" == Anthony Green writes: > > Anthony> BTW - I'm looking at why Thread_1 is failing. > > I think Thread_1 is buggy. The last time I looked at it seriously, I > noticed it had race conditions. Simply deleting it might be the most > reasonable approach. The expected output is wrong. "active count" should be 0, there is no race in that part due to the join. However the JOIN_TIMEOUT part of the test has an obvious race. It would be a shame to not have any thread tests in the test suite. Perhaps we should fix & clean up Thread_1, and extend it to cover more stuff (like more interrupt() corner cases). regards [ bryce ] --------------911584F66199FB60478AE253 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Tom Tromey wrote:

      >>>>> "Anthony" == Anthony Green <green@cygnus.com> writes:

      Anthony> BTW - I'm looking at why Thread_1 is failing.

      I think Thread_1 is buggy.  The last time I looked at it seriously, I
      noticed it had race conditions.  Simply deleting it might be the most
      reasonable approach.

      The expected output is wrong. "active count" should be 0, there is no race in that part due to the join. However the JOIN_TIMEOUT part of the test has an obvious race.

      It would be a shame to not have any thread tests in the test suite. Perhaps we should fix & clean up Thread_1, and extend it to cover more stuff (like more interrupt() corner cases).

      regards

        [ bryce ]
        --------------911584F66199FB60478AE253-- From java-patches-return-391-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Mon Jan 17 02:15:28 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 16275 invoked by alias); 17 Jan 2000 02:15:28 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 16250 invoked from network); 17 Jan 2000 02:15:27 -0000 Date: Sun, 16 Jan 2000 18:15:24 -0800 (PST) Message-Id: <200001170215.SAA06941@ferrule.cygnus.com> From: Tom Tromey To: Bryce McKinlay Cc: Tom Tromey , Anthony Green , java-patches@sourceware.cygnus.com Subject: Re: new test case In-Reply-To: <388255CC.9F94D842@albatross.co.nz> References: <200001161931.LAA24665@hoser.cygnus.com> <200001162111.NAA06726@ferrule.cygnus.com> <200001162118.NAA24794@hoser.cygnus.com> <200001162120.NAA06739@ferrule.cygnus.com> <388255CC.9F94D842@albatross.co.nz> X-Zippy: Are you selling NYLON OIL WELLS?? If so, we can use TWO DOZEN!! X-Attribution: Tom Bryce> It would be a shame to not have any thread tests in the test Bryce> suite. Perhaps we should fix & clean up Thread_1, and extend it Bryce> to cover more stuff (like more interrupt() corner cases). Feel free to hack it as you want... Tom From java-patches-return-392-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Mon Jan 17 16:37:11 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 31100 invoked by alias); 17 Jan 2000 16:37:11 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 31079 invoked from network); 17 Jan 2000 16:37:09 -0000 Date: 17 Jan 2000 16:37:08 -0000 Message-ID: <20000117163708.5851.qmail@pasanda.cygnus.co.uk> From: Andrew Haley To: java-patches@sourceware.cygnus.com Subject: Throwable.printStackTrace () I've checked in code to print stack traces. It's not yet perfect, but I figured that it's such a useful debugging tool that it makes no sense to wait for perfection. Notes: 1. I use a glibc specific backtrace() library call to retrieve the backtrace data. However, this isn't a very difficult thing to write and there are versions of this routine for most ABIs in glibc, so I don't think this is a big portability problem. 2. I run a copy of addr2line to convert a code pointer to the name of a routine. If this program isn't installed or isn't in your path you'll just get a hex dump. However, you can capture this dump and run it through addr2line on another host to get a symbolic stack trace. This is probably the best solution for small embedded systems. It might have been easier to use System.exec() to run addr2line rather than the low-level system call interface that I use. However, I didn't want the possibility of another exception being thrown while looking up a name for stack trace. Also, it would be useful to print out stack traces for other programming languages. The _Jv_name_finder class (which does the address lookups) is designed to be extensible, so other ways of converting a pointer to a class and method name may be added. It might be possible to use reflective data to do this, but we'd lose the ability to print the names of library routines without reflective data. 3. Symbols in shared objects aren't demangled. It's fairly easy to fix this by piping the stack trace through c++filt. I could do this automatically if people think it's a good idea. 4. Exceptions thrown by bytecode classes print a backtrace through the interpreter, rather than through the bytecode. 5. Stack traces are limited to 128 elements. This could easily be changed, but otherwise accidental infinite recursion would print megabytes of useless stack dump. 6. I use the dladdr() library call to find symbols in shared objects. This is another glibc dependency. Andrew. 2000-01-14 Andrew Haley * java/lang/natThrowable.cc: New file. * java/lang/Throwable.java (fillInStackTrace): Make native. (printStackTrace): Call native method to do this. (Throwable): Call fillInStackTrace. (stackTrace): New variable. * include/jvm.h: Add _Jv_ThisExecutable functions. * prims.cc: (_Jv_execName): New variable. (catch_segv): Call fillInStackTrace. (catch_fpe): Ditto. (_Jv_ThisExecutable): New functions. (JvRunMain): Set the name of this executable. * Makefile.am: Add java/lang/natThrowable.cc. Add name-finder.cc. * Makefile.in: Rebuilt. * acconfig.h: Add HAVE_PROC_SELF_EXE. * configure.in: Force link with __frame_state_for in FORCELIBGCCSPEC. Add new checks for backtrace. * include/config.h.in: Rebuilt. * name-finder.cc: New file. * include/name-finder.h: New file. From java-patches-return-393-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Mon Jan 17 18:55:51 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 23664 invoked by alias); 17 Jan 2000 18:55:51 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 23591 invoked from network); 17 Jan 2000 18:55:21 -0000 To: Java Patch List Subject: Patch: prims.cc cleanup X-Zippy: I can see you GUYS an' GALS need a LOT of HELP...You're all very STUPID!! I used to be STUPID, too..before I started watching UHF-TV!! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 17 Jan 2000 11:56:33 -0700 Message-ID: <87ln5o5xy6.fsf@cygnus.com> Lines: 34 X-Mailer: Gnus v5.5/Emacs 20.3 I'm checking in this patch, which fixes a minor bug in prims.cc. When originally written, the state values weren't even semi-publically available. Now they are. 2000-01-15 Tom Tromey * prims.cc (_Jv_PrimClass): Use `JV_STATE_NOTHING', not `0'. Tom Index: prims.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/prims.cc,v retrieving revision 1.16 diff -u -r1.16 prims.cc --- prims.cc 2000/01/17 15:43:32 1.16 +++ prims.cc 2000/01/17 18:54:01 @@ -1,6 +1,6 @@ // prims.cc - Code for core of runtime environment. -/* Copyright (C) 1998, 1999 Cygnus Solutions +/* Copyright (C) 1998, 1999, 2000 Cygnus Solutions This file is part of libgcj. @@ -558,7 +558,7 @@ interfaces = NULL; loader = NULL; interface_count = 0; - state = 0; // FIXME. + state = JV_STATE_NOTHING; thread = NULL; } }; From java-patches-return-394-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Mon Jan 17 19:15:14 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 25310 invoked by alias); 17 Jan 2000 19:15:13 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 25277 invoked from network); 17 Jan 2000 19:14:51 -0000 To: Java Patch List Subject: Patch: dynamic loading X-Zippy: --- I have seen the FUN --- X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 17 Jan 2000 12:15:51 -0700 Message-ID: <87k8l85x20.fsf@cygnus.com> Lines: 315 X-Mailer: Gnus v5.5/Emacs 20.3 I'm committing the appended patch. It adds dynamic loading capabilities to libgcj. With this patch, on native platforms, Runtime.loadLibrary will now work correctly. In addition, Class.forName() will try to load a series of shared objects in order to find the requested class. If a class `gnu.quux.whatever' is requested, libgcj will first look for `gnu-quux-whatever.so', then `gnu-quux.so', and finally `gnu.so' (actually it will also look for `.la' and `.dll' files -- it uses ltdl to do the searching). 2000-01-17 Tom Tromey * java/lang/Runtime.java (loadLibraryInternal): Declare. * java/lang/natClassLoader.cc (_Jv_FindClass): Removed dead copy. (_Jv_FindClassInCache): Likewise. (_Jv_FindClass): Don't conditionalize body on INTERPRETER. (findSystemClass): Try to load class from compiled module. Include Runtime.h. * java/lang/natRuntime.cc (load): Use UTF-8 copy of filename. (loadLibrary): Likewise. (lt_preloaded_symbols): Define. (loadLibraryInternal): New method. * include/config.h.in: Rebuilt. * acconfig.h (USE_LTDL): Added. * Makefile.am (SUBDIRS): Added $(DIRLTDL). (INCLUDES): Added $(INCLTDL).b (libgcj_la_DEPENDENCIES): Added $(LIBLTDL). (libgcj_la_LIBADD): Likewise. * aclocal.m4, configure: Rebuilt. * configure.in: Added libltdl support. Tom Index: acconfig.h =================================================================== RCS file: /cvs/java/libgcj/libjava/acconfig.h,v retrieving revision 1.14 diff -u -r1.14 acconfig.h --- acconfig.h 2000/01/17 15:43:32 1.14 +++ acconfig.h 2000/01/17 19:11:02 @@ -125,3 +125,6 @@ /* Define if getuid() and friends are missing. */ #undef NO_GETUID + +/* Define if libltdl is in use. */ +#undef USE_LTDL Index: configure.in =================================================================== RCS file: /cvs/java/libgcj/libjava/configure.in,v retrieving revision 1.46 diff -u -r1.46 configure.in --- configure.in 2000/01/17 15:43:32 1.46 +++ configure.in 2000/01/17 19:11:08 @@ -17,7 +17,20 @@ AM_CONFIG_HEADER(include/config.h) +# Only use libltdl for native builds. +if test -z "${with_cross_host}"; then + AC_LIBLTDL_CONVENIENCE + AC_LIBTOOL_DLOPEN + DIRLTDL=libltdl + AC_DEFINE(USE_LTDL) + # Sigh. Libtool's macro doesn't do the right thing. + INCLTDL="-I\$(top_srcdir)/libltdl $INCLTDL" +fi +AC_SUBST(INCLTDL) +AC_SUBST(LIBLTDL) +AC_SUBST(DIRLTDL) AM_PROG_LIBTOOL +AC_CONFIG_SUBDIRS($DIRLDL) if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then COMPPATH=. Index: java/lang/Runtime.java =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/Runtime.java,v retrieving revision 1.4 diff -u -r1.4 Runtime.java --- Runtime.java 1999/06/09 17:42:23 1.4 +++ Runtime.java 2000/01/17 19:11:13 @@ -1,6 +1,6 @@ // Runtime.java - Runtime class. -/* Copyright (C) 1998, 1999 Cygnus Solutions +/* Copyright (C) 1998, 1999, 2000 Cygnus Solutions This file is part of libgcj. @@ -96,6 +96,12 @@ public native void load (String pathname); public native void loadLibrary (String libname); + + // This is a helper function for the ClassLoader which can load + // compiled libraries. Returns true if library (which is just the + // base name -- path searching is done by this function) was loaded, + // false otherwise. + native boolean loadLibraryInternal (String libname); public native void runFinalization (); Index: java/lang/natClassLoader.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/natClassLoader.cc,v retrieving revision 1.13 diff -u -r1.13 natClassLoader.cc --- natClassLoader.cc 2000/01/13 18:13:31 1.13 +++ natClassLoader.cc 2000/01/17 19:11:16 @@ -34,6 +34,7 @@ #include #include #include +#include #define CloneableClass _CL_Q34java4lang9Cloneable extern java::lang::Class CloneableClass; @@ -193,7 +194,35 @@ jclass gnu::gcj::runtime::VMClassLoader::findSystemClass (jstring name) { - return _Jv_FindClassInCache (_Jv_makeUtf8Const (name), 0); + _Jv_Utf8Const *name_u = _Jv_makeUtf8Const (name); + jclass klass = _Jv_FindClassInCache (name_u, 0); + + if (! klass) + { + // Turn `gnu.pkg.quux' into `gnu-pkg-quux'. Then search for a + // module named (eg, on Linux) `gnu-pkg-quux.so', followed by + // `gnu-pkg.so' and `gnu.so'. If loading one of these causes + // the class to appear in the cache, then use it. + jstring so_base_name = name->replace ('.', '-'); + + while (! klass && so_base_name && so_base_name->length() > 0) + { + using namespace ::java::lang; + Runtime *rt = Runtime::getRuntime(); + jboolean loaded = rt->loadLibraryInternal (so_base_name); + + jint nd = so_base_name->lastIndexOf ('-'); + if (nd == -1) + so_base_name = NULL; + else + so_base_name = so_base_name->substring (0, nd); + + if (loaded) + klass = _Jv_FindClassInCache (name_u, 0); + } + } + + return klass; } jclass @@ -403,31 +432,11 @@ _Jv_RegisterClasses (classes); } -#if 0 -// NOTE: this one is out of date with the new loader stuff... jclass -_Jv_FindClassInCache (jstring name, java::lang::ClassLoader *loader) -{ - JvSynchronize sync (&ClassClass); - jint hash = name->hashCode(); - jclass klass = loaded_classes[(_Jv_ushort) hash % HASH_LEN]; - for ( ; klass; klass = klass->next) - { - if (loader == klass->loader - && _Jv_equal (klass->name, name, hash)) - break; - } - _Jv_MonitorExit (&ClassClass); - return klass; -} -#endif - -jclass _Jv_FindClass (_Jv_Utf8Const *name, - java::lang::ClassLoader *loader) +_Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader) { jclass klass = _Jv_FindClassInCache (name, loader); -#ifdef INTERPRETER if (! klass) { jstring sname = _Jv_NewStringUTF (name->data); @@ -466,43 +475,9 @@ // we're loading, so that they can refer to themselves. _Jv_WaitForState (klass, JV_STATE_LOADED); } -#endif return klass; } - -#if 0 -// NOTE: this one is out of date with the new class loader stuff... -jclass -_Jv_FindClass (jstring name, java::lang::ClassLoader *loader) -{ - jclass klass = _Jv_FindClassInCache (name, loader); - if (! klass) - { - if (loader) - { - klass = loader->loadClass(name); - } - else - { - // jmspec 5.3.1.2 - - // delegate to the system loader - klass = java::lang::ClassLoader::system.loadClass (sname); - - // register that we're an initiating loader - if (klass) - _Jv_RegisterInitiatingLoader (klass, 0); - } - } - else - { - _Jv_WaitForState (klass, JV_STATE_LOADED); - } - - return klass; -} -#endif jclass _Jv_NewClass (_Jv_Utf8Const *name, jclass superclass, Index: java/lang/natRuntime.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/natRuntime.cc,v retrieving revision 1.3 diff -u -r1.3 natRuntime.cc --- natRuntime.cc 1999/09/10 22:03:08 1.3 +++ natRuntime.cc 2000/01/17 19:11:16 @@ -1,6 +1,6 @@ // natRuntime.cc - Implementation of native side of Runtime class. -/* Copyright (C) 1998, 1999 Cygnus Solutions +/* Copyright (C) 1998, 1999, 2000 Cygnus Solutions This file is part of libgcj. @@ -20,6 +20,10 @@ #ifdef USE_LTDL #include + +/* FIXME: we don't always need this. The next libtool will let us use + AC_LTDL_PREOPEN to see if we do. */ +const lt_dlsymlist lt_preloaded_symbols[1] = { { 0, 0 } }; #endif void @@ -56,8 +60,12 @@ checkLink (path); using namespace java::lang; #ifdef USE_LTDL + jint len = _Jv_GetStringUTFLength (path); + char buf[len + 1]; + jsize total = JvGetStringUTFRegion (path, 0, path->length(), buf); + buf[total] = '\0'; // FIXME: make sure path is absolute. - lt_dlhandle h = lt_dlopen (FIXME); + lt_dlhandle h = lt_dlopen (buf); if (h == NULL) { const char *msg = lt_dlerror (); @@ -76,8 +84,12 @@ checkLink (lib); using namespace java::lang; #ifdef USE_LTDL + jint len = _Jv_GetStringUTFLength (lib); + char buf[len + 1]; + jsize total = JvGetStringUTFRegion (lib, 0, lib->length(), buf); + buf[total] = '\0'; // FIXME: make sure path is absolute. - lt_dlhandle h = lt_dlopenext (FIXME); + lt_dlhandle h = lt_dlopenext (buf); if (h == NULL) { const char *msg = lt_dlerror (); @@ -86,6 +98,24 @@ #else _Jv_Throw (new UnknownError (JvNewStringLatin1 ("Runtime.loadLibrary not implemented"))); +#endif /* USE_LTDL */ +} + +jboolean +java::lang::Runtime::loadLibraryInternal (jstring lib) +{ + JvSynchronize sync (this); + using namespace java::lang; +#ifdef USE_LTDL + jint len = _Jv_GetStringUTFLength (lib); + char buf[len + 1]; + jsize total = JvGetStringUTFRegion (lib, 0, lib->length(), buf); + buf[total] = '\0'; + // FIXME: make sure path is absolute. + lt_dlhandle h = lt_dlopenext (buf); + return h != NULL; +#else + return false; #endif /* USE_LTDL */ } From java-patches-return-395-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Tue Jan 18 04:03:19 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 19912 invoked by alias); 18 Jan 2000 04:03:18 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 19892 invoked from network); 18 Jan 2000 04:03:16 -0000 Message-ID: <3883E678.254ADE3@albatross.co.nz> Date: Tue, 18 Jan 2000 17:05:12 +1300 From: Bryce McKinlay X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.3.25 i686) X-Accept-Language: en MIME-Version: 1.0 To: tromey@cygnus.com CC: Java Patch List Subject: Re: Patch: dynamic loading References: <87k8l85x20.fsf@cygnus.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Tom Tromey wrote: > I'm committing the appended patch. > It adds dynamic loading capabilities to libgcj. > > With this patch, on native platforms, Runtime.loadLibrary will now > work correctly. Tom, Doing a build out of cvs I'm getting: Making all in libltdl /bin/sh: libltdl: No such file or directory The libjava/libltdl directory exists in my souce tree but never gets created configured in the build tree. Any ideas? [ bryce ] From java-patches-return-396-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Tue Jan 18 05:24:42 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 29686 invoked by alias); 18 Jan 2000 05:24:42 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 29661 invoked from network); 18 Jan 2000 05:24:42 -0000 Date: Mon, 17 Jan 2000 21:24:40 -0800 (PST) Message-Id: <200001180524.VAA07879@ferrule.cygnus.com> From: Tom Tromey To: Bryce McKinlay Cc: tromey@cygnus.com, Java Patch List Subject: Re: Patch: dynamic loading In-Reply-To: <3883E678.254ADE3@albatross.co.nz> References: <87k8l85x20.fsf@cygnus.com> <3883E678.254ADE3@albatross.co.nz> X-Zippy: Quick, sing me the BUDAPEST NATIONAL ANTHEM!! X-Attribution: Tom Bryce> The libjava/libltdl directory exists in my souce tree but never Bryce> gets created configured in the build tree. Bryce> Any ideas? Typo on my part. (And I swear I tested this patch!) I'll check in the patch in a minute. Tom From java-patches-return-397-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Tue Jan 18 05:26:42 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 29859 invoked by alias); 18 Jan 2000 05:26:42 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 29839 invoked from network); 18 Jan 2000 05:26:38 -0000 To: Java Patch List Subject: Patch: typo in configure.in X-Zippy: Xerox your lunch and file it under ``sex offenders!'' X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 17 Jan 2000 22:27:04 -0700 Message-ID: <87embg54rb.fsf@cygnus.com> Lines: 25 X-Mailer: Gnus v5.5/Emacs 20.3 This fixes a typo in my recent dynamic loading patch. 2000-01-17 Tom Tromey * configure: Rebuilt. * configure.in: Fixed typo in AC_CONFIG_SUBDIRS call. Tom Index: configure.in =================================================================== RCS file: /cvs/java/libgcj/libjava/configure.in,v retrieving revision 1.47 diff -u -r1.47 configure.in --- configure.in 2000/01/17 19:22:20 1.47 +++ configure.in 2000/01/18 05:25:21 @@ -30,7 +30,7 @@ AC_SUBST(LIBLTDL) AC_SUBST(DIRLTDL) AM_PROG_LIBTOOL -AC_CONFIG_SUBDIRS($DIRLDL) +AC_CONFIG_SUBDIRS($DIRLTDL) if test -z "$with_target_subdir" || test "$with_target_subdir" = "."; then COMPPATH=. From java-patches-return-398-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Tue Jan 18 06:14:27 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 1129 invoked by alias); 18 Jan 2000 06:14:27 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 1108 invoked from network); 18 Jan 2000 06:14:22 -0000 To: Java Patch List Subject: Patch: fixlet to Throwable X-Zippy: MERYL STREEP is my obstetrician! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 17 Jan 2000 23:15:06 -0700 Message-ID: <87d7qz6h3p.fsf@cygnus.com> Lines: 29 X-Mailer: Gnus v5.5/Emacs 20.3 I'm committing this patch. It changes Throwable.fillInStackTrace so that it always returns a value, even when the stack trace isn't computed. 2000-01-17 Tom Tromey * java/lang/natThrowable.cc (fillInStackTrace): Return `this' even when backtrace can't be computed. Tom Index: java/lang/natThrowable.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/natThrowable.cc,v retrieving revision 1.1 diff -u -r1.1 natThrowable.cc --- natThrowable.cc 2000/01/17 15:43:32 1.1 +++ natThrowable.cc 2000/01/18 06:09:47 @@ -57,9 +57,9 @@ // ??? Might this cause a problem if the byte array isn't aligned? stackTrace = JvNewByteArray (n * sizeof p[0]); memcpy (elements (stackTrace), p+1, (n * sizeof p[0])); +#endif return this; -#endif } void From java-patches-return-399-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 19 02:19:12 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 7160 invoked by alias); 19 Jan 2000 02:19:12 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 7141 invoked from network); 19 Jan 2000 02:19:10 -0000 Message-ID: <38851F9D.D6B238B6@albatross.co.nz> Date: Wed, 19 Jan 2000 15:21:17 +1300 From: Bryce McKinlay X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.3.25 i686) X-Accept-Language: en MIME-Version: 1.0 To: java-patches@sourceware.cygnus.com Subject: patch: --disable-interpreter Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit It seems natural to me to provide a "--disable-interpreter" configure option now that the interpreter is enabled by default on some platforms. Is this patch ok? [ bryce ] =================================================================== RCS file: /cvs/java/libgcj/libjava/configure.in,v retrieving revision 1.49 diff -u -r1.49 configure.in --- configure.in 2000/01/18 14:41:08 1.49 +++ configure.in 2000/01/19 02:14:43 @@ -78,6 +78,10 @@ libgcj_interpreter=yes fi) +AC_ARG_ENABLE(interpreter, +[ --disable-interpreter disable bytecode interpreter], + libgcj_interpreter=no) + if test "$libgcj_interpreter" = yes; then AC_DEFINE(INTERPRETER) fi From java-patches-return-400-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 19 03:02:01 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 13548 invoked by alias); 19 Jan 2000 03:02:01 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 13526 invoked from network); 19 Jan 2000 03:01:59 -0000 Message-ID: <388529A6.268B5BE3@albatross.co.nz> Date: Wed, 19 Jan 2000 16:04:06 +1300 From: Bryce McKinlay X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.3.25 i686) X-Accept-Language: en MIME-Version: 1.0 To: java-patches@sourceware.cygnus.com Subject: htdocs patch: cvsweb link Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I couldn't find a link to sourceware's cvsweb on the gcj pages, which I use fairly regularly. So I checked in this addition: regards [ bryce ] 2000-01-18 Bryce McKinlay * download.html: Add link to cvsweb. =================================================================== RCS file: /cvs/java/htdocs/download.html,v retrieving revision 1.1 diff -u -r1.1 download.html --- download.html 1999/09/07 00:34:01 1.1 +++ download.html 2000/01/19 02:57:53 @@ -101,6 +101,10 @@

    2. +

      +You can also +view the cvs archive via cvsweb. + From java-patches-return-401-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 19 04:11:36 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 25251 invoked by alias); 19 Jan 2000 04:11:35 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 25226 invoked from network); 19 Jan 2000 04:11:34 -0000 Date: Tue, 18 Jan 2000 20:11:32 -0800 (PST) Message-Id: <200001190411.UAA18085@ferrule.cygnus.com> From: Tom Tromey To: Bryce McKinlay Cc: java-patches@sourceware.cygnus.com Subject: Re: patch: --disable-interpreter In-Reply-To: <38851F9D.D6B238B6@albatross.co.nz> References: <38851F9D.D6B238B6@albatross.co.nz> X-Zippy: RELATIVES!! X-Attribution: Tom >>>>> "Bryce" == Bryce McKinlay writes: Bryce> It seems natural to me to provide a "--disable-interpreter" Bryce> configure option now that the interpreter is enabled by default Bryce> on some platforms. Is this patch ok? configure will automatically recognize --disable-interpreter since we already have an AC_ARG_ENABLE for it. We just have to convince it to do the right thing. So this patch isn't the one. The right thing to do is to add a case to the "if" inside the existing AC_ARG_ENABLE. Something like: elif test "$enable_interpreter" = no; then libgcj_interpreter=no fi Tom From java-patches-return-402-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 19 04:52:28 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 30456 invoked by alias); 19 Jan 2000 04:52:28 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 30431 invoked from network); 19 Jan 2000 04:52:26 -0000 Message-ID: <38854389.325F56E9@albatross.co.nz> Date: Wed, 19 Jan 2000 17:54:34 +1300 From: Bryce McKinlay X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.3.25 i686) X-Accept-Language: en MIME-Version: 1.0 To: java-patches@sourceware.cygnus.com Subject: natThrowable.lo multiple definition error Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I'm getting a link error (gcc 2.95.2): /home/bryce/projects/libgcj/build/i686-pc-linux-gnu/libjava/java/lang/Throwable.h:16: multiple definition of `java::lang::Throwable::getMessage(void)' java/lang/Throwable.lo:/home/bryce/projects/libgcj/build/i686-pc-linux-gnu/libjava/../../../libjava/java/lang/Throwable.java:38: first defined here /usr/bin/ld: Warning: size of symbol `java::lang::Throwable::getMessage(void)' changed from 17 to 13 in java/lang/natThrowable.lo collect2: ld returned 1 exit status gchj is creating an inline definition of getMessage() and for some reason the symbol for that method is showing up in both natThrowable.lo and Throwable.lo The fix seems to be to remove the `#pragma implementation "Throwable.h"' from natThrowable.cc. Is this the right thing to do? [ bryce ] =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/natThrowable.cc,v retrieving revision 1.2 diff -u -r1.2 natThrowable.cc --- natThrowable.cc 2000/01/18 06:22:13 1.2 +++ natThrowable.cc 2000/01/19 04:35:39 @@ -17,8 +17,6 @@ #include -#pragma implementation "Throwable.h" - #include #include #include From java-patches-return-403-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 19 04:54:34 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 30622 invoked by alias); 19 Jan 2000 04:54:34 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 30602 invoked from network); 19 Jan 2000 04:54:32 -0000 Message-ID: <38854407.9B80A95@albatross.co.nz> Date: Wed, 19 Jan 2000 17:56:39 +1300 From: Bryce McKinlay X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.3.25 i686) X-Accept-Language: en MIME-Version: 1.0 To: Tom Tromey CC: java-patches@sourceware.cygnus.com Subject: Re: patch: --disable-interpreter References: <38851F9D.D6B238B6@albatross.co.nz> <200001190411.UAA18085@ferrule.cygnus.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Tom Tromey wrote: > The right thing to do is to add a case to the "if" inside the existing > AC_ARG_ENABLE. Something like: > > elif test "$enable_interpreter" = no; then > libgcj_interpreter=no > fi Okay, that seems to work. Can somebody else check this in? I'm not sure if my autoconf is 100% up to date. =================================================================== RCS file: /cvs/java/libgcj/libjava/configure.in,v retrieving revision 1.49 diff -u -r1.49 configure.in --- configure.in 2000/01/18 14:41:08 1.49 +++ configure.in 2000/01/19 04:52:45 @@ -76,6 +76,8 @@ if test "$enable_interpreter" = yes; then # This can also be set in configure.host. libgcj_interpreter=yes + elif test "$enable_interpreter" = no; then + libgcj_interpreter=no fi) if test "$libgcj_interpreter" = yes; then From java-patches-return-404-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 19 05:09:19 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 3565 invoked by alias); 19 Jan 2000 05:09:19 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 3540 invoked from network); 19 Jan 2000 05:09:18 -0000 Date: Tue, 18 Jan 2000 21:09:15 -0800 (PST) Message-Id: <200001190509.VAA03187@ferrule.cygnus.com> From: Tom Tromey To: Bryce McKinlay Cc: Tom Tromey , java-patches@sourceware.cygnus.com Subject: Re: patch: --disable-interpreter In-Reply-To: <38854407.9B80A95@albatross.co.nz> References: <38851F9D.D6B238B6@albatross.co.nz> <200001190411.UAA18085@ferrule.cygnus.com> <38854407.9B80A95@albatross.co.nz> X-Zippy: How do I get HOME? X-Attribution: Tom Bryce> Okay, that seems to work. Can somebody else check this in? I'm Bryce> not sure if my autoconf is 100% up to date. I checked it in. Tom From java-patches-return-405-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 19 05:26:04 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 5042 invoked by alias); 19 Jan 2000 05:26:04 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 5013 invoked from network); 19 Jan 2000 05:25:59 -0000 Message-ID: <38854B62.EEBD4C9F@albatross.co.nz> Date: Wed, 19 Jan 2000 18:28:02 +1300 From: Bryce McKinlay X-Mailer: Mozilla 4.7 [en] (X11; U; Linux 2.3.25 i686) X-Accept-Language: en MIME-Version: 1.0 To: Andrew Haley CC: java-patches@sourceware.cygnus.com Subject: Re: Throwable.printStackTrace () References: <20000117163708.5851.qmail@pasanda.cygnus.co.uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Andrew Haley wrote: > I've checked in code to print stack traces. It's not yet perfect, but > I figured that it's such a useful debugging tool that it makes no > sense to wait for perfection. Very cool!! One comment I would have is that the output may be a bit more verbose than needed. For example, consider the following stack traces produced by a simple test program, running under both the IBM VM and gcj: $ java ExceptionTest java.lang.Exception at ExceptionTest.bar(ExceptionTest.java:23) at ExceptionTest.foo(ExceptionTest.java:18) at ExceptionTest.main(ExceptionTest.java:8 $ ./exceptiontest java.lang.Exception at 0x400caa48: __Q34java4lang9Throwable (/usr/local/gcc/lib/libgcj.so.1) at 0x400beafb: __Q34java4lang9Exception (/usr/local/gcc/lib/libgcj.so.1) at 0x0804b2bb: ExceptionTest::bar(int) (/home/bryce/projects/tests/ExceptionTest.java:22) at 0x0804b286: ExceptionTest::foo(void) (/home/bryce/projects/tests/ExceptionTest.java:18) at 0x0804b217: ExceptionTest::main(JArray *) (/home/bryce/projects/tests/ExceptionTest.java:8) at 0x4010ca30: run__Q34java4lang11FirstThread (/usr/local/gcc/lib/libgcj.so.1) at 0x400c81b2: run___Q34java4lang6Thread (/usr/local/gcc/lib/libgcj.so.1) at 0x40111fea: run____Q34java4lang6ThreadPQ34java4lang6Object (/usr/local/gcc/lib/libgcj.so.1) at 0x401222e2: _Jv_ThreadSetPriority__FP12_Jv_Thread_ti (/usr/local/gcc/lib/libgcj.so.1) at 0x401d0c56: GC_start_routine (/usr/local/gcc/lib/libgcjgc.so.1) at 0x401e6eca: pthread_detach (/lib/libpthread.so.0) Hmm. I suggest that first two lines and everything below main() are redundant for the vast majority of debugging tasks. And how useful is having the address? regards [ bryce ] From java-patches-return-406-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 19 06:34:56 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 16562 invoked by alias); 19 Jan 2000 06:34:56 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 16537 invoked from network); 19 Jan 2000 06:34:54 -0000 Date: Tue, 18 Jan 2000 22:34:50 -0800 (PST) Message-Id: <200001190634.WAA03292@ferrule.cygnus.com> From: Tom Tromey To: Bryce McKinlay Cc: java-patches@sourceware.cygnus.com Subject: Re: natThrowable.lo multiple definition error In-Reply-To: <38854389.325F56E9@albatross.co.nz> References: <38854389.325F56E9@albatross.co.nz> X-Zippy: Where's th' DAFFY DUCK EXHIBIT?? X-Attribution: Tom >>>>> "Bryce" == Bryce McKinlay writes: Bryce> The fix seems to be to remove the `#pragma implementation Bryce> "Throwable.h"' from natThrowable.cc. Is this the right thing to Bryce> do? This seems ok to me. Go ahead and check it in. Elsewhere we only use #pragma implementation when we definitely know we want the inline functions in the header to be "outlined". But that isn't the case here. Something for the CNI docs, I think. Tom From java-patches-return-407-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 19 11:16:12 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 30281 invoked by alias); 19 Jan 2000 11:16:11 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 30257 invoked from network); 19 Jan 2000 11:16:09 -0000 Date: 19 Jan 2000 11:16:06 -0000 Message-ID: <20000119111606.11764.qmail@pasanda.cygnus.co.uk> From: Andrew Haley To: bryce@albatross.co.nz CC: java-patches@sourceware.cygnus.com In-reply-to: <38854B62.EEBD4C9F@albatross.co.nz> (message from Bryce McKinlay on Wed, 19 Jan 2000 18:28:02 +1300) Subject: Re: Throwable.printStackTrace () > Date: Wed, 19 Jan 2000 18:28:02 +1300 > From: Bryce McKinlay > > Andrew Haley wrote: > > > I've checked in code to print stack traces. It's not yet perfect, but > > I figured that it's such a useful debugging tool that it makes no > > sense to wait for perfection. > > Very cool!! > > One comment I would have is that the output may be a bit more verbose than > needed. For example, consider the following stack traces produced by a simple > test program, running under both the IBM VM and gcj: Sure, our stack trace gives so much more information than the IBM VM. That's a feature! I wasn't trying to emulate what Sun do, but to do something better. > $ java ExceptionTest > java.lang.Exception > at ExceptionTest.bar(ExceptionTest.java:23) > at ExceptionTest.foo(ExceptionTest.java:18) > at ExceptionTest.main(ExceptionTest.java:8 > > $ ./exceptiontest > java.lang.Exception > at 0x400caa48: __Q34java4lang9Throwable (/usr/local/gcc/lib/libgcj.so.1) > at 0x400beafb: __Q34java4lang9Exception (/usr/local/gcc/lib/libgcj.so.1) > at 0x0804b2bb: ExceptionTest::bar(int) > (/home/bryce/projects/tests/ExceptionTest.java:22) > at 0x0804b286: ExceptionTest::foo(void) > (/home/bryce/projects/tests/ExceptionTest.java:18) > at 0x0804b217: ExceptionTest::main(JArray *) > (/home/bryce/projects/tests/ExceptionTest.java:8) > at 0x4010ca30: run__Q34java4lang11FirstThread > (/usr/local/gcc/lib/libgcj.so.1) > at 0x400c81b2: run___Q34java4lang6Thread (/usr/local/gcc/lib/libgcj.so.1) > at 0x40111fea: run____Q34java4lang6ThreadPQ34java4lang6Object > (/usr/local/gcc/lib/libgcj.so.1) > at 0x401222e2: _Jv_ThreadSetPriority__FP12_Jv_Thread_ti > (/usr/local/gcc/lib/libgcj.so.1) > at 0x401d0c56: GC_start_routine (/usr/local/gcc/lib/libgcjgc.so.1) > at 0x401e6eca: pthread_detach (/lib/libpthread.so.0) > > Hmm. I suggest that first two lines and everything below main() are > redundant for the vast majority of debugging tasks. Perhaps, but don't forget that one of the things stack traces will be used for is sending bug reports to the mailing list, where such info is valuable. We could certainly lose the first two lines, but the function signatures are very useful, and I very much like the fact that you can see where the thread started. Also, I have a bias because I get to debug the exception handler mechanism! > And how useful is having the address? Hmm. Without the address you would not be able to distinguish between identical static symbols. Andrew. From java-patches-return-408-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 19 17:28:38 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 22518 invoked by alias); 19 Jan 2000 17:28:38 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 22497 invoked from network); 19 Jan 2000 17:28:34 -0000 To: Java Patch List Subject: Patch: inner class test case X-Zippy: I think I am an overnight sensation right now!! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 19 Jan 2000 10:30:14 -0700 Message-ID: <877lh655qx.fsf@cygnus.com> Lines: 28 X-Mailer: Gnus v5.5/Emacs 20.3 I'm committing this patch. It is a test case for inner classes. (No, the inner class code isn't in the compiler yet.) 2000-01-18 Tom Tromey * libjava.compile/inner_pub.java: New file. Tom ? libjava.compile/G19990210_1.class Index: libjava.compile/inner_pub.java =================================================================== RCS file: inner_pub.java diff -N inner_pub.java --- /dev/null Tue May 5 13:32:27 1998 +++ inner_pub.java Wed Jan 19 08:45:39 2000 @@ -0,0 +1,11 @@ +// Test to ensure that public inner classes work. + +public class inner_pub +{ + public class really_inner + { + int z; + } + + really_inner foo; +} From java-patches-return-409-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 19 18:33:40 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 3088 invoked by alias); 19 Jan 2000 18:33:40 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 3049 invoked from network); 19 Jan 2000 18:33:27 -0000 To: Java Patch List Subject: Patch: copyright change X-Zippy: Don't SANFORIZE me!! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 19 Jan 2000 11:33:50 -0700 Message-ID: <8766wp6hdd.fsf@cygnus.com> Lines: 9 X-Mailer: Gnus v5.5/Emacs 20.3 I'm checking in a rather large patch which changes all files to be copyright Red Hat instead of Cygnus. I'm not going to post the patch since it is very large, and I did it mechanically. 2000-01-19 Tom Tromey * All files: Updated copyright to reflect Cygnus purchase. Tom From java-patches-return-410-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 19 18:55:41 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 9149 invoked by alias); 19 Jan 2000 18:55:41 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 9128 invoked from network); 19 Jan 2000 18:55:37 -0000 To: Java Patch List Subject: Patch: don't use #pragma implementation X-Zippy: I am deeply CONCERNED and I want something GOOD for BREAKFAST! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 19 Jan 2000 11:56:39 -0700 Message-ID: <874sc96gbc.fsf@cygnus.com> Lines: 26 X-Mailer: Gnus v5.5/Emacs 20.3 I'm checking in this patch from Bryce. 2000-01-19 Tom Tromey * java/lang/natThrowable.cc: Don't use `#pragma implementation'. From Bryce McKinlay. Tom Index: java/lang/natThrowable.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/java/lang/natThrowable.cc,v retrieving revision 1.2 diff -u -r1.2 natThrowable.cc --- natThrowable.cc 2000/01/18 06:22:13 1.2 +++ natThrowable.cc 2000/01/19 18:54:00 @@ -17,8 +17,6 @@ #include -#pragma implementation "Throwable.h" - #include #include #include From java-patches-return-411-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 19 21:03:49 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 27001 invoked by alias); 19 Jan 2000 21:03:48 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 26967 invoked from network); 19 Jan 2000 21:03:29 -0000 To: Java Patch List Cc: Kresten Krab Thorup Subject: Patch: no more %esi X-Zippy: YOW!! Now I understand advanced MICROBIOLOGY and th' new TAX REFORM laws!! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 19 Jan 2000 14:04:24 -0700 Message-ID: <87zou14vtz.fsf@cygnus.com> Lines: 53 X-Mailer: Gnus v5.5/Emacs 20.3 I'm checking in the appended patch, which removes the use of %esi from the interpreter. This code causes problems with some versions of g++. Kresten, I assume this code is a performance hack? Does it make a measurable difference when this code is included? If it does, then we might want to enable it, but with a different register. If it doesn't, then there's no harm leaving it out. (Unfortunately I currently don't have time to do any profiling.) 2000-01-19 Tom Tromey * interpret.cc (PC_REGISTER_ASM): Removed. Tom Index: interpret.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/interpret.cc,v retrieving revision 1.7 diff -u -r1.7 interpret.cc --- interpret.cc 2000/01/19 18:39:23 1.7 +++ interpret.cc 2000/01/19 20:57:12 @@ -1,6 +1,6 @@ // interpret.cc - Code for the interpreter -/* Copyright (C) 1999 Red Hat, Inc. +/* Copyright (C) 1999, 2000 Red Hat, Inc. This file is part of libgcj. @@ -403,19 +403,13 @@ */ -#ifdef __i386__ -#define PC_REGISTER_ASM asm("%esi") -#else -#define PC_REGISTER_ASM -#endif - void _Jv_InterpMethod::continue1 (_Jv_InterpMethodInvocation *inv) { using namespace java::lang::reflect; - register _Jv_word *sp = inv->sp; - register unsigned char *pc PC_REGISTER_ASM = inv->pc; - _Jv_word *locals = inv->local_base (); + register _Jv_word *sp = inv->sp; + register unsigned char *pc = inv->pc; + _Jv_word *locals = inv->local_base (); _Jv_word *pool_data = defining_class->constants.data; From java-patches-return-412-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Wed Jan 19 21:39:19 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 32395 invoked by alias); 19 Jan 2000 21:39:19 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 32057 invoked from network); 19 Jan 2000 21:38:24 -0000 To: Java Patch List Subject: Patch: many inner class tests X-Zippy: World War Three can be averted by adherence to a strictly enforced dress code! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 19 Jan 2000 14:39:34 -0700 Message-ID: <87ya9l4u7d.fsf@cygnus.com> Lines: 1116 X-Mailer: Gnus v5.5/Emacs 20.3 I'm checking in this huge patch, which adds a bunch of tests for inner classes. These tests were all written by Alex, but a couple were lightly hacked by me (some name changes). More inner class tests will follow as time permits. If you know of useful inner class test cases (corner cases or whatever), you're encouraged to send them (either as patches, or as a .java file directly to me if you want). 2000-01-19 Alexandre Petit-Bianco * libjava.lang/anon.java, libjava.lang/anon2.java, libjava.lang/anon3.java, libjava.lang/anon4.java, libjava.lang/direct_read.java, libjava.lang/direct_write.java, libjava.lang/indirect.java, libjava.lang/indirect_read.java, libjava.lang/indirect_write.java, libjava.lang/inner1.java, libjava.lang/inner2.java, libjava.lang/inner3.java, libjava.lang/inner4.java, libjava.lang/inner_array.java, libjava.lang/multiple_finit.java, libjava.lang/private_direct_read.java, libjava.lang/private_direct_write.java, libjava.lang/private_indirect_read.java, libjava.lang/private_indirect_write.java, libjava.lang/search_outer.java, libjava.lang/tmi.java, libjava.lang/tp.java, libjava.lang/update_outer.java: New file. Tom Index: libjava.lang/anon.java =================================================================== RCS file: anon.java diff -N anon.java --- /dev/null Tue May 5 13:32:27 1998 +++ anon.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,52 @@ +// Class anon +// Generated on Wed Dec 29 10:07:09 PST 1999 +// + + +interface itf {int count = 0;void setCount (int i);int getCount ();} + +class anon { + + int count = 34; + + class x implements itf { + int count = 3; + public void setCount (int j) { } + public int getCount () { return count*3; } + } + + + itf foo () { + class y implements itf { + int count = 3; + public void setCount (int j) { count = j; } + public int getCount () { return count+1; } + } + return new y (); + } + + itf bar () { + return new itf () { + // The class defined right here will implement `itf' + int count = 5; + public void setCount (int j) { count = j; } + public int getCount () { return count+1; } + } ; + } + + void test () { + itf a = foo (); + itf b = bar (); + x c = this.new x (); + System.out.println (a.getCount ()); + System.out.println (b.getCount ()); + System.out.println (c.getCount ()); + System.out.println (this.count); + } + + public static void main (String[] arg) + { + System.out.println ("Testing class `anon'..."); + new anon ().test (); + } +} Index: libjava.lang/anon.out =================================================================== RCS file: anon.out diff -N anon.out --- /dev/null Tue May 5 13:32:27 1998 +++ anon.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,5 @@ +Testing class `anon'... +4 +6 +9 +34 Index: libjava.lang/anon2.java =================================================================== RCS file: anon2.java diff -N anon2.java --- /dev/null Tue May 5 13:32:27 1998 +++ anon2.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,50 @@ +// Class anon2 +// Generated on Wed Dec 29 10:07:09 PST 1999 +// + + +class anon2 { + + int count = 34; + int field; + + anon2 () { System.out.println ("anon2()"); } + + anon2 (foobar x) { + System.out.println ("Yikes!"+x.zoink()); + } + + anon2 foo () { + class y extends anon2 { + int count = 3; + public void setCount (int j) { count = j; } + public int getCount () { return count+1; } + y (int i) { System.out.println ("y(int)"); } + } + return new y (3); + } + + anon2 bar () { + foobar xyz = new foobar (); + return new anon2 (xyz) { + int count = 5; + public void setCount (int j) { field = 3; count = j; } + public int getCount () { return count+1; } + } ; + } + + void test () { + anon2 b = bar (); + anon2 c = foo (); + } + + public static void main (String[] arg) + { + System.out.println ("Testing class `anon2'..."); + new anon2 ().test (); + } +} + +class foobar { + public String zoink() { return " zoinked"; } +} Index: libjava.lang/anon2.out =================================================================== RCS file: anon2.out diff -N anon2.out --- /dev/null Tue May 5 13:32:27 1998 +++ anon2.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,5 @@ +Testing class `anon2'... +anon2() +Yikes! zoinked +anon2() +y(int) Index: libjava.lang/anon3.java =================================================================== RCS file: anon3.java diff -N anon3.java --- /dev/null Tue May 5 13:32:27 1998 +++ anon3.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,28 @@ +// Class anon3 +// Generated on Wed Dec 29 10:07:09 PST 1999 +// + + +class anon3 { + + itf bar () { + return new itf () { + int count = 5; + public void setCount (int j) { count = 3; } + public int getCount () { return count; } + } ; + } + + void test () { + itf x = bar (); + System.out.println (x.getCount ()); + } + + public static void main (String[] arg) + { + System.out.println ("Testing class `anon3'..."); + new anon3 ().test (); + } +} + +interface itf { void setCount (int j); int getCount(); int count = 0; } Index: libjava.lang/anon3.out =================================================================== RCS file: anon3.out diff -N anon3.out --- /dev/null Tue May 5 13:32:27 1998 +++ anon3.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,2 @@ +Testing class `annon3'... +5 Index: libjava.lang/anon4.java =================================================================== RCS file: anon4.java diff -N anon4.java --- /dev/null Tue May 5 13:32:27 1998 +++ anon4.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,30 @@ +// Class anon4 +// Generated on Wed Dec 29 10:07:09 PST 1999 +// + + +class anon4 { + + private int field = 3; + + itf bar () { + return new itf () { + int count = 5; + public void setCount (int j) { count = 3+field; } + public int getCount () { return count+field; } + } ; + } + + void test () { + itf x = bar (); + System.out.println (x.getCount ()); + } + + public static void main (String[] arg) + { + System.out.println ("Testing class `anon4'..."); + new anon4 ().test (); + } +} + +interface itf { void setCount (int j); int getCount(); int count = 0; } Index: libjava.lang/anon4.out =================================================================== RCS file: anon4.out diff -N anon4.out --- /dev/null Tue May 5 13:32:27 1998 +++ anon4.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,2 @@ +Testing class `anon4'... +8 Index: libjava.lang/direct_read.java =================================================================== RCS file: direct_read.java diff -N direct_read.java --- /dev/null Tue May 5 13:32:27 1998 +++ direct_read.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,27 @@ +// Class direct_read +// Generated on Sat Nov 13 23:26:34 UTC 1999 +// + +class direct_read { + + int foo; + + class direct_read_inner { + void test () { + int x = foo; + System.out.println ("x="+x); + } + } + + void foo () + { + foo = 670; + direct_read_inner inn = this.new direct_read_inner (); + inn.test (); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `direct_read'..."); + new direct_read().foo (); + } +} Index: libjava.lang/direct_read.out =================================================================== RCS file: direct_read.out diff -N direct_read.out --- /dev/null Tue May 5 13:32:27 1998 +++ direct_read.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,2 @@ +Testing class `direct_read'... +x=670 Index: libjava.lang/direct_write.java =================================================================== RCS file: direct_write.java diff -N direct_write.java --- /dev/null Tue May 5 13:32:27 1998 +++ direct_write.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,27 @@ +// Class direct_write +// Generated on Mon Nov 15 17:10:56 UTC 1999 +// + +class direct_write { + + int foo; + + class direct_write_inner { + void test () { + foo = 670; + } + } + + void foo () + { + foo = 650; + direct_write_inner inn = this.new direct_write_inner (); + inn.test (); + System.out.println ("foo="+foo); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `direct_write'..."); + new direct_write().foo (); + } +} Index: libjava.lang/direct_write.out =================================================================== RCS file: direct_write.out diff -N direct_write.out --- /dev/null Tue May 5 13:32:27 1998 +++ direct_write.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,2 @@ +Testing class `direct_write'... +foo=670 Index: libjava.lang/indirect.java =================================================================== RCS file: indirect.java diff -N indirect.java --- /dev/null Tue May 5 13:32:27 1998 +++ indirect.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,33 @@ +// Class indirect +// Generated on Tue Nov 16 15:53:14 UTC 1999 +// Several indirection to enclosing class + +class indirect { + + private int foo; + + class indirect_inner { + class other { + class inner { + void test () { + int x = foo; + System.out.println ("x="+foo); + foo = 671; + } + } + } + + } + void foo () + { + foo = 670; + indirect_inner inn = this.new indirect_inner (); + this.new indirect_inner().new other().new inner ().test (); + System.out.println ("foo="+foo); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `indirect'..."); + new indirect().foo (); + } +} Index: libjava.lang/indirect.out =================================================================== RCS file: indirect.out diff -N indirect.out --- /dev/null Tue May 5 13:32:27 1998 +++ indirect.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,3 @@ +Testing class `indirect'... +x=670 +foo=671 Index: libjava.lang/indirect_read.java =================================================================== RCS file: indirect_read.java diff -N indirect_read.java --- /dev/null Tue May 5 13:32:27 1998 +++ indirect_read.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,33 @@ +// Class indirect_read +// Generated on Mon Nov 15 17:20:40 UTC 1999 +// + +class indirect_read { + + int foo; + + class indirect_read_inner { + void test () { + } + + class other { + void testx () { + int x = foo; + System.out.println ("x="+x); + } + } + + } + void foo () + { + foo = 670; + indirect_read_inner inn = this.new indirect_read_inner (); + indirect_read_inner.other o = inn.new other (); + o.testx (); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `indirect_read'..."); + new indirect_read().foo (); + } +} Index: libjava.lang/indirect_read.out =================================================================== RCS file: indirect_read.out diff -N indirect_read.out --- /dev/null Tue May 5 13:32:27 1998 +++ indirect_read.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,2 @@ +Testing class `indirect_read'... +x=670 Index: libjava.lang/indirect_write.java =================================================================== RCS file: indirect_write.java diff -N indirect_write.java --- /dev/null Tue May 5 13:32:27 1998 +++ indirect_write.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,32 @@ +// Class indirect_write +// Generated on Tue Nov 16 15:01:24 UTC 1999 +// + +class indirect_write { + + int foo; + + class indirect_write_inner { + void test () { + } + + class other { + void testx () { + foo = 670; + } + } + + } + void foo () + { + indirect_write_inner inn = this.new indirect_write_inner (); + indirect_write_inner.other x = inn.new other (); + x.testx(); + System.out.println ("foo="+foo); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `indirect_write'..."); + new indirect_write().foo (); + } +} Index: libjava.lang/indirect_write.out =================================================================== RCS file: indirect_write.out diff -N indirect_write.out --- /dev/null Tue May 5 13:32:27 1998 +++ indirect_write.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,2 @@ +Testing class `indirect_write'... +foo=670 Index: libjava.lang/inner1.java =================================================================== RCS file: inner1.java diff -N inner1.java --- /dev/null Tue May 5 13:32:27 1998 +++ inner1.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,36 @@ +// Class inner1 +// Generated on Thu Nov 4 16:35:03 PST 1999 +// + +class inner1 { + int i; + void foo () { + inner1.z x1 = new z(); + inner1.z.y x = x1.new y(); + x.bar (); + x.print(); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `inner1'..."); + new inner1 ().foo(); + } + class z { + int j; + void foo () { + inner1.this.i = 3; + } + class y { + int k; + void bar () { + inner1.this.i = 3; + z.this.j = 4; + y.this.k = 34; + } + void print () { + System.out.println ("i="+i+", j="+j+", k="+k); + } + } + } +} + Index: libjava.lang/inner1.out =================================================================== RCS file: inner1.out diff -N inner1.out --- /dev/null Tue May 5 13:32:27 1998 +++ inner1.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,2 @@ +Testing class `inner1'... +i=3, j=4, k=34 Index: libjava.lang/inner2.java =================================================================== RCS file: inner2.java diff -N inner2.java --- /dev/null Tue May 5 13:32:27 1998 +++ inner2.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,18 @@ +// Class inner2 +// Generated on Mon Dec 6 14:32:34 PST 1999 +// + +class inner2 { + int foo = 1999; + void foo () + { + inner2.this.foo = 666; + System.out.println (inner2.this.foo); + } + void print () {System.out.println (foo);} + public static void main (String[] arg) + { + System.out.println ("Testing class `inner2'..."); + new inner2().foo (); + } +} Index: libjava.lang/inner2.out =================================================================== RCS file: inner2.out diff -N inner2.out --- /dev/null Tue May 5 13:32:27 1998 +++ inner2.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,2 @@ +Testing class `inner2'... +666 Index: libjava.lang/inner3.java =================================================================== RCS file: inner3.java diff -N inner3.java --- /dev/null Tue May 5 13:32:27 1998 +++ inner3.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,23 @@ +// Class inner3 +// Generated on Tue Dec 7 11:37:43 PST 1999 +// + +class inner3 { + int bar; + public static void main (String[] arg) + { + System.out.println ("Testing class `inner3'..."); + new inner3().bar (); + } + void bar () { + t xx = this.new t (); + xx.bar (); + } + void foo () { bar = 3; } + class t { + void bar () { + inner3.this.foo (); + System.out.println (inner3.this.bar); + } + } +} Index: libjava.lang/inner3.out =================================================================== RCS file: inner3.out diff -N inner3.out --- /dev/null Tue May 5 13:32:27 1998 +++ inner3.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,2 @@ +Testing class `inner3'... +3 Index: libjava.lang/inner4.java =================================================================== RCS file: inner4.java diff -N inner4.java --- /dev/null Tue May 5 13:32:27 1998 +++ inner4.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,34 @@ +// Class inner4 +// Generated on Tue Dec 7 11:43:48 PST 1999 +// + +class inner4 { + static private int xyz () { return 3; } + private String f; + + String p () { + return "public String p()"; + } + + private String pp (int x, byte y, char c) { + return "private String pp("+x+", "+y+", "+c+")"; + } + + void foo () { + t xxx = this.new t(); + xxx.bar (); + pp (3, (byte)34, 'C'); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `inner4'..."); + new inner4().foo(); + } + class t { + void bar () { + System.out.println (p ()); + System.out.println (pp (3, (byte)34, 'C')); + System.out.println (xyz ()); + } + } +} Index: libjava.lang/inner4.out =================================================================== RCS file: inner4.out diff -N inner4.out --- /dev/null Tue May 5 13:32:27 1998 +++ inner4.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,4 @@ +Testing class `inner4'... +public String p() +private String pp(3, 34, C) +3 Index: libjava.lang/inner_array.java =================================================================== RCS file: inner_array.java diff -N inner_array.java --- /dev/null Tue May 5 13:32:27 1998 +++ inner_array.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,30 @@ +// Class inner_array +// Generated on Fri Nov 19 13:19:47 PST 1999 +// + +class inner_array { + + private int[] foo; + + class array_inner { + void test () { + int x = foo[2]; + System.out.println ("x="+x); + foo [1] = 34; + foo [1]++; + } + } + void foo () + { + foo = new int [3]; + foo[2]=670; + array_inner inn = this.new array_inner (); + inn.test (); + System.out.println ("foo[1]="+foo[1]); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `inner_array'..."); + new inner_array().foo (); + } +} Index: libjava.lang/inner_array.out =================================================================== RCS file: inner_array.out diff -N inner_array.out --- /dev/null Tue May 5 13:32:27 1998 +++ inner_array.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,3 @@ +Testing class `inner_array'... +x=670 +foo[1]=35 Index: libjava.lang/multiple_finit.java =================================================================== RCS file: multiple_finit.java diff -N multiple_finit.java --- /dev/null Tue May 5 13:32:27 1998 +++ multiple_finit.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,28 @@ +// Class multiple_finit +// Generated on Mon Jan 3 20:07:18 PST 2000 +// + +class multiple_finit { + + int foo = 99; + + class multiple_finit_inner { + int inner = 34; + void test () { + System.out.println (inner); + System.out.println (foo); + } + } + void foo (String s) + { + multiple_finit_inner inn = this.new multiple_finit_inner (); + inn.test (); + System.out.println (foo); + } + void testx () { } + public static void main (String[] arg) + { + System.out.println ("Testing class `multiple_finit'..."); + new multiple_finit().foo (""); + } +} Index: libjava.lang/multiple_finit.out =================================================================== RCS file: multiple_finit.out diff -N multiple_finit.out --- /dev/null Tue May 5 13:32:27 1998 +++ multiple_finit.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,4 @@ +Testing class `multiple_finit'... +34 +99 +99 Index: libjava.lang/private_direct_read.java =================================================================== RCS file: private_direct_read.java diff -N private_direct_read.java --- /dev/null Tue May 5 13:32:27 1998 +++ private_direct_read.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,26 @@ +// Class private_direct_read +// Generated on Tue Nov 16 15:04:13 UTC 1999 +// + +class private_direct_read { + + private int foo; + + class private_direct_read_inner { + void test () { + int x = foo; + System.out.println ("x="+x); + } + } + void foo () + { + foo = 670; + private_direct_read_inner inn = this.new private_direct_read_inner (); + inn.test (); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `private_direct_read'..."); + new private_direct_read().foo (); + } +} Index: libjava.lang/private_direct_read.out =================================================================== RCS file: private_direct_read.out diff -N private_direct_read.out --- /dev/null Tue May 5 13:32:27 1998 +++ private_direct_read.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,2 @@ +Testing class `private_direct_read'... +x=670 Index: libjava.lang/private_direct_write.java =================================================================== RCS file: private_direct_write.java diff -N private_direct_write.java --- /dev/null Tue May 5 13:32:27 1998 +++ private_direct_write.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,25 @@ +// Class private_direct_write +// Generated on Tue Nov 16 15:05:54 UTC 1999 +// + +class private_direct_write { + + private int foo; + + class private_direct_write_inner { + void test () { + foo = 670; + } + } + void foo () + { + private_direct_write_inner inn = this.new private_direct_write_inner (); + inn.test (); + System.out.println ("foo="+foo); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `private_direct_write'..."); + new private_direct_write().foo (); + } +} Index: libjava.lang/private_indirect_read.java =================================================================== RCS file: private_indirect_read.java diff -N private_indirect_read.java --- /dev/null Tue May 5 13:32:27 1998 +++ private_indirect_read.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,32 @@ +// Class private_indirect_read +// Generated on Tue Nov 16 15:34:56 UTC 1999 +// + +class private_indirect_read { + + private int foo; + + class private_indirect_read_inner { + void test () { + } + class other { + void testx () { + int x = foo; + System.out.println ("x="+x); + } + } + + } + void foo () + { + foo=670; + private_indirect_read_inner inn = this.new private_indirect_read_inner (); + private_indirect_read_inner.other o = inn.new other (); + o.testx(); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `private_indirect_read'..."); + new private_indirect_read().foo (); + } +} Index: libjava.lang/private_indirect_write.java =================================================================== RCS file: private_indirect_write.java diff -N private_indirect_write.java --- /dev/null Tue May 5 13:32:27 1998 +++ private_indirect_write.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,32 @@ +// Class private_indirect_write +// Generated on Tue Nov 16 15:44:49 UTC 1999 +// + +class private_indirect_write { + + private int foo; + + class private_indirect_write_inner { + void test () { + } + + class other { + void test () { + foo = 670; + } + } + + } + void foo () + { + private_indirect_write_inner inn = this.new private_indirect_write_inner (); + private_indirect_write_inner.other x = inn.new other (); + x.test (); + System.out.println ("foo="+foo); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `private_indirect_write'..."); + new private_indirect_write().foo (); + } +} Index: libjava.lang/search_outer.java =================================================================== RCS file: search_outer.java diff -N search_outer.java --- /dev/null Tue May 5 13:32:27 1998 +++ search_outer.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,28 @@ +// Class search_outer.java +// Generated on Thu Nov 18 18:40:43 UTC 1999 +// + +class search_outer { + + private int foo; + + class search_outer_inner { + void test () { + foo++; + System.out.println ("foo="+foo); + foo += 3; + System.out.println ("foo="+foo); + } + } + void foo () + { + foo = 3; + search_outer_inner inn = this.new search_outer_inner (); + inn.test (); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `search_outer'..."); + new search_outer().foo (); + } +} Index: libjava.lang/search_outer.out =================================================================== RCS file: search_outer.out diff -N search_outer.out --- /dev/null Tue May 5 13:32:27 1998 +++ search_outer.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,3 @@ +Testing class `search_outer'... +foo=4 +foo=7 Index: libjava.lang/tmi.java =================================================================== RCS file: tmi.java diff -N tmi.java --- /dev/null Tue May 5 13:32:27 1998 +++ tmi.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,43 @@ +// Class t +// Generated on Thu Nov 4 16:35:03 PST 1999 +// + +class tmi { + int i; + void foo () { + tmi.z x1 = new z(); + tmi.z.y x = x1.new y(); + x.bar (); + x.print(); + tmi.this.i = 666; + x.print(); + tmi.this.print(); + } + void print () { + System.out.println ("tmi.print()"); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `tmi'..."); + new tmi ().foo(); + } + class z { + int j; + void foo () { + tmi.this.i = 3; + } + class y { + int k; + void bar () { + tmi.this.i = 3; + tmi.this.print (); + z.this.j = 4; + y.this.k = 34; + } + void print () { + System.out.println ("i="+i+", j="+j+", k="+k); + } + } + } +} + Index: libjava.lang/tmi.out =================================================================== RCS file: tmi.out diff -N tmi.out --- /dev/null Tue May 5 13:32:27 1998 +++ tmi.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,5 @@ +Testing class `tmi'... +tmi.print() +i=3, j=4, k=34 +i=666, j=4, k=34 +tmi.print() Index: libjava.lang/tp.java =================================================================== RCS file: tp.java diff -N tp.java --- /dev/null Tue May 5 13:32:27 1998 +++ tp.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,36 @@ +// Class tp +// Generated on Thu Nov 4 16:35:03 PST 1999 +// + +class tp { + private int i; + void foo () { + tp.z x1 = new z(); + tp.z.y x = x1.new y(); + x.bar (); + x.print(); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `tp'..."); + new tp ().foo(); + } + class z { + private int j; + void foo () { + tp.this.i = 3; + } + class y { + private int k; + void bar () { + tp.this.i = 3; + z.this.j = 4; + y.this.k = 34; + } + void print () { + System.out.println ("i="+i+", j="+j+", k="+k); + } + } + } +} + Index: libjava.lang/tp.out =================================================================== RCS file: tp.out diff -N tp.out --- /dev/null Tue May 5 13:32:27 1998 +++ tp.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,2 @@ +Testing class `tp'... +i=3, j=4, k=34 Index: libjava.lang/update_outer.java =================================================================== RCS file: update_outer.java diff -N update_outer.java --- /dev/null Tue May 5 13:32:27 1998 +++ update_outer.java Wed Jan 19 13:25:56 2000 @@ -0,0 +1,28 @@ +// Class update_outer +// Generated on Thu Nov 18 21:37:21 UTC 1999 +// + +class update_outer { + + private String foo; + + class update_outer_inner { + void test () { + foo += " M$"; + System.out.println ("foo=`"+foo+"'"); + } + + + } + void foo () + { + foo = "780"; + update_outer_inner inn = this.new update_outer_inner (); + inn.test (); + } + public static void main (String[] arg) + { + System.out.println ("Testing class `update_outer'..."); + new update_outer().foo (); + } +} Index: libjava.lang/update_outer.out =================================================================== RCS file: update_outer.out diff -N update_outer.out --- /dev/null Tue May 5 13:32:27 1998 +++ update_outer.out Wed Jan 19 13:25:56 2000 @@ -0,0 +1,2 @@ +Testing class `update_outer'... +foo=`780 M$' From java-patches-return-413-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Thu Jan 20 16:49:42 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 4001 invoked by alias); 20 Jan 2000 16:49:42 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 3767 invoked from network); 20 Jan 2000 16:49:23 -0000 To: Java Patch List Subject: Patch: minor cleanup X-Zippy: Don't worry, nobody really LISTENS to lectures in MOSCOW, either! .. FRENCH, HISTORY, ADVANCED CALCULUS, COMPUTER PROGRAMMING, BLACK STUDIES, SOCIOBIOLOGY!.. Are there any QUESTIONS?? X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 20 Jan 2000 09:51:18 -0700 Message-ID: <87r9fc4rg9.fsf@cygnus.com> Lines: 59 X-Mailer: Gnus v5.5/Emacs 20.3 I'm checking in this minor cleanup patch. It removes a couple of unnecessary defines. I really should make the Class information visible to C++ via gcjh somehow... 2000-01-20 Tom Tromey * resolve.cc (StringClass): Removed. * defineclass.cc (StringClass): Removed. Tom Index: defineclass.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/defineclass.cc,v retrieving revision 1.6 diff -u -r1.6 defineclass.cc --- defineclass.cc 2000/01/19 18:39:23 1.6 +++ defineclass.cc 2000/01/20 16:47:37 @@ -1,6 +1,6 @@ // defineclass.cc - defining a class from .class format. -/* Copyright (C) 1999 Red Hat, Inc. +/* Copyright (C) 1999, 2000 Red Hat, Inc. This file is part of libgcj. @@ -42,8 +42,6 @@ #define ClassClass _CL_Q34java4lang5Class extern java::lang::Class ClassClass; -#define StringClass _CL_Q34java4lang6String -extern java::lang::Class StringClass; #define ClassObject _CL_Q34java4lang6Object extern java::lang::Class ClassObject; Index: resolve.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/resolve.cc,v retrieving revision 1.8 diff -u -r1.8 resolve.cc --- resolve.cc 2000/01/19 18:39:23 1.8 +++ resolve.cc 2000/01/20 16:47:44 @@ -1,6 +1,6 @@ // resolve.cc - Code for linking and resolving classes and pool entries. -/* Copyright (C) 1999 Red Hat, Inc. +/* Copyright (C) 1999, 2000 Red Hat, Inc. This file is part of libgcj. @@ -40,8 +40,6 @@ static void throw_class_format_error (char *msg) __attribute__ ((__noreturn__)); -#define StringClass _CL_Q34java4lang6String -extern java::lang::Class StringClass; #define ClassObject _CL_Q34java4lang6Object extern java::lang::Class ClassObject; #define ObjectClass _CL_Q34java4lang6Object From java-patches-return-414-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Fri Jan 21 10:12:05 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 19737 invoked by alias); 21 Jan 2000 10:12:04 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 19715 invoked from network); 21 Jan 2000 10:12:02 -0000 To: tromey@cygnus.com Cc: Java Patch List Subject: Re: Patch: no more %esi References: <87zou14vtz.fsf@cygnus.com> From: Kresten Krab Thorup Date: 21 Jan 2000 11:11:44 +0100 In-Reply-To: Tom Tromey's message of "19 Jan 2000 14:04:24 -0700" Message-ID: Lines: 19 X-Mailer: Gnus v5.7/Emacs 20.5 Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Tom Tromey writes: > I'm checking in the appended patch, which removes the use of %esi from > the interpreter. This code causes problems with some versions of g++. > > Kresten, I assume this code is a performance hack? Does it make a > measurable difference when this code is included? If it does, then we > might want to enable it, but with a different register. If it > doesn't, then there's no harm leaving it out. (Unfortunately I > currently don't have time to do any profiling.) Quite allright. I don't remember how much this improves performance. -- Kresten Kresten Krab Thorup "I like my eggs ploded" Department of Computer Science, University of Aarhus Aabogade 34, DK-8200 Aarhus N, Denmark +45 8942 5665 (office), +45 2343 4626 (mobile) From java-patches-return-415-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Fri Jan 21 21:13:00 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 6959 invoked by alias); 21 Jan 2000 21:13:00 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 6938 invoked from network); 21 Jan 2000 21:12:56 -0000 To: Java Patch List Subject: Patch: another JDK 1.1 test X-Zippy: World War Three can be averted by adherence to a strictly enforced dress code! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 21 Jan 2000 14:15:09 -0700 Message-ID: <87iu0n3z4y.fsf@cygnus.com> Lines: 32 X-Mailer: Gnus v5.5/Emacs 20.3 I'm checking in this patch, which adds a test for JDK 1.1 "blank final" variables. 2000-01-20 Tom Tromey * libjava.compile/BlankFinal.java: New file. Tom Index: libjava.compile/BlankFinal.java =================================================================== RCS file: BlankFinal.java diff -N BlankFinal.java --- /dev/null Tue May 5 13:32:27 1998 +++ BlankFinal.java Fri Jan 21 13:11:49 2000 @@ -0,0 +1,16 @@ +// Test to see if "blank final" variables work. +// From Mo DeJong + +public class BlankFinal { + static final boolean cond; + + static { + try + { + cond = true; + } + catch(Exception e) { + // do nothing + } + } +} From java-patches-return-416-listarch-java-patches=sourceware.cygnus.com@sourceware.cygnus.com Fri Jan 21 23:49:31 2000 Return-Path: Delivered-To: listarch-java-patches@sourceware.cygnus.com Received: (qmail 31797 invoked by alias); 21 Jan 2000 23:49:31 -0000 Mailing-List: contact java-patches-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@sourceware.cygnus.com Delivered-To: mailing list java-patches@sourceware.cygnus.com Received: (qmail 30290 invoked from network); 21 Jan 2000 23:46:16 -0000 To: Java Patch List Subject: Patch: JNI X-Zippy: It don't mean a THING if you ain't got that SWING!! X-Attribution: Tom Bcc: Reply-To: tromey@cygnus.com From: Tom Tromey Date: 21 Jan 2000 16:45:09 -0700 Message-ID: <87hfg73s6y.fsf@cygnus.com> Lines: 2612 X-Mailer: Gnus v5.5/Emacs 20.3 I'm committing the appended patch. This patch implements a large chunk of JNI. JNI still doesn't work, but this is a step in that direction. 2000-01-21 Tom Tromey * java/lang/reflect/natConstructor.cc (newInstance): Use _Jv_CallAnyMethodA. * include/jvm.h: Declare _Jv_CallAnyMethodA. * java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Renamed from _Jv_CallNonvirtualMethodA. Changed interface; overloaded. Include . (COPY): Removed. (invoke): Use _Jv_CallAnyMethodA. (VAL): Redefined. * java/lang/Class.h (Class): Declare JvGetFirstStaticField, JvNumStaticFields, JvNumMethods, and JvGetFirstMethod as friend functions. (struct _Jv_Method): Added getNextMethod method. (JvNumMethods): New function. (JvGetFirstMethod): Likewise. * gcj/field.h (JvGetFirstStaticField): New function. (JvNumStaticFields): Likewise. (getNextField): Renamed from getNextInstanceField. (struct _Jv_Field): New method getClass. * jni.cc: Wrote many new functions. * include/jni.h (JNI_TRUE): Define. (JNI_FALSE): Likewise. (jobject, jclass, jstring, jarray, jthrowable, jobjectArray, jbyteArray, jshortArray, jintArray, jlongArray, jbooleanArray, jcharArray, jfloatArray, jdoubleArray): New typedefs. (jfieldID, jmethodID): Likewise. (JNI_COMMIT, JNI_ABORT): New defines. (JNINativeMethod): New struct. (struct JNINativeInterface): Correctly declared more entries. (class _Jv_JNIEnv): Added `ex' member. (JNI_VERSION_1_1): New define. (JNI_VERSION_1_2): Likewise. * boehm.cc (_Jv_MarkObj): Use getNextField, not getNextInstanceField. Tom Index: boehm.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/boehm.cc,v retrieving revision 1.12 diff -u -r1.12 boehm.cc --- boehm.cc 2000/01/19 18:39:23 1.12 +++ boehm.cc 2000/01/21 23:41:38 @@ -1,6 +1,6 @@ // boehm.cc - interface between libjava and Boehm GC. -/* Copyright (C) 1998, 1999 Red Hat, Inc. +/* Copyright (C) 1998, 1999, 2000 Red Hat, Inc. This file is part of libgcj. @@ -256,7 +256,7 @@ MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, obj, elabel); } - field = field->getNextInstanceField (); + field = field->getNextField (); } klass = klass->getSuperclass(); } Index: jni.cc =================================================================== RCS file: /cvs/java/libgcj/libjava/jni.cc,v retrieving revision 1.3 diff -u -r1.3 jni.cc --- jni.cc 2000/01/19 18:39:23 1.3 +++ jni.cc 2000/01/21 23:41:44 @@ -1,6 +1,6 @@ // jni.cc - JNI implementation, including the jump table. -/* Copyright (C) 1998, 1999 Red Hat, Inc. +/* Copyright (C) 1998, 1999, 2000 Red Hat, Inc. This file is part of libgcj. @@ -8,13 +8,79 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details. */ +// Note: currently we take the approach of not checking most +// arguments. Instead we could do more checking conditionally (e.g., +// if DEBUG is defined). That might be beneficial in some cases, +// though to me it seems that one could just as easily use the +// debugger. + #include #include +// Must define this before jni.h. +#define GCJ_JV_JNIENV_FRIEND \ + friend jthrowable &get_throwable (JNIEnv *) + +#include +#include +#include #include #include +#include +#include +#include +#include +#include +#include +#include + +#define ClassClass _CL_Q34java4lang5Class +extern java::lang::Class ClassClass; +#define ObjectClass _CL_Q34java4lang6Object +extern java::lang::Class ObjectClass; + +// This enum is used to select different template instantiations in +// the invocation code. +enum invocation_type +{ + normal, + nonvirtual, + static_type, + constructor +}; + + + +// Tell the GC that a certain pointer is live. +static void +mark_for_gc (void *) +{ + // FIXME. +} + +// Unmark a pointer. +static void +unmark_for_gc (void *) +{ + // FIXME. +} + +// Return throwable in env. +jthrowable & +get_throwable (JNIEnv *env) +{ + return env->ex; +} + + +static jint +_Jv_JNI_GetVersion (JNIEnv *) +{ + return JNI_VERSION_1_2; +} + static jclass _Jv_JNI_GetSuperclass (JNIEnv *, jclass clazz) { @@ -27,34 +93,556 @@ return clazz1->isAssignableFrom (clazz2); } +static jint +_Jv_JNI_Throw (JNIEnv *env, jthrowable obj) +{ + get_throwable (env) = obj; + return 0; +} + +static jint +_Jv_JNI_ThrowNew (JNIEnv *env, jclass clazz, const char *message) +{ + using namespace java::lang::reflect; + + JArray *argtypes + = (JArray *) JvNewObjectArray (1, &ClassClass, NULL); + + jclass *elts = elements (argtypes); + elts[0] = &StringClass; + + // FIXME: exception processing. + Constructor *cons = clazz->getConstructor (argtypes); + + jobjectArray values = JvNewObjectArray (1, &StringClass, NULL); + jobject *velts = elements (values); + velts[0] = JvNewStringUTF (message); + + // FIXME: exception processing. + jobject obj = cons->newInstance (values); + + get_throwable (env) = reinterpret_cast (obj); + return 0; +} + +static jthrowable +_Jv_JNI_ExceptionOccurred (JNIEnv *env) +{ + return get_throwable (env); +} + +static void +_Jv_JNI_ExceptionDescribe (JNIEnv *env) +{ + if (get_throwable (env) != NULL) + get_throwable (env)->printStackTrace(); +} + +static void +_Jv_JNI_ExceptionClear (JNIEnv *env) +{ + get_throwable (env) = NULL; +} + +static void +_Jv_JNI_FatalError (JNIEnv *, const char *message) +{ + JvFail (message); +} + +static jboolean +_Jv_JNI_IsSameObject (JNIEnv *, jobject obj1, jobject obj2) +{ + return obj1 == obj2; +} + static jobject -_Jv_JNI_GetObjectField (JNIEnv *, jobject obj, jfieldID field) +_Jv_JNI_AllocObject (JNIEnv *env, jclass clazz) { - return _Jv_GetObjectField (obj, field); + jobject obj = NULL; + using namespace java::lang::reflect; + if (clazz->isInterface() || Modifier::isAbstract(clazz->getModifiers())) + get_throwable (env) = new java::lang::InstantiationException (); + else + { + // FIXME: exception processing. + // FIXME: will this work for String? + obj = JvAllocObject (clazz); + } + + return obj; } -static jbyte -_Jv_JNI_GetByteField (JNIEnv *, jobject obj, jfieldID field) +static jclass +_Jv_JNI_GetObjectClass (JNIEnv *, jobject obj) { - return _Jv_GetByteField (obj, field); + return obj->getClass(); } -static jshort -_Jv_JNI_GetShortField (JNIEnv *, jobject obj, jfieldID field) +static jboolean +_Jv_JNI_IsInstanceOf (JNIEnv *, jobject obj, jclass clazz) { - return _Jv_GetShortField (obj, field); + return clazz->isInstance(obj); } -static jint -_Jv_JNI_GetIntField (JNIEnv *, jobject obj, jfieldID field) + + +// +// This section concerns method invocation. +// + +template +static jmethodID +_Jv_JNI_GetAnyMethodID (JNIEnv *env, jclass clazz, + const char *name, const char *sig) +{ + // FIXME: exception processing. + _Jv_InitClass (clazz); + + _Jv_Utf8Const *name_u = _Jv_makeUtf8Const ((char *) name, -1); + _Jv_Utf8Const *sig_u = _Jv_makeUtf8Const ((char *) sig, -1); + + JvAssert (! clazz->isPrimitive()); + + using namespace java::lang::reflect; + + while (clazz != NULL) + { + jint count = JvNumMethods (clazz); + jmethodID meth = JvGetFirstMethod (clazz); + + for (jint i = 0; i < count; ++i) + { + if (((is_static && Modifier::isStatic (meth->accflags)) + || (! is_static && ! Modifier::isStatic (meth->accflags))) + && _Jv_equalUtf8Consts (meth->name, name_u) + && _Jv_equalUtf8Consts (meth->signature, sig_u)) + return meth; + + meth = meth->getNextMethod(); + } + + clazz = clazz->getSuperclass (); + } + + get_throwable (env) = new java::lang::NoSuchMethodError (); + return NULL; +} + +// This is a helper function which turns a va_list into an array of +// `jvalue's. It needs signature information in order to do its work. +// The array of values must already be allocated. +static void +array_from_valist (jvalue *values, JArray *arg_types, va_list vargs) +{ + jclass *arg_elts = elements (arg_types); + for (int i = 0; i < arg_types->length; ++i) + { + if (arg_elts[i] == JvPrimClass (byte)) + values[i].b = va_arg (vargs, jbyte); + else if (arg_elts[i] == JvPrimClass (short)) + values[i].s = va_arg (vargs, jshort); + else if (arg_elts[i] == JvPrimClass (int)) + values[i].i = va_arg (vargs, jint); + else if (arg_elts[i] == JvPrimClass (long)) + values[i].j = va_arg (vargs, jlong); + else if (arg_elts[i] == JvPrimClass (float)) + values[i].f = va_arg (vargs, jfloat); + else if (arg_elts[i] == JvPrimClass (double)) + values[i].d = va_arg (vargs, jdouble); + else if (arg_elts[i] == JvPrimClass (boolean)) + values[i].z = va_arg (vargs, jboolean); + else if (arg_elts[i] == JvPrimClass (char)) + values[i].c = va_arg (vargs, jchar); + else + { + // An object. + values[i].l = va_arg (vargs, jobject); + } + } +} + +// This can call any sort of method: virtual, "nonvirtual", static, or +// constructor. +template +static T +_Jv_JNI_CallAnyMethodV (JNIEnv *env, jobject obj, jclass klass, + jmethodID id, va_list vargs) +{ + if (style == normal) + id = _Jv_LookupDeclaredMethod (obj->getClass (), id->name, id->signature); + + jclass decl_class = klass ? klass : obj->getClass (); + JvAssert (decl_class != NULL); + + jclass return_type; + JArray *arg_types; + // FIXME: exception processing. + _Jv_GetTypesFromSignature (id, decl_class, + &arg_types, &return_type); + + jvalue args[arg_types->length]; + array_from_valist (args, arg_types, vargs); + + jvalue result; + jthrowable ex = _Jv_CallAnyMethodA (obj, return_type, id, + style == constructor, + arg_types, args, &result); + + if (ex != NULL) + get_throwable (env) = ex; + + // We cheat a little here. FIXME. + return * (T *) &result; +} + +template +static T +_Jv_JNI_CallAnyMethod (JNIEnv *env, jobject obj, jclass klass, + jmethodID method, ...) +{ + va_list args; + T result; + + va_start (args, method); + result = _Jv_JNI_CallAnyMethodV (env, obj, klass, method, args); + va_end (args); + + return result; +} + +template +static T +_Jv_JNI_CallAnyMethodA (JNIEnv *env, jobject obj, jclass klass, + jmethodID id, jvalue *args) +{ + if (style == normal) + id = _Jv_LookupDeclaredMethod (obj->getClass (), id->name, id->signature); + + jclass decl_class = klass ? klass : obj->getClass (); + JvAssert (decl_class != NULL); + + jclass return_type; + JArray *arg_types; + // FIXME: exception processing. + _Jv_GetTypesFromSignature (id, decl_class, + &arg_types, &return_type); + + jvalue result; + jthrowable ex = _Jv_CallAnyMethodA (obj, return_type, id, + style == constructor, + arg_types, args, &result); + + if (ex != NULL) + get_throwable (env) = ex; + + // We cheat a little here. FIXME. + return * (T *) &result; +} + +template +static void +_Jv_JNI_CallAnyVoidMethodV (JNIEnv *env, jobject obj, jclass klass, + jmethodID id, va_list vargs) +{ + if (style == normal) + id = _Jv_LookupDeclaredMethod (obj->getClass (), id->name, id->signature); + + jclass decl_class = klass ? klass : obj->getClass (); + JvAssert (decl_class != NULL); + + jclass return_type; + JArray *arg_types; + // FIXME: exception processing. + _Jv_GetTypesFromSignature (id, decl_class, + &arg_types, &return_type); + + jvalue args[arg_types->length]; + array_from_valist (args, arg_types, vargs); + + jthrowable ex = _Jv_CallAnyMethodA (obj, return_type, id, + style == constructor, + arg_types, args, NULL); + + if (ex != NULL) + get_throwable (env) = ex; +} + +template +static void +_Jv_JNI_CallAnyVoidMethod (JNIEnv *env, jobject obj, jclass klass, + jmethodID method, ...) +{ + va_list args; + + va_start (args, method); + _Jv_JNI_CallAnyVoidMethodV