hg: valhalla/valhalla/jdk: Fix specializer bug reported by Peter Levart related to improper handling of not-fully-instantiated class literals

Peter Levart peter.levart at gmail.com
Sat Jan 10 14:20:35 UTC 2015


On 01/09/2015 10:44 PM, brian.goetz at oracle.com wrote:
> Changeset: 7a3e4270521d
> Author:    briangoetz
> Date:      2015-01-09 16:44 -0500
> URL:       http://hg.openjdk.java.net/valhalla/valhalla/jdk/rev/7a3e4270521d
>
> Fix specializer bug reported by Peter Levart related to improper handling of not-fully-instantiated class literals
>
> ! src/java.base/share/classes/valhalla/specializer/Specializer.java
> ! test/valhalla/test/valhalla/specializer/GenericMethodsTest.java
>

Thanks, I have another one. This time I think there's a problem with 
array initializer in specialized code:

public class Pair<any T> {

     T[] array;

     public Pair(T v1, T v2) {
         array = new T[]{v1, v2};
         System.out.println("Ok for " + getClass());
     }

     public static void main(String[] args) {
         new Pair<String>("aaa", "bbb");
         new Pair<int>(1, 2);
         new Pair<float>(1.1f, 2.2f);
     }
}


This is the runtime failure:

Ok for class Pair
Specializing Pair${0=I}; searching for Pair.class (not found)
Specializing Pair${0=I}; searching for Pair.class (found)
Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
   Location:
     Pair${0=I}.<init>(II)V @11: aastore
   Reason:
     Type integer (current frame, stack[4]) is not assignable to 
'java/lang/Object'
   Current Frame:
     bci: @11
     flags: { }
     locals: { 'Pair${0=I}', integer, integer }
     stack: { 'Pair${0=I}', '[I', '[I', integer, integer }
   Bytecode:
     0000000: 2ab7 000d 2a05 bc0a 5903 1b53 5904 1c53
     0000010: b500 0fb2 0015 bb00 1759 b700 1812 1ab6
     0000020: 001e 2ab6 0022 b600 25b6 0029 b600 2fb1
     0000030:

         at Pair.main(Pair.java:15)


Regards, Peter



More information about the valhalla-dev mailing list