RFR: 6869327: Add new C2 flag to keep safepoints in counted loops.
Aleksey Shipilev
aleksey.shipilev at oracle.com
Fri Nov 27 13:18:37 UTC 2015
Hi,
On 11/27/2015 04:01 PM, Andreas Eriksson wrote:
> Please review this change that adds a flag to keep a safepoint in
> counted loops.
>
> Currently C2 removes safepoints in counted loops.
> This can force other safepointing threads to wait for the counted loop
> thread for long periods of time.
> This change adds a flag, UseCountedLoopSafepoints, which keeps a
> safepoint in the loop. Its default value is false.
>
> Bug: 6869327: Add new C2 flag to keep safepoints in counted loops.
> https://bugs.openjdk.java.net/browse/JDK-6869327
>
> Webrev: http://cr.openjdk.java.net/~aeriksso/6869327/webrev.00/
Do I get it right that this logic works good with loop unrolling? Can we
check?
E.g. I would expect that a counted loop like this:
int s = 0;
for (int c = 0; c < N; c++) {
s += c;
<safepoint>
}
...would get unrolled and stripped to:
int s = 0;
for (int c = 0; c < N; c += 4) {
s += c + 0;
s += c + 1;
s += c + 2;
s += c + 3;
<safepoint> // only one safepoint here
}
This would basically perform a limited variant of what Vladimir mentions
as "strip mining" (aka transform a countable loop into two nested loops
and place safepoint into external loop), where the size of "internal"
loop is limited by unrolling.
Thanks,
-Aleksey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20151127/61852d10/signature.asc>
More information about the hotspot-compiler-dev
mailing list