BZ #100: JSR166 TCK fails with e.g. java.lang.IllegalAccessException on powerpc64

Status fields:

creation_ts:2008-08-19 10:51
component:jit
version:default branch
rep_platform:powerpc64
op_sys:Linux
bug_status:RESOLVED
resolution:FIXED
reporter:twisti@complang.tuwien.ac.at
$ java -cp /usr/share/java/junit4.jar:. org.junit.runner.JUnitCore JSR166TestCase
JUnit version 4.3.1
.E
Time: 0.005
There was 1 failure:
1) initializationError0(JSR166TestCase)
java.lang.IllegalAccessException: JSR166TestCase.<clinit>()V not accessible from
org.junit.runners.AllTests
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.junit.runners.AllTests.testFromSuiteMethod(AllTests.java:36)
        at org.junit.runners.AllTests.<init>(AllTests.java:25)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccess
orImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruct
orAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
        at org.junit.internal.requests.ClassRequest.buildRunner(ClassRequest.java:33)
        at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:28)
        at org.junit.internal.requests.ClassesRequest.getRunner(ClassesRequest.java:21)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:109)
        at org.junit.runner.JUnitCore.run(JUnitCore.java:100)
        at org.junit.runner.JUnitCore.runMain(JUnitCore.java:81)
        at org.junit.runner.JUnitCore.main(JUnitCore.java:44)

FAILURES!!!
Tests run: 1,  Failures: 1

Comment #1 by twisti@complang.tuwien.ac.at on 2008-08-19 10:51:34

