collection of small fixes from running runtime tests with -Xcomp

Zoltán Majó zoltan.majo at oracle.com
Wed Mar 15 10:29:55 UTC 2017


Hi,


On 03/15/2017 09:00 AM, Tobias Hartmann wrote:
> Hi Roland,
>
> On 14.03.2017 17:16, Roland Westrelin wrote:
>> [...]
>>
>> Sometimes a lambda form compiled as the root of a compilation has a
>> signature with object parameters but is passed a value type: so it's
>> passed fields but has no way to know. This could be fixed by always
>> passing value types as references when the target is a lambda form. But
>> then, method handles intrinsics could get reference inputs and call a
>> method that expects value types to be passed as fields. So the code in
>> MethodHandles::generate_method_handle_dispatch() would need to be
>> adjusted to shuffle arguments. That all sounds too complicated so
>> instead I disallowed lambda form as root of compilations.
> I wonder if it's okay to treat value types as objects in such cases.
>
> Zoltan, you found some related problems right?

Yes. A version of Maurizio's PointValues program triggered an error in 
C2's type system.

The test attempted to pass a Q-type to an MethodHandle.invoke(Object o). 
That results in a type system error at the moment, as C2 considers a 
Q-type and and L-type to be "unrelated". (The test would, of course 
work, if the Q-type was first boxed to the matching L-type before 
calling the invoke method.)

So maybe the question is: Is a value type a subclass of a 
java.lang.Object? If yes, we should make C2 aware of that. If not, then 
I think it's a good idea to bail out compilation if the compiler detects 
that a Q-type is used in place of an L-type.

Currently, an L-type and the matching Q-type have the same memory 
layout, so we could treat them as being the same. But by starting to 
doing so we'll most likely encounter some difficult-to-trace errors. So 
I'm more for bailing out compilations (or updating the type system to 
consider Q-types as subclasses of java.lang.Object).

Best regards,


Zoltan

