Load Barrier Assembly

Per Liden per.liden at oracle.com
Thu Apr 4 07:50:49 UTC 2019


Hi,

On 4/4/19 9:04 AM, Simone Bordet wrote:
> Hi,
> 
> I have been looking at the load barrier assembly, and found out that
> (at least in JDK 12) the code is (via -XX:+PrintAssembly):
> 
> 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?

jne and jnz is the same thing (same op code), and checks if the zero 
flag (ZF) is cleared (0).

> 
> 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 Thread pointer. Each thread has an instance of 
ZThreadLocalData, where it keeps it's thread local address bad mask 
(which happens to be at offset 0x20 at this time).

> Can the bad mask be stored in a registry (at the cost of losing one registry)?

Yes. That has been prototyped (using r12), but so far we've opted to not 
go down that path. The performance gain turns out to be fairly small, 
and there are a few draw backs, like the need to carefully restore that 
register at various places where it's destroyed.

cheers,
Per

> 
> Thanks!
> 


More information about the zgc-dev mailing list