--- a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp Thu Dec 14 12:02:16 2017 +0100
+++ b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp Thu Dec 14 13:05:20 2017 +0100
@@ -1535,23 +1535,17 @@
// Acquire isn't strictly necessary here because of the fence, but
// sync_state is declared to be volatile, so we do it anyway
// (cmp-br-isync on one path, release (same as acquire on PPC64) on the other path).
- int sync_state_offs = __ load_const_optimized(sync_state_addr, SafepointSynchronize::address_of_state(), /*temp*/R0, true);
- // TODO PPC port assert(4 == SafepointSynchronize::sz_state(), "unexpected field size");
- __ lwz(sync_state, sync_state_offs, sync_state_addr);
+ Label do_safepoint, sync_check_done;
+ // No synchronization in progress nor yet synchronized.
+ __ safepoint_poll(do_safepoint, sync_state);
+ // Not suspended.
// TODO PPC port assert(4 == Thread::sz_suspend_flags(), "unexpected field size");
__ lwz(suspend_flags, thread_(suspend_flags));
+ __ cmpwi(CCR1, suspend_flags, 0);
+ __ beq(CCR1, sync_check_done);
- Label sync_check_done;
- Label do_safepoint;
- // No synchronization in progress nor yet synchronized.
- __ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized);
- // Not suspended.
- __ cmpwi(CCR1, suspend_flags, 0);
-
- __ bne(CCR0, do_safepoint);
- __ beq(CCR1, sync_check_done);
__ bind(do_safepoint);
__ isync();
// Block. We do the call directly and leave the current
@@ -1592,7 +1586,7 @@
// we don't want the current thread to continue until all our prior memory
// accesses (including the new thread state) are visible to other threads.
__ li(R0/*thread_state*/, _thread_in_Java);
- __ release();
+ __ lwsync(); // Acquire safepoint and suspend state, release thread state.
__ stw(R0/*thread_state*/, thread_(thread_state));
if (CheckJNICalls) {
@@ -1858,10 +1852,7 @@
// Safepoint check
const Register sync_state = R11_scratch1;
- int sync_state_offs = __ load_const_optimized(sync_state, SafepointSynchronize::address_of_state(), /*temp*/R0, true);
- __ lwz(sync_state, sync_state_offs, sync_state);
- __ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized);
- __ bne(CCR0, slow_path);
+ __ safepoint_poll(slow_path, sync_state);
// We don't generate local frame and don't align stack because
// we not even call stub code (we generate the code inline)
@@ -1918,10 +1909,7 @@
// Safepoint check
const Register sync_state = R11_scratch1;
- int sync_state_offs = __ load_const_optimized(sync_state, SafepointSynchronize::address_of_state(), /*temp*/R0, true);
- __ lwz(sync_state, sync_state_offs, sync_state);
- __ cmpwi(CCR0, sync_state, SafepointSynchronize::_not_synchronized);
- __ bne(CCR0, slow_path);
+ __ safepoint_poll(slow_path, sync_state);
// We don't generate local frame and don't align stack because
// we not even call stub code (we generate the code inline)