Implicit null-check in hot-loop?

Andrew Haley aph at redhat.com
Wed May 27 10:36:34 UTC 2015


On 05/27/2015 11:27 AM, Benedikt Wedenik wrote:
> 
> In the hot-loop there is this “ldr” which looked a little “strange” at the first glance.
> I think that this load is a null-check? Is that the case?

No.  It's a safepoint check.  HotSpot has to insert one of these because
it can't prove that the loop is reasonably short-lived.

> I also investigated the generated code on x86 which is quite similar, but instead of a load, they are
> using the “test”-instruction which performs an “and” but only sets the flags discarding the result.
> Is there any similar instruction available on aarch64 or is this already the closest solution?

Closest to what?  A load to XZR is the best solution: it does not hit
the flags.  x86 cannot do this.

It looks like great code.

Andrew.



More information about the hotspot-compiler-dev mailing list