Patch: Fix PR 23891 / Eclipse bootstrap

Matthias Klose doko@cs.tu-berlin.de
Fri Sep 16 14:04:00 GMT 2005


Bryce McKinlay writes:
> Bootstrapping of gcj-compiled native Eclipse, which uses gcj to build 
> Eclipse's own bytecode compiler, ecj, broke recently on both HEAD and 
> the 4.0 branch.
> 
> The problem is that when folding constants which depend on other 
> constants, the current_class context is pushed, but the package context 
> (cxtp->context) is not, so it attempts to resolve using the wrong 
> package. This regression was introduced (and subsequently backported to 
> the 4.0 branch) with the fix for java/17845. Although that patch itself 
> is correct, it exposed this problem by removing a (bogus) fallback case 
> where gcj would search in all known packages for a class definition.
> 
>  This patch fixes the problem by introducing a TYPE_PACKAGE lang 
> specific field, and changing do_resolve_class so that the package is 
> determined based on current_class and not ctxp->package which may not be 
> valid except during parsing. Adding TYPE_PACKAGE also allows other parts 
> of the compiler to be simplified, eg class_in_current_package().
> 
> No libjava testsuite regressions, and ecj now builds. However, currently 
> I see the following changes in JACKS results with this patch applied:
> 
> FAIL: 15.9.1-qualified-concrete-24
> XPASS: 15.12.2.1-accessibility-method-2
> FAIL: 15.12.2.1-accessibility-method-3
> XPASS: 15.12.2.1-accessibility-method-4
> FAIL: 15.12.2.1-accessibility-method-5
> 
> These are cross-package hidden member visibility tests. They seem to be 
> cases that we "accidentally" passed or failed for the wrong reasons 
> previously. Even if they compiled before, the code generated was 
> unlikely to be correct. I think that given the need for this patch to 
> get Eclipse working again, they can be addressed in a follow up patch.

applying this patch to the current 4.0 branch, I get an ICE for a
compiler configured for i486-linux-gnu:

/home/packages/gcc/4.0/gcc-4.0-4.0.1/build/gcc/gcj -B/home/packages/gcc/4.0/gcc-4.0-4.0.1/build/gcc/ -B/usr/i486-linux-gnu/bin/ -B/usr/i486-linux-gnu/lib/ -isystem /usr/i486-linux-gnu/include -isystem /usr/i486-linux-gnu/sys-include --encoding=UTF-8 -Wno-deprecated -C -g -classpath '' -bootclasspath /home/packages/gcc/4.0/gcc-4.0-4.0.1/build/i486-linux-gnu/libjava':'../../../src/libjava':'../../../src/libjava/external/w3c_dom':'../../../src/libjava/external/sax -d /home/packages/gcc/4.0/gcc-4.0-4.0.1/build/i486-linux-gnu/libjava \
        -MD -MF gnu/java/security/util.deps @gnu/java/security/util.list
../../../src/libjava/java/io/ObjectStreamClass.java:930: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Program received signal SIGSEGV, Segmentation fault.
0x08057f30 in do_resolve_class ()
(gdb) bt
#0  0x08057f30 in do_resolve_class ()
#1  0x08057e0a in do_resolve_class ()
#2  0x08057e0a in do_resolve_class ()
#3  0x0806c69d in maybe_layout_super_class ()
#4  0x0806de6b in layout_class ()
#5  0x0804cb44 in safe_layout_class ()
#6  0x0806c66c in maybe_layout_super_class ()
#7  0x0806de6b in layout_class ()
#8  0x0804cb44 in safe_layout_class ()
#9  0x0806c66c in maybe_layout_super_class ()
#10 0x0806de6b in layout_class ()
#11 0x0804cb44 in safe_layout_class ()
#12 0x0806c66c in maybe_layout_super_class ()
#13 0x0806de6b in layout_class ()
#14 0x0808ce9e in read_class ()
#15 0x0808d142 in load_class ()
#16 0x08063c66 in java_complete_class ()
#17 0x0808d029 in read_class ()
#18 0x0808d142 in load_class ()
#19 0x08057ff4 in do_resolve_class ()
#20 0x08058107 in resolve_class ()
#21 0x080582a4 in jdep_resolve_class ()
#22 0x08063b54 in java_complete_class ()
#23 0x0808d029 in read_class ()
#24 0x0808d142 in load_class ()
#25 0x08063c66 in java_complete_class ()
#26 0x0808d029 in read_class ()
#27 0x0808d142 in load_class ()
#28 0x08063c66 in java_complete_class ()
#29 0x0808d029 in read_class ()
#30 0x0808d142 in load_class ()
#31 0x08063c66 in java_complete_class ()
#32 0x0808d029 in read_class ()
#33 0x0808d142 in load_class ()
#34 0x08063c66 in java_complete_class ()
#35 0x0808d728 in java_parse_file ()
#36 0x08306703 in toplev_main ()
#37 0x5559ee36 in __libc_start_main () from /lib/libc.so.6
#38 0x08049ec1 in _start () at ../sysdeps/i386/elf/start.S:102



More information about the Java-patches mailing list