>
> I think it would make sense to add "-Xcomp -XX:-TieredCompilation" to the runtime tests (I did that before, see patch below).
>
> Thanks,
> Tobias
>
>
> --- old/test/runtime/valhalla/valuetypes/DeriveValueTypeCreation.java	2017-03-15 08:54:48.004842144 +0100
> +++ new/test/runtime/valhalla/valuetypes/DeriveValueTypeCreation.java	2017-03-15 08:54:47.936842147 +0100
> @@ -43,6 +43,7 @@
>    * @library /testlibrary /
>    * @build runtime.valhalla.valuetypes.ValueCapableClass
>    * @run main/othervm -Xint -noverify runtime.valhalla.valuetypes.DeriveValueTypeCreation
> + * @run main/othervm -Xcomp -XX:-TieredCompilation -noverify runtime.valhalla.valuetypes.DeriveValueTypeCreation
>    */
>   public class DeriveValueTypeCreation {
>   
> --- old/test/runtime/valhalla/valuetypes/InvokeDirect.java	2017-03-15 08:54:48.256842132 +0100
> +++ new/test/runtime/valhalla/valuetypes/InvokeDirect.java	2017-03-15 08:54:48.188842136 +0100
> @@ -7,6 +7,7 @@
>    * @summary Value Type invokedirect bytecode test (incomplete until type system defn done)
>    * @library /testlibrary /
>    * @run main/othervm -noverify -Xint runtime.valhalla.valuetypes.InvokeDirect
> + * @run main/othervm -noverify -Xcomp -XX:-TieredCompilation runtime.valhalla.valuetypes.InvokeDirect
>    */
>   public class InvokeDirect {
>       public static void main(String[] args) {
> --- old/test/runtime/valhalla/valuetypes/VDefaultTest.java	2017-03-15 08:54:48.512842121 +0100
> +++ new/test/runtime/valhalla/valuetypes/VDefaultTest.java	2017-03-15 08:54:48.444842124 +0100
> @@ -30,6 +30,7 @@
>    * @summary vdefault bytecode test
>    * @library /testlibrary /
>    * @run main/othervm -noverify -Xint runtime.valhalla.valuetypes.VDefaultTest
> + * @run main/othervm -noverify -Xcomp -XX:-TieredCompilation runtime.valhalla.valuetypes.VDefaultTest
>    */
>   
>   public class VDefaultTest {
> --- old/test/runtime/valhalla/valuetypes/VWithFieldTest.java	2017-03-15 08:54:48.756842109 +0100
> +++ new/test/runtime/valhalla/valuetypes/VWithFieldTest.java	2017-03-15 08:54:48.692842112 +0100
> @@ -30,6 +30,7 @@
>    * @summary vwithfield bytecode test
>    * @library /testlibrary /
>    * @run main/othervm -noverify -Xint runtime.valhalla.valuetypes.VWithFieldTest
> + * @run main/othervm -noverify -Xcomp -XX:-TieredCompilation runtime.valhalla.valuetypes.VWithFieldTest
>    */
>   
>   public class VWithFieldTest {
> --- old/test/runtime/valhalla/valuetypes/ValueTypeArray.java	2017-03-15 08:54:49.000842098 +0100
> +++ new/test/runtime/valhalla/valuetypes/ValueTypeArray.java	2017-03-15 08:54:48.936842101 +0100
> @@ -33,6 +33,8 @@
>    * @library /testlibrary /
>    * @run main/othervm -noverify -Xint -XX:+ValueArrayFlatten runtime.valhalla.valuetypes.ValueTypeArray
>    * @run main/othervm -noverify -Xint -XX:-ValueArrayFlatten runtime.valhalla.valuetypes.ValueTypeArray
> + * @run main/othervm -noverify -Xcomp -XX:-TieredCompilation -XX:+ValueArrayFlatten runtime.valhalla.valuetypes.ValueTypeArray
> + * @run main/othervm -noverify -Xcomp -XX:-TieredCompilation -XX:-ValueArrayFlatten runtime.valhalla.valuetypes.ValueTypeArray
>    */
>   public class ValueTypeArray {
>       public static void main(String[] args) {
> --- old/test/runtime/valhalla/valuetypes/ValueTypeCreation.java	2017-03-15 08:54:49.248842086 +0100
> +++ new/test/runtime/valhalla/valuetypes/ValueTypeCreation.java	2017-03-15 08:54:49.180842089 +0100
> @@ -7,6 +7,7 @@
>    * @summary Value Type creation test
>    * @library /testlibrary /
>    * @run main/othervm -noverify -Xint runtime.valhalla.valuetypes.ValueTypeCreation
> + * @run main/othervm -noverify -Xcomp -XX:-TieredCompilation runtime.valhalla.valuetypes.ValueTypeCreation
>    */
>   public class ValueTypeCreation {
>       public static void main(String[] args) {
> --- old/test/runtime/valhalla/valuetypes/ValueTypeDensity.java	2017-03-15 08:54:49.496842075 +0100
> +++ new/test/runtime/valhalla/valuetypes/ValueTypeDensity.java	2017-03-15 08:54:49.428842078 +0100
> @@ -36,6 +36,7 @@
>    * @run driver ClassFileInstaller sun.hotspot.WhiteBox
>    *                                sun.hotspot.WhiteBox$WhiteBoxPermission
>    * @run main/othervm -noverify -Xint -XX:+ValueArrayFlatten -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ValueTypeDensity
> + * @run main/othervm -noverify -Xcomp -XX:-TieredCompilation -XX:+ValueArrayFlatten -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ValueTypeDensity
>    */
>   
>   public class ValueTypeDensity {
> --- old/test/runtime/valhalla/valuetypes/ValueTypeGetField.java	2017-03-15 08:54:49.752842063 +0100
> +++ new/test/runtime/valhalla/valuetypes/ValueTypeGetField.java	2017-03-15 08:54:49.684842066 +0100
> @@ -7,6 +7,7 @@
>    * @summary Value Type get field test
>    * @library /testlibrary /
>    * @run main/othervm -noverify -Xint runtime.valhalla.valuetypes.ValueTypeGetField
> + * @run main/othervm -noverify -Xcomp -XX:-TieredCompilation runtime.valhalla.valuetypes.ValueTypeGetField
>    */
>   public class ValueTypeGetField {
>   
> --- old/test/runtime/valhalla/valuetypes/VboxUnbox.java	2017-03-15 08:54:50.008842051 +0100
> +++ new/test/runtime/valhalla/valuetypes/VboxUnbox.java	2017-03-15 08:54:49.940842054 +0100
> @@ -33,6 +33,7 @@
>    * @library /testlibrary /
>    * @build runtime.valhalla.valuetypes.ValueCapableClass
>    * @run main/othervm -Xint -noverify runtime.valhalla.valuetypes.VboxUnbox
> + * @run main/othervm -Xcomp -XX:-TieredCompilation -noverify runtime.valhalla.valuetypes.VboxUnbox
>    *
>    * To dump generated byte-code, add "-Dvalhalla.dumpIsolatedMethodClasses=/tmp/foo"
>    */
>




More information about the valhalla-dev mailing list