JDK-8036102 : part of the fix for 6498581 lost in mismerge
Type:Bug
Component:hotspot
Sub-Component:runtime
Affected Version:9
Priority:P3
Status:Closed
Resolution:Fixed
OS:windows
CPU:generic
Submitted:2014-03-01
Updated:2014-06-26
Resolved:2014-03-01
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
During the 2014.03.01 sync-down from Main_Baseline -> RT_Baseline,
part of the fix for the following bug was lost:
JDK-6498581 ThreadInterruptTest3 produces wrong output on Windows
Comments
Here's the patch to restore the change:
$ cat 8036102.diffs.txt
diff -r 0d8d78c0329a src/share/vm/opto/library_call.cpp
--- a/src/share/vm/opto/library_call.cpp
+++ b/src/share/vm/opto/library_call.cpp
@@ -3180,7 +3180,8 @@ bool LibraryCallKit::inline_native_curre
// private native boolean java.lang.Thread.isInterrupted(boolean ClearInterrupted);
bool LibraryCallKit::inline_native_isInterrupted() {
// Add a fast path to t.isInterrupted(clear_int):
- // (t == Thread.current() && (!TLS._osthread._interrupted || !clear_int))
+ // (t == Thread.current() &&
+ // (!TLS._osthread._interrupted || WINDOWS_ONLY(false) NOT_WINDOWS(!clear_int)))
// ? TLS._osthread._interrupted : /*slow path:*/ t.isInterrupted(clear_int)
// So, in the common case that the interrupt bit is false,
// we avoid making a call into the VM. Even if the interrupt bit
@@ -3237,6 +3238,7 @@ bool LibraryCallKit::inline_native_isInt
// drop through to next case
set_control( _gvn.transform(new (C) IfTrueNode(iff_bit)));
+#ifndef TARGET_OS_FAMILY_windows
// (c) Or, if interrupt bit is set and clear_int is false, use 2nd fast path.
Node* clr_arg = argument(1);
Node* cmp_arg = _gvn.transform(new (C) CmpINode(clr_arg, intcon(0)));
@@ -3250,6 +3252,10 @@ bool LibraryCallKit::inline_native_isInt
// drop through to next case
set_control( _gvn.transform(new (C) IfTrueNode(iff_arg)));
+#else
+ // To return true on Windows you must read the _interrupted field
+ // and check the the event state i.e. take the slow path.
+#endif // TARGET_OS_FAMILY_windows
// (d) Otherwise, go to the slow path.
slow_region->add_req(control());
And here's the diff between the two files:
$ diff library_call.cpp.6498581.diff 8036102.diffs.txt
1,4c1,4
< diff -r 0f19095fd8c1 -r f6301b007a16 src/share/vm/opto/library_call.cpp
< --- a/src/share/vm/opto/library_call.cpp Thu Feb 20 11:05:12 2014 +0100
< +++ b/src/share/vm/opto/library_call.cpp Wed Feb 26 15:20:41 2014 -0800
< @@ -3246,7 +3246,8 @@ bool LibraryCallKit::inline_native_curre
---
> diff -r 0d8d78c0329a src/share/vm/opto/library_call.cpp
> --- a/src/share/vm/opto/library_call.cpp
> +++ b/src/share/vm/opto/library_call.cpp
> @@ -3180,7 +3180,8 @@ bool LibraryCallKit::inline_native_curre
14c14
< @@ -3303,6 +3304,7 @@ bool LibraryCallKit::inline_native_isInt
---
> @@ -3237,6 +3238,7 @@ bool LibraryCallKit::inline_native_isInt
22c22
< @@ -3316,6 +3318,10 @@ bool LibraryCallKit::inline_native_isInt
---
> @@ -3250,6 +3252,10 @@ bool LibraryCallKit::inline_native_isInt
Only differences are in changeset IDs, timestamps and line numbers.
01-03-2014
Here's the diff for the missing part of 6498581:
$ cat library_call.cpp.6498581.diff
diff -r 0f19095fd8c1 -r f6301b007a16 src/share/vm/opto/library_call.cpp
--- a/src/share/vm/opto/library_call.cpp Thu Feb 20 11:05:12 2014 +0100
+++ b/src/share/vm/opto/library_call.cpp Wed Feb 26 15:20:41 2014 -0800
@@ -3246,7 +3246,8 @@ bool LibraryCallKit::inline_native_curre
// private native boolean java.lang.Thread.isInterrupted(boolean ClearInterrupted);
bool LibraryCallKit::inline_native_isInterrupted() {
// Add a fast path to t.isInterrupted(clear_int):
- // (t == Thread.current() && (!TLS._osthread._interrupted || !clear_int))
+ // (t == Thread.current() &&
+ // (!TLS._osthread._interrupted || WINDOWS_ONLY(false) NOT_WINDOWS(!clear_int)))
// ? TLS._osthread._interrupted : /*slow path:*/ t.isInterrupted(clear_int)
// So, in the common case that the interrupt bit is false,
// we avoid making a call into the VM. Even if the interrupt bit
@@ -3303,6 +3304,7 @@ bool LibraryCallKit::inline_native_isInt
// drop through to next case
set_control( _gvn.transform(new (C) IfTrueNode(iff_bit)));
+#ifndef TARGET_OS_FAMILY_windows
// (c) Or, if interrupt bit is set and clear_int is false, use 2nd fast path.
Node* clr_arg = argument(1);
Node* cmp_arg = _gvn.transform(new (C) CmpINode(clr_arg, intcon(0)));
@@ -3316,6 +3318,10 @@ bool LibraryCallKit::inline_native_isInt
// drop through to next case
set_control( _gvn.transform(new (C) IfTrueNode(iff_arg)));
+#else
+ // To return true on Windows you must read the _interrupted field
+ // and check the the event state i.e. take the slow path.
+#endif // TARGET_OS_FAMILY_windows
// (d) Otherwise, go to the slow path.
slow_region->add_req(control());