Redundant dereferences in C2 shenandoah_wb?

Aleksey Shipilev ashipile at redhat.com
Wed Sep 7 12:46:07 UTC 2016


On 09/07/2016 03:40 PM, Roland Westrelin wrote:
>> 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.

Oh, I see now how PhaseCFG::implicit_null_check treats
ShenandoahWriteBarrier as a matching memory access, thanks. Sneaky!

> I'm working on turning it into IR and that would change how
> implicit null checks are handled.

Okay, this means the changes in .ad are not relevant at this point, and
code quality should be investigated after barriers are spelled in IR.

Thanks,
-Aleksey


More information about the shenandoah-dev mailing list