[S] Change in dart/sdk[main]: [dart2wasm] Use `JSStringImpl` class for string value types

0 views
Skip to first unread message

Ömer Ağacan (Gerrit)

unread,
Jan 8, 2026, 9:24:47 AM (3 days ago) Jan 8
to Martin Kustermann, dart2wasm-t...@google.com, rev...@dartlang.org
Attention needed from Martin Kustermann

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Martin Kustermann
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-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: I2e84cd7b1fc263f88d820899254f47957085f07e
Gerrit-Change-Number: 471500
Gerrit-PatchSet: 1
Gerrit-Owner: Ömer Ağacan <ome...@google.com>
Gerrit-Reviewer: Martin Kustermann <kuste...@google.com>
Gerrit-Attention: Martin Kustermann <kuste...@google.com>
Gerrit-Comment-Date: Thu, 08 Jan 2026 14:24:42 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Martin Kustermann (Gerrit)

unread,
Jan 9, 2026, 4:13:05 AM (2 days ago) Jan 9
to Ömer Ağacan, dart2wasm-t...@google.com, rev...@dartlang.org
Attention needed from Ömer Ağacan

Martin Kustermann added 1 comment

File pkg/dart2wasm/lib/translator.dart
Line 315, Patchset 1 (Latest): translateType(InterfaceType(jsStringClass, Nullability.nonNullable))
Martin Kustermann . unresolved

I think the original code was better. Let me explain why.

When Dart code has `String x` then we want to use `translateType(String)`. So if

  • the implementation (like before) has multiple string classes, the `translateType(String)` may result in a base class (like `StringBase` before)
  • the implementation (like now) has only one string class, then `translateType(String)` should result already in the wasm struct for `StringImpl` - as it's the only implementation of `String`.

So the code (as written before) will work - irrespective of whether we have one or multiple string implementation classes.

Open in Gerrit

Related details

Attention is currently required from:
  • Ömer Ağacan
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-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: I2e84cd7b1fc263f88d820899254f47957085f07e
Gerrit-Change-Number: 471500
Gerrit-PatchSet: 1
Gerrit-Owner: Ömer Ağacan <ome...@google.com>
Gerrit-Reviewer: Martin Kustermann <kuste...@google.com>
Gerrit-Attention: Ömer Ağacan <ome...@google.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 09:13:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Ömer Ağacan (Gerrit)

unread,
Jan 9, 2026, 4:18:17 AM (2 days ago) Jan 9
to Martin Kustermann, dart2wasm-t...@google.com, rev...@dartlang.org
Attention needed from Martin Kustermann

Ömer Ağacan added 1 comment

File pkg/dart2wasm/lib/translator.dart
Line 315, Patchset 1 (Latest): translateType(InterfaceType(jsStringClass, Nullability.nonNullable))
Martin Kustermann . unresolved

I think the original code was better. Let me explain why.

When Dart code has `String x` then we want to use `translateType(String)`. So if

  • the implementation (like before) has multiple string classes, the `translateType(String)` may result in a base class (like `StringBase` before)
  • the implementation (like now) has only one string class, then `translateType(String)` should result already in the wasm struct for `StringImpl` - as it's the only implementation of `String`.

So the code (as written before) will work - irrespective of whether we have one or multiple string implementation classes.

Ömer Ağacan

We already assume that we have one string type which is `JSStringImpl`, e.g. in https://github.com/dart-lang/sdk/blob/9a2bc9327f9aee7ee7d019fb956dbb4a679dc2aa/sdk/lib/_internal/wasm/lib/string_patch.dart#L213-L214.

Multiple string types were terrible for performance (caused polymorphism everywhere) and we were happy to get rid of them with JS strings. Do we have plans to bring back multiple string types?

Open in Gerrit

Related details

Attention is currently required from:
  • Martin Kustermann
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-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: I2e84cd7b1fc263f88d820899254f47957085f07e
Gerrit-Change-Number: 471500
Gerrit-PatchSet: 1
Gerrit-Owner: Ömer Ağacan <ome...@google.com>
Gerrit-Reviewer: Martin Kustermann <kuste...@google.com>
Gerrit-Attention: Martin Kustermann <kuste...@google.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 09:18:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Martin Kustermann <kuste...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ömer Ağacan (Gerrit)

unread,
Jan 9, 2026, 4:19:19 AM (2 days ago) Jan 9
to Martin Kustermann, dart2wasm-t...@google.com, rev...@dartlang.org
Attention needed from Martin Kustermann

Ömer Ağacan added 1 comment

File pkg/dart2wasm/lib/translator.dart
Line 315, Patchset 1 (Latest): translateType(InterfaceType(jsStringClass, Nullability.nonNullable))
Martin Kustermann . unresolved

