Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(777)

Unified Diff: runtime/vm/lockers.cc

Issue 2018673003: Fix for issue 26511 (VM hangs waiting for all threads that are not already at (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/safepoint.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/lockers.cc
diff --git a/runtime/vm/lockers.cc b/runtime/vm/lockers.cc
index 2efe2458b927339fe57752d3eb575565b2f39198..b8ac4b64c84f27ce4180e057526fd77f9ac2d8fc 100644
--- a/runtime/vm/lockers.cc
+++ b/runtime/vm/lockers.cc
@@ -12,11 +12,11 @@ namespace dart {
static void updateThreadState(Thread* thread) {
// First try a fast update of the thread state to indicate it is not at a
// safepoint anymore.
- uword old_state = Thread::SetAtSafepoint(true, 0);
+ uint32_t old_state = Thread::SetAtSafepoint(true, 0);
uword addr =
reinterpret_cast<uword>(thread) + Thread::safepoint_state_offset();
- if (AtomicOperations::CompareAndSwapWord(
- reinterpret_cast<uword*>(addr), old_state, 0) != old_state) {
+ if (AtomicOperations::CompareAndSwapUint32(
+ reinterpret_cast<uint32_t*>(addr), old_state, 0) != old_state) {
// Fast update failed which means we could potentially be in the middle
// of a safepoint operation and need to block for it.
SafepointHandler* handler = thread->isolate()->safepoint_handler();
@@ -34,11 +34,11 @@ Monitor::WaitResult MonitorLocker::WaitWithSafepointCheck(Thread* thread,
Monitor::WaitResult result = monitor_->Wait(millis);
// First try a fast update of the thread state to indicate it is not at a
// safepoint anymore.
- uword old_state = Thread::SetAtSafepoint(true, 0);
+ uint32_t old_state = Thread::SetAtSafepoint(true, 0);
uword addr =
reinterpret_cast<uword>(thread) + Thread::safepoint_state_offset();
- if (AtomicOperations::CompareAndSwapWord(
- reinterpret_cast<uword*>(addr), old_state, 0) != old_state) {
+ if (AtomicOperations::CompareAndSwapUint32(
+ reinterpret_cast<uint32_t*>(addr), old_state, 0) != old_state) {
// Fast update failed which means we could potentially be in the middle
// of a safepoint operation and need to block for it.
monitor_->Exit();
@@ -98,11 +98,11 @@ Monitor::WaitResult SafepointMonitorLocker::Wait(int64_t millis) {
Monitor::WaitResult result = monitor_->Wait(millis);
// First try a fast update of the thread state to indicate it is not at a
// safepoint anymore.
- uword old_state = Thread::SetAtSafepoint(true, 0);
+ uint32_t old_state = Thread::SetAtSafepoint(true, 0);
uword addr =
reinterpret_cast<uword>(thread) + Thread::safepoint_state_offset();
- if (AtomicOperations::CompareAndSwapWord(
- reinterpret_cast<uword*>(addr), old_state, 0) != old_state) {
+ if (AtomicOperations::CompareAndSwapUint32(
+ reinterpret_cast<uint32_t*>(addr), old_state, 0) != old_state) {
// Fast update failed which means we could potentially be in the middle
// of a safepoint operation and need to block for it.
monitor_->Exit();
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/safepoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698