Load Barrier Assembly
rkennke at redhat.com
Thu Apr 4 08:09:38 UTC 2019
>> test %rsi, 0x20(%r15)
>> jne slow_path
>> This is slightly different from what reported in Per's presentations
>> where it was:
>> test %rsi, (0x16)%r15
>> jnz slow_path
>> I'm not an assembly expert, is the second version is a typo?
> Second version has a typo, it should be 0x16(%r15).
>> But the question I have is: what's loaded in r15, and why the bad mask
>> is 32 bytes after that address?
> %r15 is the pointer to thread-local storage:
> Bad mask is at offset 0x20 there:
>> Can the bad mask be stored in a registry (at the cost of losing one registry)?
> Well, in Shenandoah, we store thread-local gc state the similar way and check it on barrier
> fastpath. We did experiment with putting it into register and the short answer is: losing one of the
> registers means significant drawback when register pressure is high, think heavily unrolled and
> pipelined loop. Additionally, you'd need to handle the restoration of the register value when the
> flag/mask finally changes (happens during safepoint/handshake poll). It is doable, but tedious.
I have the prototype. There are two problems: 1. as you say, we're
loosing if register pressure is high 2. gc-state reloads (at safepoints,
call-sites, etc) appear to be more frequent than barriers, which makes
this approach not very attractive.
More information about the zgc-dev