src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp
changeset 48332 651a95f30dfb
parent 47916 bdbef8638948
child 48626 9f6f48d4f9a1
equal deleted inserted replaced
48331:a8e39cc7b88f 48332:651a95f30dfb
  1533   // the callers registers right this moment.
  1533   // the callers registers right this moment.
  1534 
  1534 
  1535   // Acquire isn't strictly necessary here because of the fence, but
  1535   // Acquire isn't strictly necessary here because of the fence, but
  1536   // sync_state is declared to be volatile, so we do it anyway
  1536   // sync_state is declared to be volatile, so we do it anyway
  1537   // (cmp-br-isync on one path, release (same as acquire on PPC64) on the other path).
  1537   // (cmp-br-isync on one path, release (same as acquire on PPC64) on the other path).
  1538   int sync_state_offs = __ load_const_optimized(sync_state_addr, SafepointSynchronize::address_of_state(), /*temp*/R0, true);
  1538 
  1539 
  1539   Label do_safepoint, sync_check_done;
  1540   // TODO PPC port assert(4 == SafepointSynchronize::sz_state(), "unexpected field size");
  1540   // No synchronization in progress nor yet synchronized.
  1541   __ lwz(sync_state, sync_state_offs, sync_state_addr);
  1541   __ safepoint_poll(do_safepoint, sync_state);
  1542 
  1542 
       
  1543   // Not suspended.
  1543   // TODO PPC port assert(4 == Thread::sz_suspend_flags(), "unexpected field size");
  1544   // TODO PPC port assert(4 == Thread::sz_suspend_flags(), "unexpected field size");
  1544   __ lwz(suspend_flags, thread_(suspend_flags));
  1545   __ lwz(suspend_flags, thread_(suspend_flags));
  1545 
       
  1546   Label sync_check_done;
       
  1547   Label do_safepoint;
       
  1548   // No synchronization in progress nor yet synchronized.
       
  1549   __ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized);
       
  1550   // Not suspended.
       
  1551   __ cmpwi(CCR1, suspend_flags, 0);
  1546   __ cmpwi(CCR1, suspend_flags, 0);
  1552 
       
  1553   __ bne(CCR0, do_safepoint);
       
  1554   __ beq(CCR1, sync_check_done);
  1547   __ beq(CCR1, sync_check_done);
       
  1548 
  1555   __ bind(do_safepoint);
  1549   __ bind(do_safepoint);
  1556   __ isync();
  1550   __ isync();
  1557   // Block. We do the call directly and leave the current
  1551   // Block. We do the call directly and leave the current
  1558   // last_Java_frame setup undisturbed. We must save any possible
  1552   // last_Java_frame setup undisturbed. We must save any possible
  1559   // native result across the call. No oop is present.
  1553   // native result across the call. No oop is present.
  1590 
  1584 
  1591   // We use release_store_fence to update values like the thread state, where
  1585   // We use release_store_fence to update values like the thread state, where
  1592   // we don't want the current thread to continue until all our prior memory
  1586   // we don't want the current thread to continue until all our prior memory
  1593   // accesses (including the new thread state) are visible to other threads.
  1587   // accesses (including the new thread state) are visible to other threads.
  1594   __ li(R0/*thread_state*/, _thread_in_Java);
  1588   __ li(R0/*thread_state*/, _thread_in_Java);
  1595   __ release();
  1589   __ lwsync(); // Acquire safepoint and suspend state, release thread state.
  1596   __ stw(R0/*thread_state*/, thread_(thread_state));
  1590   __ stw(R0/*thread_state*/, thread_(thread_state));
  1597 
  1591 
  1598   if (CheckJNICalls) {
  1592   if (CheckJNICalls) {
  1599     // clear_pending_jni_exception_check
  1593     // clear_pending_jni_exception_check
  1600     __ load_const_optimized(R0, 0L);
  1594     __ load_const_optimized(R0, 0L);
  1856     address start = __ pc();  // Remember stub start address (is rtn value).
  1850     address start = __ pc();  // Remember stub start address (is rtn value).
  1857     Label slow_path;
  1851     Label slow_path;
  1858 
  1852 
  1859     // Safepoint check
  1853     // Safepoint check
  1860     const Register sync_state = R11_scratch1;
  1854     const Register sync_state = R11_scratch1;
  1861     int sync_state_offs = __ load_const_optimized(sync_state, SafepointSynchronize::address_of_state(), /*temp*/R0, true);
  1855     __ safepoint_poll(slow_path, sync_state);
  1862     __ lwz(sync_state, sync_state_offs, sync_state);
       
  1863     __ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized);
       
  1864     __ bne(CCR0, slow_path);
       
  1865 
  1856 
  1866     // We don't generate local frame and don't align stack because
  1857     // We don't generate local frame and don't align stack because
  1867     // we not even call stub code (we generate the code inline)
  1858     // we not even call stub code (we generate the code inline)
  1868     // and there is no safepoint on this path.
  1859     // and there is no safepoint on this path.
  1869 
  1860 
  1916     address start = __ pc();  // Remember stub start address (is rtn value).
  1907     address start = __ pc();  // Remember stub start address (is rtn value).
  1917     Label slow_path;
  1908     Label slow_path;
  1918 
  1909 
  1919     // Safepoint check
  1910     // Safepoint check
  1920     const Register sync_state = R11_scratch1;
  1911     const Register sync_state = R11_scratch1;
  1921     int sync_state_offs = __ load_const_optimized(sync_state, SafepointSynchronize::address_of_state(), /*temp*/R0, true);
  1912     __ safepoint_poll(slow_path, sync_state);
  1922     __ lwz(sync_state, sync_state_offs, sync_state);
       
  1923     __ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized);
       
  1924     __ bne(CCR0, slow_path);
       
  1925 
  1913 
  1926     // We don't generate local frame and don't align stack because
  1914     // We don't generate local frame and don't align stack because
  1927     // we not even call stub code (we generate the code inline)
  1915     // we not even call stub code (we generate the code inline)
  1928     // and there is no safepoint on this path.
  1916     // and there is no safepoint on this path.
  1929 
  1917