I think the original code was better. Let me explain why.

When Dart code has `String x` then we want to use `translateType(String)`. So if

  • the implementation (like before) has multiple string classes, the `translateType(String)` may result in a base class (like `StringBase` before)
  • the implementation (like now) has only one string class, then `translateType(String)` should result already in the wasm struct for `StringImpl` - as it's the only implementation of `String`.

So the code (as written before) will work - irrespective of whether we have one or multiple string implementation classes.

Ömer Ağacan

We already assume that we have one string type which is `JSStringImpl`, e.g. in https://github.com/dart-lang/sdk/blob/9a2bc9327f9aee7ee7d019fb956dbb4a679dc2aa/sdk/lib/_internal/wasm/lib/string_patch.dart#L213-L214.

Multiple string types were terrible for performance (caused polymorphism everywhere) and we were happy to get rid of them with JS strings. Do we have plans to bring back multiple string types?

Open in Gerrit

Related details

Attention is currently required from:
  • Martin Kustermann
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-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: I2e84cd7b1fc263f88d820899254f47957085f07e
Gerrit-Change-Number: 471500
Gerrit-PatchSet: 1
Gerrit-Owner: Ömer Ağacan <ome...@google.com>
Gerrit-Reviewer: Martin Kustermann <kuste...@google.com>
Gerrit-Attention: Martin Kustermann <kuste...@google.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 09:19:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Ömer Ağacan <ome...@google.com>
Comment-In-Reply-To: Martin Kustermann <kuste...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Martin Kustermann (Gerrit)

unread,
Jan 9, 2026, 4:24:55 AM (2 days ago) Jan 9
to Ömer Ağacan, dart2wasm-t...@google.com, rev...@dartlang.org
Attention needed from Ömer Ağacan

Martin Kustermann added 1 comment

File pkg/dart2wasm/lib/translator.dart
Line 315, Patchset 1 (Latest): translateType(InterfaceType(jsStringClass, Nullability.nonNullable))
Martin Kustermann . unresolved

I think the original code was better. Let me explain why.

When Dart code has `String x` then we want to use `translateType(String)`. So if

  • the implementation (like before) has multiple string classes, the `translateType(String)` may result in a base class (like `StringBase` before)
  • the implementation (like now) has only one string class, then `translateType(String)` should result already in the wasm struct for `StringImpl` - as it's the only implementation of `String`.

So the code (as written before) will work - irrespective of whether we have one or multiple string implementation classes.

Ömer Ağacan

We already assume that we have one string type which is `JSStringImpl`, e.g. in https://github.com/dart-lang/sdk/blob/9a2bc9327f9aee7ee7d019fb956dbb4a679dc2aa/sdk/lib/_internal/wasm/lib/string_patch.dart#L213-L214.

Multiple string types were terrible for performance (caused polymorphism everywhere) and we were happy to get rid of them with JS strings. Do we have plans to bring back multiple string types?

Martin Kustermann

Right now we don't have plans on introducing multiple string types. Maybe in the future if we target pure wasm environments without a JS embedder we need custom strings and maybe then we need OneByte/TwoByte strings again - who knows.

But that doesn't matter for this discussion.

The question is whether we should bake in the specific string implementation in the entire compiler (and possibly runtime) vs using `String` and let the compiler figure out itself that there's only one implementation class and let it use that.

There doesn't seem any reason here to hard code this in.

The same is actually true for the other members above, see for example
```
late final w.RefType runtimeTypeType =
translateType(coreTypes.typeNonNullableRawType) as w.RefType;
```

We don't bake in `_Type` here either and instead use the `Type` and let the compiler figure out that all implementations of `Type` share `_Type` as base class and it should therefore use it's wasm struct.

Open in Gerrit

Related details

Attention is currently required from:
  • Ömer Ağacan
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-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: I2e84cd7b1fc263f88d820899254f47957085f07e
Gerrit-Change-Number: 471500
Gerrit-PatchSet: 1
Gerrit-Owner: Ömer Ağacan <ome...@google.com>
Gerrit-Reviewer: Martin Kustermann <kuste...@google.com>
Gerrit-Attention: Ömer Ağacan <ome...@google.com>
Gerrit-Comment-Date: Fri, 09 Jan 2026 09:24:51 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Ömer Ağacan (Gerrit)

unread,
Jan 9, 2026, 4:25:43 AM (2 days ago) Jan 9
to Martin Kustermann, dart2wasm-t...@google.com, rev...@dartlang.org

Ömer Ağacan abandoned this change

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: abandon
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages