diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc index 2e9530296e7..e0c1d55c5ad 100644 --- a/runtime/vm/thread.cc +++ b/runtime/vm/thread.cc @@ -331,6 +331,7 @@ void Thread::ClearStackLimit() { uword Thread::GetCurrentStackPointer() { // Since AddressSanitizer's detect_stack_use_after_return instruments the // C++ code to give out fake stack addresses, we call a stub in that case. + ASSERT(StubCode::GetStackPointer_entry() != NULL); uword (*func)() = reinterpret_cast( StubCode::GetStackPointer_entry()->EntryPoint()); // But for performance (and to support simulators), we normally use a local. diff --git a/runtime/vm/thread_pool.cc b/runtime/vm/thread_pool.cc index 70bac99675b..fb0f7d7c69b 100644 --- a/runtime/vm/thread_pool.cc +++ b/runtime/vm/thread_pool.cc @@ -433,6 +433,9 @@ void ThreadPool::Worker::Main(uword args) { ThreadJoinId join_id = os_thread->join_id(); ThreadPool* pool; + // Set the thread's stack_base based on the current stack pointer. + os_thread->set_stack_base(Thread::GetCurrentStackPointer()); + { MonitorLocker ml(&worker->monitor_); ASSERT(worker->task_);