RFR: JDK-8221766: Load-reference barriers for Shenandoah

Andrew Haley aph at redhat.com
Mon Apr 8 09:19:21 UTC 2019


On 4/8/19 9:36 AM, Roman Kennke wrote:
> On 4/7/19 7:18 PM, Roman Kennke wrote:
>>> On 4/2/19 10:12 PM, Roman Kennke wrote:
>>>>> - No more need for object equals barriers.
>>>>
>>>> I'm pleased about that. I really hated the AArch64 Shenandoah
>>>> CAS!
>>>
>>> I'm sorry to disappoint you, but the CAS barrier is still needed.
>>> The
>>> memory location may still legally hold a from-space reference, and
>>> comparing that to a to-space reference needs some special care. And
>>> yes, ZGC has a similar problem as far as I know.
>>
>> That's interesting. Could we not simply promote the reference in the
>> reference field we're CASing, then do a normal CAS?
> 
> Yes. But it requires two CASes in a row. Don't know if that is better
> than our loop, which is rarely even entered (normally the CAS-construct 
> goes via fast-path with a single CAS).

I think it's better, yes: it's significantly less complex to promote both
if needed and then do a normal CAS.

-- 
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the hotspot-gc-dev mailing list