[9] RFR (M): 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared

John Rose john.r.rose at oracle.com
Tue Jan 27 21:08:47 UTC 2015

Looking very good, thanks.  Ship it!

Actually, can you insert a comment why the injected counts are not scaled?  (Or perhaps they should be??)

Also, we may need a followup bug for the code with this comment:
  // Look for the following shape: AndI (ProfileBoolean) (ConI 1))

Since profileBoolean returns a TypeInt::BOOL, the AndI with (ConI 1) should fold up.
So there's some work to do in MulNode, which may allow that special pattern match to go away.
But I don't want to divert the present bug by a possibly complex dive into fixing AndI::Ideal.

(Generally speaking, pattern matching should assume strong normalization of its inputs.  Otherwise you end up duplicating pattern match code in many places, inconsistently.  Funny one-off idiom checks like this are evidence of incomplete IR normalization.  See http://en.wikipedia.org/wiki/Rewriting for some background on terms like "normalization" and "confluence" which are relevant to C2.)

— John

On Jan 27, 2015, at 8:05 AM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com> wrote:
> Thanks for the feedback, John!
> Updated webrev:
> http://cr.openjdk.java.net/~vlivanov/8063137/webrev.03/jdk
> http://cr.openjdk.java.net/~vlivanov/8063137/webrev.03/hotspot
> Changes:
>  - renamed MHI::profileBranch to MHI::profileBoolean, and ProfileBranchNode to ProfileBooleanNode;
>  - restructured profile layout ([0] => false_cnt, [1] => true_cnt)
>  - factored out profile injection in a separate function (has_injected_profile() in parse2.cpp)
>  - ProfileBooleanNode stores true/false counts instead of taken/not_taken counts
>  - matching from value counts to taken/not_taken happens in has_injected_profile();
>  - added BoolTest::ne support
>  - sharpened test for AndI case: now it checks AndI (ProfileBoolean) (ConI 1) shape
> Best regards,
> Vladimir Ivanov

More information about the core-libs-dev mailing list