RFR(M): 8210260: [lworld] Improve acmp implementation
tobias.hartmann at oracle.com
Mon Sep 3 09:16:13 UTC 2018
please review the following patch:
This includes the following changes:
- The acmp implementation now first checks for pointer equality and only if the pointers are equal,
the mark word is checked for the 'always_locked_pattern' to determine if the operand is a value type
- The old pointer perturbation scheme is still available as an alternative and is now guarded by the
experimental flag -XX:+UsePointerPerturbation
- C2's value type guard code ('GraphKit::gen_value_type_guard', currently only used by monitorenter)
now also uses the mark word instead of checking the klass
- I've removed the value type klass pointer alignment and all support code that was added by 
The core of the C2 implementation is in parse2.cpp. The code is now a bit more complex because we
need to emit an additional branch for the first pointer comparison and need to be careful when
wiring that in to use the correct profile for branch prediction.
I've removed the code in CmpPNode::Ideal that swaps operands in case we determine during IGVN that
one is never NULL because we cannot remove the null check anyway at this stage and therefore the
optimization doesn't help.
Here are the performance numbers that Sergey provided (lower is better):
The red line is the performance with this patch. Please note that we are very close to baseline
performance for the cases with high rates of inequality (which should be common).
More information about the valhalla-dev