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

Side by Side Diff: runtime/vm/os_thread_android.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 6
7 7
8 #if defined(TARGET_OS_ANDROID) 8 #if defined(TARGET_OS_ANDROID)
9 9
10 #include "vm/os_thread.h" 10 #include "vm/os_thread.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 ThreadId OSThread::ThreadIdFromIntPtr(intptr_t id) { 227 ThreadId OSThread::ThreadIdFromIntPtr(intptr_t id) {
228 return static_cast<ThreadId>(id); 228 return static_cast<ThreadId>(id);
229 } 229 }
230 230
231 231
232 bool OSThread::Compare(ThreadId a, ThreadId b) { 232 bool OSThread::Compare(ThreadId a, ThreadId b) {
233 return a == b; 233 return a == b;
234 } 234 }
235 235
236 236
237 bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) {
238 pthread_attr_t attr;
239 if (pthread_getattr_np(pthread_self(), &attr)) {
240 return false;
241 }
242
243 void* base;
244 size_t size;
245 int error = pthread_attr_getstack(&attr, &base, &size);
246 pthread_attr_destroy(&attr);
247 if (error) {
248 return false;
249 }
250
251 *lower = reinterpret_cast<uword>(base);
252 *upper = *lower + size;
253 return true;
254 }
255
256
237 Mutex::Mutex() { 257 Mutex::Mutex() {
238 pthread_mutexattr_t attr; 258 pthread_mutexattr_t attr;
239 int result = pthread_mutexattr_init(&attr); 259 int result = pthread_mutexattr_init(&attr);
240 VALIDATE_PTHREAD_RESULT(result); 260 VALIDATE_PTHREAD_RESULT(result);
241 261
242 #if defined(DEBUG) 262 #if defined(DEBUG)
243 result = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); 263 result = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
244 VALIDATE_PTHREAD_RESULT(result); 264 VALIDATE_PTHREAD_RESULT(result);
245 #endif // defined(DEBUG) 265 #endif // defined(DEBUG)
246 266
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 void Monitor::NotifyAll() { 466 void Monitor::NotifyAll() {
447 // When running with assertions enabled we track the owner. 467 // When running with assertions enabled we track the owner.
448 ASSERT(IsOwnedByCurrentThread()); 468 ASSERT(IsOwnedByCurrentThread());
449 int result = pthread_cond_broadcast(data_.cond()); 469 int result = pthread_cond_broadcast(data_.cond());
450 VALIDATE_PTHREAD_RESULT(result); 470 VALIDATE_PTHREAD_RESULT(result);
451 } 471 }
452 472
453 } // namespace dart 473 } // namespace dart
454 474
455 #endif // defined(TARGET_OS_ANDROID) 475 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « runtime/vm/os_thread.h ('k') | runtime/vm/os_thread_fuchsia.cc » ('j') | runtime/vm/profiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698