RFR(S): 8244086: Following 8241492, strip mined loop may run extra iterations
Pengfei Li
Pengfei.Li at arm.com
Thu Apr 30 02:42:50 UTC 2020
Hi Roland,
I'm studying the strip mining code recently.
> With 8241492, I changed that computation to use an unsigned comparison
> because limit - init can be greater that max_jint. This assumes that limit is
> always greater that init but in some rare cases that doesn't hold. The body
> should then be executed for only one iteration but the computation of the
> number of iterations above causes it to run for LoopStripMiningIter. The fix I
> propose is to change the computation to:
>
> min_unsigned(LoopStripMiningIter, max(0, limit - iv)) for stride > 0
> min_unsigned(LoopStripMiningIter, max(0, iv - limit)) for stride < 0
Just one question: If the case that "limit < init" is quite rare (perhaps occurs only with some "synchronized (new Object()) {}" hack), is it better to add a "limit >= init" prediction and put it before the outer loop? I see the limit check for counted loops does in this way to avoid the overflow beyond max_jint.
--
Thanks,
Pengfei
More information about the hotspot-compiler-dev
mailing list