Skip to content

Commit dd6dc29

Browse files
alexmarkovcommit-bot@chromium.org
authored andcommitted
[vm/nnbd] Prepare to migrate runtime/tests/vm/dart to NNBD
This change mechanically copies runtime/tests/vm/dart -> runtime/tests/vm/dart_2 in preparation for the migration of runtime/tests/vm/dart to NNBD. Corresponding statuses in vm.status are duplicated. Added vm_nnbd builder tag for NNBD bots. vm/dart/* tests are allowed to run only on vm_nnbd builders. vm/dart_2/* tests are allowed to run only on non-vm_nnbd builders. Issue: #41314 Change-Id: I079da92da17960605f37c1c0e28e48362b236739 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149485 Reviewed-by: Régis Crelier <[email protected]> Reviewed-by: Ryan Macnak <[email protected]> Commit-Queue: Alexander Markov <[email protected]>
1 parent b9a89b2 commit dd6dc29

File tree

184 files changed

+22344
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+22344
-7
lines changed

pkg/front_end/lib/src/fasta/source/source_library_builder.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
421421
'language_2/',
422422
'lib_2/',
423423
'standalone_2/',
424-
'vm/dart/', // in runtime/tests
424+
'vm/dart_2/', // in runtime/tests
425425
];
426426

427427
LanguageVersion get languageVersion => _languageVersion;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// OtherResources=appjit_bytecode_simple_test_body.dart
6+
7+
// Verify that app-jit snapshot contains dependencies between classes and CHA
8+
// optimized code.
9+
10+
import 'dart:async';
11+
import 'dart:io' show Platform;
12+
13+
import 'snapshot_test_helper.dart';
14+
15+
Future<void> main() => runAppJitBytecodeTest(
16+
Platform.script.resolve('appjit_bytecode_simple_test_body.dart'));
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
void main(List<String> args) {
6+
final isTraining = args.contains("--train");
7+
print(isTraining ? 'OK(Trained)' : 'OK(Run)');
8+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// OtherResources=appjit_cha_deopt_test_body.dart
6+
// VMOptions=--optimization-counter-threshold=100 --deterministic
7+
8+
// Verify that app-jit snapshot contains dependencies between classes and CHA
9+
// optimized code.
10+
11+
import 'dart:async';
12+
import 'dart:io' show Platform;
13+
14+
import 'snapshot_test_helper.dart';
15+
16+
Future<void> main() =>
17+
runAppJitTest(Platform.script.resolve('appjit_cha_deopt_test_body.dart'));
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// Verify that app-jit snapshot contains dependencies between classes and CHA
6+
// optimized code.
7+
8+
import 'package:expect/expect.dart';
9+
10+
class A {
11+
void getMyName() => getMyNameImpl();
12+
13+
void getMyNameImpl() => "A";
14+
}
15+
16+
class B extends A {
17+
void getMyNameImpl() => "B";
18+
}
19+
20+
final Function makeA = () => new A();
21+
final Function makeB = () => new B();
22+
23+
void optimizeGetMyName(dynamic obj) {
24+
for (var i = 0; i < 100; i++) {
25+
obj.getMyName();
26+
}
27+
Expect.equals("A", obj.getMyName());
28+
}
29+
30+
void main(List<String> args) {
31+
final isTraining = args.contains("--train");
32+
final dynamic obj = (isTraining ? makeA : makeB)();
33+
if (isTraining) {
34+
for (var i = 0; i < 10; i++) {
35+
optimizeGetMyName(obj);
36+
}
37+
Expect.equals('A', obj.getMyName());
38+
print('OK(Trained)');
39+
} else {
40+
Expect.equals('B', obj.getMyName());
41+
print('OK(Run)');
42+
}
43+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// Verify creating an app-jit snapshot twice generates the same bits.
6+
7+
import 'dart:async';
8+
import 'snapshot_test_helper.dart';
9+
10+
int fib(int n) {
11+
if (n <= 1) return 1;
12+
return fib(n - 1) + fib(n - 2);
13+
}
14+
15+
Future<void> main(List<String> args) async {
16+
if (args.contains('--child')) {
17+
print(fib(35));
18+
return;
19+
}
20+
21+
await checkDeterministicSnapshot("app-jit", "14930352");
22+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// OtherResources=appjit_load_static_licm_test_body.dart
6+
7+
// Verify that app-jit snapshot contains dependencies between classes and CHA
8+
// optimized code.
9+
10+
import 'dart:async';
11+
import 'dart:io' show Platform;
12+
13+
import 'snapshot_test_helper.dart';
14+
15+
Future<void> main() => runAppJitTest(
16+
Platform.script.resolve('appjit_load_static_licm_test_body.dart'));
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// Verify that LoadStaticField IL instruction can't be hoisted above
6+
// InitStaticField instruction.
7+
8+
import 'package:expect/expect.dart';
9+
10+
// Classes used to trigger deoptimization when running from app-jit snapshot.
11+
class A {
12+
void foo() {}
13+
}
14+
15+
class B {
16+
void foo() {}
17+
}
18+
19+
// Static final field with a non-trivial initializer.
20+
// This field will be reset before snapshot is written.
21+
final field = (() => 'value')();
22+
23+
dynamic bar(dynamic o, {bool loadField: false}) {
24+
o.foo();
25+
// Create loop to trigger loop invariant code motion. We are testing that
26+
// field load can't be hoisted above field initialization.
27+
for (var i = 0; i < 2; i++) {
28+
final v = loadField ? field : null;
29+
if (loadField) {
30+
return v;
31+
}
32+
}
33+
return null;
34+
}
35+
36+
void main(List<String> args) {
37+
final isTraining = args.contains("--train");
38+
dynamic o = isTraining ? new A() : new B();
39+
for (var i = 0; i < 20000; i++) {
40+
bar(o, loadField: false);
41+
if (isTraining) {
42+
// Initialize the field when training.
43+
bar(o, loadField: true);
44+
}
45+
}
46+
Expect.equals('value', bar(o, loadField: true));
47+
print(isTraining ? 'OK(Trained)' : 'OK(Run)');
48+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// This test is ensuring that the flag for --async-igoto-threshold is handled.
6+
// - -1 means igoto-based async is disabled.
7+
// - All other values sets the threshold for after how many continuations we
8+
// used the igoto-based async.
9+
10+
// VMOptions=--async-igoto-threshold=-1
11+
// VMOptions=--async-igoto-threshold=0
12+
// VMOptions=--async-igoto-threshold=1
13+
// VMOptions=--async-igoto-threshold=10
14+
// VMOptions=--async-igoto-threshold=1000
15+
16+
import '../../../../benchmarks/Calls/dart/Calls.dart' as calls;
17+
18+
main() async => calls.main();

runtime/tests/vm/dart_2/bad_snapshot

1014 Bytes
Binary file not shown.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// VMOptions=--always-generate-trampolines-for-testing --use-bare-instructions
6+
7+
// We use a reasonable sized test and run it with the above options.
8+
import 'hello_fuchsia_test.dart' as test;
9+
10+
main(args) {
11+
test.main(args);
12+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// VMOptions=--serialize_flow_graphs_to=il_tmp.txt
6+
// VMOptions=--serialize_flow_graphs_to=il_tmp.txt --populate_llvm_constant_pool
7+
// VMOptions=--serialize_flow_graphs_to=il_tmp.txt --no_serialize_flow_graph_types
8+
// VMOptions=--serialize_flow_graphs_to=il_tmp.txt --verbose_flow_graph_serialization
9+
// VMOptions=--serialize_flow_graphs_to=il_tmp.txt --no_serialize_flow_graph_types --verbose_flow_graph_serialization
10+
11+
// Just use the existing hello world test.
12+
import 'hello_world_test.dart' as test;
13+
14+
main(args) {
15+
test.main();
16+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// Test case that tests boxing mint
6+
7+
// VMOptions=--optimization_counter_threshold=10 --deterministic --use-slow-path --shared-slow-path-triggers-gc --stacktrace_filter=foobar
8+
9+
import 'dart:typed_data';
10+
import 'package:expect/expect.dart';
11+
12+
final gSize = 100;
13+
final l = Uint64List(gSize);
14+
int sum = 0;
15+
16+
foobar() {
17+
for (int i = 0; i < l.length; ++i) {
18+
sum += l[i];
19+
}
20+
Expect.equals(-9223372036854775808, sum);
21+
}
22+
23+
main() {
24+
for (int i = 0; i < gSize; i++) {
25+
l[i] = (i + 30) << 62;
26+
}
27+
foobar();
28+
}

0 commit comments

Comments
 (0)