[L] Change in dart/sdk[main]: [vm/immutable] Ensure that canonical instances are deeply-immutable.

0 views
Skip to first unread message

Slava Egorov (Gerrit)

unread,
Jan 20, 2026, 8:13:21 AM (2 days ago) Jan 20
to Alexander Aprelev, Ryan Macnak, Commit Queue, rev...@dartlang.org, vm-...@dartlang.org
Attention needed from Alexander Aprelev

Slava Egorov voted and added 5 comments

Votes added by Slava Egorov

Code-Review+1

5 comments

File runtime/vm/app_snapshot.cc
Line 172, Patchset 1 (Latest): is_deeply_immutable_(is_deeply_immutable) {
Slava Egorov . unresolved

Given two asserts below consider removing this parameter altogether and just do:

```
is_deeply_immutable_(is_canonical_ || Object::ShouldHaveDeeplyImmutabilityBitSet(cid))
```

Line 1500, Patchset 1 (Latest): TypeParametersDeserializationCluster(bool is_canonical,
Slava Egorov . unresolved

There is assert below which says it is never canonical? So this is always false.

Line 9316, Patchset 1 (Latest): ASSERT(is_deeply_immutable);
Slava Egorov . unresolved

If you have an assert like this then pass constant `true` instead of the `is_deeply_immutable` variable to the constructor below and fold constant value into the constructor itself (if it is only invoked with one value.

Line 9319, Patchset 1 (Latest): case kFunctionTypeCid:
Slava Egorov . unresolved

I would imagine that these types are also deeply immutable? Should there be an assert? (Same for types below). If yes - please fold the constant into the constructor itself as described in the comment above.

Line 9332, Patchset 1 (Latest): ASSERT(is_deeply_immutable);
Slava Egorov . unresolved

Same comment as above. Fold constants into constructors everywhere - where appropriate.

Open in Gerrit

Related details

Attention is currently required from:
  • Alexander Aprelev
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedCommit-Message-Has-TEST
  • 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: Ifa7d8f8b0af73b3a6ff9c1f79a174246280b1ce9
Gerrit-Change-Number: 473422
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Aprelev <a...@google.com>
Gerrit-Reviewer: Alexander Aprelev <a...@google.com>
Gerrit-Reviewer: Slava Egorov <veg...@google.com>
Gerrit-CC: Ryan Macnak <rma...@google.com>
Gerrit-Attention: Alexander Aprelev <a...@google.com>
Gerrit-Comment-Date: Tue, 20 Jan 2026 13:13:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Alexander Aprelev (Gerrit)

unread,
Jan 20, 2026, 11:23:35 AM (2 days ago) Jan 20
to Alexander Aprelev, Slava Egorov, Ryan Macnak, Commit Queue, rev...@dartlang.org, vm-...@dartlang.org
Attention needed from Slava Egorov

Alexander Aprelev added 2 comments

File runtime/vm/app_snapshot.cc
Line 172, Patchset 1 (Latest): is_deeply_immutable_(is_deeply_immutable) {
Slava Egorov . unresolved

Given two asserts below consider removing this parameter altogether and just do:

```
is_deeply_immutable_(is_canonical_ || Object::ShouldHaveDeeplyImmutabilityBitSet(cid))
```

Alexander Aprelev

Somehow in my mind by having explicit parameter and separate ASSERT I wanted to emphasize that here we consume `is_canonical` and `is_deeply_immutable` properties that were calculated at previous stages, only having an ASSERT to confirm assumptions that we generally have about these attributes.
Specifically I wanted to avoid use of `Object::ShouldHaveDeeplyImmutabilityBitSet` here which to me feels like leaking of implementation details if `is_deeply_immutable` proprety calculation.

Line 1500, Patchset 1 (Latest): TypeParametersDeserializationCluster(bool is_canonical,
Slava Egorov . unresolved

There is assert below which says it is never canonical? So this is always false.

Alexander Aprelev

Like above and below my intent with explicit parameter passing was to highlight the fact that code here doesn't calculate those `is_canonical`, `is_deeply_immutable` attributes, only consumes them.

Open in Gerrit

Related details

Attention is currently required from:
  • Slava Egorov
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedCommit-Message-Has-TEST
  • 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: Ifa7d8f8b0af73b3a6ff9c1f79a174246280b1ce9
Gerrit-Change-Number: 473422
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Aprelev <a...@google.com>
Gerrit-Reviewer: Alexander Aprelev <a...@google.com>
Gerrit-Reviewer: Slava Egorov <veg...@google.com>
Gerrit-CC: Ryan Macnak <rma...@google.com>
Gerrit-Attention: Slava Egorov <veg...@google.com>
Gerrit-Comment-Date: Tue, 20 Jan 2026 16:23:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Slava Egorov <veg...@google.com>
satisfied_requirement
open
diffy

Alexander Aprelev (Gerrit)

unread,
Jan 20, 2026, 12:31:59 PM (2 days ago) Jan 20
to Alexander Aprelev, Slava Egorov, Ryan Macnak, Commit Queue, rev...@dartlang.org, vm-...@dartlang.org
Attention needed from Slava Egorov

Alexander Aprelev voted and added 5 comments

Votes added by Alexander Aprelev

Commit-Queue+1

5 comments

File runtime/vm/app_snapshot.cc
Line 172, Patchset 1: is_deeply_immutable_(is_deeply_immutable) {
Slava Egorov . resolved

Given two asserts below consider removing this parameter altogether and just do:

```
is_deeply_immutable_(is_canonical_ || Object::ShouldHaveDeeplyImmutabilityBitSet(cid))
```

Alexander Aprelev

Somehow in my mind by having explicit parameter and separate ASSERT I wanted to emphasize that here we consume `is_canonical` and `is_deeply_immutable` properties that were calculated at previous stages, only having an ASSERT to confirm assumptions that we generally have about these attributes.
Specifically I wanted to avoid use of `Object::ShouldHaveDeeplyImmutabilityBitSet` here which to me feels like leaking of implementation details if `is_deeply_immutable` proprety calculation.

Alexander Aprelev

Done

Line 1500, Patchset 1: TypeParametersDeserializationCluster(bool is_canonical,
Slava Egorov . resolved

There is assert below which says it is never canonical? So this is always false.

Alexander Aprelev

Like above and below my intent with explicit parameter passing was to highlight the fact that code here doesn't calculate those `is_canonical`, `is_deeply_immutable` attributes, only consumes them.

Alexander Aprelev

Also, this is plural TypeParameters, and assert is about singular TypeParameter.

Line 9316, Patchset 1: ASSERT(is_deeply_immutable);
Slava Egorov . resolved

If you have an assert like this then pass constant `true` instead of the `is_deeply_immutable` variable to the constructor below and fold constant value into the constructor itself (if it is only invoked with one value.

Alexander Aprelev

Done

Line 9319, Patchset 1: case kFunctionTypeCid:
Slava Egorov . resolved

I would imagine that these types are also deeply immutable? Should there be an assert? (Same for types below). If yes - please fold the constant into the constructor itself as described in the comment above.

Alexander Aprelev

Done

Line 9332, Patchset 1: ASSERT(is_deeply_immutable);
Slava Egorov . unresolved

Same comment as above. Fold constants into constructors everywhere - where appropriate.

Alexander Aprelev

Which constant do you refer to in here?

Open in Gerrit

Related details

Attention is currently required from:
  • Slava Egorov
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedCommit-Message-Has-TEST
  • 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: Ifa7d8f8b0af73b3a6ff9c1f79a174246280b1ce9
Gerrit-Change-Number: 473422
Gerrit-PatchSet: 2
Gerrit-Owner: Alexander Aprelev <a...@google.com>
Gerrit-Reviewer: Alexander Aprelev <a...@google.com>
Gerrit-Reviewer: Slava Egorov <veg...@google.com>
Gerrit-CC: Ryan Macnak <rma...@google.com>
Gerrit-Attention: Slava Egorov <veg...@google.com>
Gerrit-Comment-Date: Tue, 20 Jan 2026 17:31:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Alexander Aprelev <a...@google.com>
Comment-In-Reply-To: Slava Egorov <veg...@google.com>
satisfied_requirement
open
diffy

Slava Egorov (Gerrit)

unread,
Jan 21, 2026, 4:01:24 AM (20 hours ago) Jan 21
to Alexander Aprelev, Ryan Macnak, Commit Queue, rev...@dartlang.org, vm-...@dartlang.org
Attention needed from Alexander Aprelev

Slava Egorov voted and added 2 comments

Votes added by Slava Egorov

Code-Review+1

2 comments

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Slava Egorov . resolved

Still LGMT

File runtime/vm/app_snapshot.cc
Line 9332, Patchset 1: ASSERT(is_deeply_immutable);
Slava Egorov . resolved

Same comment as above. Fold constants into constructors everywhere - where appropriate.

Alexander Aprelev

Which constant do you refer to in here?

Slava Egorov

This one was wrong comment. I thought we had MintDeserializationCluster was taking is_deeply_immutable, but I see it is already folded in.

Open in Gerrit

Related details

Attention is currently required from:
  • Alexander Aprelev
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedCommit-Message-Has-TEST
  • 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: Ifa7d8f8b0af73b3a6ff9c1f79a174246280b1ce9
Gerrit-Change-Number: 473422
Gerrit-PatchSet: 2
Gerrit-Owner: Alexander Aprelev <a...@google.com>
Gerrit-Reviewer: Alexander Aprelev <a...@google.com>
Gerrit-Reviewer: Slava Egorov <veg...@google.com>
Gerrit-CC: Ryan Macnak <rma...@google.com>
Gerrit-Attention: Alexander Aprelev <a...@google.com>
Gerrit-Comment-Date: Wed, 21 Jan 2026 09:01:18 +0000
satisfied_requirement
open
diffy

Alexander Aprelev (Gerrit)

unread,
Jan 21, 2026, 11:19:23 AM (13 hours ago) Jan 21
to Alexander Aprelev, Slava Egorov, Ryan Macnak, Commit Queue, rev...@dartlang.org, vm-...@dartlang.org

Alexander Aprelev voted and added 1 comment

Votes added by Alexander Aprelev

Commit-Queue+2

1 comment

Patchset-level comments
Alexander Aprelev . resolved

thank you Slava!

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement satisfiedCommit-Message-Has-TEST
  • 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: Ifa7d8f8b0af73b3a6ff9c1f79a174246280b1ce9
Gerrit-Change-Number: 473422
Gerrit-PatchSet: 2
Gerrit-Owner: Alexander Aprelev <a...@google.com>
Gerrit-Reviewer: Alexander Aprelev <a...@google.com>
Gerrit-Reviewer: Slava Egorov <veg...@google.com>
Gerrit-CC: Ryan Macnak <rma...@google.com>
Gerrit-Comment-Date: Wed, 21 Jan 2026 16:19:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Commit Queue (Gerrit)

unread,
Jan 21, 2026, 11:19:39 AM (13 hours ago) Jan 21
to Alexander Aprelev, Slava Egorov, Ryan Macnak, rev...@dartlang.org, vm-...@dartlang.org

Commit Queue submitted the change

Change information

Commit message:
[vm/immutable] Ensure that canonical instances are deeply-immutable.

Fix snapshot serializer/deserializer to take care of deep-immutability proprety.

BUG=https://github.com/dart-lang/sdk/issues/62404
TEST=ci
Change-Id: Ifa7d8f8b0af73b3a6ff9c1f79a174246280b1ce9
Reviewed-by: Slava Egorov <veg...@google.com>
Commit-Queue: Alexander Aprelev <a...@google.com>
Files:
  • M runtime/vm/app_snapshot.cc
  • M runtime/vm/class_id.h
  • M runtime/vm/object.cc
Change size: L
Delta: 3 files changed, 339 insertions(+), 163 deletions(-)
Branch: refs/heads/main
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Slava Egorov
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: Ifa7d8f8b0af73b3a6ff9c1f79a174246280b1ce9
Gerrit-Change-Number: 473422
Gerrit-PatchSet: 3
Gerrit-Owner: Alexander Aprelev <a...@google.com>
Gerrit-Reviewer: Alexander Aprelev <a...@google.com>
Gerrit-Reviewer: Slava Egorov <veg...@google.com>
Gerrit-CC: Ryan Macnak <rma...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages