1.1 --- a/src/share/vm/opto/library_call.cpp Mon Dec 17 11:00:22 2012 -0800 1.2 +++ b/src/share/vm/opto/library_call.cpp Tue Dec 18 06:52:00 2012 -0800 1.3 @@ -2952,14 +2952,23 @@ 1.4 1.5 // We only go to the fast case code if we pass two guards. 1.6 // Paths which do not pass are accumulated in the slow_region. 1.7 + 1.8 + enum { 1.9 + no_int_result_path = 1, // t == Thread.current() && !TLS._osthread._interrupted 1.10 + no_clear_result_path = 2, // t == Thread.current() && TLS._osthread._interrupted && !clear_int 1.11 + slow_result_path = 3, // slow path: t.isInterrupted(clear_int) 1.12 + PATH_LIMIT 1.13 + }; 1.14 + 1.15 + // Ensure that it's not possible to move the load of TLS._osthread._interrupted flag 1.16 + // out of the function. 1.17 + insert_mem_bar(Op_MemBarCPUOrder); 1.18 + 1.19 + RegionNode* result_rgn = new (C) RegionNode(PATH_LIMIT); 1.20 + PhiNode* result_val = new (C) PhiNode(result_rgn, TypeInt::BOOL); 1.21 + 1.22 RegionNode* slow_region = new (C) RegionNode(1); 1.23 record_for_igvn(slow_region); 1.24 - RegionNode* result_rgn = new (C) RegionNode(1+3); // fast1, fast2, slow 1.25 - PhiNode* result_val = new (C) PhiNode(result_rgn, TypeInt::BOOL); 1.26 - enum { no_int_result_path = 1, 1.27 - no_clear_result_path = 2, 1.28 - slow_result_path = 3 1.29 - }; 1.30 1.31 // (a) Receiving thread must be the current thread. 1.32 Node* rec_thr = argument(0); 1.33 @@ -2968,14 +2977,13 @@ 1.34 Node* cmp_thr = _gvn.transform( new (C) CmpPNode(cur_thr, rec_thr) ); 1.35 Node* bol_thr = _gvn.transform( new (C) BoolNode(cmp_thr, BoolTest::ne) ); 1.36 1.37 - bool known_current_thread = (_gvn.type(bol_thr) == TypeInt::ZERO); 1.38 - if (!known_current_thread) 1.39 - generate_slow_guard(bol_thr, slow_region); 1.40 + generate_slow_guard(bol_thr, slow_region); 1.41 1.42 // (b) Interrupt bit on TLS must be false. 1.43 Node* p = basic_plus_adr(top()/*!oop*/, tls_ptr, in_bytes(JavaThread::osthread_offset())); 1.44 Node* osthread = make_load(NULL, p, TypeRawPtr::NOTNULL, T_ADDRESS); 1.45 p = basic_plus_adr(top()/*!oop*/, osthread, in_bytes(OSThread::interrupted_offset())); 1.46 + 1.47 // Set the control input on the field _interrupted read to prevent it floating up. 1.48 Node* int_bit = make_load(control(), p, TypeInt::BOOL, T_INT); 1.49 Node* cmp_bit = _gvn.transform( new (C) CmpINode(int_bit, intcon(0)) ); 1.50 @@ -3020,22 +3028,20 @@ 1.51 Node* slow_val = set_results_for_java_call(slow_call); 1.52 // this->control() comes from set_results_for_java_call 1.53 1.54 - // If we know that the result of the slow call will be true, tell the optimizer! 1.55 - if (known_current_thread) slow_val = intcon(1); 1.56 - 1.57 Node* fast_io = slow_call->in(TypeFunc::I_O); 1.58 Node* fast_mem = slow_call->in(TypeFunc::Memory); 1.59 + 1.60 // These two phis are pre-filled with copies of of the fast IO and Memory 1.61 - Node* io_phi = PhiNode::make(result_rgn, fast_io, Type::ABIO); 1.62 - Node* mem_phi = PhiNode::make(result_rgn, fast_mem, Type::MEMORY, TypePtr::BOTTOM); 1.63 + PhiNode* result_mem = PhiNode::make(result_rgn, fast_mem, Type::MEMORY, TypePtr::BOTTOM); 1.64 + PhiNode* result_io = PhiNode::make(result_rgn, fast_io, Type::ABIO); 1.65 1.66 result_rgn->init_req(slow_result_path, control()); 1.67 - io_phi ->init_req(slow_result_path, i_o()); 1.68 - mem_phi ->init_req(slow_result_path, reset_memory()); 1.69 + result_io ->init_req(slow_result_path, i_o()); 1.70 + result_mem->init_req(slow_result_path, reset_memory()); 1.71 result_val->init_req(slow_result_path, slow_val); 1.72 1.73 - set_all_memory( _gvn.transform(mem_phi) ); 1.74 - set_i_o( _gvn.transform(io_phi) ); 1.75 + set_all_memory(_gvn.transform(result_mem)); 1.76 + set_i_o( _gvn.transform(result_io)); 1.77 } 1.78 1.79 C->set_has_split_ifs(true); // Has chance for split-if optimization