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

Side by Side Diff: runtime/vm/os_thread_macos.cc

Issue 2680123004: VM: Teach GetAndValidateIsolateStackBounds(...) to fallback to OS thread stack bounds. (Closed)
Patch Set: Done Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" // NOLINT 5 #include "platform/globals.h" // NOLINT
6 #if defined(TARGET_OS_MACOS) 6 #if defined(TARGET_OS_MACOS)
7 7
8 #include "vm/os_thread.h" 8 #include "vm/os_thread.h"
9 9
10 #include <sys/errno.h> // NOLINT 10 #include <sys/errno.h> // NOLINT
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 ThreadId OSThread::ThreadIdFromIntPtr(intptr_t id) { 202 ThreadId OSThread::ThreadIdFromIntPtr(intptr_t id) {
203 return reinterpret_cast<ThreadId>(id); 203 return reinterpret_cast<ThreadId>(id);
204 } 204 }
205 205
206 206
207 bool OSThread::Compare(ThreadId a, ThreadId b) { 207 bool OSThread::Compare(ThreadId a, ThreadId b) {
208 return pthread_equal(a, b) != 0; 208 return pthread_equal(a, b) != 0;
209 } 209 }
210 210
211 211
212 bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) {
213 *upper = reinterpret_cast<uword>(pthread_get_stackaddr_np(pthread_self()));
214 *lower = *upper - pthread_get_stacksize_np(pthread_self());
215 return true;
216 }
217
218
212 Mutex::Mutex() { 219 Mutex::Mutex() {
213 pthread_mutexattr_t attr; 220 pthread_mutexattr_t attr;
214 int result = pthread_mutexattr_init(&attr); 221 int result = pthread_mutexattr_init(&attr);
215 VALIDATE_PTHREAD_RESULT(result); 222 VALIDATE_PTHREAD_RESULT(result);
216 223
217 #if defined(DEBUG) 224 #if defined(DEBUG)
218 result = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); 225 result = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
219 VALIDATE_PTHREAD_RESULT(result); 226 VALIDATE_PTHREAD_RESULT(result);
220 #endif // defined(DEBUG) 227 #endif // defined(DEBUG)
221 228
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 void Monitor::NotifyAll() { 430 void Monitor::NotifyAll() {
424 // When running with assertions enabled we track the owner. 431 // When running with assertions enabled we track the owner.
425 ASSERT(IsOwnedByCurrentThread()); 432 ASSERT(IsOwnedByCurrentThread());
426 int result = pthread_cond_broadcast(data_.cond()); 433 int result = pthread_cond_broadcast(data_.cond());
427 VALIDATE_PTHREAD_RESULT(result); 434 VALIDATE_PTHREAD_RESULT(result);
428 } 435 }
429 436
430 } // namespace dart 437 } // namespace dart
431 438
432 #endif // defined(TARGET_OS_MACOS) 439 #endif // defined(TARGET_OS_MACOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698