[vm] Rename USING_SIMULATOR to DART_INCLUDE_SIMULATOR.

We now have a mode where the simulator is available but not always used.

TEST=ci
Change-Id: If271f334150e2a125a014a4baa2e03d726300d35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435562
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This commit is contained in:
Ryan Macnak
2025-06-18 13:07:22 -07:00
committed by Commit Queue
parent 7466f6e1ff
commit 7973eacdd0
40 changed files with 119 additions and 117 deletions
+1 -1
View File
@@ -169,7 +169,7 @@ config("dart_arch_config") {
assert(false)
}
if (dart_force_simulator) {
defines += [ "USING_SIMULATOR" ]
defines += [ "DART_INCLUDE_SIMULATOR" ]
if (dart_target_arch == "arm64") {
defines += [ "SIMULATOR_FFI" ]
}
+4 -4
View File
@@ -25,14 +25,14 @@
#define LOG_SECTION_BOUNDARIES false
#if !defined(USING_SIMULATOR)
#if !defined(DART_INCLUDE_SIMULATOR)
#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_ANDROID) || \
defined(DART_HOST_OS_FUCHSIA)
#define NATIVE_SHARED_OBJECT_FORMAT_ELF 1
#elif defined(DART_HOST_OS_MACOS)
#define NATIVE_SHARED_OBJECT_FORMAT_MACHO 1
#endif
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
namespace dart {
namespace bin {
@@ -215,7 +215,7 @@ static AppSnapshot* TryReadAppSnapshotDynamicLibrary(
DartUtils::MagicNumber magic_number,
const char* script_name,
const char** error) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
*error = "running on a simulated architecture";
return nullptr;
#else
@@ -277,7 +277,7 @@ static AppSnapshot* TryReadAppSnapshotDynamicLibrary(
return new DylibAppSnapshot(magic_number, library, vm_data_buffer,
vm_instructions_buffer, isolate_data_buffer,
isolate_instructions_buffer);
#endif // defined(USING_SIMULATOR)
#endif // defined(DART_INCLUDE_SIMULATOR)
}
class ElfAppSnapshot : public AppSnapshot {
+4 -4
View File
@@ -29,11 +29,11 @@
namespace dart {
#if (defined(USING_SIMULATOR) && !defined(SIMULATOR_FFI)) || \
#if (defined(DART_INCLUDE_SIMULATOR) && !defined(SIMULATOR_FFI)) || \
(defined(DART_PRECOMPILER) && !defined(TESTING))
DART_NORETURN static void SimulatorUnsupported() {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
Exceptions::ThrowUnsupportedError("Not supported on this simulator.");
#else
Exceptions::ThrowUnsupportedError("Not supported in precompiler.");
@@ -66,7 +66,7 @@ DEFINE_NATIVE_ENTRY(Ffi_GetFfiNativeResolver, 1, 0) {
SimulatorUnsupported();
}
#else // defined(USING_SIMULATOR) || \
#else // defined(DART_INCLUDE_SIMULATOR) || \
// (defined(DART_PRECOMPILER) && !defined(TESTING))
// If an error occurs populates |error| (if provided) with an error message
@@ -516,7 +516,7 @@ DEFINE_NATIVE_ENTRY(Ffi_GetFfiNativeResolver, 1, 0) {
return Pointer::New(reinterpret_cast<intptr_t>(FfiResolve));
}
#endif // (defined(USING_SIMULATOR) && !defined (SIMULATOR_FFI)) || \
#endif // (defined(DART_INCLUDE_SIMULATOR) && !defined (SIMULATOR_FFI)) || \
// (defined(DART_PRECOMPILER) && !defined(TESTING))
} // namespace dart
+6 -6
View File
@@ -368,30 +368,30 @@ struct simd128_value_t {
// Determine whether we will be using the simulator.
#if defined(TARGET_ARCH_IA32)
#if !defined(HOST_ARCH_IA32)
#define USING_SIMULATOR 1
#define DART_INCLUDE_SIMULATOR 1
#endif
#elif defined(TARGET_ARCH_X64)
#if !defined(HOST_ARCH_X64)
#define USING_SIMULATOR 1
#define DART_INCLUDE_SIMULATOR 1
#endif
#elif defined(TARGET_ARCH_ARM)
#if !defined(HOST_ARCH_ARM)
#define TARGET_HOST_MISMATCH 1
#if !defined(IS_SIMARM_HOST64)
#define USING_SIMULATOR 1
#define DART_INCLUDE_SIMULATOR 1
#endif
#endif
#elif defined(TARGET_ARCH_ARM64)
#if !defined(HOST_ARCH_ARM64)
#define USING_SIMULATOR 1
#define DART_INCLUDE_SIMULATOR 1
#endif
#elif defined(TARGET_ARCH_RISCV32)
#if !defined(HOST_ARCH_RISCV32)
#define USING_SIMULATOR 1
#define DART_INCLUDE_SIMULATOR 1
#endif
#elif defined(TARGET_ARCH_RISCV64)
#if !defined(HOST_ARCH_RISCV64)
#define USING_SIMULATOR 1
#define DART_INCLUDE_SIMULATOR 1
#endif
#else
#error Unknown architecture.
@@ -15,8 +15,9 @@
#include "vm/tags.h"
// An extra check since we are assuming the existence of /proc/cpuinfo below.
#if !defined(USING_SIMULATOR) && !defined(__linux__) && !defined(ANDROID) && \
!defined(DART_HOST_OS_IOS) && !defined(DART_HOST_OS_MACOS)
#if !defined(DART_INCLUDE_SIMULATOR) && !defined(__linux__) && \
!defined(ANDROID) && !defined(DART_HOST_OS_IOS) && \
!defined(DART_HOST_OS_MACOS)
#error ARM cross-compile only supported on Linux, Android, iOS, and Mac
#endif
@@ -1871,7 +1871,7 @@ ASSEMBLER_TEST_RUN(Sdiv_corner, test) {
}
ASSEMBLER_TEST_GENERATE(IntDiv_supported, assembler) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
bool orig = TargetCPUFeatures::integer_division_supported();
HostCPUFeatures::set_integer_division_supported(true);
__ mov(R0, Operand(27));
@@ -1889,7 +1889,7 @@ ASSEMBLER_TEST_GENERATE(IntDiv_supported, assembler) {
ASSEMBLER_TEST_RUN(IntDiv_supported, test) {
EXPECT(test != nullptr);
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
bool orig = TargetCPUFeatures::integer_division_supported();
HostCPUFeatures::set_integer_division_supported(true);
typedef int (*Tst)() DART_UNUSED;
@@ -1902,7 +1902,7 @@ ASSEMBLER_TEST_RUN(IntDiv_supported, test) {
}
ASSEMBLER_TEST_GENERATE(IntDiv_unsupported, assembler) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
bool orig = TargetCPUFeatures::integer_division_supported();
HostCPUFeatures::set_integer_division_supported(false);
__ mov(R0, Operand(27));
@@ -1920,7 +1920,7 @@ ASSEMBLER_TEST_GENERATE(IntDiv_unsupported, assembler) {
ASSEMBLER_TEST_RUN(IntDiv_unsupported, test) {
EXPECT(test != nullptr);
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
bool orig = TargetCPUFeatures::integer_division_supported();
HostCPUFeatures::set_integer_division_supported(false);
typedef int (*Tst)() DART_UNUSED;
@@ -50,7 +50,7 @@ static intx_t Call(intx_t entry,
intx_t arg1 = 0,
intx_t arg2 = 0,
intx_t arg3 = 0) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->Call(entry, arg0, arg1, arg2, arg3);
#else
typedef intx_t (*F)(intx_t, intx_t, intx_t, intx_t);
@@ -58,7 +58,7 @@ static intx_t Call(intx_t entry,
#endif
}
static float CallF(intx_t entry, intx_t arg0) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallF(entry, arg0);
#else
typedef float (*F)(intx_t);
@@ -66,7 +66,7 @@ static float CallF(intx_t entry, intx_t arg0) {
#endif
}
static float CallF(intx_t entry, intx_t arg0, float arg1) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallF(entry, arg0, arg1);
#else
typedef float (*F)(intx_t, float);
@@ -74,7 +74,7 @@ static float CallF(intx_t entry, intx_t arg0, float arg1) {
#endif
}
static float CallF(intx_t entry, double arg0) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallF(entry, arg0);
#else
typedef float (*F)(double);
@@ -82,7 +82,7 @@ static float CallF(intx_t entry, double arg0) {
#endif
}
static float CallF(intx_t entry, float arg0) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallF(entry, arg0);
#else
typedef float (*F)(float);
@@ -90,7 +90,7 @@ static float CallF(intx_t entry, float arg0) {
#endif
}
static float CallF(intx_t entry, float arg0, float arg1) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallF(entry, arg0, arg1);
#else
typedef float (*F)(float, float);
@@ -98,7 +98,7 @@ static float CallF(intx_t entry, float arg0, float arg1) {
#endif
}
static float CallF(intx_t entry, float arg0, float arg1, float arg2) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallF(entry, arg0, arg1, arg2);
#else
typedef float (*F)(float, float, float);
@@ -106,7 +106,7 @@ static float CallF(intx_t entry, float arg0, float arg1, float arg2) {
#endif
}
static intx_t CallI(intx_t entry, float arg0) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallI(entry, arg0);
#else
typedef intx_t (*F)(float);
@@ -114,7 +114,7 @@ static intx_t CallI(intx_t entry, float arg0) {
#endif
}
static intx_t CallI(intx_t entry, float arg0, float arg1) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallI(entry, arg0, arg1);
#else
typedef intx_t (*F)(float, float);
@@ -122,7 +122,7 @@ static intx_t CallI(intx_t entry, float arg0, float arg1) {
#endif
}
static double CallD(intx_t entry, intx_t arg0) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallD(entry, arg0);
#else
typedef double (*F)(intx_t);
@@ -131,7 +131,7 @@ static double CallD(intx_t entry, intx_t arg0) {
}
#if XLEN == 32
static double CallD(intx_t entry, int64_t arg0) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallD(entry, arg0);
#else
typedef double (*F)(int64_t);
@@ -140,7 +140,7 @@ static double CallD(intx_t entry, int64_t arg0) {
}
#endif
static double CallD(intx_t entry, intx_t arg0, double arg1) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallD(entry, arg0, arg1);
#else
typedef double (*F)(intx_t, double);
@@ -148,7 +148,7 @@ static double CallD(intx_t entry, intx_t arg0, double arg1) {
#endif
}
static double CallD(intx_t entry, float arg0) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallD(entry, arg0);
#else
typedef double (*F)(float);
@@ -156,7 +156,7 @@ static double CallD(intx_t entry, float arg0) {
#endif
}
static double CallD(intx_t entry, double arg0) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallD(entry, arg0);
#else
typedef double (*F)(double);
@@ -164,7 +164,7 @@ static double CallD(intx_t entry, double arg0) {
#endif
}
static double CallD(intx_t entry, double arg0, double arg1) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallD(entry, arg0, arg1);
#else
typedef double (*F)(double, double);
@@ -172,7 +172,7 @@ static double CallD(intx_t entry, double arg0, double arg1) {
#endif
}
static double CallD(intx_t entry, double arg0, double arg1, double arg2) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallD(entry, arg0, arg1, arg2);
#else
typedef double (*F)(double, double, double);
@@ -180,7 +180,7 @@ static double CallD(intx_t entry, double arg0, double arg1, double arg2) {
#endif
}
static intx_t CallI(intx_t entry, double arg0) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallI(entry, arg0);
#else
typedef intx_t (*F)(double);
@@ -188,7 +188,7 @@ static intx_t CallI(intx_t entry, double arg0) {
#endif
}
static intx_t CallI(intx_t entry, double arg0, double arg1) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallI(entry, arg0, arg1);
#else
typedef intx_t (*F)(double, double);
@@ -197,7 +197,7 @@ static intx_t CallI(intx_t entry, double arg0, double arg1) {
}
#if XLEN == 32
static int64_t CallI64(intx_t entry, double arg0, double arg1 = 0.0) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
return Simulator::Current()->CallI64(entry, arg0, arg1);
#else
typedef int64_t (*F)(double, double);
@@ -311,7 +311,7 @@ void StubCodeCompiler::GenerateLoadFfiCallbackMetadataRuntimeFunction(
}
void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
#if defined(USING_SIMULATOR) && !defined(DART_PRECOMPILER)
#if defined(DART_INCLUDE_SIMULATOR) && !defined(DART_PRECOMPILER)
// TODO(37299): FFI is not supported in SIMARM.
__ Breakpoint();
#else
@@ -76,7 +76,7 @@ void StubCodeCompiler::EnsureIsNewOrRemembered() {
// [Thread::tsan_utils_->setjmp_buffer_]).
static void WithExceptionCatchingTrampoline(Assembler* assembler,
std::function<void()> fun) {
#if !defined(USING_SIMULATOR)
#if !defined(DART_INCLUDE_SIMULATOR)
const Register kTsanUtilsReg = R3;
// Reserve space for arguments and align frame before entering C++ world.
@@ -147,11 +147,11 @@ static void WithExceptionCatchingTrampoline(Assembler* assembler,
__ Bind(&do_native_call);
__ MoveRegister(kSavedRspReg, SP);
}
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
fun();
#if !defined(USING_SIMULATOR)
#if !defined(DART_INCLUDE_SIMULATOR)
if (FLAG_target_thread_sanitizer) {
__ MoveRegister(SP, kSavedRspReg);
__ AddImmediate(SP, kJumpBufferSize);
@@ -161,7 +161,7 @@ static void WithExceptionCatchingTrampoline(Assembler* assembler,
__ str(TMP,
Address(kTsanUtilsReg2, target::TsanUtils::setjmp_buffer_offset()));
}
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
}
// Input parameters:
@@ -322,7 +322,7 @@ void StubCodeCompiler::GenerateLoadFfiCallbackMetadataRuntimeFunction(
}
void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
#if defined(USING_SIMULATOR) && !defined(DART_PRECOMPILER)
#if defined(DART_INCLUDE_SIMULATOR) && !defined(DART_PRECOMPILER)
// TODO(37299): FFI is not supported in SIMRISCV32/64.
__ ebreak();
#else
@@ -79,7 +79,7 @@ void StubCodeCompiler::EnsureIsNewOrRemembered() {
// [Thread::tsan_utils_->setjmp_buffer_]).
static void WithExceptionCatchingTrampoline(Assembler* assembler,
std::function<void()> fun) {
#if !defined(USING_SIMULATOR)
#if !defined(DART_INCLUDE_SIMULATOR)
const Register kTsanUtilsReg = RAX;
// Reserve space for arguments and align frame before entering C++ world.
@@ -149,11 +149,11 @@ static void WithExceptionCatchingTrampoline(Assembler* assembler,
__ Bind(&do_native_call);
__ MoveRegister(kSavedRspReg, RSP);
}
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
fun();
#if !defined(USING_SIMULATOR)
#if !defined(DART_INCLUDE_SIMULATOR)
if (FLAG_target_thread_sanitizer) {
__ MoveRegister(RSP, kSavedRspReg);
__ AddImmediate(RSP, Immediate(kJumpBufferSize));
@@ -161,7 +161,7 @@ static void WithExceptionCatchingTrampoline(Assembler* assembler,
__ movq(kTsanUtilsReg2, Address(THR, target::Thread::tsan_utils_offset()));
__ popq(Address(kTsanUtilsReg2, target::TsanUtils::setjmp_buffer_offset()));
}
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
}
// Input parameters:
+6 -6
View File
@@ -24,7 +24,7 @@ void CPU::FlushICache(uword start, uword size) {
#if defined(DART_PRECOMPILED_RUNTIME)
UNREACHABLE();
#else
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
if (FLAG_use_simulator) {
return;
}
@@ -65,9 +65,9 @@ void CPU::FlushICache(uword start, uword size) {
const char* CPU::Id() {
return
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
"sim"
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
"arm64";
}
@@ -76,7 +76,7 @@ const char* HostCPUFeatures::hardware_ = nullptr;
bool HostCPUFeatures::initialized_ = false;
#endif
#if !defined(USING_SIMULATOR)
#if !defined(DART_INCLUDE_SIMULATOR)
void HostCPUFeatures::Init() {
CpuInfo::Init();
hardware_ = CpuInfo::GetCpuModel();
@@ -96,7 +96,7 @@ void HostCPUFeatures::Cleanup() {
CpuInfo::Cleanup();
}
#else // !defined(USING_SIMULATOR)
#else // !defined(DART_INCLUDE_SIMULATOR)
void HostCPUFeatures::Init() {
CpuInfo::Init();
@@ -116,7 +116,7 @@ void HostCPUFeatures::Cleanup() {
hardware_ = nullptr;
CpuInfo::Cleanup();
}
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
} // namespace dart
+2 -2
View File
@@ -20,9 +20,9 @@ void CPU::FlushICache(uword start, uword size) {
const char* CPU::Id() {
return
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
"sim"
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
"ia32";
}
+7 -7
View File
@@ -10,7 +10,7 @@
#include "vm/cpuinfo.h"
#if !defined(USING_SIMULATOR)
#if !defined(DART_INCLUDE_SIMULATOR)
#if !defined(DART_HOST_OS_FUCHSIA)
#include <sys/syscall.h>
#else
@@ -28,7 +28,7 @@ namespace dart {
void CPU::FlushICache(uword start, uword size) {
#if defined(DART_PRECOMPILED_RUNTIME)
UNREACHABLE();
#elif !defined(USING_SIMULATOR)
#elif !defined(DART_INCLUDE_SIMULATOR)
// Nothing to do. Flushing no instructions.
if (size == 0) {
return;
@@ -53,9 +53,9 @@ void CPU::FlushICache(uword start, uword size) {
const char* CPU::Id() {
return
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
"sim"
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
#if defined(TARGET_ARCH_RISCV32)
"riscv32";
#elif defined(TARGET_ARCH_RISCV64)
@@ -70,7 +70,7 @@ const char* HostCPUFeatures::hardware_ = nullptr;
bool HostCPUFeatures::initialized_ = false;
#endif
#if !defined(USING_SIMULATOR)
#if !defined(DART_INCLUDE_SIMULATOR)
void HostCPUFeatures::Init() {
CpuInfo::Init();
hardware_ = CpuInfo::GetCpuModel();
@@ -90,7 +90,7 @@ void HostCPUFeatures::Cleanup() {
CpuInfo::Cleanup();
}
#else // !defined(USING_SIMULATOR)
#else // !defined(DART_INCLUDE_SIMULATOR)
void HostCPUFeatures::Init() {
CpuInfo::Init();
@@ -110,7 +110,7 @@ void HostCPUFeatures::Cleanup() {
hardware_ = nullptr;
CpuInfo::Cleanup();
}
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
} // namespace dart
+5 -5
View File
@@ -20,9 +20,9 @@ void CPU::FlushICache(uword start, uword size) {
const char* CPU::Id() {
return
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
"sim"
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
"x64";
}
@@ -36,7 +36,7 @@ bool HostCPUFeatures::abm_supported_ = false;
bool HostCPUFeatures::initialized_ = false;
#endif
#if !defined(USING_SIMULATOR)
#if !defined(DART_INCLUDE_SIMULATOR)
void HostCPUFeatures::Init() {
CpuInfo::Init();
hardware_ = CpuInfo::GetCpuModel();
@@ -60,7 +60,7 @@ void HostCPUFeatures::Cleanup() {
CpuInfo::Cleanup();
}
#else // !defined(USING_SIMULATOR)
#else // !defined(DART_INCLUDE_SIMULATOR)
void HostCPUFeatures::Init() {
CpuInfo::Init();
@@ -83,7 +83,7 @@ void HostCPUFeatures::Cleanup() {
hardware_ = nullptr;
CpuInfo::Cleanup();
}
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
} // namespace dart
+1 -1
View File
@@ -386,7 +386,7 @@ char* Dart::DartInit(const Dart_InitializeParams* params) {
TargetCPUFeatures::Init();
FfiCallbackMetadata::Init();
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
Simulator::Init();
#endif
// Create the read-only handles area.
+1 -1
View File
@@ -103,7 +103,7 @@ static ObjectPtr InvokeDartCode(uword entry_point,
DartEntryScope dart_entry_scope(thread);
const uword stub = StubCode::InvokeDartCode().EntryPoint();
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
if (FLAG_use_simulator) {
auto invoke = [&](uword entry_point, uword arguments_descriptor,
uword arguments, Thread* thread) -> uword {
+1 -1
View File
@@ -618,7 +618,7 @@ NO_SANITIZE_SAFE_STACK // This function manipulates the safestack pointer.
thread->set_execution_state(Thread::kThreadInGenerated);
}
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
// Unwinding of the C++ frames and destroying of their stack resources is done
// by the simulator, because the target stack_pointer is a simulated stack
// pointer and not the C++ stack pointer.
+1 -1
View File
@@ -583,7 +583,7 @@ DART_NOINLINE bool Interpreter::InvokeCompiled(Thread* thread,
{
InterpreterSetjmpBuffer buffer(this);
if (!DART_SETJMP(buffer.buffer_)) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
// We need to beware that bouncing between the interpreter and the
// simulator may exhaust the C stack before exhausting either the
// interpreter or simulator stacks.
+1 -1
View File
@@ -1869,7 +1869,7 @@ Isolate::~Isolate() {
free(name_);
delete field_table_;
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
delete simulator_;
#endif
delete message_handler_;
+1 -1
View File
@@ -21,7 +21,7 @@ class Thread;
#if defined(TESTING) || defined(DEBUG)
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
// The simulator/isolate might not exist yet for an async FFI callback, so do
// not check. An equivalent check exists in the simulator itself.
#define CHECK_STACK_ALIGNMENT \
+3 -3
View File
@@ -119,7 +119,7 @@ extern "C" void DRT_BootstrapNativeCall(Dart_NativeArguments args,
uword NativeEntry::BootstrapNativeCallWrapperEntry() {
uword entry = reinterpret_cast<uword>(DRT_BootstrapNativeCall);
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
if (FLAG_use_simulator) {
entry = Simulator::RedirectExternalReference(
entry, Simulator::kNativeCallWrapper,
@@ -165,7 +165,7 @@ extern "C" void DRT_NoScopeNativeCall(Dart_NativeArguments args,
uword NativeEntry::NoScopeNativeCallWrapperEntry() {
uword entry = reinterpret_cast<uword>(DRT_NoScopeNativeCall);
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
if (FLAG_use_simulator) {
entry = Simulator::RedirectExternalReference(
entry, Simulator::kNativeCallWrapper,
@@ -198,7 +198,7 @@ extern "C" void DRT_AutoScopeNativeCall(Dart_NativeArguments args,
uword NativeEntry::AutoScopeNativeCallWrapperEntry() {
uword entry = reinterpret_cast<uword>(DRT_AutoScopeNativeCall);
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
if (FLAG_use_simulator) {
entry = Simulator::RedirectExternalReference(
entry, Simulator::kNativeCallWrapper,
+1 -1
View File
@@ -27010,7 +27010,7 @@ const char* StackTrace::ToCString() const {
#else
const char kCompressedPointers[] = "no";
#endif
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
const char kUsingSimulator[] = "yes";
#else
const char kUsingSimulator[] = "no";
+2 -1
View File
@@ -8206,7 +8206,8 @@ TEST_CASE(TypeArguments_Cache_SomeInstantiations) {
// reasons. Any core issues will likely be found by SomeInstantiations.
#if !defined(DEBUG) && !defined(USING_MEMORY_SANITIZER) && \
!defined(USING_THREAD_SANITIZER) && !defined(USING_LEAK_SANITIZER) && \
!defined(USING_UNDEFINED_BEHAVIOR_SANITIZER) && !defined(USING_SIMULATOR)
!defined(USING_UNDEFINED_BEHAVIOR_SANITIZER) && \
!defined(DART_INCLUDE_SIMULATOR)
TEST_CASE(TypeArguments_Cache_ManyInstantiations) {
const intptr_t kNumClasses = 100000;
static_assert(kNumClasses > TypeArguments::Cache::kMaxLinearCacheEntries,
+6 -6
View File
@@ -45,7 +45,7 @@ DEFINE_FLAG(int,
max_profile_depth,
Sample::kPCArraySizeInWords* kMaxSamplesPerTick,
"Maximum number stack frames walked. Minimum 1. Maximum 255.");
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
DEFINE_FLAG(bool, profile_vm, true, "Always collect native stack traces.");
#else
DEFINE_FLAG(bool, profile_vm, false, "Always collect native stack traces.");
@@ -363,7 +363,7 @@ static bool GetAndValidateThreadStackBounds(OSThread* os_thread,
ASSERT(stack_lower != nullptr);
ASSERT(stack_upper != nullptr);
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
const bool use_simulator_stack_bounds =
FLAG_use_simulator && thread != nullptr && thread->IsExecutingDartCode();
if (use_simulator_stack_bounds) {
@@ -375,7 +375,7 @@ static bool GetAndValidateThreadStackBounds(OSThread* os_thread,
}
#else
const bool use_simulator_stack_bounds = false;
#endif // defined(USING_SIMULATOR)
#endif // defined(DART_INCLUDE_SIMULATOR)
if (!use_simulator_stack_bounds) {
*stack_lower = os_thread->stack_limit();
@@ -514,7 +514,7 @@ void Profiler::DumpStackTrace(uword sp, uword fp, uword pc, bool for_crash) {
#else
const char kCompressedPointers[] = "no";
#endif
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
const char kUsingSimulator[] = "yes";
#else
const char kUsingSimulator[] = "no";
@@ -1249,7 +1249,7 @@ static Sample* SetupSample(Thread* thread,
}
sample->Init(isolate->main_port(), OS::GetCurrentMonotonicMicros(), tid);
uword vm_tag = thread->vm_tag();
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
// When running in the simulator, the runtime entry function address
// (stored as the vm tag) is the address of a redirect function.
// Attempt to find the real runtime entry function address and use that.
@@ -1393,7 +1393,7 @@ void Profiler::SampleThread(Thread* thread,
if (in_dart_code) {
// If we're in Dart code, use the Dart stack pointer.
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
if (FLAG_use_simulator) {
Simulator* simulator = isolate->simulator();
sp = simulator->get_register(SPREG);
+5 -5
View File
@@ -123,7 +123,7 @@ uword RuntimeEntry::GetEntryPoint() const {
// this is a redirection address that forces the simulator to call
// into the runtime system.
uword entry = reinterpret_cast<uword>(function());
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
if (FLAG_use_simulator) {
// Redirection to leaf runtime calls supports a maximum of 4 arguments
// passed in registers (maximum 2 double arguments for leaf float runtime
@@ -153,14 +153,14 @@ uword RuntimeEntry::GetEntryPoint() const {
} while (0)
#endif
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
#define CHECK_SIMULATOR_STACK_OVERFLOW() \
if (FLAG_use_simulator && !OSThread::Current()->HasStackHeadroom()) { \
Exceptions::ThrowStackOverflow(); \
}
#else
#define CHECK_SIMULATOR_STACK_OVERFLOW()
#endif // defined(USING_SIMULATOR)
#endif // defined(DART_INCLUDE_SIMULATOR)
void OnEveryRuntimeEntryCall(Thread* thread,
const char* runtime_call_name,
@@ -3490,7 +3490,7 @@ static void HandleOSRRequest(Thread* thread) {
DEFINE_RUNTIME_ENTRY(InterruptOrStackOverflow, 0) {
uword stack_pos = OSThread::GetCurrentStackPointer();
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
if (FLAG_use_simulator) {
stack_pos = Simulator::Current()->get_sp();
// If simulator was never called it may return 0 as a value of SPREG.
@@ -4384,7 +4384,7 @@ extern "C" uword /*ObjectPtr*/ InterpretCall(uword /*FunctionPtr*/ function_in,
uword RuntimeEntry::InterpretCallEntry() {
#if defined(DART_DYNAMIC_MODULES)
uword entry = reinterpret_cast<uword>(InterpretCall);
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
if (FLAG_use_simulator) {
entry = Simulator::RedirectExternalReference(
entry, Simulator::kLeafRuntimeCall, 5);
+1 -1
View File
@@ -76,7 +76,7 @@ uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) {
}
uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) {
#if defined(TARGET_ARCH_ARM64) && !defined(USING_SIMULATOR)
#if defined(TARGET_ARCH_ARM64) && !defined(DART_INCLUDE_SIMULATOR)
return static_cast<uintptr_t>(mcontext.regs[SPREG]);
#else
return GetCStackPointer(mcontext);
+1 -1
View File
@@ -82,7 +82,7 @@ uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) {
}
uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) {
#if defined(TARGET_ARCH_ARM64) && !defined(USING_SIMULATOR)
#if defined(TARGET_ARCH_ARM64) && !defined(DART_INCLUDE_SIMULATOR)
return static_cast<uintptr_t>(mcontext.regs[SPREG]);
#else
return GetCStackPointer(mcontext);
+1 -1
View File
@@ -65,7 +65,7 @@ uintptr_t SignalHandler::GetCStackPointer(const mcontext_t& mcontext) {
}
uintptr_t SignalHandler::GetDartStackPointer(const mcontext_t& mcontext) {
#if defined(TARGET_ARCH_ARM64) && !defined(USING_SIMULATOR)
#if defined(TARGET_ARCH_ARM64) && !defined(DART_INCLUDE_SIMULATOR)
return static_cast<uintptr_t>(mcontext->__ss.__x[SPREG]);
#else
return GetCStackPointer(mcontext);
+2 -2
View File
@@ -7,7 +7,7 @@
#include "vm/globals.h"
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
#if defined(TARGET_ARCH_IA32)
#error Simulator not implemented.
#elif defined(TARGET_ARCH_X64)
@@ -21,6 +21,6 @@
#else
#error Unknown architecture.
#endif // defined(TARGET_ARCH_...)
#endif // defined(USING_SIMULATOR)
#endif // defined(DART_INCLUDE_SIMULATOR)
#endif // RUNTIME_VM_SIMULATOR_H_
+2 -2
View File
@@ -9,7 +9,7 @@
#if defined(TARGET_ARCH_ARM)
// Only build the simulator if not compiling for real ARM hardware.
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
#include "vm/simulator.h"
@@ -3710,6 +3710,6 @@ void Simulator::JumpToFrame(uword pc, uword sp, uword fp, Thread* thread) {
} // namespace dart
#endif // defined(USING_SIMULATOR)
#endif // defined(DART_INCLUDE_SIMULATOR)
#endif // defined TARGET_ARCH_ARM
+2 -2
View File
@@ -9,7 +9,7 @@
#if defined(TARGET_ARCH_ARM64)
// Only build the simulator if not compiling for real ARM hardware.
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
#include "vm/simulator.h"
@@ -4125,6 +4125,6 @@ void Simulator::JumpToFrame(uword pc, uword sp, uword fp, Thread* thread) {
} // namespace dart
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
#endif // defined TARGET_ARCH_ARM64
+2 -2
View File
@@ -9,7 +9,7 @@
#if defined(TARGET_ARCH_RISCV32) || defined(TARGET_ARCH_RISCV64)
// Only build the simulator if not compiling for real RISCV hardware.
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
#include "vm/simulator.h"
@@ -3451,6 +3451,6 @@ void Simulator::CSRClear(uint16_t csr, intx_t mask) {
} // namespace dart
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
#endif // defined TARGET_ARCH_RISCV
+2 -2
View File
@@ -9,7 +9,7 @@
#if defined(TARGET_ARCH_X64)
// Only build the simulator if not compiling for real X64 hardware.
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
#include "vm/simulator.h"
@@ -67,6 +67,6 @@ uword Simulator::FunctionForRedirect(uword redirect) {
} // namespace dart
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
#endif // defined TARGET_ARCH_X64
+2 -2
View File
@@ -738,7 +738,7 @@ void StackFrameIterator::FrameSetIterator::Unpoison() {
// instrumented C++, so there is nothing to unpoison. Additionally,
// fp_ will be somewhere in the simulator's stack instead of the OSThread's
// stack.
#if !defined(USING_SIMULATOR)
#if !defined(DART_INCLUDE_SIMULATOR)
if (fp_ == 0) return;
// Note that Thread::os_thread_ is cleared when the thread is descheduled.
ASSERT(is_interpreted() || (thread_->os_thread() == nullptr) ||
@@ -754,7 +754,7 @@ void StackFrameIterator::FrameSetIterator::Unpoison() {
uword upper = fp_ + kSavedCallerPcSlotFromFp * kWordSize;
// Both lower and upper are inclusive, so we add one word when computing size.
MSAN_UNPOISON(reinterpret_cast<void*>(lower), upper - lower + kWordSize);
#endif // !defined(USING_SIMULATOR)
#endif // !defined(DART_INCLUDE_SIMULATOR)
}
StackFrame* StackFrameIterator::FrameSetIterator::NextFrame(bool validate) {
+4 -4
View File
@@ -532,7 +532,7 @@ void Thread::EnterIsolateGroupAsMutator(IsolateGroup* isolate_group,
thread->SetupDartMutatorStateDependingOnSnapshot(isolate_group);
ResumeThreadInternal(thread);
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
if (FLAG_use_simulator) {
thread->SetStackLimit(Simulator::Current()->overflow_stack_limit());
} else {
@@ -586,7 +586,7 @@ void Thread::ResumeDartMutatorThreadInternal(Thread* thread) {
ResumeThreadInternal(thread);
if (Dart::vm_isolate() != nullptr &&
thread->isolate() != Dart::vm_isolate()) {
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
if (FLAG_use_simulator) {
thread->SetStackLimit(Simulator::Current()->overflow_stack_limit());
} else {
@@ -1328,7 +1328,7 @@ intptr_t Thread::OffsetFromThread(const RuntimeEntry* runtime_entry) {
bool Thread::TopErrorHandlerIsSetJump() const {
if (long_jump_base() == nullptr) return false;
if (top_exit_frame_info_ == 0) return true;
#if defined(USING_SIMULATOR) || defined(USING_SAFE_STACK)
#if defined(DART_INCLUDE_SIMULATOR) || defined(USING_SAFE_STACK)
// False positives: simulator stack and native stack are unordered.
return true;
#else
@@ -1344,7 +1344,7 @@ bool Thread::TopErrorHandlerIsSetJump() const {
bool Thread::TopErrorHandlerIsExitFrame() const {
if (top_exit_frame_info_ == 0) return false;
if (long_jump_base() == nullptr) return true;
#if defined(USING_SIMULATOR) || defined(USING_SAFE_STACK)
#if defined(DART_INCLUDE_SIMULATOR) || defined(USING_SAFE_STACK)
// False positives: simulator stack and native stack are unordered.
return true;
#else
+1 -1
View File
@@ -114,7 +114,7 @@ class ThreadInterrupterMacOS {
its.lr = state.__lr;
#endif // HOST_ARCH_...
#if defined(TARGET_ARCH_ARM64) && !defined(USING_SIMULATOR)
#if defined(TARGET_ARCH_ARM64) && !defined(DART_INCLUDE_SIMULATOR)
its.dsp = state.__x[SPREG];
#endif
return its;
+2 -2
View File
@@ -624,11 +624,11 @@ TEST_CASE(SafepointTestDart) {
// to get their verification done and exit. Use a specific UserTag
// to enable the helpers to verify that the main thread is
// successfully interrupted in the pure Dart loop.
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
const intptr_t kLoopCount = 12345678;
#else
const intptr_t kLoopCount = 1234567890;
#endif // defined(USING_SIMULATOR)
#endif // defined(DART_INCLUDE_SIMULATOR)
char buffer[1024];
Utils::SNPrint(buffer, sizeof(buffer),
"import 'dart:developer';\n"
+2 -2
View File
@@ -524,7 +524,7 @@ class AssemblerTest {
// using the ABI calling convention.
// ResultType is the return type of the assembler test function.
// ArgNType is the type of the Nth argument.
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
// Since Simulator::Call always return a int64_t, bit_cast does not work
// on 32-bit platforms when returning an int32_t. Use static cast on the
@@ -611,7 +611,7 @@ class AssemblerTest {
typedef ResultType (*FunctionType)(Arg1Type, Arg2Type, Arg3Type);
return reinterpret_cast<FunctionType>(entry())(arg1, arg2, arg3);
}
#endif // defined(USING_SIMULATOR)
#endif // defined(DART_INCLUDE_SIMULATOR)
// Assemble test and set code_.
void Assemble();
+1 -1
View File
@@ -33,7 +33,7 @@ const char* Version::str_ =
"{{VERSION_STR}} ({{CHANNEL}}) ({{COMMIT_TIME}})"
" on \"" kHostOperatingSystemName
"_"
#if defined(USING_SIMULATOR)
#if defined(DART_INCLUDE_SIMULATOR)
"sim"
#endif
kTargetArchitectureName "\"";