RFR(M): optional flattening - interpreter/runtime part
Frederic Parain
frederic.parain at oracle.com
Thu Sep 14 14:52:28 UTC 2017
Here’s the layouts with the fix:
java.lang.__Value: field layout
@ 16 --- instance fields start ---
@ 16 --- instance fields end ---
@ 16 --- instance ends ---
@112 --- static fields start ---
@112 --- static fields end ---
OopMapBlocks: 0 / 0
compiler.valhalla.valuetypes.MyValue2: field layout
@ 16 --- instance fields start ---
@ 24 "x" I
@ 28 "y" B
@ 29 "b" Z
@ 16 "c" J
@ 32 --- instance fields end ---
@ 32 --- instance ends ---
@112 --- static fields start ---
@112 --- static fields end ---
OopMapBlocks: 0 / 0
compiler.valhalla.valuetypes.MyValue1: field layout
@ 16 --- instance fields start ---
@ 24 "x" I
@ 16 "y" J
@ 32 "z" S
@ 36 "o" Ljava.lang.Integer;
@ 40 "oa" [I
@ 44 "v1" Qcompiler.valhalla.valuetypes.MyValue2;
@ 48 "v2" Qcompiler.valhalla.valuetypes.MyValue2;
@ 28 "c" I
@ 56 --- instance fields end ---
@ 56 --- instance ends ---
@112 --- static fields start ---
@128 "s" I
@120 "sf" J
@112 "v3" Qcompiler.valhalla.valuetypes.MyValue2;
@136 --- static fields end ---
OopMapBlocks: 1 / 4
Offset: 36 - 48 Count: 4
compiler.valhalla.valuetypes.MyValue3: field layout
@ 16 --- instance fields start ---
@ 76 "c" C
@ 80 "bb" B
@ 78 "s" S
@ 56 "i" I
@ 16 "l" J
@ 84 "o" Ljava.lang.Object;
@ 60 "f1" F
@ 24 "f2" D
@ 64 "f3" F
@ 32 "f4" D
@ 68 "f5" F
@ 40 "f6" D
@ 72 "f7" F
@ 48 "f8" D
@ 88 --- instance fields end ---
@ 88 --- instance ends ---
@112 --- static fields start ---
@112 --- static fields end ---
OopMapBlocks: 1 / 1
Offset: 84 - 84 Count: 1
compiler.valhalla.valuetypes.MyValue4: field layout
@ 16 --- instance fields start ---
@ 16 "v1" Qcompiler.valhalla.valuetypes.MyValue3;
@ 20 "v2" Qcompiler.valhalla.valuetypes.MyValue3;
@ 24 --- instance fields end ---
@ 24 --- instance ends ---
@112 --- static fields start ---
@112 --- static fields end ---
OopMapBlocks: 1 / 2
Offset: 16 - 20 Count: 2
compiler.valhalla.valuetypes.ValueCapableClass1$Value: field layout
@ 16 --- instance fields start ---
@ 16 "t" J
@ 24 "x" I
@ 28 "y" S
@ 30 "z" S
@ 32 --- instance fields end ---
@ 32 --- instance ends ---
@112 --- static fields start ---
@112 --- static fields end ---
OopMapBlocks: 0 / 0
For random generator using seed: 1551026262373040118
To re-run test with same seed value please add "-Djdk.test.lib.random.seed=1551026262373040118" to command line.
compiler.valhalla.valuetypes.ValueCapableClass2$Value: field layout
@ 16 --- instance fields start ---
@ 16 "u" J
@ 24 --- instance fields end ---
@ 24 --- instance ends ---
@112 --- static fields start ---
@112 --- static fields end ---
OopMapBlocks: 0 / 0
Fred
> On Sep 14, 2017, at 10:50, Frederic Parain <frederic.parain at oracle.com> wrote:
>
> Tobias,
>
> Thank you for catching that.
>
> There’s a bug in the layout computation, optional flattening code moves non-flattened
> values from the value types section of the layout to the nonstatic_oop section, but the size
> of the later was not updated accordingly.
>
> Here’s an updated webrev fixing this issue:
>
> http://cr.openjdk.java.net/~fparain/optional-flattening-interp/webrev.01/index.html
>
> Regards,
>
> Fred
>
>> On Sep 14, 2017, at 03:46, Tobias Hartmann <tobias.hartmann at oracle.com> wrote:
>>
>> Hi Fred,
>>
>> there seems to be a problem with the field layout:
>>
>> compiler.valhalla.valuetypes.MyValue1: field layout
>> @ 16 --- instance fields start ---
>> @ 24 "x" I
>> @ 16 "y" J
>> @ 32 "z" S
>> @ 40 "o" Ljava.lang.Integer;
>> @ 48 "oa" [I
>> @ 56 "v1" Qcompiler.valhalla.valuetypes.MyValue2;
>> @ 64 "v2" Qcompiler.valhalla.valuetypes.MyValue2;
>> @ 28 "c" I
>> @ 56 --- instance fields end ---
>> @ 56 --- instance ends ---
>> @176 --- static fields start ---
>> @192 "s" I
>> @184 "sf" J
>> @176 "v3" Qcompiler.valhalla.valuetypes.MyValue2;
>> @200 --- static fields end ---
>>
>> OopMapBlocks: 1 / 4
>> Offset: 40 - 64 Count: 4
>>
>> "instance fields end" points to offset 56 which is not correct because the non-flattened field v2 is at offset 64.
>>
>> Thanks,
>> Tobias
>>
>> On 13.09.2017 21:41, Frederic Parain wrote:
>>> Greetings,
>>> Please review this changeset implementing optional field flattening
>>> in the interpreter and the runtime. The support for C2 is provided by
>>> Tobias in a separate changeset.
>>> http://cr.openjdk.java.net/~fparain/optional-flattening-interp/webrev.00/index.html
>>> Note that trying to run some programs/tests with this changeset and
>>> not Tobias’ changeset is likely to cause crashes unless interpreted mode
>>> is forced and passing/returning values in registers is disabled.
>>> Thank you,
>>> Fred
>
More information about the valhalla-dev
mailing list