RFR (S): 8003135: HotSpot inlines and hoists the Thread.currentThread().isInterrupted() out of the loop
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Thu Dec 13 15:02:40 PST 2012
http://cr.openjdk.java.net/~vlivanov/8003135/simple/webrev.00
31 lines changed: 16 ins; 6 del; 9 mod
In the IR produced by Thread.isInterrupted(Z)Z intrinsic it's possible
to hoist the load of _interrupted flag out of the loop. The fix is to
add a barrier to forbid such optimization.
Proposed fix is cleaner that [1] (no explicit memory state management).
The place for the barrier is deliberately chosen earlier than necessary
and it blocks hoisting of some loop invariants when
Thread.isInterrupted() is called in a loop. But I think it's a fair
price since I don't think that Thread.isInterrupted(Z)Z performance in
tight loops is critical.
If you prefer [1] let me know.
Also, cleaned up the code around a little.
Testing: failing test, manual (verified generated code), JPRT (in progress)
Thanks!
Best regards,
Vladimir Ivanov
[1] http://cr.openjdk.java.net/~vlivanov/8003135/fast/webrev.00
More information about the hotspot-compiler-dev
mailing list