Redundant dereferences in C2 shenandoah_wb?

Roland Westrelin rwestrel at redhat.com
Wed Sep 7 12:40:44 UTC 2016


> AFAIU, implicit NPE checks are prepared on a higher level, e.g. at
> GraphKit::null_check, which sets up uncommon_trap with appropriate
> dependencies. Placing a lowered memory access in .ad does not yield an
> implicit null check, this is just a potential SEGV.

Graphkit::null_check inserts the null check. Later in compilation,
PhaseCFG::implicit_null_check() turns some null checks into implicit
null checks by looking for a memory access close to a null check. Roman
changed the code of PhaseCFG::implicit_null_check() so a
ShenandoahWriteBarrier can be used for an implicit null checks. For that
the first instruction in the barrier must be a memory reference. When
the code for the barrier is emitted, the barrier is always emitted as if
it is used for an implicit null check independently of whether this
particular barrier is used as an implicit null check.

FWIW, right now the write barrier is a a blob of assembly code in the ad
file. I'm working on turning it into IR and that would change how
implicit null checks are handled.

Roland.


More information about the shenandoah-dev mailing list