-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vm/aot] Attach unboxing info to unreachable members
Unreachable members could be used as interface targets of dispatch table calls, so they should have correct unboxing metadata. This change fixes attaching unboxing info to such members. TEST=runtime/tests/vm/dart/regress_44563_test.dart Fixes #44563 Change-Id: I5da6a8d07048904eb94b05bfba11bdf72d655e12 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177621 Reviewed-by: Aske Simon Christensen <askesc@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
- Loading branch information
1 parent
e5ed69d
commit 3bef6cf
Showing
3 changed files
with
91 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) 2021, 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. | ||
|
||
// Verifies that unboxing info is attached to a member with unreachable body, | ||
// which is still used as an interface target. | ||
// Regression test for https://github.com/dart-lang/sdk/issues/44563. | ||
|
||
import 'package:expect/expect.dart'; | ||
|
||
class BaseClass { | ||
int get value => 0; | ||
} | ||
|
||
class Class1 extends BaseClass { | ||
@pragma('vm:never-inline') | ||
int get value => 1; | ||
} | ||
|
||
class Class2 extends BaseClass { | ||
@pragma('vm:never-inline') | ||
int get value => 2; | ||
} | ||
|
||
bool nonConstantCondition = int.parse("1") == 1; | ||
|
||
void main() { | ||
BaseClass obj = BaseClass(); | ||
obj = nonConstantCondition ? Class1() : Class2(); | ||
Expect.equals(1, obj.value); | ||
} |
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,31 @@ | ||
// Copyright (c) 2021, 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. | ||
|
||
// Verifies that unboxing info is attached to a member with unreachable body, | ||
// which is still used as an interface target. | ||
// Regression test for https://github.com/dart-lang/sdk/issues/44563. | ||
|
||
import 'package:expect/expect.dart'; | ||
|
||
class BaseClass { | ||
int get value => 0; | ||
} | ||
|
||
class Class1 extends BaseClass { | ||
@pragma('vm:never-inline') | ||
int get value => 1; | ||
} | ||
|
||
class Class2 extends BaseClass { | ||
@pragma('vm:never-inline') | ||
int get value => 2; | ||
} | ||
|
||
bool nonConstantCondition = int.parse("1") == 1; | ||
|
||
void main() { | ||
BaseClass obj = BaseClass(); | ||
obj = nonConstantCondition ? Class1() : Class2(); | ||
Expect.equals(1, obj.value); | ||
} |