Skip to content

Commit 3ba5bd0

Browse files
iinozemtsevCommit Queue
authored andcommitted
Revert "[vm] Turn on entry point checking in JIT mode."
This reverts commit 982b9fa. Reason for revert: b/385114574 Original change's description: > [vm] Turn on entry point checking in JIT mode. > > Now that Flutter tests that access entry points from native code > have been annotated[1], we can turn on entry point checking in JIT > mode. > > This CL also removes the A flag category from flag_list.h and the > AOT_FLAG_MACRO definitions and uses from flags.[cc,h], as they were > created as a temporary measure until this flag could be unconditionally > defaulted to true. > > [1] See the following PRs: > * flutter/engine#57158 > * flutter/flutter#160158 > * flutter/flutter#160421 > > TEST=vm/dart/entrypoints_verification_test vm/cc/IRTest > vm/cc/StreamingFlowGraphBuilder vm/cc/STC vm/cc/TTS > > Issue: #50649 > Issue: flutter/flutter#118608 > > Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-debug-x64-try,vm-linux-release-x64-try,vm-appjit-linux-product-x64-try > Change-Id: Ibe5b21bb74f1a6fb88824b71ff87b9e555216dbf > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400301 > Reviewed-by: Martin Kustermann <[email protected]> > Commit-Queue: Tess Strickland <[email protected]> Issue: #50649 Issue: flutter/flutter#118608 Change-Id: Id403cd0832807e417202e17dac57c2224cab09e7 Cq-Include-Trybots: luci.dart.try:vm-aot-linux-product-x64-try,vm-aot-linux-debug-x64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-product-arm64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-debug-x64-try,vm-linux-release-x64-try,vm-appjit-linux-product-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401880 Bot-Commit: Rubber Stamper <[email protected]> Reviewed-by: Martin Kustermann <[email protected]> Commit-Queue: Ivan Inozemtsev <[email protected]>
1 parent cc34c05 commit 3ba5bd0

File tree

11 files changed

+36
-97
lines changed

11 files changed

+36
-97
lines changed

runtime/tests/vm/dart/entrypoints_verification_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44
//
5+
// VMOptions=--verify-entry-points=true
56
// SharedObjects=entrypoints_verification_test
67

78
import 'dart:ffi';

