b0e18fa40b
There was a bug in `CallTarget.signature` which triggers if there's only one entry that's statically dispatched against, which causes us to inline the polymorphic dispatcher, which relies on this (previously incorrect) signature. The CL also changes the dispatch table building logic to not allocate table entries for the statically dispatched regions (as they would never be used). Change-Id: Ic2d0c387e8863e89ef811e1892642fe81df9189a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468000 Reviewed-by: Ömer Ağacan <omersa@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
35 lines
800 B
Dart
35 lines
800 B
Dart
// Copyright (c) 2025, 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.
|
|
|
|
void main() {
|
|
final list = <Base>[A1(), A2()];
|
|
for (final entry in list) {
|
|
// The polymorphic dispatcher for `doit()` will be inlined as there's only
|
|
// one method marked with `@pragma('wasm:static-dispatch')`.
|
|
//
|
|
// This inlining used to trigger a bug, this is a regression test for
|
|
// this bug.
|
|
entry.doit();
|
|
}
|
|
}
|
|
|
|
class Base {
|
|
void doit() {
|
|
print('Base.doit()');
|
|
}
|
|
}
|
|
|
|
class A1 extends Base {
|
|
void doit() {
|
|
print('A1.doit()');
|
|
}
|
|
}
|
|
|
|
class A2 extends Base {
|
|
@pragma('wasm:static-dispatch')
|
|
void doit() {
|
|
print('A2.doit()');
|
|
}
|
|
}
|