hg: valhalla/valhalla: 8222711: [lworld] Initial skeletal implementation of inline class instance construction via <init>

Tobias Hartmann tobias.hartmann at oracle.com
Thu May 2 07:12:10 UTC 2019


Hi John,

On 30.04.19 21:11, John Rose wrote:
> Does the annotation make it into the class file?

Yes:

  public static MyValue1 MyValue1(int);
    descriptor: (I)QMyValue1;
    flags: (0x0009) ACC_PUBLIC, ACC_STATIC
    Code:

  [...]

    RuntimeVisibleAnnotations:
      0: #20()
        ForceInline

> Either javac is failing to carry it from the constructor
> AST to the static init factory, or else the JVM is failing
> to apply it to the static init factory, or else the JIT is
> ignoring the bit.  (Or else something else!)

It's the test using 'getDeclaredMethods' which does not pick up the constructor (see below).

>> Now that worked with old 'makeValue' because it's a normal method and therefore returned by
>> getDeclaredMethods but it does not work with the new '<init>' constructor. Below is a little test
>> that shows the difference. Before, the test printed "public static MyValue1/val
>> MyValue1.$makeValue$(int)". Now it does not print anything.
> 
> That sounds right.  $makeValue$ has been renamed <init>
> *and* it has been reclassified as a jlr.Constructor.

Right, we should go with below test fix then.

>> diff -r 51c89c6d10e6 test/hotspot/jtreg/compiler/valhalla/valuetypes/ValueTypeTest.java
>> --- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/ValueTypeTest.java	Fri Apr 26 23:27:18 2019 +0530
>> +++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/ValueTypeTest.java	Tue Apr 30 17:35:09 2019 +0200
>> @@ -121,6 +121,7 @@
>>         "-XX:CompileCommand=compileonly,java.lang.invoke.*::*",
>>         "-XX:CompileCommand=compileonly,java.lang.Long::sum",
>>         "-XX:CompileCommand=compileonly,java.lang.Object::<init>",
>> +        "-XX:CompileCommand=inline,compiler.valhalla.valuetypes.MyValue*::<init>",
>>         "-XX:CompileCommand=compileonly,compiler.valhalla.valuetypes.*::*"};
>>     private static final String[] printFlags = {
>>         "-XX:+PrintCompilation", "-XX:+PrintIdeal", "-XX:+UnlockDiagnosticVMOptions",
>> "-XX:+PrintOptoAssembly"};

Thanks,
Tobias


More information about the valhalla-dev mailing list