$ java -cp /usr/share/java/junit4.jar:. JSR166TestCase
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
...............................E.E.E.E.E.E.E.E.E.E.
E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.E.
E.E.E.E.E.....................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
..........E.E.E.............................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................................
.........................
Time: 0.4
There were 59 errors:
1) testConstructor1(DelayQueueTest)     at JSR166TestCase.main(JSR166TestCase.java:98)
2) testConstructor3(DelayQueueTest)     at JSR166TestCase.main(JSR166TestCase.java:98)
3) testConstructor4(DelayQueueTest)     at JSR166TestCase.main(JSR166TestCase.java:98)
4) testConstructor5(DelayQueueTest)     at JSR166TestCase.main(JSR166TestCase.java:98)
5) testConstructor6(DelayQueueTest)     at JSR166TestCase.main(JSR166TestCase.java:98)
6) testEmpty(DelayQueueTest)    at JSR166TestCase.main(JSR166TestCase.java:98)
7) testRemainingCapacity(DelayQueueTest)        at
JSR166TestCase.main(JSR166TestCase.java:98)
8) testOfferNull(DelayQueueTest)        at JSR166TestCase.main(JSR166TestCase.java:98)
9) testAddNull(DelayQueueTest)  at JSR166TestCase.main(JSR166TestCase.java:98)
10) testOffer(DelayQueueTest)   at JSR166TestCase.main(JSR166TestCase.java:98)
11) testAdd(DelayQueueTest)     at JSR166TestCase.main(JSR166TestCase.java:98)
12) testAddAll1(DelayQueueTest) at JSR166TestCase.main(JSR166TestCase.java:98)
13) testAddAllSelf(DelayQueueTest)      at JSR166TestCase.main(JSR166TestCase.java:98)
14) testAddAll2(DelayQueueTest) at JSR166TestCase.main(JSR166TestCase.java:98)
15) testAddAll3(DelayQueueTest) at JSR166TestCase.main(JSR166TestCase.java:98)
16) testAddAll5(DelayQueueTest) at JSR166TestCase.main(JSR166TestCase.java:98)
17) testPutNull(DelayQueueTest) at JSR166TestCase.main(JSR166TestCase.java:98)
18) testPut(DelayQueueTest)     at JSR166TestCase.main(JSR166TestCase.java:98)
19) testPutWithTake(DelayQueueTest)     at JSR166TestCase.main(JSR166TestCase.java:98)
20) testTimedOffer(DelayQueueTest)      at JSR166TestCase.main(JSR166TestCase.java:98)
21) testTake(DelayQueueTest)    at JSR166TestCase.main(JSR166TestCase.java:98)
22) testTakeFromEmpty(DelayQueueTest)   at JSR166TestCase.main(JSR166TestCase.java:98)
23) testBlockingTake(DelayQueueTest)    at JSR166TestCase.main(JSR166TestCase.java:98)
24) testPoll(DelayQueueTest)    at JSR166TestCase.main(JSR166TestCase.java:98)
25) testTimedPoll0(DelayQueueTest)      at JSR166TestCase.main(JSR166TestCase.java:98)
26) testTimedPoll(DelayQueueTest)       at JSR166TestCase.main(JSR166TestCase.java:98)
27) testInterruptedTimedPoll(DelayQueueTest)    at
JSR166TestCase.main(JSR166TestCase.java:98)
28) testTimedPollWithOffer(DelayQueueTest)      at
JSR166TestCase.main(JSR166TestCase.java:98)
29) testPeek(DelayQueueTest)    at JSR166TestCase.main(JSR166TestCase.java:98)
30) testElement(DelayQueueTest) at JSR166TestCase.main(JSR166TestCase.java:98)
31) testRemove(DelayQueueTest)  at JSR166TestCase.main(JSR166TestCase.java:98)
32) testRemoveElement(DelayQueueTest)   at JSR166TestCase.main(JSR166TestCase.java:98)
33) testContains(DelayQueueTest)        at JSR166TestCase.main(JSR166TestCase.java:98)
34) testClear(DelayQueueTest)   at JSR166TestCase.main(JSR166TestCase.java:98)
35) testContainsAll(DelayQueueTest)     at JSR166TestCase.main(JSR166TestCase.java:98)
36) testRetainAll(DelayQueueTest)       at JSR166TestCase.main(JSR166TestCase.java:98)
37) testRemoveAll(DelayQueueTest)       at JSR166TestCase.main(JSR166TestCase.java:98)
38) testToArray(DelayQueueTest) at JSR166TestCase.main(JSR166TestCase.java:98)
39) testToArray2(DelayQueueTest)        at JSR166TestCase.main(JSR166TestCase.java:98)
40) testToArray_BadArg(DelayQueueTest)  at JSR166TestCase.main(JSR166TestCase.java:98)
41) testToArray1_BadArg(DelayQueueTest) at JSR166TestCase.main(JSR166TestCase.java:98)
42) testIterator(DelayQueueTest)        at JSR166TestCase.main(JSR166TestCase.java:98)
43) testIteratorRemove(DelayQueueTest)  at JSR166TestCase.main(JSR166TestCase.java:98)
44) testToString(DelayQueueTest)        at JSR166TestCase.main(JSR166TestCase.java:98)
45) testPollInExecutor(DelayQueueTest)  at JSR166TestCase.main(JSR166TestCase.java:98)
46) testDelay(DelayQueueTest)   at JSR166TestCase.main(JSR166TestCase.java:98)
47) testPeekDelayed(DelayQueueTest)     at JSR166TestCase.main(JSR166TestCase.java:98)
48) testPollDelayed(DelayQueueTest)     at JSR166TestCase.main(JSR166TestCase.java:98)
49) testTimedPollDelayed(DelayQueueTest)        at
JSR166TestCase.main(JSR166TestCase.java:98)
50) testDrainToNull(DelayQueueTest)     at JSR166TestCase.main(JSR166TestCase.java:98)
51) testDrainToSelf(DelayQueueTest)     at JSR166TestCase.main(JSR166TestCase.java:98)
52) testDrainTo(DelayQueueTest) at JSR166TestCase.main(JSR166TestCase.java:98)
53) testDrainToWithActivePut(DelayQueueTest)    at
JSR166TestCase.main(JSR166TestCase.java:98)
54) testDrainToNullN(DelayQueueTest)    at JSR166TestCase.main(JSR166TestCase.java:98)
55) testDrainToSelfN(DelayQueueTest)    at JSR166TestCase.main(JSR166TestCase.java:98)
56) testDrainToN(DelayQueueTest)        at JSR166TestCase.main(JSR166TestCase.java:98)
57) testRemove(ThreadLocalTest) at JSR166TestCase.main(JSR166TestCase.java:98)
58) testRemoveITL(ThreadLocalTest)      at JSR166TestCase.main(JSR166TestCase.java:98)
59) testGenericITL(ThreadLocalTest)     at JSR166TestCase.main(JSR166TestCase.java:98)

FAILURES!!!
Tests run: 2034,  Failures: 0,  Errors: 59

Comment #2 by twisti@complang.tuwien.ac.at on 2008-08-19 15:02:53

This one breaks it on the default branch:

http://mips.complang.tuwien.ac.at/hg/cacao/rev/1462ebee626f

I hope I find it on the twisti branch.

Comment #3 by twisti@complang.tuwien.ac.at on 2008-08-19 17:37:32

The problem only happend on big-endian machines and is like the following:

In line:

http://mips.complang.tuwien.ac.at/hg/cacao/file/f9a67d917b8f/src/vm/javaobjects.hpp#l251
3

sizeof(m - m->clazz->methods) is 8 on 64-bit machines, but "slot" is an int32_t field.
Since we simply use set() without a size modifier, a 64-bit value is written.  This is
actually OK as the following field is a pointer and aligned to 8-byte, giving the "slot"
field 8-byte space.  So the store does not overwrite the following field, but storing
the wrong value in the lower 32-bits on BE machines.  Obviously the value written is
correct on LE machines.

Comment #4 by twisti@complang.tuwien.ac.at on 2008-08-19 18:05:20

Fixed in: http://mips.complang.tuwien.ac.at/hg/cacao/rev/624cab354a43