< prev index next >

src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp

Print this page




2413   //     for GC.
2414   //   - Thread A is resumed to finish this native method, but doesn't block
2415   //     here since it didn't see any synchronization in progress, and escapes.
2416 
2417   // Transition from _thread_in_native to _thread_in_native_trans.
2418   __ li(R0, _thread_in_native_trans);
2419   __ release();
2420   // TODO: PPC port assert(4 == JavaThread::sz_thread_state(), "unexpected field size");
2421   __ stw(R0, thread_(thread_state));
2422 
2423 
2424   // Must we block?
2425   // --------------------------------------------------------------------------
2426 
2427   // Block, if necessary, before resuming in _thread_in_Java state.
2428   // In order for GC to work, don't clear the last_Java_sp until after blocking.
2429   Label after_transition;
2430   {
2431     Label no_block, sync;
2432 
2433     if (os::is_MP()) {
2434       if (UseMembar) {
2435         // Force this write out before the read below.
2436         __ fence();
2437       } else {
2438         // Write serialization page so VM thread can do a pseudo remote membar.
2439         // We use the current thread pointer to calculate a thread specific
2440         // offset to write to within the page. This minimizes bus traffic
2441         // due to cache line collision.
2442         __ serialize_memory(R16_thread, r_temp_4, r_temp_5);
2443       }
2444     }
2445 
2446     Register sync_state_addr = r_temp_4;
2447     Register sync_state      = r_temp_5;
2448     Register suspend_flags   = r_temp_6;
2449 
2450     // No synchronization in progress nor yet synchronized
2451     // (cmp-br-isync on one path, release (same as acquire on PPC64) on the other path).
2452     __ safepoint_poll(sync, sync_state);
2453 
2454     // Not suspended.
2455     // TODO: PPC port assert(4 == Thread::sz_suspend_flags(), "unexpected field size");
2456     __ lwz(suspend_flags, thread_(suspend_flags));
2457     __ cmpwi(CCR1, suspend_flags, 0);
2458     __ beq(CCR1, no_block);
2459 
2460     // Block. Save any potential method result value before the operation and
2461     // use a leaf call to leave the last_Java_frame setup undisturbed. Doing this
2462     // lets us share the oopMap we used when we went native rather than create
2463     // a distinct one for this pc.




2413   //     for GC.
2414   //   - Thread A is resumed to finish this native method, but doesn't block
2415   //     here since it didn't see any synchronization in progress, and escapes.
2416 
2417   // Transition from _thread_in_native to _thread_in_native_trans.
2418   __ li(R0, _thread_in_native_trans);
2419   __ release();
2420   // TODO: PPC port assert(4 == JavaThread::sz_thread_state(), "unexpected field size");
2421   __ stw(R0, thread_(thread_state));
2422 
2423 
2424   // Must we block?
2425   // --------------------------------------------------------------------------
2426 
2427   // Block, if necessary, before resuming in _thread_in_Java state.
2428   // In order for GC to work, don't clear the last_Java_sp until after blocking.
2429   Label after_transition;
2430   {
2431     Label no_block, sync;
2432 

2433     if (UseMembar) {
2434       // Force this write out before the read below.
2435       __ fence();
2436     } else {
2437       // Write serialization page so VM thread can do a pseudo remote membar.
2438       // We use the current thread pointer to calculate a thread specific
2439       // offset to write to within the page. This minimizes bus traffic
2440       // due to cache line collision.
2441       __ serialize_memory(R16_thread, r_temp_4, r_temp_5);

2442     }
2443 
2444     Register sync_state_addr = r_temp_4;
2445     Register sync_state      = r_temp_5;
2446     Register suspend_flags   = r_temp_6;
2447 
2448     // No synchronization in progress nor yet synchronized
2449     // (cmp-br-isync on one path, release (same as acquire on PPC64) on the other path).
2450     __ safepoint_poll(sync, sync_state);
2451 
2452     // Not suspended.
2453     // TODO: PPC port assert(4 == Thread::sz_suspend_flags(), "unexpected field size");
2454     __ lwz(suspend_flags, thread_(suspend_flags));
2455     __ cmpwi(CCR1, suspend_flags, 0);
2456     __ beq(CCR1, no_block);
2457 
2458     // Block. Save any potential method result value before the operation and
2459     // use a leaf call to leave the last_Java_frame setup undisturbed. Doing this
2460     // lets us share the oopMap we used when we went native rather than create
2461     // a distinct one for this pc.


< prev index next >