RFR(M): 8223051: support loops with long (64b) trip counts
Roland Westrelin
rwestrel at redhat.com
Fri May 29 11:15:05 UTC 2020
> I noticed one more corner case that might be good to address.
>
> + // We can't iterate for more than max int at a time.
> + if (stride_con != (jint)stride_con || ABS(stride_con) >= max_jint) {
> + return false;
> + }
>
> Should be:
>
> + // We can't iterate for more than max int at a time.
> ++ if (stride_con != (jint)stride_con || ABS(stride_con) * (1+MIN_ITER) >= max_jint) {
> + return false;
> + }
>
> Where MIN_ITER is some constant that defines the minimum
> number of iterations that the strip-mined int-loop should run.
> If the stride is very large (nearly max_jint) then the int-loop
> will only run once, or just a few times. I think MIN_ITER
> should be at least 10.
>
> I suggest hardwiring it to 10 locally in loopnode.cpp, and
> making it a tunable parameter later on if we actually
> run into trouble with it. But we won’t; nobody is going
> to write loops with strides on the order of max_jint.
> In fact, you can leave out this suggestion altogether,
> if you are not comfortable with it, and we just take the
> odd performance hit if someone does something that
> strange.
I thought about this a bit when I prepared the change and I left the
code as is so as many loop transformations as possible are performed to
shake out bugs thinking it could be revised later.
Roland.
More information about the hotspot-compiler-dev
mailing list