Index: src/vm-state-inl.h |
diff --git a/src/vm-state-inl.h b/src/vm-state-inl.h |
index 4df2cfda73b4f47cc584287afffa986d26f91d1d..aa4cedbb134b532e20020f160ba8930a827b3c9d 100644 |
--- a/src/vm-state-inl.h |
+++ b/src/vm-state-inl.h |
@@ -74,8 +74,10 @@ VMState::VMState(StateTag state) |
if (state == EXTERNAL) state = OTHER; |
#endif |
state_ = state; |
- previous_ = current_state_; // Save the previous state. |
- current_state_ = this; // Install the new state. |
+ // Save the previous state. |
+ previous_ = reinterpret_cast<VMState*>(current_state_); |
+ // Install the new state. |
+ OS::ReleaseStore(¤t_state_, reinterpret_cast<AtomicWord>(this)); |
#ifdef ENABLE_LOGGING_AND_PROFILING |
if (FLAG_log_state_changes) { |
@@ -103,7 +105,8 @@ VMState::VMState(StateTag state) |
VMState::~VMState() { |
if (disabled_) return; |
- current_state_ = previous_; // Return to the previous state. |
+ // Return to the previous state. |
+ OS::ReleaseStore(¤t_state_, reinterpret_cast<AtomicWord>(previous_)); |
#ifdef ENABLE_LOGGING_AND_PROFILING |
if (FLAG_log_state_changes) { |