Skip to content

Commit 0b8e153

Browse files
alexmarkovCommit Queue
authored andcommitted
[vm,dyn_modules] Take --use_simulator flag into account when calling simulator from the interpreter
TEST=ci (vm-dyn-mac-debug-simarm64_arm64) Change-Id: I123426bf633b4271803138c3c5b591db6ba0f519 Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try,vm-ffi-dyn-mac-debug-simarm64_arm64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/447605 Commit-Queue: Alexander Markov <[email protected]> Reviewed-by: Tess Strickland <[email protected]>
1 parent be68f15 commit 0b8e153

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

runtime/vm/interpreter.cc

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -603,30 +603,34 @@ DART_NOINLINE bool Interpreter::InvokeCompiled(Thread* thread,
603603
InterpreterSetjmpBuffer buffer(this);
604604
if (!DART_SETJMP(buffer.buffer_)) {
605605
#if defined(DART_INCLUDE_SIMULATOR)
606-
// We need to beware that bouncing between the interpreter and the
607-
// simulator may exhaust the C stack before exhausting either the
608-
// interpreter or simulator stacks.
609-
if (!thread->os_thread()->HasStackHeadroom()) {
610-
thread->SetStackLimit(-1);
611-
}
612-
result = bit_copy<ObjectPtr, int64_t>(Simulator::Current()->Call(
613-
reinterpret_cast<intptr_t>(entrypoint),
606+
if (FLAG_use_simulator) {
607+
// We need to beware that bouncing between the interpreter and the
608+
// simulator may exhaust the C stack before exhausting either the
609+
// interpreter or simulator stacks.
610+
if (!thread->os_thread()->HasStackHeadroom()) {
611+
thread->SetStackLimit(-1);
612+
}
613+
result = bit_copy<ObjectPtr, int64_t>(Simulator::Current()->Call(
614+
reinterpret_cast<intptr_t>(entrypoint),
614615
#if defined(DART_PRECOMPILED_RUNTIME)
615-
static_cast<intptr_t>(function->untag()->entry_point_),
616+
static_cast<intptr_t>(function->untag()->entry_point_),
616617
#else
617-
static_cast<intptr_t>(function->untag()->code()),
618+
static_cast<intptr_t>(function->untag()->code()),
618619
#endif
619-
static_cast<intptr_t>(argdesc_),
620-
reinterpret_cast<intptr_t>(call_base),
621-
reinterpret_cast<intptr_t>(thread)));
622-
#else
623-
result = static_cast<ObjectPtr>(entrypoint(
620+
static_cast<intptr_t>(argdesc_),
621+
reinterpret_cast<intptr_t>(call_base),
622+
reinterpret_cast<intptr_t>(thread)));
623+
} else {
624+
#endif
625+
result = static_cast<ObjectPtr>(entrypoint(
624626
#if defined(DART_PRECOMPILED_RUNTIME)
625-
function->untag()->entry_point_,
627+
function->untag()->entry_point_,
626628
#else
627629
static_cast<uword>(function->untag()->code()),
628630
#endif
629-
static_cast<uword>(argdesc_), call_base, thread));
631+
static_cast<uword>(argdesc_), call_base, thread));
632+
#if defined(DART_INCLUDE_SIMULATOR)
633+
}
630634
#endif
631635
ASSERT(thread->vm_tag() == VMTag::kDartInterpretedTagId);
632636
ASSERT(thread->execution_state() == Thread::kThreadInGenerated);

0 commit comments

Comments
 (0)