1371 // VM thread changes sync state to synchronizing and suspends threads for GC. |
1371 // VM thread changes sync state to synchronizing and suspends threads for GC. |
1372 // Thread A is resumed to finish this native method, but doesn't block here since it |
1372 // Thread A is resumed to finish this native method, but doesn't block here since it |
1373 // didn't see any synchronization is progress, and escapes. |
1373 // didn't see any synchronization is progress, and escapes. |
1374 __ set(_thread_in_native_trans, G3_scratch); |
1374 __ set(_thread_in_native_trans, G3_scratch); |
1375 __ st(G3_scratch, thread_state); |
1375 __ st(G3_scratch, thread_state); |
1376 if (os::is_MP()) { |
1376 |
1377 if (UseMembar) { |
1377 if (UseMembar) { |
1378 // Force this write out before the read below |
1378 // Force this write out before the read below |
1379 __ membar(Assembler::StoreLoad); |
1379 __ membar(Assembler::StoreLoad); |
1380 } else { |
1380 } else { |
1381 // Write serialization page so VM thread can do a pseudo remote membar. |
1381 // Write serialization page so VM thread can do a pseudo remote membar. |
1382 // We use the current thread pointer to calculate a thread specific |
1382 // We use the current thread pointer to calculate a thread specific |
1383 // offset to write to within the page. This minimizes bus traffic |
1383 // offset to write to within the page. This minimizes bus traffic |
1384 // due to cache line collision. |
1384 // due to cache line collision. |
1385 __ serialize_memory(G2_thread, G1_scratch, G3_scratch); |
1385 __ serialize_memory(G2_thread, G1_scratch, G3_scratch); |
1386 } |
|
1387 } |
1386 } |
1388 |
1387 |
1389 Label L; |
1388 Label L; |
1390 __ safepoint_poll(L, false, G2_thread, G3_scratch); |
1389 __ safepoint_poll(L, false, G2_thread, G3_scratch); |
1391 __ delayed()->ld(G2_thread, JavaThread::suspend_flags_offset(), G3_scratch); |
1390 __ delayed()->ld(G2_thread, JavaThread::suspend_flags_offset(), G3_scratch); |