BZ #88: CACAO + OpenJDK fails Hotspot compiler test 6571539

Status fields:

creation_ts:2008-07-07 17:49
component:verifier
version:0.99.1
rep_platform:All
op_sys:Linux
bug_status:NEW
reporter:gnu_andrew@member.fsf.org
This is with 0.99.1 + the PPC64 patch
(http://mips.complang.tuwien.ac.at/hg/cacao/rev/bb85a81bf759)

java.lang.LinkageError: subtype constraint violated (C4 is not a subclass of
java.lang.Iterable)
        at Test.<clinit>(Test.java:15)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:186)
        at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:88)
        at java.lang.Thread.run(Thread.java:636)
STATUS:Failed.`main' threw exception: java.lang.LinkageError: subtype constraint
violated (C4 is not a subclass of java.lang.Iterable)
result: Failed. Execution failed: `main' threw exception: java.lang.LinkageError:
subtype constraint violated (C4 is not a subclass of java.lang.Iterable)

Comment #1 by twisti@complang.tuwien.ac.at on 2008-07-08 10:24:42

Edwin, is this one related to #82?

Comment #2 by edwin.steiner@gmx.net on 2008-07-11 13:02:53

I looked at test 6571539 and it uses a class bad/C4.java that violates
a subtype constrained on purpose (see hotspot/test/compiler/6571539/Test.java).

The problem is that the test expects to get a IncompatibleClassChangeError
when object.iterator() is called for the bad object for the first time.

CACAO, however, throws a LinkageError when the <clinit> method does this:

    static Iterable badObject = new C4();

Correctly, I think, since C4 does not implement Iterable (the C4.class at
runtime is from bad/C4.java).

I know that HotSpot is correct by definition, but still: Why should any VM
accept this assignment that violates the Java type system?

The JVM Spec says about PUTSTATIC:

    If the field descriptor type is a reference type, then the value must
    be of a type that is assignment compatible (ยง2.6.7) with the field
    descriptor type.

Do we really have to check that at runtime each time the PUTSTATIC is
executed?

Comment #3 by twisti@complang.tuwien.ac.at on 2008-07-20 12:42:55

I take this one and will write an email to hotspot-dev.

Comment #4 by twisti@complang.tuwien.ac.at on 2008-07-20 12:46:44

For the record:

http://mail.openjdk.java.net/pipermail/hotspot-dev/2008-July/000490.html

Comment #5 by twisti@complang.tuwien.ac.at on 2008-07-21 09:54:36

PR 90 seems to be the same bug.

Comment #6 by twisti@complang.tuwien.ac.at on 2008-07-22 09:29:16

From:   David Holmes - Sun Microsystems <David.Holmes@Sun.COM>
To:     Christian Thalinger <twisti@complang.tuwien.ac.at>
Subject:        Re: Hotspot compiler test 6571539 problem with CACAO
Date:   Tue, 22 Jul 2008 08:21:35 +1000 (00:21 CEST)


PS. For some historical references:

http://gcc.gnu.org/ml/java/2001-01/msg00213.html

and section 7 of 1998's "A Specification of Java Loading and Bytecode
Verification" (http://citeseer.ist.psu.edu/goldberg98specification.html).

David

Comment #7 by stefan@complang.tuwien.ac.at on 2008-09-04 19:35:42

Created an attachment (id=46)
Verifier patch

This one seems to fix the Verifier. It also allows Groovy to run (#90).

Of course, nasty things happen at the time invokeinterface is actually executed.

Comment #8 by stefan@complang.tuwien.ac.at on 2008-09-04 19:55:01

Clojure works as well (bug 82).

Attachment id=46

date:2008-09-04 19:35
desc:Verifier patch
type:text/plain
download:udif