Skip to content

Commit 7973eac

Browse files
rmacnak-googleCommit Queue
authored andcommitted
[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 <[email protected]> Reviewed-by: Slava Egorov <[email protected]>
1 parent 7466f6e commit 7973eac

40 files changed

+119
-117
lines changed

runtime/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ config("dart_arch_config") {
169169
assert(false)
170170
}
171171
if (dart_force_simulator) {
172-
defines += [ "USING_SIMULATOR" ]
172+
defines += [ "DART_INCLUDE_SIMULATOR" ]
173173
if (dart_target_arch == "arm64") {
174174
defines += [ "SIMULATOR_FFI" ]
175175
}

runtime/bin/snapshot_utils.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525

2626
#define LOG_SECTION_BOUNDARIES false
2727

28-
#if !defined(USING_SIMULATOR)
28+
#if !defined(DART_INCLUDE_SIMULATOR)
2929
#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_ANDROID) || \
3030
defined(DART_HOST_OS_FUCHSIA)
3131
#define NATIVE_SHARED_OBJECT_FORMAT_ELF 1
3232
#elif defined(DART_HOST_OS_MACOS)
3333
#define NATIVE_SHARED_OBJECT_FORMAT_MACHO 1
3434
#endif
35-
#endif // !defined(USING_SIMULATOR)
35+
#endif // !defined(DART_INCLUDE_SIMULATOR)
3636

3737
namespace dart {
3838
namespace bin {
@@ -215,7 +215,7 @@ static AppSnapshot* TryReadAppSnapshotDynamicLibrary(
215215
DartUtils::MagicNumber magic_number,
216216
const char* script_name,
217217
const char** error) {
218-
#if defined(USING_SIMULATOR)
218+
#if defined(DART_INCLUDE_SIMULATOR)
219219
*error = "running on a simulated architecture";
220220
return nullptr;
221221
#else
@@ -277,7 +277,7 @@ static AppSnapshot* TryReadAppSnapshotDynamicLibrary(
277277
return new DylibAppSnapshot(magic_number, library, vm_data_buffer,
278278
vm_instructions_buffer, isolate_data_buffer,
279279
isolate_instructions_buffer);
280-
#endif // defined(USING_SIMULATOR)
280+
#endif // defined(DART_INCLUDE_SIMULATOR)
281281
}
282282

283283
class ElfAppSnapshot : public AppSnapshot {

runtime/lib/ffi_dynamic_library.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929

3030
namespace dart {
3131

32-
#if (defined(USING_SIMULATOR) && !defined(SIMULATOR_FFI)) || \
32+
#if (defined(DART_INCLUDE_SIMULATOR) && !defined(SIMULATOR_FFI)) || \
3333
(defined(DART_PRECOMPILER) && !defined(TESTING))
3434

3535
DART_NORETURN static void SimulatorUnsupported() {
36-
#if defined(USING_SIMULATOR)
36+
#if defined(DART_INCLUDE_SIMULATOR)
3737
Exceptions::ThrowUnsupportedError("Not supported on this simulator.");
3838
#else
3939
Exceptions::ThrowUnsupportedError("Not supported in precompiler.");
@@ -66,7 +66,7 @@ DEFINE_NATIVE_ENTRY(Ffi_GetFfiNativeResolver, 1, 0) {
6666
SimulatorUnsupported();
6767
}
6868

69-
#else // defined(USING_SIMULATOR) || \
69+
#else // defined(DART_INCLUDE_SIMULATOR) || \
7070
// (defined(DART_PRECOMPILER) && !defined(TESTING))
7171

7272
// If an error occurs populates |error| (if provided) with an error message
@@ -516,7 +516,7 @@ DEFINE_NATIVE_ENTRY(Ffi_GetFfiNativeResolver, 1, 0) {
516516
return Pointer::New(reinterpret_cast<intptr_t>(FfiResolve));
517517
}
518518

519-
#endif // (defined(USING_SIMULATOR) && !defined (SIMULATOR_FFI)) || \
519+
#endif // (defined(DART_INCLUDE_SIMULATOR) && !defined (SIMULATOR_FFI)) || \
520520
// (defined(DART_PRECOMPILER) && !defined(TESTING))
521521

522522
} // namespace dart

runtime/platform/globals.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,30 +368,30 @@ struct simd128_value_t {
368368
// Determine whether we will be using the simulator.
369369
#if defined(TARGET_ARCH_IA32)
370370
#if !defined(HOST_ARCH_IA32)
371-
#define USING_SIMULATOR 1
371+
#define DART_INCLUDE_SIMULATOR 1
372372
#endif
373373
#elif defined(TARGET_ARCH_X64)
374374
#if !defined(HOST_ARCH_X64)
375-
#define USING_SIMULATOR 1
375+
#define DART_INCLUDE_SIMULATOR 1
376376
#endif
377377
#elif defined(TARGET_ARCH_ARM)
378378
#if !defined(HOST_ARCH_ARM)
379379
#define TARGET_HOST_MISMATCH 1
380380
#if !defined(IS_SIMARM_HOST64)
381-
#define USING_SIMULATOR 1
381+
#define DART_INCLUDE_SIMULATOR 1
382382
#endif
383383
#endif
384384
#elif defined(TARGET_ARCH_ARM64)
385385
#if !defined(HOST_ARCH_ARM64)
386-
#define USING_SIMULATOR 1
386+
#define DART_INCLUDE_SIMULATOR 1
387387
#endif
388388
#elif defined(TARGET_ARCH_RISCV32)
389389
#if !defined(HOST_ARCH_RISCV32)
390-
#define USING_SIMULATOR 1
390+
#define DART_INCLUDE_SIMULATOR 1
391391
#endif
392392
#elif defined(TARGET_ARCH_RISCV64)
393393
#if !defined(HOST_ARCH_RISCV64)
394-
#define USING_SIMULATOR 1
394+
#define DART_INCLUDE_SIMULATOR 1
395395
#endif
396396
#else
397397
#error Unknown architecture.

runtime/vm/compiler/assembler/assembler_arm.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
#include "vm/tags.h"
1616

1717
// An extra check since we are assuming the existence of /proc/cpuinfo below.
18-
#if !defined(USING_SIMULATOR) && !defined(__linux__) && !defined(ANDROID) && \
19-
!defined(DART_HOST_OS_IOS) && !defined(DART_HOST_OS_MACOS)
18+
#if !defined(DART_INCLUDE_SIMULATOR) && !defined(__linux__) && \
19+
!defined(ANDROID) && !defined(DART_HOST_OS_IOS) && \
20+
!defined(DART_HOST_OS_MACOS)
2021
#error ARM cross-compile only supported on Linux, Android, iOS, and Mac
2122
#endif
2223

runtime/vm/compiler/assembler/assembler_arm_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,7 +1871,7 @@ ASSEMBLER_TEST_RUN(Sdiv_corner, test) {
18711871
}
18721872

18731873
ASSEMBLER_TEST_GENERATE(IntDiv_supported, assembler) {
1874-
#if defined(USING_SIMULATOR)
1874+
#if defined(DART_INCLUDE_SIMULATOR)
18751875
bool orig = TargetCPUFeatures::integer_division_supported();
18761876
HostCPUFeatures::set_integer_division_supported(true);
18771877
__ mov(R0, Operand(27));
@@ -1889,7 +1889,7 @@ ASSEMBLER_TEST_GENERATE(IntDiv_supported, assembler) {
18891889

18901890
ASSEMBLER_TEST_RUN(IntDiv_supported, test) {
18911891
EXPECT(test != nullptr);
1892-
#if defined(USING_SIMULATOR)
1892+
#if defined(DART_INCLUDE_SIMULATOR)
18931893
bool orig = TargetCPUFeatures::integer_division_supported();
18941894
HostCPUFeatures::set_integer_division_supported(true);
18951895
typedef int (*Tst)() DART_UNUSED;
@@ -1902,7 +1902,7 @@ ASSEMBLER_TEST_RUN(IntDiv_supported, test) {
19021902
}
19031903

19041904
ASSEMBLER_TEST_GENERATE(IntDiv_unsupported, assembler) {
1905-
#if defined(USING_SIMULATOR)
1905+
#if defined(DART_INCLUDE_SIMULATOR)
19061906
bool orig = TargetCPUFeatures::integer_division_supported();
19071907
HostCPUFeatures::set_integer_division_supported(false);
19081908
__ mov(R0, Operand(27));
@@ -1920,7 +1920,7 @@ ASSEMBLER_TEST_GENERATE(IntDiv_unsupported, assembler) {
19201920

19211921
ASSEMBLER_TEST_RUN(IntDiv_unsupported, test) {
19221922
EXPECT(test != nullptr);
1923-
#if defined(USING_SIMULATOR)
1923+
#if defined(DART_INCLUDE_SIMULATOR)
19241924
bool orig = TargetCPUFeatures::integer_division_supported();
19251925
HostCPUFeatures::set_integer_division_supported(false);
19261926
typedef int (*Tst)() DART_UNUSED;

runtime/vm/compiler/assembler/assembler_riscv_test.cc

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,79 +50,79 @@ static intx_t Call(intx_t entry,
5050
intx_t arg1 = 0,
5151
intx_t arg2 = 0,
5252
intx_t arg3 = 0) {
53-
#if defined(USING_SIMULATOR)
53+
#if defined(DART_INCLUDE_SIMULATOR)
5454
return Simulator::Current()->Call(entry, arg0, arg1, arg2, arg3);
5555
#else
5656
typedef intx_t (*F)(intx_t, intx_t, intx_t, intx_t);
5757
return reinterpret_cast<F>(entry)(arg0, arg1, arg2, arg3);
5858
#endif
5959
}
6060
static float CallF(intx_t entry, intx_t arg0) {
61-
#if defined(USING_SIMULATOR)
61+
#if defined(DART_INCLUDE_SIMULATOR)
6262
return Simulator::Current()->CallF(entry, arg0);
6363
#else
6464
typedef float (*F)(intx_t);
6565
return reinterpret_cast<F>(entry)(arg0);
6666
#endif
6767
}
6868
static float CallF(intx_t entry, intx_t arg0, float arg1) {
69-
#if defined(USING_SIMULATOR)
69+
#if defined(DART_INCLUDE_SIMULATOR)
7070
return Simulator::Current()->CallF(entry, arg0, arg1);
7171
#else
7272
typedef float (*F)(intx_t, float);
7373
return reinterpret_cast<F>(entry)(arg0, arg1);
7474
#endif
7575
}
7676
static float CallF(intx_t entry, double arg0) {
77-
#if defined(USING_SIMULATOR)
77+
#if defined(DART_INCLUDE_SIMULATOR)
7878
return Simulator::Current()->CallF(entry, arg0);
7979
#else
8080
typedef float (*F)(double);
8181
return reinterpret_cast<F>(entry)(arg0);
8282
#endif
8383
}
8484
static float CallF(intx_t entry, float arg0) {
85-
#if defined(USING_SIMULATOR)
85+
#if defined(DART_INCLUDE_SIMULATOR)
8686
return Simulator::Current()->CallF(entry, arg0);
8787
#else
8888
typedef float (*F)(float);
8989
return reinterpret_cast<F>(entry)(arg0);
9090
#endif
9191
}
9292
static float CallF(intx_t entry, float arg0, float arg1) {
93-
#if defined(USING_SIMULATOR)
93+
#if defined(DART_INCLUDE_SIMULATOR)
9494
return Simulator::Current()->CallF(entry, arg0, arg1);
9595
#else
9696
typedef float (*F)(float, float);
9797
return reinterpret_cast<F>(entry)(arg0, arg1);
9898
#endif
9999
}
100100
static float CallF(intx_t entry, float arg0, float arg1, float arg2) {
101-
#if defined(USING_SIMULATOR)
101+
#if defined(DART_INCLUDE_SIMULATOR)
102102
return Simulator::Current()->CallF(entry, arg0, arg1, arg2);
103103
#else
104104
typedef float (*F)(float, float, float);
105105
return reinterpret_cast<F>(entry)(arg0, arg1, arg2);
106106
#endif
107107
}
108108
static intx_t CallI(intx_t entry, float arg0) {
109-
#if defined(USING_SIMULATOR)
109+
#if defined(DART_INCLUDE_SIMULATOR)
110110
return Simulator::Current()->CallI(entry, arg0);
111111
#else
112112
typedef intx_t (*F)(float);
113113
return reinterpret_cast<F>(entry)(arg0);
114114
#endif
115115
}
116116
static intx_t CallI(intx_t entry, float arg0, float arg1) {
117-
#if defined(USING_SIMULATOR)
117+
#if defined(DART_INCLUDE_SIMULATOR)
118118
return Simulator::Current()->CallI(entry, arg0, arg1);
119119
#else
120120
typedef intx_t (*F)(float, float);
121121
return reinterpret_cast<F>(entry)(arg0, arg1);
122122
#endif
123123
}
124124
static double CallD(intx_t entry, intx_t arg0) {
125-
#if defined(USING_SIMULATOR)
125+
#if defined(DART_INCLUDE_SIMULATOR)
126126
return Simulator::Current()->CallD(entry, arg0);
127127
#else
128128
typedef double (*F)(intx_t);
@@ -131,7 +131,7 @@ static double CallD(intx_t entry, intx_t arg0) {
131131
}
132132
#if XLEN == 32
133133
static double CallD(intx_t entry, int64_t arg0) {
134-
#if defined(USING_SIMULATOR)
134+
#if defined(DART_INCLUDE_SIMULATOR)
135135
return Simulator::Current()->CallD(entry, arg0);
136136
#else
137137
typedef double (*F)(int64_t);
@@ -140,55 +140,55 @@ static double CallD(intx_t entry, int64_t arg0) {
140140
}
141141
#endif
142142
static double CallD(intx_t entry, intx_t arg0, double arg1) {
143-
#if defined(USING_SIMULATOR)
143+
#if defined(DART_INCLUDE_SIMULATOR)
144144
return Simulator::Current()->CallD(entry, arg0, arg1);
145145
#else
146146
typedef double (*F)(intx_t, double);
147147
return reinterpret_cast<F>(entry)(arg0, arg1);
148148
#endif
149149
}
150150
static double CallD(intx_t entry, float arg0) {
151-
#if defined(USING_SIMULATOR)
151+
#if defined(DART_INCLUDE_SIMULATOR)
152152
return Simulator::Current()->CallD(entry, arg0);
153153
#else
154154
typedef double (*F)(float);
155155
return reinterpret_cast<F>(entry)(arg0);
156156
#endif
157157
}
158158
static double CallD(intx_t entry, double arg0) {
159-
#if defined(USING_SIMULATOR)
159+
#if defined(DART_INCLUDE_SIMULATOR)
160160
return Simulator::Current()->CallD(entry, arg0);
161161
#else
162162
typedef double (*F)(double);
163163
return reinterpret_cast<F>(entry)(arg0);
164164
#endif
165165
}
166166
static double CallD(intx_t entry, double arg0, double arg1) {
167-
#if defined(USING_SIMULATOR)
167+
#if defined(DART_INCLUDE_SIMULATOR)
168168
return Simulator::Current()->CallD(entry, arg0, arg1);
169169
#else
170170
typedef double (*F)(double, double);
171171
return reinterpret_cast<F>(entry)(arg0, arg1);
172172
#endif
173173
}
174174
static double CallD(intx_t entry, double arg0, double arg1, double arg2) {
175-
#if defined(USING_SIMULATOR)
175+
#if defined(DART_INCLUDE_SIMULATOR)
176176
return Simulator::Current()->CallD(entry, arg0, arg1, arg2);
177177
#else
178178
typedef double (*F)(double, double, double);
179179
return reinterpret_cast<F>(entry)(arg0, arg1, arg2);
180180
#endif
181181
}
182182
static intx_t CallI(intx_t entry, double arg0) {
183-
#if defined(USING_SIMULATOR)
183+
#if defined(DART_INCLUDE_SIMULATOR)
184184
return Simulator::Current()->CallI(entry, arg0);
185185
#else
186186
typedef intx_t (*F)(double);
187187
return reinterpret_cast<F>(entry)(arg0);
188188
#endif
189189
}
190190
static intx_t CallI(intx_t entry, double arg0, double arg1) {
191-
#if defined(USING_SIMULATOR)
191+
#if defined(DART_INCLUDE_SIMULATOR)
192192
return Simulator::Current()->CallI(entry, arg0, arg1);
193193
#else
194194
typedef intx_t (*F)(double, double);
@@ -197,7 +197,7 @@ static intx_t CallI(intx_t entry, double arg0, double arg1) {
197197
}
198198
#if XLEN == 32
199199
static int64_t CallI64(intx_t entry, double arg0, double arg1 = 0.0) {
200-
#if defined(USING_SIMULATOR)
200+
#if defined(DART_INCLUDE_SIMULATOR)
201201
return Simulator::Current()->CallI64(entry, arg0, arg1);
202202
#else
203203
typedef int64_t (*F)(double, double);

runtime/vm/compiler/stub_code_compiler_arm.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ void StubCodeCompiler::GenerateLoadFfiCallbackMetadataRuntimeFunction(
311311
}
312312

313313
void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
314-
#if defined(USING_SIMULATOR) && !defined(DART_PRECOMPILER)
314+
#if defined(DART_INCLUDE_SIMULATOR) && !defined(DART_PRECOMPILER)
315315
// TODO(37299): FFI is not supported in SIMARM.
316316
__ Breakpoint();
317317
#else

runtime/vm/compiler/stub_code_compiler_arm64.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void StubCodeCompiler::EnsureIsNewOrRemembered() {
7676
// [Thread::tsan_utils_->setjmp_buffer_]).
7777
static void WithExceptionCatchingTrampoline(Assembler* assembler,
7878
std::function<void()> fun) {
79-
#if !defined(USING_SIMULATOR)
79+
#if !defined(DART_INCLUDE_SIMULATOR)
8080
const Register kTsanUtilsReg = R3;
8181

8282
// Reserve space for arguments and align frame before entering C++ world.
@@ -147,11 +147,11 @@ static void WithExceptionCatchingTrampoline(Assembler* assembler,
147147
__ Bind(&do_native_call);
148148
__ MoveRegister(kSavedRspReg, SP);
149149
}
150-
#endif // !defined(USING_SIMULATOR)
150+
#endif // !defined(DART_INCLUDE_SIMULATOR)
151151

152152
fun();
153153

154-
#if !defined(USING_SIMULATOR)
154+
#if !defined(DART_INCLUDE_SIMULATOR)
155155
if (FLAG_target_thread_sanitizer) {
156156
__ MoveRegister(SP, kSavedRspReg);
157157
__ AddImmediate(SP, kJumpBufferSize);
@@ -161,7 +161,7 @@ static void WithExceptionCatchingTrampoline(Assembler* assembler,
161161
__ str(TMP,
162162
Address(kTsanUtilsReg2, target::TsanUtils::setjmp_buffer_offset()));
163163
}
164-
#endif // !defined(USING_SIMULATOR)
164+
#endif // !defined(DART_INCLUDE_SIMULATOR)
165165
}
166166

167167
// Input parameters:

runtime/vm/compiler/stub_code_compiler_riscv.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ void StubCodeCompiler::GenerateLoadFfiCallbackMetadataRuntimeFunction(
322322
}
323323

324324
void StubCodeCompiler::GenerateFfiCallbackTrampolineStub() {
325-
#if defined(USING_SIMULATOR) && !defined(DART_PRECOMPILER)
325+
#if defined(DART_INCLUDE_SIMULATOR) && !defined(DART_PRECOMPILER)
326326
// TODO(37299): FFI is not supported in SIMRISCV32/64.
327327
__ ebreak();
328328
#else

0 commit comments

Comments
 (0)