[L] Change in dart/sdk[main]: Make concrete `_ZoneFunction`s not generic.

0 views
Skip to first unread message

Lasse Nielsen (Gerrit)

unread,
Jun 23, 2026, 11:42:06 AM (12 hours ago) Jun 23
to Daco Harkes, Nate Bosch, dart-...@luci-project-accounts.iam.gserviceaccount.com, rev...@dartlang.org
Attention needed from Daco Harkes and Nate Bosch

Lasse Nielsen added 1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Lasse Nielsen . resolved

Another attempt, taking _smaller_ steps, towards making Zone monomorphic.

Just refactoring and getting rid of an unnecessary split between interface and implementation of a class that is now final anyway.

@dacoh...@google.com - You seem to be one of only two people owning dart2wasm tests.

Open in Gerrit

Related details

Attention is currently required from:
  • Daco Harkes
  • Nate Bosch
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedCore-Library-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I80f9979e6bda16f60239a4a6961aab3d5d1ba560
Gerrit-Change-Number: 514841
Gerrit-PatchSet: 3
Gerrit-Owner: Lasse Nielsen <l...@google.com>
Gerrit-Reviewer: Daco Harkes <dacoh...@google.com>
Gerrit-Reviewer: Lasse Nielsen <l...@google.com>
Gerrit-Reviewer: Nate Bosch <nbo...@google.com>
Gerrit-Attention: Nate Bosch <nbo...@google.com>
Gerrit-Attention: Daco Harkes <dacoh...@google.com>
Gerrit-Comment-Date: Tue, 23 Jun 2026 15:41:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Daco Harkes (Gerrit)

unread,
Jun 23, 2026, 11:58:01 AM (12 hours ago) Jun 23
to Lasse Nielsen, Martin Kustermann, Nate Bosch, dart-...@luci-project-accounts.iam.gserviceaccount.com, rev...@dartlang.org
Attention needed from Lasse Nielsen, Martin Kustermann and Nate Bosch

Daco Harkes added 1 comment

Patchset-level comments
Lasse Nielsen . resolved

Another attempt, taking _smaller_ steps, towards making Zone monomorphic.

Just refactoring and getting rid of an unnecessary split between interface and implementation of a class that is now final anyway.

@dacoh...@google.com - You seem to be one of only two people owning dart2wasm tests.

Daco Harkes

@kuste...@google.com or the others in the WASM team are the real owners. I have write access to be able to update record_use things.

I have no idea why Gerrit doesn't suggest all people in the WASM_OWNERS file.

Open in Gerrit

Related details

Attention is currently required from:
  • Lasse Nielsen
  • Martin Kustermann
  • Nate Bosch
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedCore-Library-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I80f9979e6bda16f60239a4a6961aab3d5d1ba560
Gerrit-Change-Number: 514841
Gerrit-PatchSet: 3
Gerrit-Owner: Lasse Nielsen <l...@google.com>
Gerrit-Reviewer: Lasse Nielsen <l...@google.com>
Gerrit-Reviewer: Martin Kustermann <kuste...@google.com>
Gerrit-Attention: Martin Kustermann <kuste...@google.com>
Gerrit-Attention: Lasse Nielsen <l...@google.com>
Gerrit-Comment-Date: Tue, 23 Jun 2026 15:57:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Lasse Nielsen <l...@google.com>
unsatisfied_requirement
open
diffy

Lasse Nielsen (Gerrit)

unread,
Jun 23, 2026, 12:04:43 PM (12 hours ago) Jun 23
to Martin Kustermann, Nate Bosch, dart-...@luci-project-accounts.iam.gserviceaccount.com, rev...@dartlang.org
Attention needed from Lasse Nielsen, Martin Kustermann and Nate Bosch

Lasse Nielsen added 6 comments

File sdk/lib/async/zone.dart
Line 491, Patchset 3 (Latest): _ZoneVariables get _zoneVariables;
Lasse Nielsen . unresolved

Makes zone variables be tracked the same way as other zone-overrides.
They're the only non-function, but otherwise they're scoped the same way.

Line 532, Patchset 3 (Latest): _ZoneRun _run;
Lasse Nielsen . unresolved

Introduces specialized subclasses for each type of zone values, so that the instance doesn't have to store type arguments. May reduce memory load a little.

There is no code that treats a zone value in general, they don't even need a common superclass, that's just to reuse code.

