RFR(M): 8210260: [lworld] Improve acmp implementation

Tobias Hartmann tobias.hartmann at oracle.com
Mon Sep 3 09:36:03 UTC 2018

Thanks for the review!

Best regards,

On 03.09.2018 11:34, David Simms wrote:
> Looks goods, thanks for the klass encoding removal (less CDS issues)
> /D
> On 03/09/18 11:16, Tobias Hartmann wrote:
>> Hi,
>> please review the following patch:
>> https://bugs.openjdk.java.net/browse/JDK-8210260
>> http://cr.openjdk.java.net/~thartmann/valhalla/lworld/acmp_optimization/webrev.01/
>> 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 [1]
>> 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):
>> http://cr.openjdk.java.net/~skuksenko/valhalla/acmp1/acmp_charts_0831.png
>> 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).
>> Thanks,
>> Tobias
>> [1] http://cr.openjdk.java.net/~dsimms/valhalla/object_methods/webrev2/

More information about the valhalla-dev mailing list