From 86af66a3eed89ae3d877fcdd27bdf797b873b36c Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Thu, 24 Oct 2019 04:12:16 +0000 Subject: [PATCH] Revert "[vm, arm64] Adjust CSP during the invocation stub instead of each function prologue." This reverts commit b5b322962a43536e3c58d45e02a871e98c2950d0. Reason for revert: low frequency of crashes in service tests Original change's description: > [vm, arm64] Adjust CSP during the invocation stub instead of each function prologue. > > Since 6e2c4636cddece36c87ca77f69955a8490c8a0dd, we have more reliable information about the stack limit. > > This saves 8 bytes from each function. > > Flutter Gallery: > Instructions(CodeSize): 6491472 -> 6375472 (-1.79%) > Total(CodeSize): 10375882 -> 10258802 (-1.13%) > > Bug: http://dartbug.com/26472 > Change-Id: Ief1ddd25eecd32a8314c71fdb470dd73046e5dc0 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122408 > Commit-Queue: Ryan Macnak > Reviewed-by: Alexander Markov TBR=rmacnak@google.com,alexmarkov@google.com,ajcbik@google.com Change-Id: I0b45e1c81c1534e123dd85d27b7af27217e08795 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: http://dartbug.com/26472 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122725 Reviewed-by: Ryan Macnak Commit-Queue: Ryan Macnak --- runtime/bin/thread_android.cc | 2 +- .../vm/compiler/assembler/assembler_arm64.cc | 43 +- .../vm/compiler/assembler/assembler_arm64.h | 2 - runtime/vm/compiler/backend/il_arm64.cc | 14 +- runtime/vm/compiler/runtime_api.h | 1 - .../vm/compiler/runtime_offsets_extracted.h | 810 +++++++++--------- runtime/vm/compiler/runtime_offsets_list.h | 1 - runtime/vm/compiler/stub_code_compiler.h | 2 +- .../vm/compiler/stub_code_compiler_arm64.cc | 39 +- runtime/vm/dart_entry.cc | 8 + runtime/vm/os_thread.cc | 3 +- runtime/vm/os_thread.h | 9 +- runtime/vm/os_thread_android.cc | 3 +- runtime/vm/thread.cc | 2 +- runtime/vm/thread.h | 12 +- runtime/vm/thread_pool.cc | 3 + 16 files changed, 469 insertions(+), 485 deletions(-) diff --git a/runtime/bin/thread_android.cc b/runtime/bin/thread_android.cc index 28b47adf648..2bef99cf95d 100644 --- a/runtime/bin/thread_android.cc +++ b/runtime/bin/thread_android.cc @@ -154,7 +154,7 @@ ThreadId Thread::GetCurrentThreadId() { } intptr_t Thread::ThreadIdToIntPtr(ThreadId id) { - ASSERT(sizeof(id) <= sizeof(intptr_t)); + ASSERT(sizeof(id) == sizeof(intptr_t)); return static_cast(id); } diff --git a/runtime/vm/compiler/assembler/assembler_arm64.cc b/runtime/vm/compiler/assembler/assembler_arm64.cc index 6091c9ac8f2..bfd971be354 100644 --- a/runtime/vm/compiler/assembler/assembler_arm64.cc +++ b/runtime/vm/compiler/assembler/assembler_arm64.cc @@ -1207,27 +1207,13 @@ void Assembler::CheckCodePointer() { #endif } -// The ARM64 ABI requires at all times -// - stack limit < CSP <= stack base -// - CSP mod 16 = 0 -// - we do not access stack memory below CSP -// Practically, this means we need to keep the C stack pointer ahead of the -// Dart stack pointer and 16-byte aligned for signal handlers. We set -// CSP to a value near the stack limit during SetupDartSP*, and use a different -// register within our generated code to avoid the alignment requirement. -// Note that Fuchsia does not have signal handlers. - void Assembler::SetupDartSP() { mov(SP, CSP); - // The caller doesn't have a Thread available. Just kick CSP forward a bit. - AddImmediate(CSP, CSP, -kSpaceForSignalHandlers); -} - -void Assembler::SetupDartSPFromThread(Register thr) { - ldr(TMP, Address(thr, target::Thread::saved_stack_limit_offset())); - mov(SP, CSP); - // This is a Dart entry stub. Set CSP close to the stack limit. - AddImmediate(CSP, TMP, kSpaceForSignalHandlers); +#if defined(TARGET_OS_FUCHSIA) + // Make any future signal handlers fail fast. Verifies our assumption in + // EnterFrame. + orri(CSP, ZR, Immediate(16)); +#endif } void Assembler::RestoreCSP() { @@ -1235,6 +1221,25 @@ void Assembler::RestoreCSP() { } void Assembler::EnterFrame(intptr_t frame_size) { + // The ARM64 ABI requires at all times + // - stack limit < CSP <= stack base + // - CSP mod 16 = 0 + // - we do not access stack memory below CSP + // Pratically, this means we need to keep the C stack pointer ahead of the + // Dart stack pointer and 16-byte aligned for signal handlers. If we knew the + // real stack limit, we could just set CSP to a value near it during + // SetupDartSP, but we do not know the real stack limit for the initial + // thread or threads created by the embedder. + // TODO(26472): It would be safer to use CSP as the Dart stack pointer, but + // this requires adjustments to stack handling to maintain the 16-byte + // alignment. + // Note Fuchsia does not have signal handlers; see also SetupDartSP. +#if !defined(TARGET_OS_FUCHSIA) + const intptr_t kMaxDartFrameSize = 4096; + sub(TMP, SP, Operand(kMaxDartFrameSize)); + andi(CSP, TMP, Immediate(~15)); +#endif + PushPair(FP, LR); // low: FP, high: LR. mov(FP, SP); diff --git a/runtime/vm/compiler/assembler/assembler_arm64.h b/runtime/vm/compiler/assembler/assembler_arm64.h index 9c02c1e82ba..7c83c72a5bd 100644 --- a/runtime/vm/compiler/assembler/assembler_arm64.h +++ b/runtime/vm/compiler/assembler/assembler_arm64.h @@ -1532,9 +1532,7 @@ class Assembler : public AssemblerBase { void LoadClassIdMayBeSmi(Register result, Register object); void LoadTaggedClassIdMayBeSmi(Register result, Register object); - static constexpr intptr_t kSpaceForSignalHandlers = 4096; void SetupDartSP(); - void SetupDartSPFromThread(Register thr); void RestoreCSP(); void EnterFrame(intptr_t frame_size); diff --git a/runtime/vm/compiler/backend/il_arm64.cc b/runtime/vm/compiler/backend/il_arm64.cc index 73c65694872..6b20bc534b4 100644 --- a/runtime/vm/compiler/backend/il_arm64.cc +++ b/runtime/vm/compiler/backend/il_arm64.cc @@ -921,14 +921,12 @@ void FfiCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { // We are entering runtime code, so the C stack pointer must be restored // from the stack limit to the top of the stack. - __ mov(R25, CSP); __ mov(CSP, SP); __ blr(branch); // Restore the Dart stack pointer. __ mov(SP, CSP); - __ mov(CSP, R25); // Update information in the thread object and leave the safepoint. __ TransitionNativeToGenerated(temp, /*leave_safepoint=*/true); @@ -1036,9 +1034,7 @@ void NativeEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ Bind(compiler->GetJumpLabel(this)); // We don't use the regular stack pointer in ARM64, so we have to copy the - // native stack pointer into the Dart stack pointer. This will also kick CSP - // forward a bit, enough for the spills and leaf call below, until we can set - // it properly after setting up THR. + // native stack pointer into the Dart stack pointer. __ SetupDartSP(); // Create a dummy frame holding the pushed arguments. This simplifies @@ -1106,11 +1102,6 @@ void NativeEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { __ LeaveFrame(); } - // Now we have THR and can set CSP. See SetupDartSPFromThread. - __ ldr(TMP, compiler::Address( - THR, compiler::target::Thread::saved_stack_limit_offset())); - __ AddImmediate(CSP, TMP, compiler::Assembler::kSpaceForSignalHandlers); - // Refresh write barrier mask. __ ldr(BARRIER_MASK, compiler::Address( @@ -2959,8 +2950,7 @@ void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); compiler->AddSlowPathCode(slow_path); - __ ldr(TMP, compiler::Address( - THR, compiler::target::Thread::stack_limit_offset())); + __ ldr(TMP, compiler::Address(THR, Thread::stack_limit_offset())); __ CompareRegisters(SP, TMP); __ b(slow_path->entry_label(), LS); if (compiler->CanOSRFunction() && in_loop()) { diff --git a/runtime/vm/compiler/runtime_api.h b/runtime/vm/compiler/runtime_api.h index 46c677b9f9e..8c3656149e2 100644 --- a/runtime/vm/compiler/runtime_api.h +++ b/runtime/vm/compiler/runtime_api.h @@ -668,7 +668,6 @@ class Thread : public AllStatic { static word stack_overflow_flags_offset(); static word stack_overflow_shared_stub_entry_point_offset(bool fpu_regs); static word stack_limit_offset(); - static word saved_stack_limit_offset(); static word unboxed_int64_runtime_arg_offset(); static word callback_code_offset(); diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h index a24a2981a6b..62a38bad9a7 100644 --- a/runtime/vm/compiler/runtime_offsets_extracted.h +++ b/runtime/vm/compiler/runtime_offsets_extracted.h @@ -193,132 +193,130 @@ static constexpr dart::compiler::target::word String_hash_offset = 8; static constexpr dart::compiler::target::word String_length_offset = 4; static constexpr dart::compiler::target::word SubtypeTestCache_cache_offset = 4; static constexpr dart::compiler::target::word - Thread_AllocateArray_entry_point_offset = 292; + Thread_AllocateArray_entry_point_offset = 284; static constexpr dart::compiler::target::word Thread_active_exception_offset = - 624; + 616; static constexpr dart::compiler::target::word Thread_active_stacktrace_offset = - 628; + 620; static constexpr dart::compiler::target::word - Thread_array_write_barrier_code_offset = 120; + Thread_array_write_barrier_code_offset = 112; static constexpr dart::compiler::target::word - Thread_array_write_barrier_entry_point_offset = 204; + Thread_array_write_barrier_entry_point_offset = 196; static constexpr dart::compiler::target::word Thread_async_stack_trace_offset = - 88; + 84; static constexpr dart::compiler::target::word - Thread_auto_scope_native_wrapper_entry_point_offset = 252; -static constexpr dart::compiler::target::word Thread_bool_false_offset = 112; -static constexpr dart::compiler::target::word Thread_bool_true_offset = 108; + Thread_auto_scope_native_wrapper_entry_point_offset = 244; +static constexpr dart::compiler::target::word Thread_bool_false_offset = 104; +static constexpr dart::compiler::target::word Thread_bool_true_offset = 100; static constexpr dart::compiler::target::word - Thread_call_to_runtime_entry_point_offset = 208; + Thread_call_to_runtime_entry_point_offset = 200; static constexpr dart::compiler::target::word - Thread_call_to_runtime_stub_offset = 140; -static constexpr dart::compiler::target::word Thread_dart_stream_offset = 660; + Thread_call_to_runtime_stub_offset = 132; +static constexpr dart::compiler::target::word Thread_dart_stream_offset = 652; static constexpr dart::compiler::target::word Thread_optimize_entry_offset = - 236; -static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 164; + 228; +static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 156; static constexpr dart::compiler::target::word Thread_deoptimize_entry_offset = - 240; + 232; static constexpr dart::compiler::target::word Thread_deoptimize_stub_offset = - 168; + 160; static constexpr dart::compiler::target::word Thread_double_abs_address_offset = - 272; + 264; static constexpr dart::compiler::target::word - Thread_double_negate_address_offset = 268; -static constexpr dart::compiler::target::word Thread_end_offset = 64; + Thread_double_negate_address_offset = 260; +static constexpr dart::compiler::target::word Thread_end_offset = 60; static constexpr dart::compiler::target::word - Thread_enter_safepoint_stub_offset = 188; + Thread_enter_safepoint_stub_offset = 180; static constexpr dart::compiler::target::word Thread_execution_state_offset = - 644; + 636; static constexpr dart::compiler::target::word - Thread_exit_safepoint_stub_offset = 192; + Thread_exit_safepoint_stub_offset = 184; static constexpr dart::compiler::target::word - Thread_call_native_through_safepoint_stub_offset = 196; + Thread_call_native_through_safepoint_stub_offset = 188; static constexpr dart::compiler::target::word - Thread_call_native_through_safepoint_entry_point_offset = 244; + Thread_call_native_through_safepoint_entry_point_offset = 236; static constexpr dart::compiler::target::word - Thread_fix_allocation_stub_code_offset = 128; + Thread_fix_allocation_stub_code_offset = 120; static constexpr dart::compiler::target::word - Thread_fix_callers_target_code_offset = 124; + Thread_fix_callers_target_code_offset = 116; static constexpr dart::compiler::target::word - Thread_float_absolute_address_offset = 284; + Thread_float_absolute_address_offset = 276; static constexpr dart::compiler::target::word - Thread_float_negate_address_offset = 280; + Thread_float_negate_address_offset = 272; static constexpr dart::compiler::target::word Thread_float_not_address_offset = - 276; + 268; static constexpr dart::compiler::target::word - Thread_float_zerow_address_offset = 288; + Thread_float_zerow_address_offset = 280; static constexpr dart::compiler::target::word Thread_global_object_pool_offset = - 632; + 624; static constexpr dart::compiler::target::word - Thread_interpret_call_entry_point_offset = 256; + Thread_interpret_call_entry_point_offset = 248; static constexpr dart::compiler::target::word - Thread_invoke_dart_code_from_bytecode_stub_offset = 136; + Thread_invoke_dart_code_from_bytecode_stub_offset = 128; static constexpr dart::compiler::target::word - Thread_invoke_dart_code_stub_offset = 132; -static constexpr dart::compiler::target::word Thread_isolate_offset = 52; + Thread_invoke_dart_code_stub_offset = 124; +static constexpr dart::compiler::target::word Thread_isolate_offset = 48; static constexpr dart::compiler::target::word - Thread_lazy_deopt_from_return_stub_offset = 172; + Thread_lazy_deopt_from_return_stub_offset = 164; static constexpr dart::compiler::target::word - Thread_lazy_deopt_from_throw_stub_offset = 176; + Thread_lazy_deopt_from_throw_stub_offset = 168; static constexpr dart::compiler::target::word - Thread_lazy_specialize_type_test_stub_offset = 184; + Thread_lazy_specialize_type_test_stub_offset = 176; static constexpr dart::compiler::target::word - Thread_marking_stack_block_offset = 76; + Thread_marking_stack_block_offset = 72; static constexpr dart::compiler::target::word - Thread_megamorphic_call_checked_entry_offset = 228; + Thread_megamorphic_call_checked_entry_offset = 220; static constexpr dart::compiler::target::word - Thread_monomorphic_miss_entry_offset = 232; + Thread_monomorphic_miss_entry_offset = 224; static constexpr dart::compiler::target::word - Thread_monomorphic_miss_stub_offset = 160; + Thread_monomorphic_miss_stub_offset = 152; static constexpr dart::compiler::target::word - Thread_no_scope_native_wrapper_entry_point_offset = 248; + Thread_no_scope_native_wrapper_entry_point_offset = 240; static constexpr dart::compiler::target::word - Thread_null_error_shared_with_fpu_regs_entry_point_offset = 216; + Thread_null_error_shared_with_fpu_regs_entry_point_offset = 208; static constexpr dart::compiler::target::word - Thread_null_error_shared_with_fpu_regs_stub_offset = 148; + Thread_null_error_shared_with_fpu_regs_stub_offset = 140; static constexpr dart::compiler::target::word - Thread_null_error_shared_without_fpu_regs_entry_point_offset = 212; + Thread_null_error_shared_without_fpu_regs_entry_point_offset = 204; static constexpr dart::compiler::target::word - Thread_null_error_shared_without_fpu_regs_stub_offset = 144; -static constexpr dart::compiler::target::word Thread_object_null_offset = 104; + Thread_null_error_shared_without_fpu_regs_stub_offset = 136; +static constexpr dart::compiler::target::word Thread_object_null_offset = 96; static constexpr dart::compiler::target::word - Thread_predefined_symbols_address_offset = 260; -static constexpr dart::compiler::target::word Thread_resume_pc_offset = 636; + Thread_predefined_symbols_address_offset = 252; +static constexpr dart::compiler::target::word Thread_resume_pc_offset = 628; static constexpr dart::compiler::target::word - Thread_saved_shadow_call_stack_offset = 640; + Thread_saved_shadow_call_stack_offset = 632; static constexpr dart::compiler::target::word Thread_safepoint_state_offset = - 648; + 640; static constexpr dart::compiler::target::word - Thread_slow_type_test_stub_offset = 180; + Thread_slow_type_test_stub_offset = 172; static constexpr dart::compiler::target::word Thread_stack_limit_offset = 36; -static constexpr dart::compiler::target::word Thread_saved_stack_limit_offset = - 40; static constexpr dart::compiler::target::word - Thread_stack_overflow_flags_offset = 44; + Thread_stack_overflow_flags_offset = 40; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 224; + Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 216; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 156; + Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 148; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 220; + Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 212; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 152; + Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 144; static constexpr dart::compiler::target::word Thread_store_buffer_block_offset = - 72; + 68; static constexpr dart::compiler::target::word - Thread_top_exit_frame_info_offset = 68; -static constexpr dart::compiler::target::word Thread_top_offset = 60; + Thread_top_exit_frame_info_offset = 64; +static constexpr dart::compiler::target::word Thread_top_offset = 56; static constexpr dart::compiler::target::word Thread_top_resource_offset = 24; static constexpr dart::compiler::target::word - Thread_unboxed_int64_runtime_arg_offset = 96; -static constexpr dart::compiler::target::word Thread_vm_tag_offset = 84; + Thread_unboxed_int64_runtime_arg_offset = 88; +static constexpr dart::compiler::target::word Thread_vm_tag_offset = 80; static constexpr dart::compiler::target::word Thread_write_barrier_code_offset = - 116; + 108; static constexpr dart::compiler::target::word - Thread_write_barrier_entry_point_offset = 200; + Thread_write_barrier_entry_point_offset = 192; static constexpr dart::compiler::target::word Thread_write_barrier_mask_offset = - 48; -static constexpr dart::compiler::target::word Thread_callback_code_offset = 652; + 44; +static constexpr dart::compiler::target::word Thread_callback_code_offset = 644; static constexpr dart::compiler::target::word TimelineStream_enabled_offset = 8; static constexpr dart::compiler::target::word TwoByteString_data_offset = 12; static constexpr dart::compiler::target::word Type_arguments_offset = 16; @@ -351,8 +349,8 @@ static constexpr dart::compiler::target::word Code_function_entry_point_offset[] = {4, 8}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { - 588, 592, 596, 600, 604, -1, 608, 612, - 616, 620, -1, -1, -1, -1, -1, -1}; + 580, 584, 588, 592, 596, -1, 600, 604, + 608, 612, -1, -1, -1, -1, -1, -1}; static constexpr dart::compiler::target::word Array_header_size = 12; static constexpr dart::compiler::target::word Context_header_size = 12; static constexpr dart::compiler::target::word Double_InstanceSize = 16; @@ -554,133 +552,131 @@ static constexpr dart::compiler::target::word String_hash_offset = 4; static constexpr dart::compiler::target::word String_length_offset = 8; static constexpr dart::compiler::target::word SubtypeTestCache_cache_offset = 8; static constexpr dart::compiler::target::word - Thread_AllocateArray_entry_point_offset = 568; + Thread_AllocateArray_entry_point_offset = 560; static constexpr dart::compiler::target::word Thread_active_exception_offset = - 1248; + 1240; static constexpr dart::compiler::target::word Thread_active_stacktrace_offset = - 1256; + 1248; static constexpr dart::compiler::target::word - Thread_array_write_barrier_code_offset = 224; + Thread_array_write_barrier_code_offset = 216; static constexpr dart::compiler::target::word - Thread_array_write_barrier_entry_point_offset = 392; + Thread_array_write_barrier_entry_point_offset = 384; static constexpr dart::compiler::target::word Thread_async_stack_trace_offset = - 176; + 168; static constexpr dart::compiler::target::word - Thread_auto_scope_native_wrapper_entry_point_offset = 488; -static constexpr dart::compiler::target::word Thread_bool_false_offset = 208; -static constexpr dart::compiler::target::word Thread_bool_true_offset = 200; + Thread_auto_scope_native_wrapper_entry_point_offset = 480; +static constexpr dart::compiler::target::word Thread_bool_false_offset = 200; +static constexpr dart::compiler::target::word Thread_bool_true_offset = 192; static constexpr dart::compiler::target::word - Thread_call_to_runtime_entry_point_offset = 400; + Thread_call_to_runtime_entry_point_offset = 392; static constexpr dart::compiler::target::word - Thread_call_to_runtime_stub_offset = 264; -static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1320; + Thread_call_to_runtime_stub_offset = 256; +static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1312; static constexpr dart::compiler::target::word Thread_optimize_entry_offset = - 456; -static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 312; + 448; +static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 304; static constexpr dart::compiler::target::word Thread_deoptimize_entry_offset = - 464; + 456; static constexpr dart::compiler::target::word Thread_deoptimize_stub_offset = - 320; + 312; static constexpr dart::compiler::target::word Thread_double_abs_address_offset = + 520; +static constexpr dart::compiler::target::word + Thread_double_negate_address_offset = 512; +static constexpr dart::compiler::target::word Thread_end_offset = 120; +static constexpr dart::compiler::target::word + Thread_enter_safepoint_stub_offset = 352; +static constexpr dart::compiler::target::word Thread_execution_state_offset = + 1280; +static constexpr dart::compiler::target::word + Thread_exit_safepoint_stub_offset = 360; +static constexpr dart::compiler::target::word + Thread_call_native_through_safepoint_stub_offset = 368; +static constexpr dart::compiler::target::word + Thread_call_native_through_safepoint_entry_point_offset = 464; +static constexpr dart::compiler::target::word + Thread_fix_allocation_stub_code_offset = 232; +static constexpr dart::compiler::target::word + Thread_fix_callers_target_code_offset = 224; +static constexpr dart::compiler::target::word + Thread_float_absolute_address_offset = 544; +static constexpr dart::compiler::target::word + Thread_float_negate_address_offset = 536; +static constexpr dart::compiler::target::word Thread_float_not_address_offset = 528; static constexpr dart::compiler::target::word - Thread_double_negate_address_offset = 520; -static constexpr dart::compiler::target::word Thread_end_offset = 128; + Thread_float_zerow_address_offset = 552; +static constexpr dart::compiler::target::word Thread_global_object_pool_offset = + 1256; static constexpr dart::compiler::target::word - Thread_enter_safepoint_stub_offset = 360; -static constexpr dart::compiler::target::word Thread_execution_state_offset = + Thread_interpret_call_entry_point_offset = 488; +static constexpr dart::compiler::target::word + Thread_invoke_dart_code_from_bytecode_stub_offset = 248; +static constexpr dart::compiler::target::word + Thread_invoke_dart_code_stub_offset = 240; +static constexpr dart::compiler::target::word Thread_isolate_offset = 96; +static constexpr dart::compiler::target::word + Thread_lazy_deopt_from_return_stub_offset = 320; +static constexpr dart::compiler::target::word + Thread_lazy_deopt_from_throw_stub_offset = 328; +static constexpr dart::compiler::target::word + Thread_lazy_specialize_type_test_stub_offset = 344; +static constexpr dart::compiler::target::word + Thread_marking_stack_block_offset = 144; +static constexpr dart::compiler::target::word + Thread_megamorphic_call_checked_entry_offset = 432; +static constexpr dart::compiler::target::word + Thread_monomorphic_miss_entry_offset = 440; +static constexpr dart::compiler::target::word + Thread_monomorphic_miss_stub_offset = 296; +static constexpr dart::compiler::target::word + Thread_no_scope_native_wrapper_entry_point_offset = 472; +static constexpr dart::compiler::target::word + Thread_null_error_shared_with_fpu_regs_entry_point_offset = 408; +static constexpr dart::compiler::target::word + Thread_null_error_shared_with_fpu_regs_stub_offset = 272; +static constexpr dart::compiler::target::word + Thread_null_error_shared_without_fpu_regs_entry_point_offset = 400; +static constexpr dart::compiler::target::word + Thread_null_error_shared_without_fpu_regs_stub_offset = 264; +static constexpr dart::compiler::target::word Thread_object_null_offset = 184; +static constexpr dart::compiler::target::word + Thread_predefined_symbols_address_offset = 496; +static constexpr dart::compiler::target::word Thread_resume_pc_offset = 1264; +static constexpr dart::compiler::target::word + Thread_saved_shadow_call_stack_offset = 1272; +static constexpr dart::compiler::target::word Thread_safepoint_state_offset = 1288; static constexpr dart::compiler::target::word - Thread_exit_safepoint_stub_offset = 368; -static constexpr dart::compiler::target::word - Thread_call_native_through_safepoint_stub_offset = 376; -static constexpr dart::compiler::target::word - Thread_call_native_through_safepoint_entry_point_offset = 472; -static constexpr dart::compiler::target::word - Thread_fix_allocation_stub_code_offset = 240; -static constexpr dart::compiler::target::word - Thread_fix_callers_target_code_offset = 232; -static constexpr dart::compiler::target::word - Thread_float_absolute_address_offset = 552; -static constexpr dart::compiler::target::word - Thread_float_negate_address_offset = 544; -static constexpr dart::compiler::target::word Thread_float_not_address_offset = - 536; -static constexpr dart::compiler::target::word - Thread_float_zerow_address_offset = 560; -static constexpr dart::compiler::target::word Thread_global_object_pool_offset = - 1264; -static constexpr dart::compiler::target::word - Thread_interpret_call_entry_point_offset = 496; -static constexpr dart::compiler::target::word - Thread_invoke_dart_code_from_bytecode_stub_offset = 256; -static constexpr dart::compiler::target::word - Thread_invoke_dart_code_stub_offset = 248; -static constexpr dart::compiler::target::word Thread_isolate_offset = 104; -static constexpr dart::compiler::target::word - Thread_lazy_deopt_from_return_stub_offset = 328; -static constexpr dart::compiler::target::word - Thread_lazy_deopt_from_throw_stub_offset = 336; -static constexpr dart::compiler::target::word - Thread_lazy_specialize_type_test_stub_offset = 352; -static constexpr dart::compiler::target::word - Thread_marking_stack_block_offset = 152; -static constexpr dart::compiler::target::word - Thread_megamorphic_call_checked_entry_offset = 440; -static constexpr dart::compiler::target::word - Thread_monomorphic_miss_entry_offset = 448; -static constexpr dart::compiler::target::word - Thread_monomorphic_miss_stub_offset = 304; -static constexpr dart::compiler::target::word - Thread_no_scope_native_wrapper_entry_point_offset = 480; -static constexpr dart::compiler::target::word - Thread_null_error_shared_with_fpu_regs_entry_point_offset = 416; -static constexpr dart::compiler::target::word - Thread_null_error_shared_with_fpu_regs_stub_offset = 280; -static constexpr dart::compiler::target::word - Thread_null_error_shared_without_fpu_regs_entry_point_offset = 408; -static constexpr dart::compiler::target::word - Thread_null_error_shared_without_fpu_regs_stub_offset = 272; -static constexpr dart::compiler::target::word Thread_object_null_offset = 192; -static constexpr dart::compiler::target::word - Thread_predefined_symbols_address_offset = 504; -static constexpr dart::compiler::target::word Thread_resume_pc_offset = 1272; -static constexpr dart::compiler::target::word - Thread_saved_shadow_call_stack_offset = 1280; -static constexpr dart::compiler::target::word Thread_safepoint_state_offset = - 1296; -static constexpr dart::compiler::target::word - Thread_slow_type_test_stub_offset = 344; + Thread_slow_type_test_stub_offset = 336; static constexpr dart::compiler::target::word Thread_stack_limit_offset = 72; -static constexpr dart::compiler::target::word Thread_saved_stack_limit_offset = - 80; static constexpr dart::compiler::target::word - Thread_stack_overflow_flags_offset = 88; + Thread_stack_overflow_flags_offset = 80; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 432; + Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 424; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 296; + Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 288; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 424; + Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 416; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 288; + Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 280; static constexpr dart::compiler::target::word Thread_store_buffer_block_offset = - 144; + 136; static constexpr dart::compiler::target::word - Thread_top_exit_frame_info_offset = 136; -static constexpr dart::compiler::target::word Thread_top_offset = 120; + Thread_top_exit_frame_info_offset = 128; +static constexpr dart::compiler::target::word Thread_top_offset = 112; static constexpr dart::compiler::target::word Thread_top_resource_offset = 48; static constexpr dart::compiler::target::word - Thread_unboxed_int64_runtime_arg_offset = 184; -static constexpr dart::compiler::target::word Thread_vm_tag_offset = 168; + Thread_unboxed_int64_runtime_arg_offset = 176; +static constexpr dart::compiler::target::word Thread_vm_tag_offset = 160; static constexpr dart::compiler::target::word Thread_write_barrier_code_offset = - 216; + 208; static constexpr dart::compiler::target::word - Thread_write_barrier_entry_point_offset = 384; + Thread_write_barrier_entry_point_offset = 376; static constexpr dart::compiler::target::word Thread_write_barrier_mask_offset = - 96; + 88; static constexpr dart::compiler::target::word Thread_callback_code_offset = - 1304; + 1296; static constexpr dart::compiler::target::word TimelineStream_enabled_offset = 16; static constexpr dart::compiler::target::word TwoByteString_data_offset = 16; @@ -714,8 +710,8 @@ static constexpr dart::compiler::target::word Code_function_entry_point_offset[] = {8, 16}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { - 1160, 1168, 1176, 1184, -1, -1, 1192, 1200, - 1208, 1216, 1224, -1, 1232, 1240, -1, -1}; + 1152, 1160, 1168, 1176, -1, -1, 1184, 1192, + 1200, 1208, 1216, -1, 1224, 1232, -1, -1}; static constexpr dart::compiler::target::word Array_header_size = 24; static constexpr dart::compiler::target::word Context_header_size = 24; static constexpr dart::compiler::target::word Double_InstanceSize = 16; @@ -915,132 +911,130 @@ static constexpr dart::compiler::target::word String_hash_offset = 8; static constexpr dart::compiler::target::word String_length_offset = 4; static constexpr dart::compiler::target::word SubtypeTestCache_cache_offset = 4; static constexpr dart::compiler::target::word - Thread_AllocateArray_entry_point_offset = 292; + Thread_AllocateArray_entry_point_offset = 284; static constexpr dart::compiler::target::word Thread_active_exception_offset = - 588; + 580; static constexpr dart::compiler::target::word Thread_active_stacktrace_offset = - 592; + 584; static constexpr dart::compiler::target::word - Thread_array_write_barrier_code_offset = 120; + Thread_array_write_barrier_code_offset = 112; static constexpr dart::compiler::target::word - Thread_array_write_barrier_entry_point_offset = 204; + Thread_array_write_barrier_entry_point_offset = 196; static constexpr dart::compiler::target::word Thread_async_stack_trace_offset = - 88; + 84; static constexpr dart::compiler::target::word - Thread_auto_scope_native_wrapper_entry_point_offset = 252; -static constexpr dart::compiler::target::word Thread_bool_false_offset = 112; -static constexpr dart::compiler::target::word Thread_bool_true_offset = 108; + Thread_auto_scope_native_wrapper_entry_point_offset = 244; +static constexpr dart::compiler::target::word Thread_bool_false_offset = 104; +static constexpr dart::compiler::target::word Thread_bool_true_offset = 100; static constexpr dart::compiler::target::word - Thread_call_to_runtime_entry_point_offset = 208; + Thread_call_to_runtime_entry_point_offset = 200; static constexpr dart::compiler::target::word - Thread_call_to_runtime_stub_offset = 140; -static constexpr dart::compiler::target::word Thread_dart_stream_offset = 624; + Thread_call_to_runtime_stub_offset = 132; +static constexpr dart::compiler::target::word Thread_dart_stream_offset = 616; static constexpr dart::compiler::target::word Thread_optimize_entry_offset = - 236; -static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 164; + 228; +static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 156; static constexpr dart::compiler::target::word Thread_deoptimize_entry_offset = - 240; + 232; static constexpr dart::compiler::target::word Thread_deoptimize_stub_offset = - 168; + 160; static constexpr dart::compiler::target::word Thread_double_abs_address_offset = - 272; + 264; static constexpr dart::compiler::target::word - Thread_double_negate_address_offset = 268; -static constexpr dart::compiler::target::word Thread_end_offset = 64; + Thread_double_negate_address_offset = 260; +static constexpr dart::compiler::target::word Thread_end_offset = 60; static constexpr dart::compiler::target::word - Thread_enter_safepoint_stub_offset = 188; + Thread_enter_safepoint_stub_offset = 180; static constexpr dart::compiler::target::word Thread_execution_state_offset = - 608; + 600; static constexpr dart::compiler::target::word - Thread_exit_safepoint_stub_offset = 192; + Thread_exit_safepoint_stub_offset = 184; static constexpr dart::compiler::target::word - Thread_call_native_through_safepoint_stub_offset = 196; + Thread_call_native_through_safepoint_stub_offset = 188; static constexpr dart::compiler::target::word - Thread_call_native_through_safepoint_entry_point_offset = 244; + Thread_call_native_through_safepoint_entry_point_offset = 236; static constexpr dart::compiler::target::word - Thread_fix_allocation_stub_code_offset = 128; + Thread_fix_allocation_stub_code_offset = 120; static constexpr dart::compiler::target::word - Thread_fix_callers_target_code_offset = 124; + Thread_fix_callers_target_code_offset = 116; static constexpr dart::compiler::target::word - Thread_float_absolute_address_offset = 284; + Thread_float_absolute_address_offset = 276; static constexpr dart::compiler::target::word - Thread_float_negate_address_offset = 280; + Thread_float_negate_address_offset = 272; static constexpr dart::compiler::target::word Thread_float_not_address_offset = - 276; + 268; static constexpr dart::compiler::target::word - Thread_float_zerow_address_offset = 288; + Thread_float_zerow_address_offset = 280; static constexpr dart::compiler::target::word Thread_global_object_pool_offset = - 596; + 588; static constexpr dart::compiler::target::word - Thread_interpret_call_entry_point_offset = 256; + Thread_interpret_call_entry_point_offset = 248; static constexpr dart::compiler::target::word - Thread_invoke_dart_code_from_bytecode_stub_offset = 136; + Thread_invoke_dart_code_from_bytecode_stub_offset = 128; static constexpr dart::compiler::target::word - Thread_invoke_dart_code_stub_offset = 132; -static constexpr dart::compiler::target::word Thread_isolate_offset = 52; + Thread_invoke_dart_code_stub_offset = 124; +static constexpr dart::compiler::target::word Thread_isolate_offset = 48; static constexpr dart::compiler::target::word - Thread_lazy_deopt_from_return_stub_offset = 172; + Thread_lazy_deopt_from_return_stub_offset = 164; static constexpr dart::compiler::target::word - Thread_lazy_deopt_from_throw_stub_offset = 176; + Thread_lazy_deopt_from_throw_stub_offset = 168; static constexpr dart::compiler::target::word - Thread_lazy_specialize_type_test_stub_offset = 184; + Thread_lazy_specialize_type_test_stub_offset = 176; static constexpr dart::compiler::target::word - Thread_marking_stack_block_offset = 76; + Thread_marking_stack_block_offset = 72; static constexpr dart::compiler::target::word - Thread_megamorphic_call_checked_entry_offset = 228; + Thread_megamorphic_call_checked_entry_offset = 220; static constexpr dart::compiler::target::word - Thread_monomorphic_miss_entry_offset = 232; + Thread_monomorphic_miss_entry_offset = 224; static constexpr dart::compiler::target::word - Thread_monomorphic_miss_stub_offset = 160; + Thread_monomorphic_miss_stub_offset = 152; static constexpr dart::compiler::target::word - Thread_no_scope_native_wrapper_entry_point_offset = 248; + Thread_no_scope_native_wrapper_entry_point_offset = 240; static constexpr dart::compiler::target::word - Thread_null_error_shared_with_fpu_regs_entry_point_offset = 216; + Thread_null_error_shared_with_fpu_regs_entry_point_offset = 208; static constexpr dart::compiler::target::word - Thread_null_error_shared_with_fpu_regs_stub_offset = 148; + Thread_null_error_shared_with_fpu_regs_stub_offset = 140; static constexpr dart::compiler::target::word - Thread_null_error_shared_without_fpu_regs_entry_point_offset = 212; + Thread_null_error_shared_without_fpu_regs_entry_point_offset = 204; static constexpr dart::compiler::target::word - Thread_null_error_shared_without_fpu_regs_stub_offset = 144; -static constexpr dart::compiler::target::word Thread_object_null_offset = 104; + Thread_null_error_shared_without_fpu_regs_stub_offset = 136; +static constexpr dart::compiler::target::word Thread_object_null_offset = 96; static constexpr dart::compiler::target::word - Thread_predefined_symbols_address_offset = 260; -static constexpr dart::compiler::target::word Thread_resume_pc_offset = 600; + Thread_predefined_symbols_address_offset = 252; +static constexpr dart::compiler::target::word Thread_resume_pc_offset = 592; static constexpr dart::compiler::target::word - Thread_saved_shadow_call_stack_offset = 604; + Thread_saved_shadow_call_stack_offset = 596; static constexpr dart::compiler::target::word Thread_safepoint_state_offset = - 612; + 604; static constexpr dart::compiler::target::word - Thread_slow_type_test_stub_offset = 180; + Thread_slow_type_test_stub_offset = 172; static constexpr dart::compiler::target::word Thread_stack_limit_offset = 36; -static constexpr dart::compiler::target::word Thread_saved_stack_limit_offset = - 40; static constexpr dart::compiler::target::word - Thread_stack_overflow_flags_offset = 44; + Thread_stack_overflow_flags_offset = 40; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 224; + Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 216; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 156; + Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 148; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 220; + Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 212; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 152; + Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 144; static constexpr dart::compiler::target::word Thread_store_buffer_block_offset = - 72; + 68; static constexpr dart::compiler::target::word - Thread_top_exit_frame_info_offset = 68; -static constexpr dart::compiler::target::word Thread_top_offset = 60; + Thread_top_exit_frame_info_offset = 64; +static constexpr dart::compiler::target::word Thread_top_offset = 56; static constexpr dart::compiler::target::word Thread_top_resource_offset = 24; static constexpr dart::compiler::target::word - Thread_unboxed_int64_runtime_arg_offset = 96; -static constexpr dart::compiler::target::word Thread_vm_tag_offset = 84; + Thread_unboxed_int64_runtime_arg_offset = 88; +static constexpr dart::compiler::target::word Thread_vm_tag_offset = 80; static constexpr dart::compiler::target::word Thread_write_barrier_code_offset = - 116; + 108; static constexpr dart::compiler::target::word - Thread_write_barrier_entry_point_offset = 200; + Thread_write_barrier_entry_point_offset = 192; static constexpr dart::compiler::target::word Thread_write_barrier_mask_offset = - 48; -static constexpr dart::compiler::target::word Thread_callback_code_offset = 616; + 44; +static constexpr dart::compiler::target::word Thread_callback_code_offset = 608; static constexpr dart::compiler::target::word TimelineStream_enabled_offset = 8; static constexpr dart::compiler::target::word TwoByteString_data_offset = 12; static constexpr dart::compiler::target::word Type_arguments_offset = 16; @@ -1272,133 +1266,131 @@ static constexpr dart::compiler::target::word String_hash_offset = 4; static constexpr dart::compiler::target::word String_length_offset = 8; static constexpr dart::compiler::target::word SubtypeTestCache_cache_offset = 8; static constexpr dart::compiler::target::word - Thread_AllocateArray_entry_point_offset = 568; + Thread_AllocateArray_entry_point_offset = 560; static constexpr dart::compiler::target::word Thread_active_exception_offset = - 1336; + 1328; static constexpr dart::compiler::target::word Thread_active_stacktrace_offset = - 1344; + 1336; static constexpr dart::compiler::target::word - Thread_array_write_barrier_code_offset = 224; + Thread_array_write_barrier_code_offset = 216; static constexpr dart::compiler::target::word - Thread_array_write_barrier_entry_point_offset = 392; + Thread_array_write_barrier_entry_point_offset = 384; static constexpr dart::compiler::target::word Thread_async_stack_trace_offset = - 176; + 168; static constexpr dart::compiler::target::word - Thread_auto_scope_native_wrapper_entry_point_offset = 488; -static constexpr dart::compiler::target::word Thread_bool_false_offset = 208; -static constexpr dart::compiler::target::word Thread_bool_true_offset = 200; + Thread_auto_scope_native_wrapper_entry_point_offset = 480; +static constexpr dart::compiler::target::word Thread_bool_false_offset = 200; +static constexpr dart::compiler::target::word Thread_bool_true_offset = 192; static constexpr dart::compiler::target::word - Thread_call_to_runtime_entry_point_offset = 400; + Thread_call_to_runtime_entry_point_offset = 392; static constexpr dart::compiler::target::word - Thread_call_to_runtime_stub_offset = 264; -static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1408; + Thread_call_to_runtime_stub_offset = 256; +static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1400; static constexpr dart::compiler::target::word Thread_optimize_entry_offset = - 456; -static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 312; + 448; +static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 304; static constexpr dart::compiler::target::word Thread_deoptimize_entry_offset = - 464; + 456; static constexpr dart::compiler::target::word Thread_deoptimize_stub_offset = - 320; + 312; static constexpr dart::compiler::target::word Thread_double_abs_address_offset = + 520; +static constexpr dart::compiler::target::word + Thread_double_negate_address_offset = 512; +static constexpr dart::compiler::target::word Thread_end_offset = 120; +static constexpr dart::compiler::target::word + Thread_enter_safepoint_stub_offset = 352; +static constexpr dart::compiler::target::word Thread_execution_state_offset = + 1368; +static constexpr dart::compiler::target::word + Thread_exit_safepoint_stub_offset = 360; +static constexpr dart::compiler::target::word + Thread_call_native_through_safepoint_stub_offset = 368; +static constexpr dart::compiler::target::word + Thread_call_native_through_safepoint_entry_point_offset = 464; +static constexpr dart::compiler::target::word + Thread_fix_allocation_stub_code_offset = 232; +static constexpr dart::compiler::target::word + Thread_fix_callers_target_code_offset = 224; +static constexpr dart::compiler::target::word + Thread_float_absolute_address_offset = 544; +static constexpr dart::compiler::target::word + Thread_float_negate_address_offset = 536; +static constexpr dart::compiler::target::word Thread_float_not_address_offset = 528; static constexpr dart::compiler::target::word - Thread_double_negate_address_offset = 520; -static constexpr dart::compiler::target::word Thread_end_offset = 128; + Thread_float_zerow_address_offset = 552; +static constexpr dart::compiler::target::word Thread_global_object_pool_offset = + 1344; static constexpr dart::compiler::target::word - Thread_enter_safepoint_stub_offset = 360; -static constexpr dart::compiler::target::word Thread_execution_state_offset = + Thread_interpret_call_entry_point_offset = 488; +static constexpr dart::compiler::target::word + Thread_invoke_dart_code_from_bytecode_stub_offset = 248; +static constexpr dart::compiler::target::word + Thread_invoke_dart_code_stub_offset = 240; +static constexpr dart::compiler::target::word Thread_isolate_offset = 96; +static constexpr dart::compiler::target::word + Thread_lazy_deopt_from_return_stub_offset = 320; +static constexpr dart::compiler::target::word + Thread_lazy_deopt_from_throw_stub_offset = 328; +static constexpr dart::compiler::target::word + Thread_lazy_specialize_type_test_stub_offset = 344; +static constexpr dart::compiler::target::word + Thread_marking_stack_block_offset = 144; +static constexpr dart::compiler::target::word + Thread_megamorphic_call_checked_entry_offset = 432; +static constexpr dart::compiler::target::word + Thread_monomorphic_miss_entry_offset = 440; +static constexpr dart::compiler::target::word + Thread_monomorphic_miss_stub_offset = 296; +static constexpr dart::compiler::target::word + Thread_no_scope_native_wrapper_entry_point_offset = 472; +static constexpr dart::compiler::target::word + Thread_null_error_shared_with_fpu_regs_entry_point_offset = 408; +static constexpr dart::compiler::target::word + Thread_null_error_shared_with_fpu_regs_stub_offset = 272; +static constexpr dart::compiler::target::word + Thread_null_error_shared_without_fpu_regs_entry_point_offset = 400; +static constexpr dart::compiler::target::word + Thread_null_error_shared_without_fpu_regs_stub_offset = 264; +static constexpr dart::compiler::target::word Thread_object_null_offset = 184; +static constexpr dart::compiler::target::word + Thread_predefined_symbols_address_offset = 496; +static constexpr dart::compiler::target::word Thread_resume_pc_offset = 1352; +static constexpr dart::compiler::target::word + Thread_saved_shadow_call_stack_offset = 1360; +static constexpr dart::compiler::target::word Thread_safepoint_state_offset = 1376; static constexpr dart::compiler::target::word - Thread_exit_safepoint_stub_offset = 368; -static constexpr dart::compiler::target::word - Thread_call_native_through_safepoint_stub_offset = 376; -static constexpr dart::compiler::target::word - Thread_call_native_through_safepoint_entry_point_offset = 472; -static constexpr dart::compiler::target::word - Thread_fix_allocation_stub_code_offset = 240; -static constexpr dart::compiler::target::word - Thread_fix_callers_target_code_offset = 232; -static constexpr dart::compiler::target::word - Thread_float_absolute_address_offset = 552; -static constexpr dart::compiler::target::word - Thread_float_negate_address_offset = 544; -static constexpr dart::compiler::target::word Thread_float_not_address_offset = - 536; -static constexpr dart::compiler::target::word - Thread_float_zerow_address_offset = 560; -static constexpr dart::compiler::target::word Thread_global_object_pool_offset = - 1352; -static constexpr dart::compiler::target::word - Thread_interpret_call_entry_point_offset = 496; -static constexpr dart::compiler::target::word - Thread_invoke_dart_code_from_bytecode_stub_offset = 256; -static constexpr dart::compiler::target::word - Thread_invoke_dart_code_stub_offset = 248; -static constexpr dart::compiler::target::word Thread_isolate_offset = 104; -static constexpr dart::compiler::target::word - Thread_lazy_deopt_from_return_stub_offset = 328; -static constexpr dart::compiler::target::word - Thread_lazy_deopt_from_throw_stub_offset = 336; -static constexpr dart::compiler::target::word - Thread_lazy_specialize_type_test_stub_offset = 352; -static constexpr dart::compiler::target::word - Thread_marking_stack_block_offset = 152; -static constexpr dart::compiler::target::word - Thread_megamorphic_call_checked_entry_offset = 440; -static constexpr dart::compiler::target::word - Thread_monomorphic_miss_entry_offset = 448; -static constexpr dart::compiler::target::word - Thread_monomorphic_miss_stub_offset = 304; -static constexpr dart::compiler::target::word - Thread_no_scope_native_wrapper_entry_point_offset = 480; -static constexpr dart::compiler::target::word - Thread_null_error_shared_with_fpu_regs_entry_point_offset = 416; -static constexpr dart::compiler::target::word - Thread_null_error_shared_with_fpu_regs_stub_offset = 280; -static constexpr dart::compiler::target::word - Thread_null_error_shared_without_fpu_regs_entry_point_offset = 408; -static constexpr dart::compiler::target::word - Thread_null_error_shared_without_fpu_regs_stub_offset = 272; -static constexpr dart::compiler::target::word Thread_object_null_offset = 192; -static constexpr dart::compiler::target::word - Thread_predefined_symbols_address_offset = 504; -static constexpr dart::compiler::target::word Thread_resume_pc_offset = 1360; -static constexpr dart::compiler::target::word - Thread_saved_shadow_call_stack_offset = 1368; -static constexpr dart::compiler::target::word Thread_safepoint_state_offset = - 1384; -static constexpr dart::compiler::target::word - Thread_slow_type_test_stub_offset = 344; + Thread_slow_type_test_stub_offset = 336; static constexpr dart::compiler::target::word Thread_stack_limit_offset = 72; -static constexpr dart::compiler::target::word Thread_saved_stack_limit_offset = - 80; static constexpr dart::compiler::target::word - Thread_stack_overflow_flags_offset = 88; + Thread_stack_overflow_flags_offset = 80; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 432; + Thread_stack_overflow_shared_with_fpu_regs_entry_point_offset = 424; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 296; + Thread_stack_overflow_shared_with_fpu_regs_stub_offset = 288; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 424; + Thread_stack_overflow_shared_without_fpu_regs_entry_point_offset = 416; static constexpr dart::compiler::target::word - Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 288; + Thread_stack_overflow_shared_without_fpu_regs_stub_offset = 280; static constexpr dart::compiler::target::word Thread_store_buffer_block_offset = - 144; + 136; static constexpr dart::compiler::target::word - Thread_top_exit_frame_info_offset = 136; -static constexpr dart::compiler::target::word Thread_top_offset = 120; + Thread_top_exit_frame_info_offset = 128; +static constexpr dart::compiler::target::word Thread_top_offset = 112; static constexpr dart::compiler::target::word Thread_top_resource_offset = 48; static constexpr dart::compiler::target::word - Thread_unboxed_int64_runtime_arg_offset = 184; -static constexpr dart::compiler::target::word Thread_vm_tag_offset = 168; + Thread_unboxed_int64_runtime_arg_offset = 176; +static constexpr dart::compiler::target::word Thread_vm_tag_offset = 160; static constexpr dart::compiler::target::word Thread_write_barrier_code_offset = - 216; + 208; static constexpr dart::compiler::target::word - Thread_write_barrier_entry_point_offset = 384; + Thread_write_barrier_entry_point_offset = 376; static constexpr dart::compiler::target::word Thread_write_barrier_mask_offset = - 96; + 88; static constexpr dart::compiler::target::word Thread_callback_code_offset = - 1392; + 1384; static constexpr dart::compiler::target::word TimelineStream_enabled_offset = 16; static constexpr dart::compiler::target::word TwoByteString_data_offset = 16; @@ -1432,9 +1424,9 @@ static constexpr dart::compiler::target::word Code_function_entry_point_offset[] = {8, 16}; static constexpr dart::compiler::target::word Thread_write_barrier_wrappers_thread_offset[] = { - 1160, 1168, 1176, 1184, 1192, 1200, 1208, 1216, 1224, 1232, 1240, - 1248, 1256, 1264, 1272, -1, -1, -1, -1, 1280, 1288, 1296, - 1304, 1312, 1320, 1328, -1, -1, -1, -1, -1, -1}; + 1152, 1160, 1168, 1176, 1184, 1192, 1200, 1208, 1216, 1224, 1232, + 1240, 1248, 1256, 1264, -1, -1, -1, -1, 1272, 1280, 1288, + 1296, 1304, 1312, 1320, -1, -1, -1, -1, -1, -1}; static constexpr dart::compiler::target::word Array_header_size = 24; static constexpr dart::compiler::target::word Context_header_size = 24; static constexpr dart::compiler::target::word Double_InstanceSize = 16; @@ -1636,65 +1628,63 @@ static constexpr dart::compiler::target::word String_hash_offset = 4; static constexpr dart::compiler::target::word String_length_offset = 8; static constexpr dart::compiler::target::word SubtypeTestCache_cache_offset = 8; static constexpr dart::compiler::target::word - Thread_AllocateArray_entry_point_offset = 304; + Thread_AllocateArray_entry_point_offset = 296; static constexpr dart::compiler::target::word Thread_active_exception_offset = - 896; + 888; static constexpr dart::compiler::target::word Thread_active_stacktrace_offset = - 904; + 896; static constexpr dart::compiler::target::word Thread_async_stack_trace_offset = - 176; + 168; static constexpr dart::compiler::target::word - Thread_auto_scope_native_wrapper_entry_point_offset = 224; -static constexpr dart::compiler::target::word Thread_bool_false_offset = 208; -static constexpr dart::compiler::target::word Thread_bool_true_offset = 200; -static constexpr dart::compiler::target::word Thread_dart_stream_offset = 968; + Thread_auto_scope_native_wrapper_entry_point_offset = 216; +static constexpr dart::compiler::target::word Thread_bool_false_offset = 200; +static constexpr dart::compiler::target::word Thread_bool_true_offset = 192; +static constexpr dart::compiler::target::word Thread_dart_stream_offset = 960; static constexpr dart::compiler::target::word Thread_double_abs_address_offset = + 256; +static constexpr dart::compiler::target::word + Thread_double_negate_address_offset = 248; +static constexpr dart::compiler::target::word Thread_end_offset = 120; +static constexpr dart::compiler::target::word Thread_execution_state_offset = + 928; +static constexpr dart::compiler::target::word + Thread_float_absolute_address_offset = 280; +static constexpr dart::compiler::target::word + Thread_float_negate_address_offset = 272; +static constexpr dart::compiler::target::word Thread_float_not_address_offset = 264; static constexpr dart::compiler::target::word - Thread_double_negate_address_offset = 256; -static constexpr dart::compiler::target::word Thread_end_offset = 128; -static constexpr dart::compiler::target::word Thread_execution_state_offset = - 936; -static constexpr dart::compiler::target::word - Thread_float_absolute_address_offset = 288; -static constexpr dart::compiler::target::word - Thread_float_negate_address_offset = 280; -static constexpr dart::compiler::target::word Thread_float_not_address_offset = - 272; -static constexpr dart::compiler::target::word - Thread_float_zerow_address_offset = 296; + Thread_float_zerow_address_offset = 288; static constexpr dart::compiler::target::word Thread_global_object_pool_offset = - 912; -static constexpr dart::compiler::target::word Thread_isolate_offset = 104; + 904; +static constexpr dart::compiler::target::word Thread_isolate_offset = 96; static constexpr dart::compiler::target::word - Thread_marking_stack_block_offset = 152; + Thread_marking_stack_block_offset = 144; static constexpr dart::compiler::target::word - Thread_no_scope_native_wrapper_entry_point_offset = 216; -static constexpr dart::compiler::target::word Thread_object_null_offset = 192; + Thread_no_scope_native_wrapper_entry_point_offset = 208; +static constexpr dart::compiler::target::word Thread_object_null_offset = 184; static constexpr dart::compiler::target::word - Thread_predefined_symbols_address_offset = 240; -static constexpr dart::compiler::target::word Thread_resume_pc_offset = 920; + Thread_predefined_symbols_address_offset = 232; +static constexpr dart::compiler::target::word Thread_resume_pc_offset = 912; static constexpr dart::compiler::target::word - Thread_saved_shadow_call_stack_offset = 928; + Thread_saved_shadow_call_stack_offset = 920; static constexpr dart::compiler::target::word Thread_safepoint_state_offset = - 944; + 936; static constexpr dart::compiler::target::word Thread_stack_limit_offset = 72; -static constexpr dart::compiler::target::word Thread_saved_stack_limit_offset = - 80; static constexpr dart::compiler::target::word - Thread_stack_overflow_flags_offset = 88; + Thread_stack_overflow_flags_offset = 80; static constexpr dart::compiler::target::word Thread_store_buffer_block_offset = - 144; + 136; static constexpr dart::compiler::target::word - Thread_top_exit_frame_info_offset = 136; -static constexpr dart::compiler::target::word Thread_top_offset = 120; + Thread_top_exit_frame_info_offset = 128; +static constexpr dart::compiler::target::word Thread_top_offset = 112; static constexpr dart::compiler::target::word Thread_top_resource_offset = 48; static constexpr dart::compiler::target::word - Thread_unboxed_int64_runtime_arg_offset = 184; -static constexpr dart::compiler::target::word Thread_vm_tag_offset = 168; + Thread_unboxed_int64_runtime_arg_offset = 176; +static constexpr dart::compiler::target::word Thread_vm_tag_offset = 160; static constexpr dart::compiler::target::word Thread_write_barrier_mask_offset = - 96; -static constexpr dart::compiler::target::word Thread_callback_code_offset = 952; + 88; +static constexpr dart::compiler::target::word Thread_callback_code_offset = 944; static constexpr dart::compiler::target::word TimelineStream_enabled_offset = 16; static constexpr dart::compiler::target::word TwoByteString_data_offset = 16; @@ -1925,65 +1915,63 @@ static constexpr dart::compiler::target::word String_hash_offset = 8; static constexpr dart::compiler::target::word String_length_offset = 4; static constexpr dart::compiler::target::word SubtypeTestCache_cache_offset = 4; static constexpr dart::compiler::target::word - Thread_AllocateArray_entry_point_offset = 160; + Thread_AllocateArray_entry_point_offset = 152; static constexpr dart::compiler::target::word Thread_active_exception_offset = - 456; + 448; static constexpr dart::compiler::target::word Thread_active_stacktrace_offset = - 460; + 452; static constexpr dart::compiler::target::word Thread_async_stack_trace_offset = - 88; + 84; static constexpr dart::compiler::target::word - Thread_auto_scope_native_wrapper_entry_point_offset = 120; -static constexpr dart::compiler::target::word Thread_bool_false_offset = 112; -static constexpr dart::compiler::target::word Thread_bool_true_offset = 108; -static constexpr dart::compiler::target::word Thread_dart_stream_offset = 492; + Thread_auto_scope_native_wrapper_entry_point_offset = 112; +static constexpr dart::compiler::target::word Thread_bool_false_offset = 104; +static constexpr dart::compiler::target::word Thread_bool_true_offset = 100; +static constexpr dart::compiler::target::word Thread_dart_stream_offset = 484; static constexpr dart::compiler::target::word Thread_double_abs_address_offset = - 140; + 132; static constexpr dart::compiler::target::word - Thread_double_negate_address_offset = 136; -static constexpr dart::compiler::target::word Thread_end_offset = 64; + Thread_double_negate_address_offset = 128; +static constexpr dart::compiler::target::word Thread_end_offset = 60; static constexpr dart::compiler::target::word Thread_execution_state_offset = - 476; + 468; static constexpr dart::compiler::target::word - Thread_float_absolute_address_offset = 152; + Thread_float_absolute_address_offset = 144; static constexpr dart::compiler::target::word - Thread_float_negate_address_offset = 148; + Thread_float_negate_address_offset = 140; static constexpr dart::compiler::target::word Thread_float_not_address_offset = - 144; + 136; static constexpr dart::compiler::target::word - Thread_float_zerow_address_offset = 156; + Thread_float_zerow_address_offset = 148; static constexpr dart::compiler::target::word Thread_global_object_pool_offset = - 464; -static constexpr dart::compiler::target::word Thread_isolate_offset = 52; + 456; +static constexpr dart::compiler::target::word Thread_isolate_offset = 48; static constexpr dart::compiler::target::word - Thread_marking_stack_block_offset = 76; + Thread_marking_stack_block_offset = 72; static constexpr dart::compiler::target::word - Thread_no_scope_native_wrapper_entry_point_offset = 116; -static constexpr dart::compiler::target::word Thread_object_null_offset = 104; + Thread_no_scope_native_wrapper_entry_point_offset = 108; +static constexpr dart::compiler::target::word Thread_object_null_offset = 96; static constexpr dart::compiler::target::word - Thread_predefined_symbols_address_offset = 128; -static constexpr dart::compiler::target::word Thread_resume_pc_offset = 468; + Thread_predefined_symbols_address_offset = 120; +static constexpr dart::compiler::target::word Thread_resume_pc_offset = 460; static constexpr dart::compiler::target::word - Thread_saved_shadow_call_stack_offset = 472; + Thread_saved_shadow_call_stack_offset = 464; static constexpr dart::compiler::target::word Thread_safepoint_state_offset = - 480; + 472; static constexpr dart::compiler::target::word Thread_stack_limit_offset = 36; -static constexpr dart::compiler::target::word Thread_saved_stack_limit_offset = - 40; static constexpr dart::compiler::target::word - Thread_stack_overflow_flags_offset = 44; + Thread_stack_overflow_flags_offset = 40; static constexpr dart::compiler::target::word Thread_store_buffer_block_offset = - 72; + 68; static constexpr dart::compiler::target::word - Thread_top_exit_frame_info_offset = 68; -static constexpr dart::compiler::target::word Thread_top_offset = 60; + Thread_top_exit_frame_info_offset = 64; +static constexpr dart::compiler::target::word Thread_top_offset = 56; static constexpr dart::compiler::target::word Thread_top_resource_offset = 24; static constexpr dart::compiler::target::word - Thread_unboxed_int64_runtime_arg_offset = 96; -static constexpr dart::compiler::target::word Thread_vm_tag_offset = 84; + Thread_unboxed_int64_runtime_arg_offset = 88; +static constexpr dart::compiler::target::word Thread_vm_tag_offset = 80; static constexpr dart::compiler::target::word Thread_write_barrier_mask_offset = - 48; -static constexpr dart::compiler::target::word Thread_callback_code_offset = 484; + 44; +static constexpr dart::compiler::target::word Thread_callback_code_offset = 476; static constexpr dart::compiler::target::word TimelineStream_enabled_offset = 8; static constexpr dart::compiler::target::word TwoByteString_data_offset = 12; static constexpr dart::compiler::target::word Type_arguments_offset = 16; diff --git a/runtime/vm/compiler/runtime_offsets_list.h b/runtime/vm/compiler/runtime_offsets_list.h index 4d67d2e896c..de860a7dc02 100644 --- a/runtime/vm/compiler/runtime_offsets_list.h +++ b/runtime/vm/compiler/runtime_offsets_list.h @@ -202,7 +202,6 @@ FIELD(Thread, safepoint_state_offset) \ NOT_IN_DBC(FIELD(Thread, slow_type_test_stub_offset)) \ FIELD(Thread, stack_limit_offset) \ - FIELD(Thread, saved_stack_limit_offset) \ FIELD(Thread, stack_overflow_flags_offset) \ NOT_IN_DBC( \ FIELD(Thread, stack_overflow_shared_with_fpu_regs_entry_point_offset)) \ diff --git a/runtime/vm/compiler/stub_code_compiler.h b/runtime/vm/compiler/stub_code_compiler.h index 126d1255294..c7ce24af9c4 100644 --- a/runtime/vm/compiler/stub_code_compiler.h +++ b/runtime/vm/compiler/stub_code_compiler.h @@ -80,7 +80,7 @@ class StubCodeCompiler : public AllStatic { static constexpr intptr_t kNativeCallbackTrampolineStackDelta = 4; #elif defined(TARGET_ARCH_ARM64) static constexpr intptr_t kNativeCallbackTrampolineSize = 12; - static constexpr intptr_t kNativeCallbackSharedStubSize = 268; + static constexpr intptr_t kNativeCallbackSharedStubSize = 284; static constexpr intptr_t kNativeCallbackTrampolineStackDelta = 2; #endif diff --git a/runtime/vm/compiler/stub_code_compiler_arm64.cc b/runtime/vm/compiler/stub_code_compiler_arm64.cc index f39fcae858a..8de1aaa6037 100644 --- a/runtime/vm/compiler/stub_code_compiler_arm64.cc +++ b/runtime/vm/compiler/stub_code_compiler_arm64.cc @@ -212,20 +212,18 @@ void StubCodeCompiler::GenerateEnterSafepointStub(Assembler* assembler) { __ EnterFrame(0); __ PushRegisters(all_registers); - __ mov(CALLEE_SAVED_TEMP, CSP); - __ mov(CALLEE_SAVED_TEMP2, SP); + __ mov(CALLEE_SAVED_TEMP, SP); __ ReserveAlignedFrameSpace(0); - __ mov(CSP, SP); + __ mov(CSP, SP); __ ldr(R0, Address(THR, kEnterSafepointRuntimeEntry.OffsetFromThread())); __ blr(R0); - - __ mov(SP, CALLEE_SAVED_TEMP2); - __ mov(CSP, CALLEE_SAVED_TEMP); + __ mov(SP, CALLEE_SAVED_TEMP); __ PopRegisters(all_registers); __ LeaveFrame(); + __ mov(CSP, SP); __ Ret(); } @@ -236,9 +234,9 @@ void StubCodeCompiler::GenerateExitSafepointStub(Assembler* assembler) { __ EnterFrame(0); __ PushRegisters(all_registers); - __ mov(CALLEE_SAVED_TEMP, CSP); - __ mov(CALLEE_SAVED_TEMP2, SP); + __ mov(CALLEE_SAVED_TEMP, SP); __ ReserveAlignedFrameSpace(0); + __ mov(CSP, SP); // Set the execution state to VM while waiting for the safepoint to end. @@ -249,13 +247,12 @@ void StubCodeCompiler::GenerateExitSafepointStub(Assembler* assembler) { __ ldr(R0, Address(THR, kExitSafepointRuntimeEntry.OffsetFromThread())); __ blr(R0); - - __ mov(SP, CALLEE_SAVED_TEMP2); - __ mov(CSP, CALLEE_SAVED_TEMP); + __ mov(SP, CALLEE_SAVED_TEMP); __ PopRegisters(all_registers); __ LeaveFrame(); + __ mov(CSP, SP); __ Ret(); } @@ -275,7 +272,6 @@ void StubCodeCompiler::GenerateCallNativeThroughSafepointStub( __ mov(R19, LR); __ TransitionGeneratedToNative(R8, FPREG, R9 /*volatile*/, /*enter_safepoint=*/true); - __ mov(R25, CSP); __ mov(CSP, SP); #if defined(DEBUG) @@ -290,10 +286,7 @@ void StubCodeCompiler::GenerateCallNativeThroughSafepointStub( #endif __ blr(R8); - __ mov(SP, CSP); - __ mov(CSP, R25); - __ TransitionNativeToGenerated(R9, /*leave_safepoint=*/true); __ ret(R19); } @@ -1320,11 +1313,9 @@ void StubCodeCompiler::GenerateAllocateArrayStub(Assembler* assembler) { void StubCodeCompiler::GenerateInvokeDartCodeStub(Assembler* assembler) { __ Comment("InvokeDartCodeStub"); - // Copy the C stack pointer (CSP/R31) into the stack pointer we'll actually - // use to access the stack (SP/R15) and set the C stack pointer to near the - // stack limit, loaded from the Thread held in R3, to prevent signal handlers - // from over-writing Dart frames. - __ SetupDartSPFromThread(R3); + // Copy the C stack pointer (R31) into the stack pointer we'll actually use + // to access the stack. + __ SetupDartSP(); __ Push(LR); // Marker for the profiler. __ EnterFrame(0); @@ -1469,11 +1460,9 @@ void StubCodeCompiler::GenerateInvokeDartCodeFromBytecodeStub( #if defined(DART_PRECOMPILED_RUNTIME) __ Stop("Not using interpreter"); #else - // Copy the C stack pointer (CSP/R31) into the stack pointer we'll actually - // use to access the stack (SP/R15) and set the C stack pointer to near the - // stack limit, loaded from the Thread held in R3, to prevent signal handlers - // from over-writing Dart frames. - __ SetupDartSPFromThread(R3); + // Copy the C stack pointer (R31) into the stack pointer we'll actually use + // to access the stack. + __ SetupDartSP(); __ Push(LR); // Marker for the profiler. __ EnterFrame(0); diff --git a/runtime/vm/dart_entry.cc b/runtime/vm/dart_entry.cc index 389b03e1f4e..2f26ce6dc2a 100644 --- a/runtime/vm/dart_entry.cc +++ b/runtime/vm/dart_entry.cc @@ -41,6 +41,14 @@ class ScopedIsolateStackLimits : public ValueObject { explicit ScopedIsolateStackLimits(Thread* thread, uword current_sp) : thread_(thread) { ASSERT(thread != NULL); + // Set the thread's stack_base based on the current + // stack pointer, we keep refining this value as we + // see higher stack pointers (Note: we assume the stack + // grows from high to low addresses). + OSThread* os_thread = thread->os_thread(); + ASSERT(os_thread != NULL); + os_thread->RefineStackBoundsFromSP(current_sp); + // Save the Thread's current stack limit and adjust the stack limit. ASSERT(thread->isolate() == Isolate::Current()); saved_stack_limit_ = thread->saved_stack_limit(); diff --git a/runtime/vm/os_thread.cc b/runtime/vm/os_thread.cc index 3ef9f8f59fc..4185a08a735 100644 --- a/runtime/vm/os_thread.cc +++ b/runtime/vm/os_thread.cc @@ -44,7 +44,8 @@ OSThread::OSThread() thread_(NULL) { // Try to get accurate stack bounds from pthreads, etc. if (!GetCurrentStackBounds(&stack_limit_, &stack_base_)) { - FATAL("Failed to retrieve stack bounds"); + // Fall back to a guess based on the stack pointer. + RefineStackBoundsFromSP(GetCurrentStackPointer()); } stack_headroom_ = CalculateHeadroom(stack_base_ - stack_limit_); diff --git a/runtime/vm/os_thread.h b/runtime/vm/os_thread.h index 849d47217e5..2479dfa7159 100644 --- a/runtime/vm/os_thread.h +++ b/runtime/vm/os_thread.h @@ -138,7 +138,14 @@ class OSThread : public BaseThread { return GetCurrentStackPointer() > (stack_limit_ + headroom); } - // May fail for the main thread on Linux if resources are low. + void RefineStackBoundsFromSP(uword sp) { + if (sp > stack_base_) { + stack_base_ = sp; + stack_limit_ = sp - GetSpecifiedStackSize(); + } + } + + // May fail for the main thread on Linux and Android. static bool GetCurrentStackBounds(uword* lower, uword* upper); // Returns the current C++ stack pointer. Equivalent taking the address of a diff --git a/runtime/vm/os_thread_android.cc b/runtime/vm/os_thread_android.cc index b8354e74474..093795d073d 100644 --- a/runtime/vm/os_thread_android.cc +++ b/runtime/vm/os_thread_android.cc @@ -215,7 +215,7 @@ void OSThread::Join(ThreadJoinId id) { } intptr_t OSThread::ThreadIdToIntPtr(ThreadId id) { - ASSERT(sizeof(id) <= sizeof(intptr_t)); + ASSERT(sizeof(id) == sizeof(intptr_t)); return static_cast(id); } @@ -229,6 +229,7 @@ bool OSThread::Compare(ThreadId a, ThreadId b) { bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) { pthread_attr_t attr; + // May fail on the main thread. if (pthread_getattr_np(pthread_self(), &attr) != 0) { return false; } diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc index 6e25f4f5103..688e88624b1 100644 --- a/runtime/vm/thread.cc +++ b/runtime/vm/thread.cc @@ -60,7 +60,6 @@ Thread::~Thread() { Thread::Thread(bool is_vm_isolate) : ThreadState(false), stack_limit_(0), - saved_stack_limit_(0), stack_overflow_flags_(0), write_barrier_mask_(RawObject::kGenerationalBarrierMask), isolate_(NULL), @@ -90,6 +89,7 @@ Thread::Thread(bool is_vm_isolate) no_safepoint_scope_depth_(0), #endif reusable_handles_(), + saved_stack_limit_(0), defer_oob_messages_count_(0), deferred_interrupts_mask_(0), deferred_interrupts_(0), diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h index e9f2fa5929a..8cc9ab5c289 100644 --- a/runtime/vm/thread.h +++ b/runtime/vm/thread.h @@ -269,9 +269,8 @@ class Thread : public ThreadState { void SetStackLimit(uword value); void ClearStackLimit(); - // Access to the current stack limit for generated code. Either the true OS - // thread's stack limit minus some headroom, or a special value to trigger - // interrupts. + // Access to the current stack limit for generated code. This may be + // overwritten with a special value to trigger interrupts. uword stack_limit_address() const { return reinterpret_cast(&stack_limit_); } @@ -279,10 +278,7 @@ class Thread : public ThreadState { return OFFSET_OF(Thread, stack_limit_); } - // The true stack limit for this OS thread. - static intptr_t saved_stack_limit_offset() { - return OFFSET_OF(Thread, saved_stack_limit_); - } + // The true stack limit for this isolate. uword saved_stack_limit() const { return saved_stack_limit_; } #if defined(USING_SAFE_STACK) @@ -852,7 +848,6 @@ class Thread : public ThreadState { // We use only word-sized fields to avoid differences in struct packing on the // different architectures. See also CheckOffsets in dart.cc. uword stack_limit_; - uword saved_stack_limit_; uword stack_overflow_flags_; uword write_barrier_mask_; Isolate* isolate_; @@ -918,6 +913,7 @@ class Thread : public ThreadState { int32_t no_safepoint_scope_depth_; #endif VMHandles reusable_handles_; + uword saved_stack_limit_; intptr_t defer_oob_messages_count_; uint16_t deferred_interrupts_mask_; uint16_t deferred_interrupts_; diff --git a/runtime/vm/thread_pool.cc b/runtime/vm/thread_pool.cc index 8353648160b..cb64714c1d6 100644 --- a/runtime/vm/thread_pool.cc +++ b/runtime/vm/thread_pool.cc @@ -424,6 +424,9 @@ void ThreadPool::Worker::Main(uword args) { ThreadId id = os_thread->id(); ThreadPool* pool; + // Set the thread's stack_base based on the current stack pointer. + os_thread->RefineStackBoundsFromSP(OSThread::GetCurrentStackPointer()); + { MonitorLocker ml(&worker->monitor_); ASSERT(worker->task_);