Line 581, Patchset 3 (Latest): if (specification != null) {
Lasse Nielsen . unresolved

Allows `specification` to be null instead of passing in an empty specification object, so if you don't give a specification when forking, it can skip all the checks.

Line 728, Patchset 3 (Latest): dynamic _recursiveLookup(_ZoneVariables variables, Object? key) {
Lasse Nielsen . unresolved

Split into two functions in hope that the lookup might be inlined.
(But that probably won't happen until `Zone` becomes one class, not `_CustomZone` and `_RootZone` with different `[]` operations.

File sdk/lib/async/zone_root.dart
Line 197, Patchset 3 (Parent): throw "unreachable"; // TODO(lrn): Remove when type promotion works.
Lasse Nielsen . resolved

It works. But now so does passing `null` instead of creating a dummy value.

File sdk/lib/async/zone_specification.dart
Line 28, Patchset 3 (Latest):final class const ZoneSpecification({
Lasse Nielsen . unresolved

(Maybe it's still too soon to use primary constructor syntax, https://github.com/dart-lang/sdk/issues/63589, but I don't actually know where to see that. I can convert back if necessary. Or have the AI do it?)

Gerrit-Comment-Date: Tue, 23 Jun 2026 16:04:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Lasse Nielsen (Gerrit)

unread,
Jun 23, 2026, 12:05:45 PM (12 hours ago) Jun 23
to Martin Kustermann, Nate Bosch, dart-...@luci-project-accounts.iam.gserviceaccount.com, rev...@dartlang.org
Attention needed from Martin Kustermann and Nate Bosch

Lasse Nielsen added 1 comment

Patchset-level comments
Lasse Nielsen . resolved

Another attempt, taking _smaller_ steps, towards making Zone monomorphic.

Just refactoring and getting rid of an unnecessary split between interface and implementation of a class that is now final anyway.

@dacoh...@google.com - You seem to be one of only two people owning dart2wasm tests.

Daco Harkes

@kuste...@google.com or the others in the WASM team are the real owners. I have write access to be able to update record_use things.

I have no idea why Gerrit doesn't suggest all people in the WASM_OWNERS file.

Lasse Nielsen

ACK, you're relieved, I'll tag Martin instead.

Open in Gerrit

Related details

Attention is currently required from:
  • Martin Kustermann
  • Nate Bosch
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedCore-Library-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I80f9979e6bda16f60239a4a6961aab3d5d1ba560
Gerrit-Change-Number: 514841
Gerrit-PatchSet: 3
Gerrit-Owner: Lasse Nielsen <l...@google.com>
Gerrit-Reviewer: Lasse Nielsen <l...@google.com>
Gerrit-Reviewer: Martin Kustermann <kuste...@google.com>
Gerrit-Reviewer: Nate Bosch <nbo...@google.com>
Gerrit-Attention: Nate Bosch <nbo...@google.com>
Gerrit-Attention: Martin Kustermann <kuste...@google.com>
Gerrit-Comment-Date: Tue, 23 Jun 2026 16:05:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Daco Harkes <dacoh...@google.com>
Comment-In-Reply-To: Lasse Nielsen <l...@google.com>
unsatisfied_requirement
open
diffy

Martin Kustermann (Gerrit)

unread,
Jun 23, 2026, 3:38:58 PM (8 hours ago) Jun 23
to Lasse Nielsen, Nate Bosch, dart-...@luci-project-accounts.iam.gserviceaccount.com, rev...@dartlang.org
Attention needed from Lasse Nielsen and Nate Bosch

Martin Kustermann voted and added 7 comments

Votes added by Martin Kustermann

Code-Review+1

7 comments

File pkg/dart2wasm/test/ir_tests/try_blocks.wat
Line 10, Patchset 3 (Latest): (global $"WasmArray<WasmI32>[800]" (ref $Array<WasmI32>) <...>)
Martin Kustermann . unresolved

(That's due to increase in number of classes)

File sdk/lib/async/zone.dart
Line 477, Patchset 3 (Latest): // all fields.
Martin Kustermann . unresolved

nit: remove this comment?

Lasse Nielsen . unresolved

Introduces specialized subclasses for each type of zone values, so that the instance doesn't have to store type arguments. May reduce memory load a little.

There is no code that treats a zone value in general, they don't even need a common superclass, that's just to reuse code.

Martin Kustermann

so that the instance doesn't have to store type arguments

Without digging, I would suspect that at least VM AOT and wasm store the `_ZoneValue.T` type argument in an extra field. i.e. I suspect we don't optimize this away.

If you pay the price for extra classes already, why not remove the common super class?
What would be the downside of making those records? i.e.
```
typedef _ZoneRun = (Zone, RunHandler);
...
```
?

Line 544, Patchset 3 (Latest): _ZoneHandleUncaughtError _handleUncaughtError;
Martin Kustermann . unresolved

Is there a reason why they can't be final fields?

Line 728, Patchset 3 (Latest): dynamic _recursiveLookup(_ZoneVariables variables, Object? key) {
Lasse Nielsen . unresolved

Split into two functions in hope that the lookup might be inlined.
(But that probably won't happen until `Zone` becomes one class, not `_CustomZone` and `_RootZone` with different `[]` operations.

Martin Kustermann

dbc: Having only one class would be great (In fact, at some point I thought I try myself, because I stumbled upon some bad code because of this)

Line 769, Patchset 3 (Latest): var handler = implementation.value as RunHandler;
Martin Kustermann . unresolved
This `_run` field is defined via
```
_ZoneRun _run;
```
and we have
```
final class const _ZoneRun(super.zone, super.value)
extends _ZoneValue<RunHandler>;

sealed class _ZoneValue<T extends Object> {
final _Zone zone;
final T value;
const _ZoneValue(this.zone, this.value);
}

```

So shouldn't `implementation.value` have the type `RunHandler` type already?
Why this cast here?

File sdk/lib/async/zone_root.dart
Line 184, Patchset 3 (Latest): valueMap = HashMap<Object?, Object?>.of(zoneValues);
Martin Kustermann . unresolved

In general we should always use the default `Map` (which is used also for `{}` and `{}` const literals). This avoid pulling in 2 different map implementations into apps, reducing size.

Do you use `HashMap` intentionally here because we have prove it makes things meaningfully faster? If not, consider using `Map`

Open in Gerrit

Related details

Attention is currently required from:
  • Lasse Nielsen
  • Nate Bosch
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedCore-Library-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I80f9979e6bda16f60239a4a6961aab3d5d1ba560
Gerrit-Change-Number: 514841
Gerrit-PatchSet: 3
Gerrit-Owner: Lasse Nielsen <l...@google.com>
Gerrit-Reviewer: Lasse Nielsen <l...@google.com>
Gerrit-Reviewer: Martin Kustermann <kuste...@google.com>
Gerrit-Reviewer: Nate Bosch <nbo...@google.com>
Gerrit-Attention: Nate Bosch <nbo...@google.com>
Gerrit-Attention: Lasse Nielsen <l...@google.com>
Gerrit-Comment-Date: Tue, 23 Jun 2026 19:38:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Lasse Nielsen <l...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Nate Bosch (Gerrit)

unread,
Jun 23, 2026, 8:09:36 PM (4 hours ago) Jun 23
to Lasse Nielsen, Martin Kustermann, dart-...@luci-project-accounts.iam.gserviceaccount.com, rev...@dartlang.org
Attention needed from Lasse Nielsen

Nate Bosch added 3 comments

Patchset-level comments
Nate Bosch . unresolved

Can you expand the commit message with more details on the code change and the motivation for the changes?

File DEPS
Line 138, Patchset 3 (Latest): "dartdoc_rev": "d0fac90eb4213db3d5f8d8ff360a4f4bcb4b7ae2",
Nate Bosch . unresolved

Is this intentionally included in this CL? It seems unrelated, but if it is related we should say how in the commit message.

File sdk/lib/async/zone.dart
Line 548, Patchset 3 (Latest): /// This is always a [HashMap].
Nate Bosch . unresolved
[nit]
```suggestion
/// The `value` is always a [HashMap].
```
Open in Gerrit

Related details

Attention is currently required from:
  • Lasse Nielsen
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedCore-Library-Review
  • requirement satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I80f9979e6bda16f60239a4a6961aab3d5d1ba560
Gerrit-Change-Number: 514841
Gerrit-PatchSet: 3
Gerrit-Owner: Lasse Nielsen <l...@google.com>
Gerrit-Reviewer: Lasse Nielsen <l...@google.com>
Gerrit-Reviewer: Martin Kustermann <kuste...@google.com>
Gerrit-Reviewer: Nate Bosch <nbo...@google.com>
Gerrit-Attention: Lasse Nielsen <l...@google.com>
Gerrit-Comment-Date: Wed, 24 Jun 2026 00:09:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages