src/share/vm/opto/library_call.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6498581 Cdiff src/share/vm/opto/library_call.cpp

src/share/vm/opto/library_call.cpp

Print this page
6498581: ThreadInterruptTest3 produces wrong output on Windows

*** 3244,3254 **** //------------------------inline_native_isInterrupted------------------ // 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)) // ? 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 // is true, if the clear_int argument is false, we avoid the VM call. // However, if the receiver is not currentThread, we must call the VM, --- 3244,3255 ---- //------------------------inline_native_isInterrupted------------------ // 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 || 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 // is true, if the clear_int argument is false, we avoid the VM call. // However, if the receiver is not currentThread, we must call the VM,
*** 3301,3310 **** --- 3302,3312 ---- result_val->init_req(no_int_result_path, intcon(0)); // 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))); Node* bol_arg = _gvn.transform(new (C) BoolNode(cmp_arg, BoolTest::ne)); IfNode* iff_arg = create_and_map_if(control(), bol_arg, PROB_FAIR, COUNT_UNKNOWN);
*** 3314,3323 **** --- 3316,3329 ---- result_rgn->init_req(no_clear_result_path, false_arg); result_val->init_req(no_clear_result_path, intcon(1)); // 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()); set_control( _gvn.transform(slow_region));
src/share/vm/opto/library_call.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File