2369 // VM thread changes sync state to synchronizing and suspends threads for GC. |
2369 // VM thread changes sync state to synchronizing and suspends threads for GC. |
2370 // Thread A is resumed to finish this native method, but doesn't block here since it |
2370 // Thread A is resumed to finish this native method, but doesn't block here since it |
2371 // didn't see any synchronization is progress, and escapes. |
2371 // didn't see any synchronization is progress, and escapes. |
2372 __ set(_thread_in_native_trans, G3_scratch); |
2372 __ set(_thread_in_native_trans, G3_scratch); |
2373 __ st(G3_scratch, G2_thread, JavaThread::thread_state_offset()); |
2373 __ st(G3_scratch, G2_thread, JavaThread::thread_state_offset()); |
2374 if(os::is_MP()) { |
2374 |
2375 if (UseMembar) { |
2375 if (UseMembar) { |
2376 // Force this write out before the read below |
2376 // Force this write out before the read below |
2377 __ membar(Assembler::StoreLoad); |
2377 __ membar(Assembler::StoreLoad); |
2378 } else { |
2378 } else { |
2379 // Write serialization page so VM thread can do a pseudo remote membar. |
2379 // Write serialization page so VM thread can do a pseudo remote membar. |
2380 // We use the current thread pointer to calculate a thread specific |
2380 // We use the current thread pointer to calculate a thread specific |
2381 // offset to write to within the page. This minimizes bus traffic |
2381 // offset to write to within the page. This minimizes bus traffic |
2382 // due to cache line collision. |
2382 // due to cache line collision. |
2383 __ serialize_memory(G2_thread, G1_scratch, G3_scratch); |
2383 __ serialize_memory(G2_thread, G1_scratch, G3_scratch); |
2384 } |
|
2385 } |
2384 } |
2386 |
2385 |
2387 Label L; |
2386 Label L; |
2388 Address suspend_state(G2_thread, JavaThread::suspend_flags_offset()); |
2387 Address suspend_state(G2_thread, JavaThread::suspend_flags_offset()); |
2389 __ safepoint_poll(L, false, G2_thread, G3_scratch); |
2388 __ safepoint_poll(L, false, G2_thread, G3_scratch); |