< prev index next >

src/hotspot/cpu/s390/sharedRuntime_s390.cpp

Print this page




2138   //   - VM thread changes sync state to synchronizing and suspends threads for GC.
2139   //   - Thread A is resumed to finish this native method, but doesn't block here since it
2140   //     didn't see any synchronization in progress, and escapes.
2141 
2142   // Transition from _thread_in_native to _thread_in_native_trans.
2143   __ set_thread_state(_thread_in_native_trans);
2144 
2145   // Safepoint synchronization
2146   //--------------------------------------------------------------------
2147   // Must we block?
2148   //--------------------------------------------------------------------
2149   // Block, if necessary, before resuming in _thread_in_Java state.
2150   // In order for GC to work, don't clear the last_Java_sp until after blocking.
2151   //--------------------------------------------------------------------
2152   Label after_transition;
2153   {
2154     Label no_block, sync;
2155 
2156     save_native_result(masm, ret_type, workspace_slot_offset); // Make Z_R2 available as work reg.
2157 
2158     if (os::is_MP()) {
2159       if (UseMembar) {
2160         // Force this write out before the read below.
2161         __ z_fence();
2162       } else {
2163         // Write serialization page so VM thread can do a pseudo remote membar.
2164         // We use the current thread pointer to calculate a thread specific
2165         // offset to write to within the page. This minimizes bus traffic
2166         // due to cache line collision.
2167         __ serialize_memory(Z_thread, Z_R1, Z_R2);
2168       }
2169     }
2170     __ safepoint_poll(sync, Z_R1);
2171 
2172     __ load_and_test_int(Z_R0, Address(Z_thread, JavaThread::suspend_flags_offset()));
2173     __ z_bre(no_block);
2174 
2175     // Block. Save any potential method result value before the operation and
2176     // use a leaf call to leave the last_Java_frame setup undisturbed. Doing this
2177     // lets us share the oopMap we used when we went native rather than create
2178     // a distinct one for this pc.
2179     //
2180     __ bind(sync);
2181     __ z_acquire();
2182 
2183     address entry_point = is_critical_native ? CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans_and_transition)
2184                                              : CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans);
2185 
2186     __ call_VM_leaf(entry_point, Z_thread);
2187 
2188     if (is_critical_native) {
2189       restore_native_result(masm, ret_type, workspace_slot_offset);




2138   //   - VM thread changes sync state to synchronizing and suspends threads for GC.
2139   //   - Thread A is resumed to finish this native method, but doesn't block here since it
2140   //     didn't see any synchronization in progress, and escapes.
2141 
2142   // Transition from _thread_in_native to _thread_in_native_trans.
2143   __ set_thread_state(_thread_in_native_trans);
2144 
2145   // Safepoint synchronization
2146   //--------------------------------------------------------------------
2147   // Must we block?
2148   //--------------------------------------------------------------------
2149   // Block, if necessary, before resuming in _thread_in_Java state.
2150   // In order for GC to work, don't clear the last_Java_sp until after blocking.
2151   //--------------------------------------------------------------------
2152   Label after_transition;
2153   {
2154     Label no_block, sync;
2155 
2156     save_native_result(masm, ret_type, workspace_slot_offset); // Make Z_R2 available as work reg.
2157 

2158     if (UseMembar) {
2159       // Force this write out before the read below.
2160       __ z_fence();
2161     } else {
2162       // Write serialization page so VM thread can do a pseudo remote membar.
2163       // We use the current thread pointer to calculate a thread specific
2164       // offset to write to within the page. This minimizes bus traffic
2165       // due to cache line collision.
2166       __ serialize_memory(Z_thread, Z_R1, Z_R2);
2167     }
2168 
2169     __ safepoint_poll(sync, Z_R1);
2170 
2171     __ load_and_test_int(Z_R0, Address(Z_thread, JavaThread::suspend_flags_offset()));
2172     __ z_bre(no_block);
2173 
2174     // Block. Save any potential method result value before the operation and
2175     // use a leaf call to leave the last_Java_frame setup undisturbed. Doing this
2176     // lets us share the oopMap we used when we went native rather than create
2177     // a distinct one for this pc.
2178     //
2179     __ bind(sync);
2180     __ z_acquire();
2181 
2182     address entry_point = is_critical_native ? CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans_and_transition)
2183                                              : CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans);
2184 
2185     __ call_VM_leaf(entry_point, Z_thread);
2186 
2187     if (is_critical_native) {
2188       restore_native_result(masm, ret_type, workspace_slot_offset);


< prev index next >