-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vm] Use multiple entrypoints to remove unnecessary checks on statica…
…lly-typed closure calls. Test Plan: Behavioral correctness should be ensured by existing tests. Tests in vm/dart/entrypoints ensure that the unchecked entrypoint is used in cases where the optimization should trigger. Bug: #31798 Change-Id: Id25ecba86e20c22f0678c12986ad620db312ddaa Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try Reviewed-on: https://dart-review.googlesource.com/69743 Commit-Queue: Samir Jindel <[email protected]> Reviewed-by: Vyacheslav Egorov <[email protected]>
- Loading branch information
1 parent
0093885
commit 19126e8
Showing
35 changed files
with
243 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
// Test that typed calls against tearoffs go into the unchecked entrypoint. | ||
|
||
import "package:expect/expect.dart"; | ||
import "common.dart"; | ||
|
||
class C<T> { | ||
@NeverInline | ||
@pragma("vm:testing.unsafe.trace-entrypoints-fn", validateTearoff) | ||
void target1(T x, String y) { | ||
Expect.notEquals(x, -1); | ||
Expect.equals(y, "foo"); | ||
} | ||
} | ||
|
||
test(List<String> args) { | ||
var f = (new C<int>()).target1; | ||
|
||
// Warmup. | ||
expectedEntryPoint = -1; | ||
expectedTearoffEntryPoint = -1; | ||
for (int i = 0; i < 100; ++i) { | ||
f(i, "foo"); | ||
} | ||
|
||
expectedEntryPoint = 0; | ||
expectedTearoffEntryPoint = 1; | ||
const int iterations = benchmarkMode ? 100000000 : 100; | ||
for (int i = 0; i < iterations; ++i) { | ||
f(i, "foo"); | ||
} | ||
|
||
Expect.isTrue(validateRan); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
// VMOptions=--enable-testing-pragmas --no-background-compilation --enable-inlining-annotations --optimization-counter-threshold=10 -Denable_inlining=true | ||
|
||
import "tearoff.dart"; | ||
|
||
main(args) => test(args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
// VMOptions=--enable-testing-pragmas --no-background-compilation --enable-inlining-annotations --optimization-counter-threshold=10 | ||
|
||
import "tearoff.dart"; | ||
|
||
main(args) => test(args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// No type checks are removed here, but we can skip the argument count check. | ||
|
||
import "package:expect/expect.dart"; | ||
import "common.dart"; | ||
|
||
class C<T> { | ||
@NeverInline | ||
@pragma("vm:testing.unsafe.trace-entrypoints-fn", validateTearoff) | ||
void samir1(T x) { | ||
if (x == -1) { | ||
throw "oh no"; | ||
} | ||
} | ||
} | ||
|
||
test(List<String> args) { | ||
var c = new C<int>(); | ||
var f = c.samir1; | ||
|
||
// Warmup. | ||
expectedEntryPoint = -1; | ||
expectedTearoffEntryPoint = -1; | ||
for (int i = 0; i < 100; ++i) { | ||
f(i); | ||
} | ||
|
||
expectedEntryPoint = 0; | ||
expectedTearoffEntryPoint = 1; | ||
int iterations = benchmarkMode ? 100000000 : 100; | ||
for (int i = 0; i < iterations; ++i) { | ||
f(i); | ||
} | ||
|
||
Expect.isTrue(validateRan); | ||
} |
5 changes: 5 additions & 0 deletions
5
runtime/tests/vm/dart/entrypoints/tearoff_prologue_inline_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// VMOptions=--enable-testing-pragmas --no-background-compilation --enable-inlining-annotations --optimization-counter-threshold=10 -Denable_inlining=true | ||
|
||
import "tearoff_prologue.dart"; | ||
|
||
main(args) => test(args); |
5 changes: 5 additions & 0 deletions
5
runtime/tests/vm/dart/entrypoints/tearoff_prologue_noinline_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// VMOptions=--enable-testing-pragmas --no-background-compilation --enable-inlining-annotations --optimization-counter-threshold=10 | ||
|
||
import "tearoff_prologue.dart"; | ||
|
||
main(args) => test(args); |
Oops, something went wrong.