This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Non-indirect-dispatch and failed loading of classes


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Haley wrote:
> Ranjit Mathew writes:
>  > -----BEGIN PGP SIGNED MESSAGE-----
>  > Hash: SHA1
>  > 
>  > Hi,
>  > 
>  >   Consider the following:
>  > 
>  > Foo.java:
>  >   class Foo { }
>  > 
>  > Bar.java:
>  >   class Bar extends Foo { }
>  > 
>  > Compile both to bytecode and then remove Foo.*. Now try to
>  > compile Bar.class to object code (non-indirect-dispatch).
>  > We get an internal error with current mainline.
> 
> We should get a class not found error.

We do get an error, but it's not a fatal error and we die
later trying to lay out this class:

  ~/src/GCJ/PR20031 > $MYGCJ -c Bar.class
  Bar.java:0: error: cannot find file for class Foo
  Bar.java:0: error: cannot find file for class Foo
  Bar.java:0: confused by earlier errors, bailing out

Under a debugger:
- --------------------------------- 8< ---------------------------------
(gdb) r
Starting program: /extra/src/gcc/build/gcc/jc1 Bar.class
- -fhash-synchronization-fno-use-divide-subroutine -fuse-boehm-gc
- -fnon-call-exceptions -fomit-frame-pointer -fkeep-inline-functions
- -quiet -dumpbase Bar.class -march=pentium3 -auxbase Bar -g1
- -I/extra/src/gcc/build/i686-pc-linux-gnu/libjava/libgcj-4.1.0.jar -o
/tmp/ccbWIDLt.s
Bar.java:0: error: cannot find file for class Foo
Bar.java:0: error: cannot find file for class Foo

Program received signal SIGSEGV, Segmentation fault.
0x0806d8c1 in layout_class_methods (this_class=0xb7e34bdc)
    at /extra/src/gcc/gcc-20050907/gcc/java/class.c:2265
2265          if (!TYPE_NVIRTUALS (super_class))
(gdb)
- --------------------------------- 8< ---------------------------------


>  > In this change:
>  > 
>  > http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/java/jcf-parse.c.diff?r1=1.158&r2=1.158.4.1
>  > 
>  > load_class() sets TYPE_DUMMY for a RECORD_TYPE if we failed to
>  > load it, but that bit is effected only for non-indirect-dispatch.
>  > 
>  > Is there a reason we can't make this independent of indirect-dispatch?
> 
> Yes.  When not using indirect dispatch we verify classes at compile
> time, and thus we really need to have them around.

But the loading of the class was *unsuccessful* for the case in
question. Do we have any hope of finding it later?

Thanks,
Ranjit.

- --
Ranjit Mathew       Email: rmathew AT gmail DOT com

Bangalore, INDIA.     Web: http://ranjitmathew.hostingzero.com/




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDIFE2Yb1hx2wRS48RAk/gAKCcJksy6T7EtVJS5Gjvjvq/oCciNACfWEtJ
ttuxMwKGQlHfHl3sjrsZXNI=
=9rWl
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]