bug in "8183130: [MVT] Implement intrinsics for Q-typed LambdaForms"?

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Jul 6 11:54:16 UTC 2017


I've been able to reproduce and fix - see RFR for JDK-8183929

Cheers
Maurizio

On 06/07/17 10:45, Maurizio Cimadamore wrote:
> I'll take a look
>
> Maurizio
>
>
> On 06/07/17 10:30, Roland Westrelin wrote:
>> The simple test below passes with the revision right before 8183130 and
>> fails (detects incorrect result) with 8183130. It passes again if I
>> change:
>>
>> vt.verify(test94_bool ? test94_vt1 : test94_vt2);
>>
>> to:
>>
>> vt.verify(test94_bool ? test94_vt2 : test94_vt1);
>>
>> which is obviously incorrect.
>>
>> Roland.
>>
>> diff --git 
>> a/test/compiler/valhalla/valuetypes/ValueTypeTestBench.java 
>> b/test/compiler/valhalla/valuetypes/ValueTypeTestBench.java
>> --- a/test/compiler/valhalla/valuetypes/ValueTypeTestBench.java
>> +++ b/test/compiler/valhalla/valuetypes/ValueTypeTestBench.java
>> @@ -2422,6 +2422,14 @@
>>                 MethodType test86_mt = 
>> MethodType.fromMethodDescriptorString("(Qcompiler/valhalla/valuetypes/MyValue1;)I", 
>> ValueTypeTestBench.class.getClassLoader());
>>               test86_mh = 
>> lookup.findVirtual(ValueTypeTestBench.class, "test86_target", 
>> test86_mt);
>> +
>> +            MethodType test94_mt = 
>> MethodType.fromMethodDescriptorString("()Qcompiler/valhalla/valuetypes/MyValue3;", 
>> ValueTypeTestBench.class.getClassLoader());
>> +            MethodHandle test94_mh1 = 
>> lookup.findVirtual(ValueTypeTestBench.class, "test94_target1", 
>> test94_mt);
>> +            MethodHandle test94_mh2 = 
>> lookup.findVirtual(ValueTypeTestBench.class, "test94_target2", 
>> test94_mt);
>> +            MethodType test94_mt2 = 
>> MethodType.methodType(boolean.class);
>> +            MethodHandle test94_mh_test = 
>> lookup.findVirtual(ValueTypeTestBench.class, "test94_test", test94_mt2);
>> +            test94_mh = MethodHandles.guardWithTest(test94_mh_test, 
>> test94_mh1, test94_mh2);
>> +
>>           } catch (NoSuchMethodException|IllegalAccessException e) {
>>               throw new RuntimeException("method handle lookup fails");
>>           }
>> @@ -2605,6 +2613,40 @@
>>           Asserts.assertEQ(result, 0L);
>>       }
>>   +    // method handle combinators
>> +    final MyValue3 test94_vt1 = MyValue3.create();
>> +    @ForceInline
>> +    MyValue3 test94_target1() {
>> +        return test94_vt1;
>> +    }
>> +
>> +    final MyValue3 test94_vt2 = MyValue3.create();
>> +    @ForceInline
>> +    MyValue3 test94_target2() {
>> +        return test94_vt2;
>> +    }
>> +
>> +    boolean test94_bool = true;
>> +    @ForceInline
>> +    boolean test94_test() {
>> +        return test94_bool;
>> +    }
>> +
>> +    static final MethodHandle test94_mh;
>> +
>> +    @Test
>> +    MyValue3 test94() throws Throwable {
>> +        return (MyValue3)test94_mh.invokeExact(this);
>> +    }
>> +
>> +    @DontCompile
>> +    public void test94_verifier(boolean warmup) throws Throwable {
>> +        test94_bool = !test94_bool;
>> +        MyValue3 vt = test94();
>> +        vt.verify(test94_bool ? test94_vt1 : test94_vt2);
>> +    }
>> +
>> +
>>       // ========== Test infrastructure ==========
>>         private static final WhiteBox WHITE_BOX = 
>> WhiteBox.getWhiteBox();
>> @@ -2679,7 +2721,7 @@
>>       }
>>         public static void main(String[] args) throws Throwable {
>> -        //tests.values().removeIf(p -> 
>> !p.getName().equals("test85")); // Run single test
>> +        tests.values().removeIf(p -> !p.getName().equals("test94")); 
>> // Run single test
>>           if (args.length == 0) {
>>               execute_vm("-XX:+IgnoreUnrecognizedVMOptions", 
>> "-XX:-BackgroundCompilation",
>>                       "-XX:+PrintCompilation", "-XX:+PrintInlining", 
>> "-XX:+PrintIdeal", "-XX:+PrintOptoAssembly",
>



More information about the valhalla-dev mailing list