runtime/vm/compiler/backend/il_test.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ ISOLATE_UNIT_TEST_CASE(IRTest_EliminateWriteBarrier) {
6262
6363
Container<int> x = Container<int>();
6464
65-
@pragma("vm:entry-point", "call")
6665
foo() {
6766
for (int i = 0; i < 10; ++i) {
6867
x[i] = i;
@@ -690,7 +689,6 @@ ISOLATE_UNIT_TEST_CASE(IRTest_LoadThread) {
690689
auto kScript = R"(
691690
import 'dart:ffi';
692691
693-
@pragma("vm:entry-point", "call")
694692
int myFunction() {
695693
return 100;
696694
}
@@ -782,7 +780,6 @@ ISOLATE_UNIT_TEST_CASE(IRTest_CachableIdempotentCall) {
782780
return increment();
783781
}
784782
785-
@pragma("vm:entry-point", "call")
786783
int multipleIncrement() {
787784
int returnValue = 0;
788785
for(int i = 0; i < 10; i++) {
@@ -946,7 +943,6 @@ ISOLATE_UNIT_TEST_CASE(IRTest_FfiCallInstrLeafDoesntSpill) {
946943
void placeholder() {}
947944
948945
// Will call the "doFfiCall" and exercise its code.
949-
@pragma("vm:entry-point", "call")
950946
bool invokeDoFfiCall() {
951947
final double result = doFfiCall(1, 2, 3, 1.0, 2.0, 3.0);
952948
if (result != (2 + 3 + 4 + 2.0 + 3.0 + 4.0)) {
@@ -975,7 +971,6 @@ ISOLATE_UNIT_TEST_CASE(IRTest_FfiCallInstrLeafDoesntSpill) {
975971
typedef NT = Void Function();
976972
typedef DT = void Function();
977973
Pointer<NativeFunction<NT>> ptr = Pointer.fromAddress(0);
978-
@pragma("vm:entry-point", "call")
979974
DT getFfiTrampolineClosure() => ptr.asFunction(isLeaf:true);
980975
)";
981976

runtime/vm/compiler/backend/memory_copy_test.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,12 @@ static void RunMemoryCopyInstrTest(intptr_t src_start,
157157
CStringUniquePtr kScript(OS::SCreate(nullptr, R"(
158158
import 'dart:ffi';
159159
160-
@pragma("vm:entry-point", "call")
161160
void copyConst() {
162161
final pointer = Pointer<Uint8>.fromAddress(%s%p);
163162
final pointer2 = Pointer<Uint8>.fromAddress(%s%p);
164163
noop();
165164
}
166165
167-
@pragma("vm:entry-point", "call")
168166
void callNonConstCopy() {
169167
final pointer = Pointer<Uint8>.fromAddress(%s%p);
170168
final pointer2 = Pointer<Uint8>.fromAddress(%s%p);

runtime/vm/compiler/backend/redundancy_elimination_test.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,6 @@ ISOLATE_UNIT_TEST_CASE(DelayAllocations_DelayAcrossCalls) {
14801480
@pragma("vm:never-inline")
14811481
dynamic use(v) {}
14821482
1483-
@pragma("vm:entry-point", "call")
14841483
void test() {
14851484
A a = new A(foo(1), foo(2));
14861485
use(a);
@@ -1739,12 +1738,10 @@ ISOLATE_UNIT_TEST_CASE(AllocationSinking_NoViewDataMaterialization) {
17391738
return x is int;
17401739
}
17411740
1742-
@pragma("vm:entry-point", "call")
17431741
bool %s() {
17441742
return %s(0xABCC);
17451743
}
17461744
1747-
@pragma("vm:entry-point", "call")
17481745
bool %s() {
17491746
return %s(1.0);
17501747
}

runtime/vm/compiler/backend/yield_position_test.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ void RunTestInMode(CompilerPass::PipelineMode mode) {
5252
R"(
5353
import 'dart:async';
5454
55-
@pragma("vm:entry-point", "call")
5655
Future foo() async {
5756
print('pos-0');
5857
await 0;
@@ -82,9 +81,9 @@ void RunTestInMode(CompilerPass::PipelineMode mode) {
8281
auto validate_indices = [](const YieldPoints& yield_points) {
8382
EXPECT_EQ(3, yield_points.length());
8483

85-
EXPECT_EQ(128, yield_points[0].Pos());
86-
EXPECT_EQ(169, yield_points[1].Pos());
87-
EXPECT_EQ(210, yield_points[2].Pos());
84+
EXPECT_EQ(88, yield_points[0].Pos());
85+
EXPECT_EQ(129, yield_points[1].Pos());
86+
EXPECT_EQ(170, yield_points[2].Pos());
8887
};
8988

9089
validate_indices(*GetYieldPointsFromGraph(flow_graph));

runtime/vm/compiler/frontend/kernel_binary_flowgraph_test.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ ISOLATE_UNIT_TEST_CASE(StreamingFlowGraphBuilder_ConstFoldStringConcats) {
1515
// "Adjacent strings are implicitly concatenated to form a single string
1616
// literal."
1717
const char* kScript = R"(
18-
@pragma("vm:entry-point", "call")
1918
test() {
2019
var s = 'aaaa'
2120
'bbbb'
@@ -253,7 +252,6 @@ ISOLATE_UNIT_TEST_CASE(StreamingFlowGraphBuilder_ConcatStringLits) {
253252

254253
ISOLATE_UNIT_TEST_CASE(StreamingFlowGraphBuilder_InvariantFlagInListLiterals) {
255254
const char* kScript = R"(
256-
@pragma("vm:entry-point", "call")
257255
test() {
258256
return [...[], 42];
259257
}
@@ -316,7 +314,6 @@ ISOLATE_UNIT_TEST_CASE(StreamingFlowGraphBuilder_TypedClosureCall) {
316314
//
317315
const char* kScript = R"(
318316
int callClosure(int Function(int) fun, int value) => fun(value);
319-
@pragma("vm:entry-point", "call")
320317
test() => callClosure((int a) => a + 1, 10);
321318
)";
322319

@@ -357,7 +354,6 @@ ISOLATE_UNIT_TEST_CASE(
357354
StreamingFlowGraphBuilder_StaticGetFinalFieldWithTrivialInitializer) {
358355
const char* kScript = R"(
359356
final int x = 0xFEEDFEED;
360-
@pragma("vm:entry-point", "call")
361357
test() {
362358
return x;
363359
}

runtime/vm/flag_list.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,18 @@ constexpr bool FLAG_support_il_printer = false;
6969
// * R elease flags: Generally available flags except when building product.
7070
// * pre C ompile flags: Generally available flags except when building product
7171
// or precompiled runtime.
72+
// * A ot flags: Generally available flags except when building precompiled
73+
// runtime. (Unlike C, these flags are available in product mode.)
7274
// * D ebug flags: Can only be set in debug VMs, which also have C++ assertions
7375
// enabled.
7476
//
7577
// Usage:
7678
// P(name, type, default_value, comment)
7779
// R(name, product_value, type, default_value, comment)
7880
// C(name, precompiled_value, product_value, type, default_value, comment)
81+
// A(name, precompiled_value, type, default_value, comment)
7982
// D(name, type, default_value, comment)
80-
#define FLAG_LIST(P, R, C, D) \
83+
#define FLAG_LIST(P, R, C, A, D) \
8184
VM_GLOBAL_FLAG_LIST(P, R, C, D) \
8285
DISASSEMBLE_FLAGS(P, R, C, D) \
8386
P(abort_on_oom, bool, false, \
@@ -246,7 +249,7 @@ constexpr bool FLAG_support_il_printer = false;
246249
R(eliminate_type_checks, true, bool, true, \
247250
"Eliminate type checks when allowed by static type analysis.") \
248251
D(support_rr, bool, false, "Support running within RR.") \
249-
P(verify_entry_points, bool, true, \
252+
A(verify_entry_points, true, bool, false, \
250253
"Throw API error on invalid member access through native API. See " \
251254
"entry_point_pragma.md") \
252255
C(branch_coverage, false, false, bool, false, "Enable branch coverage") \

runtime/vm/flags.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,18 @@ DEFINE_FLAG(bool,
3535
// Nothing to be done for the precompilation flag definitions.
3636
#define PRECOMPILE_FLAG_MACRO(name, pre_value, product_value, type, \
3737
default_value, comment)
38+
// Nothing to be done for the AOT flag definitions.
39+
#define AOT_FLAG_MACRO(name, pre_value, type, default_value, comment)
3840

3941
#elif defined(PRODUCT) // !PRECOMPILED
4042
// Nothing to be done for the product flag definitions.
4143
#define RELEASE_FLAG_MACRO(name, product_value, type, default_value, comment)
4244
// Nothing to be done for the precompilation flag definitions.
4345
#define PRECOMPILE_FLAG_MACRO(name, pre_value, product_value, type, \
4446
default_value, comment)
47+
#define AOT_FLAG_MACRO(name, pre_value, type, default_value, comment) \
48+
type FLAG_##name = \
49+
Flags::Register_##type(&FLAG_##name, #name, default_value, comment);
4550

4651
#elif defined(DART_PRECOMPILED_RUNTIME) // !PRODUCT
4752
#define RELEASE_FLAG_MACRO(name, product_value, type, default_value, comment) \
@@ -50,6 +55,8 @@ DEFINE_FLAG(bool,
5055
// Nothing to be done for the precompilation flag definitions.
5156
#define PRECOMPILE_FLAG_MACRO(name, pre_value, product_value, type, \
5257
default_value, comment)
58+
// Nothing to be done for the AOT flag definitions.
59+
#define AOT_FLAG_MACRO(name, pre_value, type, default_value, comment)
5360

5461
#else // !PRODUCT && !PRECOMPILED
5562
#define RELEASE_FLAG_MACRO(name, product_value, type, default_value, comment) \
@@ -59,17 +66,22 @@ DEFINE_FLAG(bool,
5966
default_value, comment) \
6067
type FLAG_##name = \
6168
Flags::Register_##type(&FLAG_##name, #name, default_value, comment);
69+
#define AOT_FLAG_MACRO(name, pre_value, type, default_value, comment) \
70+
type FLAG_##name = \
71+
Flags::Register_##type(&FLAG_##name, #name, default_value, comment);
6272
#endif
6373

6474
// Define all of the non-product flags here.
6575
FLAG_LIST(PRODUCT_FLAG_MACRO,
6676
RELEASE_FLAG_MACRO,
6777
PRECOMPILE_FLAG_MACRO,
78+
AOT_FLAG_MACRO,
6879
DEBUG_FLAG_MACRO)
6980

7081
#undef PRODUCT_FLAG_MACRO
7182
#undef RELEASE_FLAG_MACRO
7283
#undef PRECOMPILE_FLAG_MACRO
84+
#undef AOT_FLAG_MACRO
7385
#undef DEBUG_FLAG_MACRO
7486

7587
#if defined(DART_PRECOMPILER)

runtime/vm/flags.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,39 +124,49 @@ class Flags {
124124
#define PRECOMPILE_FLAG_MACRO(name, precompiled_value, product_value, type, \
125125
default_value, comment) \
126126
const type FLAG_##name = precompiled_value;
127+
#define AOT_FLAG_MACRO(name, precompiled_value, type, default_value, comment) \
128+
const type FLAG_##name = precompiled_value;
127129

128130
#elif defined(PRODUCT) // !PRECOMPILED
129131
#define RELEASE_FLAG_MACRO(name, product_value, type, default_value, comment) \
130132
const type FLAG_##name = product_value;
131133
#define PRECOMPILE_FLAG_MACRO(name, precompiled_value, product_value, type, \
132134
default_value, comment) \
133135
const type FLAG_##name = product_value;
136+
#define AOT_FLAG_MACRO(name, precompiled_value, type, default_value, comment) \
137+
extern type FLAG_##name;
134138

135139
#elif defined(DART_PRECOMPILED_RUNTIME) // !PRODUCT
136140
#define RELEASE_FLAG_MACRO(name, product_value, type, default_value, comment) \
137141
extern type FLAG_##name;
138142
#define PRECOMPILE_FLAG_MACRO(name, precompiled_value, product_value, type, \
139143
default_value, comment) \
140144
const type FLAG_##name = precompiled_value;
145+
#define AOT_FLAG_MACRO(name, precompiled_value, type, default_value, comment) \
146+
const type FLAG_##name = precompiled_value;
141147

142148
#else // !PRODUCT && !PRECOMPILED
143149
#define RELEASE_FLAG_MACRO(name, product_value, type, default_value, comment) \
144150
extern type FLAG_##name;
145151
#define PRECOMPILE_FLAG_MACRO(name, precompiled_value, product_value, type, \
146152
default_value, comment) \
147153
extern type FLAG_##name;
154+
#define AOT_FLAG_MACRO(name, precompiled_value, type, default_value, comment) \
155+
extern type FLAG_##name;
148156

149157
#endif
150158

151159
// Now declare all flags here.
152160
FLAG_LIST(PRODUCT_FLAG_MACRO,
153161
RELEASE_FLAG_MACRO,
154162
PRECOMPILE_FLAG_MACRO,
163+
AOT_FLAG_MACRO,
155164
DEBUG_FLAG_MACRO)
156165

157166
#undef RELEASE_FLAG_MACRO
158167
#undef DEBUG_FLAG_MACRO
159168
#undef PRODUCT_FLAG_MACRO
169+
#undef AOT_FLAG_MACRO
160170
#undef PRECOMPILE_FLAG_MACRO
161171

162172
#if defined(DART_PRECOMPILER)

runtime/vm/object_test.cc

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8436,23 +8436,15 @@ static void SubtypeTestCacheTest(Thread* thread,
84368436
intptr_t num_classes,
84378437
bool expect_hash) {
84388438
TextBuffer buffer(MB);
8439-
buffer.AddString(R"(
8440-
class D {}
8441-
8442-
@pragma('vm:entry-point', 'call')
8443-
D createInstanceD() => D();
8444-
8445-
@pragma('vm:entry-point', 'call')
8446-
D Function() createClosureD() => () => D();
8447-
)");
8439+
buffer.AddString("class D {}\n");
8440+
buffer.AddString("D createInstanceD() => D();");
8441+
buffer.AddString("D Function() createClosureD() => () => D();\n");
84488442
for (intptr_t i = 0; i < num_classes; i++) {
84498443
buffer.Printf(R"(class C%)" Pd R"( extends D {}
84508444
)"
8451-
"@pragma('vm:entry-point', 'call')\n"
84528445
R"(C%)" Pd R"( createInstanceC%)" Pd R"(() => C%)" Pd
84538446
R"(();
84548447
)"
8455-
"@pragma('vm:entry-point', 'call')\n"
84568448
R"(C%)" Pd R"( Function() createClosureC%)" Pd
84578449
R"(() => () => C%)" Pd
84588450
R"(();

0 commit comments

Comments
 (0)