RFR: Improve C2 no-fwdptr codegen: assume object is forwarded, avoid long immediate

Roman Kennke rkennke at redhat.com
Mon May 13 17:05:43 UTC 2019


OK let's do this, then see if it makes sense to take further. Thanks!
Roman


Am 13. Mai 2019 18:41:37 MESZ schrieb Aleksey Shipilev <shade at redhat.com>:
>On 5/13/19 4:51 PM, Roman Kennke wrote:
>> What do you think?
>
>Right. I can try to make C2 do this, but that is not guaranteed to work
>the way we want due to
>register alloc quirks. Current C2 code (with this patch) does this;
>
>----- LRB midpath
>----- Check in-cset
>         ↘││  0x00007f9140437320: mov    %rax,%r10
>          ││  0x00007f9140437323: shr    $0x17,%r10
>          ││  0x00007f9140437327: cmpb   $0x0,(%rbx,%r10,1)
>          ╰│  0x00007f914043732c: je     0x00007f91404372f8
>----- Null-check
>           │  0x00007f914043732e: test   %r11d,%r11d
>           │  0x00007f9140437331: je     0x00007f91404373ae
>----- Decode fwdptr
>           │  0x00007f9140437333: lea    (%r12,%r11,8),%rdi
>           │  0x00007f9140437337: mov    (%rdi),%r10
>           │  0x00007f914043733a: mov    %r10,%r11
>           │  0x00007f914043733d: and    $0x3,%r11
>           │  0x00007f9140437341: mov    %r10,%rax
>           │  0x00007f9140437344: mov    %r11,%r10
>           │  0x00007f9140437347: neg    %r10
>│  0x00007f914043734a: add    %r10,%rax     // rax = mw - (mw & 0x3)
>[clean ptr]
>    │  0x00007f914043734d: cmp    $0x3,%r11     // if (mw & 0x3) == 0x3
>           ╰  0x00007f9140437351: je     0x00007f91404372f8
>----- Slow path
>              0x00007f9140437353: movabs $0x7f9158175cd0,%r10
>              0x00007f914043735d: callq  *%r10
>
>...which I think is quite good already. We can certainly try to improve
>it further.
>
>-Aleksey

-- 
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.


More information about the shenandoah-dev mailing list