[M] Change in dart/sdk[main]: [ddc] Updating tearoffs to be evaluated on access.

1 view
Skip to first unread message

Mark Zhou (Gerrit)

unread,
Dec 19, 2024, 6:00:23 PM12/19/24
to Nicholas Shahan, Nate Biggs, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Nate Biggs and Nicholas Shahan

Mark Zhou added 1 comment

File tests/dartdevc/no_such_method_errors_test.dart
Line 266, Patchset 15 (Latest): (error) => error.toString().contains("NoSuchMethodError: 'arity1'"),
Mark Zhou . unresolved

@nsh...@google.com
The VM outputs this:
```
Unhandled exception:
NoSuchMethodError: Closure call with mismatched arguments: function 'A.arity1'
Receiver: Closure: (int) => String from Function 'arity1':.
Tried calling: A.arity1()
Found: A.arity1(int) => String
```

And actually crashes on this test. Should we just delete 'bound'?

Open in Gerrit

Related details

Attention is currently required from:
  • Nate Biggs
  • Nicholas Shahan
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: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 15
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nate Biggs <nate...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Comment-Date: Thu, 19 Dec 2024 23:00:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Nicholas Shahan (Gerrit)

unread,
Dec 20, 2024, 3:07:13 PM12/20/24
to Mark Zhou, Nate Biggs, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Mark Zhou and Nate Biggs

Nicholas Shahan added 10 comments

File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
Line 353, Patchset 16: final List<js_ast.Statement> _functionLinks = [];
Nicholas Shahan . unresolved

WDYT about making the name a little more descriptive, `_functionSignatureLinks`?

Line 1015, Patchset 16: ..._typeRuleLinks,
..._functionLinks,
Nicholas Shahan . unresolved

`typeRuleLinks` ended up here because of a bootstrap ordering issue between the `dart:_runtime` and the `dart:_rti` libraries. That should have been noted in a comment at the time. I suspect that is the same reason the signatures are being declared here as well. Could you add a comment for these two?

That said, I'm curious what

Line 3597, Patchset 16: _functionLinks.add(_emitFunctionTagged(nameExpr,
p.function.computeThisFunctionType(p.enclosingLibrary.nonNullable))
.toStatement());
Nicholas Shahan . unresolved

Is this adding a signature to every top level function in a library? I belive now we only add signatures when the function appears in the const table because it was torn off.

Line 6755, Patchset 16: (js_ast.Expression, js_ast.Expression) _emitStaticTargetAsAccessor(
Member target) {
Nicholas Shahan . unresolved

I don't love the idea of duplicating the logic here just to package the return value differently. Maybe we should refactor to share the logic more?

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Line 71, Patchset 17 (Latest):tearoff(context, property) {
Nicholas Shahan . unresolved

Is this only used for tearoff of static methods? If so, let's update the name and/or comment to make it more clear.

Line 72, Patchset 17 (Latest): // TODO(markzipan): canonicalize tearoffs so we can use JS object identity
// for 'equals' and 'identical' checks.
Nicholas Shahan . unresolved

Add more detail here for us in the future. Ex: What tearoffs still need to be canonicalized?

Line 75, Patchset 17 (Latest): var tear = JS('', '(...args) => #[#](...args)', context, property);
Nicholas Shahan . unresolved

I'm struggling to understand if it is safe to just pass the arguments here. Does this new representation introduce a type check somewhere to catch when the type of the tearoff has changed on a hot reload?

If you call this tearoff passing the arguments that match the oringial type, does the VM catch the problem?

Line 76, Patchset 17 (Latest): var rtiName = JS('', '#', JS_GET_NAME(JsGetName.SIGNATURE_NAME));
Nicholas Shahan . unresolved

It seems like there is no need for the `JS()` here?

Line 110, Patchset 17 (Latest): JS('', '#._boundMethod = () => #.#', tear, context, property);
Nicholas Shahan . unresolved

Why don't we define this as a getter like we do with the signature and type args lazy functions?

File tests/dartdevc/no_such_method_errors_test.dart
Line 266, Patchset 15: (error) => error.toString().contains("NoSuchMethodError: 'arity1'"),
Mark Zhou . resolved

@nsh...@google.com
The VM outputs this:
```
Unhandled exception:
NoSuchMethodError: Closure call with mismatched arguments: function 'A.arity1'
Receiver: Closure: (int) => String from Function 'arity1':.
Tried calling: A.arity1()
Found: A.arity1(int) => String
```

And actually crashes on this test. Should we just delete 'bound'?

Nicholas Shahan

Yeah I think we can delete that because it was an artifact of us returning the result of the JavaScript `bind()` call as our tearoff value.

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Zhou
  • Nate Biggs
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: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 17
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nate Biggs <nate...@google.com>
Gerrit-Attention: Mark Zhou <mark...@google.com>
Gerrit-Comment-Date: Fri, 20 Dec 2024 20:07:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Mark Zhou <mark...@google.com>
unsatisfied_requirement
open
diffy

Mark Zhou (Gerrit)

unread,
Dec 23, 2024, 4:17:48 AM12/23/24
to Nicholas Shahan, Nate Biggs, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Nate Biggs and Nicholas Shahan

Mark Zhou added 9 comments

File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
Line 353, Patchset 16: final List<js_ast.Statement> _functionLinks = [];
Nicholas Shahan . resolved

WDYT about making the name a little more descriptive, `_functionSignatureLinks`?

Mark Zhou

Done

Line 1015, Patchset 16: ..._typeRuleLinks,
..._functionLinks,
Nicholas Shahan . unresolved

`typeRuleLinks` ended up here because of a bootstrap ordering issue between the `dart:_runtime` and the `dart:_rti` libraries. That should have been noted in a comment at the time. I suspect that is the same reason the signatures are being declared here as well. Could you add a comment for these two?

That said, I'm curious what

Mark Zhou

Done - but did you accidentally a comment?

Line 3597, Patchset 16: _functionLinks.add(_emitFunctionTagged(nameExpr,
p.function.computeThisFunctionType(p.enclosingLibrary.nonNullable))
.toStatement());
Nicholas Shahan . resolved

Is this adding a signature to every top level function in a library? I belive now we only add signatures when the function appears in the const table because it was torn off.

Mark Zhou

Oooh right, this is redundant. Good catch - deleted.

Line 6755, Patchset 16: (js_ast.Expression, js_ast.Expression) _emitStaticTargetAsAccessor(
Member target) {
Nicholas Shahan . resolved

I don't love the idea of duplicating the logic here just to package the return value differently. Maybe we should refactor to share the logic more?

Mark Zhou

Done - refactored it to always return a `PropertyAccess` object.

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Line 71, Patchset 17:tearoff(context, property) {
Nicholas Shahan . resolved

Is this only used for tearoff of static methods? If so, let's update the name and/or comment to make it more clear.

Mark Zhou

This is used for both static and instance tearoffs. Static tearoffs are called via 'canonicalizedTearoff`, but I can rename that one.

Line 72, Patchset 17: // TODO(markzipan): canonicalize tearoffs so we can use JS object identity

// for 'equals' and 'identical' checks.
Nicholas Shahan . resolved

Add more detail here for us in the future. Ex: What tearoffs still need to be canonicalized?

Mark Zhou

Done

Line 75, Patchset 17: var tear = JS('', '(...args) => #[#](...args)', context, property);
Nicholas Shahan . resolved

I'm struggling to understand if it is safe to just pass the arguments here. Does this new representation introduce a type check somewhere to catch when the type of the tearoff has changed on a hot reload?

If you call this tearoff passing the arguments that match the oringial type, does the VM catch the problem?

Mark Zhou

Calling old closures is actually unsound. Beyond CFE-inserted static checks, you can leak in arbitrarily typed values.

Line 76, Patchset 17: var rtiName = JS('', '#', JS_GET_NAME(JsGetName.SIGNATURE_NAME));
Nicholas Shahan . resolved

It seems like there is no need for the `JS()` here?

Mark Zhou

Done

Line 110, Patchset 17: JS('', '#._boundMethod = () => #.#', tear, context, property);
Nicholas Shahan . resolved

Why don't we define this as a getter like we do with the signature and type args lazy functions?

Mark Zhou

Good point - I can update this and undo some of the function invocations downstream.

Open in Gerrit

Related details

Attention is currently required from:
  • Nate Biggs
  • Nicholas Shahan
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: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 21
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nate Biggs <nate...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Comment-Date: Mon, 23 Dec 2024 09:17:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nicholas Shahan <nsh...@google.com>
unsatisfied_requirement
open
diffy

Nate Biggs (Gerrit)

unread,
Dec 23, 2024, 12:06:22 PM12/23/24
to Mark Zhou, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Nicholas Shahan

Nate Biggs added 9 comments

File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
Line 927, Patchset 18: var prerequisiteRtiTypes = [
Nate Biggs . unresolved

I'm not clear why we now need to do this for every library now. Shouldn't we only need to initialize the rti cache once when the program starts up?

Line 3597, Patchset 18: _functionLinks.add(_emitFunctionTagged(nameExpr,
Nate Biggs . unresolved

I see _emitFunctionTagged takes a `topLevel` optional param. I think that should be passed as true here?

I commented above on you emitting the type rules for all libraries, not just the runtime. Were you were getting infinite loop errors from the rti library because the rti cache didn't contain those base types yet? If so I think passing `topLevel = true` here should make the necessary functions lazily generate the types so you don't hit the RTI cache before its been populated.

Line 6755, Patchset 16: (js_ast.Expression, js_ast.Expression) _emitStaticTargetAsAccessor(
Member target) {
Nicholas Shahan . unresolved

I don't love the idea of duplicating the logic here just to package the return value differently. Maybe we should refactor to share the logic more?

Nate Biggs

+1

It looks like all the returns in `_emitStaticTarget` are returning a `js_ast.PropertyAccess`. So if you make the return type of that function a `ProprtyAccess` (you'll have to cast the `global.#.#` return) then you can just get the `receiver` and `selector` from there when you need it.

Then you can delete this copy.

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/debugger.dart
Line 281, Patchset 18: if (JS<bool>('', '# == void 0', constructor)) return name;
Nate Biggs . unresolved

nit: I think `# == null` is usually the idiomatic way to check null/undefined (probably just because it's less characters).

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Line 57, Patchset 18:/// TODO(#3612): We do not canonicalize instance tearoffs to be consistent with
Nate Biggs . unresolved

This doesn't seem like a TODO so much as a note for posterity. I read this as there's no further action to be taken here (unless something external changes in the Future).

Line 75, Patchset 17: var tear = JS('', '(...args) => #[#](...args)', context, property);
Nicholas Shahan . unresolved

I'm struggling to understand if it is safe to just pass the arguments here. Does this new representation introduce a type check somewhere to catch when the type of the tearoff has changed on a hot reload?

If you call this tearoff passing the arguments that match the oringial type, does the VM catch the problem?

Nate Biggs

Won't the body of the underlying function include the necessary parametric type checks? So whatever function is bound when this is called should check the arguments are passed to it.

Line 75, Patchset 18: var tear = JS('', '(...args) => #[#](...args)', context, property);
Nate Biggs . unresolved

Related to Nick's point here, I'm curious about the argument count changing here. I wonder if this can put us in a similar boat to: https://github.com/dart-lang/sdk/issues/59671

Consider:

```
// main.1.dart
void foo(int a) => a + 1;

void main() {
void Function() bar() {
return () => foo(3);
}
final f = bar();
hotReload();
f();
}
```

```
// main.2.dart
void foo(int a, int b) => a + b;

void main() {
void Function() bar() {
return () => foo(3, 4);
}
final f = bar();
hotReload();
f(); // <- f is from before hot reload so it only passes 1 argument to foo.
}
```

If `f` is still the closure `() => foo(3)` after hot reload, then when you invoke it, it seems like it would pass the wrong # of arguments to the new `foo`. Or is the closure's context going to still have access to the old `foo`?

Line 85, Patchset 18: return existingRti ?? getMethodType(context, property);
Nate Biggs . unresolved

If the result isn't already cached and we're calculating it from scratch, should we cache that result?

File sdk/lib/_internal/js_dev_runtime/private/interceptors.dart
Line 257, Patchset 18: var boundMethod = JS<Object>('!', '#._boundMethod()', this);
Nate Biggs . unresolved

It seems like this would cause the hashCode not to be stable pre/post hot reload. The result of `this._boundMethod()` will be the current underlying implementation when `hashCode` is called.

How about we pass the closure itself (`#._boundMethod`) to `identityHashCode`?

Basing stable hashcode expectation on `IsolateReload_StaticTearOffRetainsHash`.

Open in Gerrit

Related details

Attention is currently required from:
  • Nicholas Shahan
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: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 18
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Comment-Date: Mon, 23 Dec 2024 17:06:18 +0000
unsatisfied_requirement
open
diffy

Nate Biggs (Gerrit)

unread,
Dec 23, 2024, 12:11:08 PM12/23/24
to Mark Zhou, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Mark Zhou and Nicholas Shahan

Nate Biggs added 1 comment

Patchset-level comments
File-level comment, Patchset 21 (Latest):
Nate Biggs . resolved

Oops I didn't refresh before sending, let me clear out the ones already addressed.

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Zhou
  • Nicholas Shahan
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: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 21
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Mark Zhou <mark...@google.com>
Gerrit-Comment-Date: Mon, 23 Dec 2024 17:11:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Nate Biggs (Gerrit)

unread,
Dec 23, 2024, 12:16:53 PM12/23/24
to Mark Zhou, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Mark Zhou and Nicholas Shahan

Nate Biggs added 2 comments

File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
Line 6755, Patchset 16: (js_ast.Expression, js_ast.Expression) _emitStaticTargetAsAccessor(
Member target) {
Nicholas Shahan . resolved

I don't love the idea of duplicating the logic here just to package the return value differently. Maybe we should refactor to share the logic more?

Nate Biggs

+1

It looks like all the returns in `_emitStaticTarget` are returning a `js_ast.PropertyAccess`. So if you make the return type of that function a `ProprtyAccess` (you'll have to cast the `global.#.#` return) then you can just get the `receiver` and `selector` from there when you need it.

Then you can delete this copy.

Nate Biggs

Nice glad you came to the same idea!

File sdk/lib/_internal/js_dev_runtime/private/interceptors.dart
Line 257, Patchset 18: var boundMethod = JS<Object>('!', '#._boundMethod()', this);
Nate Biggs . resolved

It seems like this would cause the hashCode not to be stable pre/post hot reload. The result of `this._boundMethod()` will be the current underlying implementation when `hashCode` is called.

How about we pass the closure itself (`#._boundMethod`) to `identityHashCode`?

Basing stable hashcode expectation on `IsolateReload_StaticTearOffRetainsHash`.

Nate Biggs

I think now that you're not invoking _boundMethod, this is obsolete.

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Zhou
  • Nicholas Shahan
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: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 21
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Mark Zhou <mark...@google.com>
Gerrit-Comment-Date: Mon, 23 Dec 2024 17:16:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nate Biggs <nate...@google.com>
Comment-In-Reply-To: Nicholas Shahan <nsh...@google.com>
unsatisfied_requirement
open
diffy

Mark Zhou (Gerrit)

unread,
Dec 23, 2024, 4:29:32 PM12/23/24
to Nicholas Shahan, Nate Biggs, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Nate Biggs and Nicholas Shahan

Mark Zhou added 5 comments

File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
Line 927, Patchset 18: var prerequisiteRtiTypes = [
Nate Biggs . resolved

I'm not clear why we now need to do this for every library now. Shouldn't we only need to initialize the rti cache once when the program starts up?

Mark Zhou

We need these in `dart:_rti` as well (which is not part of the runtime) since we tag functions ahead of time. I've updated this to only apply to the SDK, which should suffice.

Line 3597, Patchset 18: _functionLinks.add(_emitFunctionTagged(nameExpr,
Nate Biggs . unresolved

I see _emitFunctionTagged takes a `topLevel` optional param. I think that should be passed as true here?

I commented above on you emitting the type rules for all libraries, not just the runtime. Were you were getting infinite loop errors from the rti library because the rti cache didn't contain those base types yet? If so I think passing `topLevel = true` here should make the necessary functions lazily generate the types so you don't hit the RTI cache before its been populated.

Mark Zhou

I think that version of `_emitFunctionTagged` is only in the old DDC module system, but we could adopt that late getter pattern for the new module system. We'd still have to tag all functions since they might be updated after a hot reload, but once the differ lands, we could 1) tag all functions lazily and tearoff time and 2) retag functions that were tagged but reloaded.

Thoughts?

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/debugger.dart
Line 281, Patchset 18: if (JS<bool>('', '# == void 0', constructor)) return name;
Nate Biggs . resolved

nit: I think `# == null` is usually the idiomatic way to check null/undefined (probably just because it's less characters).

Mark Zhou

Done

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Line 57, Patchset 18:/// TODO(#3612): We do not canonicalize instance tearoffs to be consistent with
Nate Biggs . resolved

This doesn't seem like a TODO so much as a note for posterity. I read this as there's no further action to be taken here (unless something external changes in the Future).

Mark Zhou

True - rephrased

Line 75, Patchset 18: var tear = JS('', '(...args) => #[#](...args)', context, property);
Nate Biggs . unresolved

Related to Nick's point here, I'm curious about the argument count changing here. I wonder if this can put us in a similar boat to: https://github.com/dart-lang/sdk/issues/59671

Consider:

```
// main.1.dart
void foo(int a) => a + 1;

void main() {
void Function() bar() {
return () => foo(3);
}
final f = bar();
hotReload();
f();
}
```

```
// main.2.dart
void foo(int a, int b) => a + b;

void main() {
void Function() bar() {
return () => foo(3, 4);
}
final f = bar();
hotReload();
f(); // <- f is from before hot reload so it only passes 1 argument to foo.
}
```

If `f` is still the closure `() => foo(3)` after hot reload, then when you invoke it, it seems like it would pass the wrong # of arguments to the new `foo`. Or is the closure's context going to still have access to the old `foo`?

Mark Zhou

Good catch - let me investigate this and get back to you.

Open in Gerrit

Related details

Attention is currently required from:
  • Nate Biggs
  • Nicholas Shahan
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: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 21
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nate Biggs <nate...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Comment-Date: Mon, 23 Dec 2024 21:29:29 +0000
unsatisfied_requirement
open
diffy

Mark Zhou (Gerrit)

unread,
Dec 23, 2024, 4:42:14 PM12/23/24
to Nicholas Shahan, Nate Biggs, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Nate Biggs and Nicholas Shahan

Mark Zhou added 1 comment

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Line 85, Patchset 18: return existingRti ?? getMethodType(context, property);
Nate Biggs . resolved

If the result isn't already cached and we're calculating it from scratch, should we cache that result?

Mark Zhou

Good idea - aded

Open in Gerrit

Related details

Attention is currently required from:
  • Nate Biggs
  • Nicholas Shahan
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: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 22
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nate Biggs <nate...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Comment-Date: Mon, 23 Dec 2024 21:42:11 +0000
unsatisfied_requirement
open
diffy

Nate Biggs (Gerrit)

unread,
Dec 23, 2024, 8:49:23 PM12/23/24
to Mark Zhou, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Mark Zhou and Nicholas Shahan

Nate Biggs added 1 comment

File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
Line 3597, Patchset 18: _functionLinks.add(_emitFunctionTagged(nameExpr,
Nate Biggs . resolved

I see _emitFunctionTagged takes a `topLevel` optional param. I think that should be passed as true here?

I commented above on you emitting the type rules for all libraries, not just the runtime. Were you were getting infinite loop errors from the rti library because the rti cache didn't contain those base types yet? If so I think passing `topLevel = true` here should make the necessary functions lazily generate the types so you don't hit the RTI cache before its been populated.

Mark Zhou

I think that version of `_emitFunctionTagged` is only in the old DDC module system, but we could adopt that late getter pattern for the new module system. We'd still have to tag all functions since they might be updated after a hot reload, but once the differ lands, we could 1) tag all functions lazily and tearoff time and 2) retag functions that were tagged but reloaded.

Thoughts?

Nate Biggs

Okay I think this is good now that you're only including the "prerequisiteRtiTypes" in the SDK. My goal here was just to avoid that.

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Zhou
  • Nicholas Shahan
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: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 24
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Mark Zhou <mark...@google.com>
Gerrit-Comment-Date: Tue, 24 Dec 2024 01:49:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nate Biggs <nate...@google.com>
Comment-In-Reply-To: Mark Zhou <mark...@google.com>
unsatisfied_requirement
open
diffy

Mark Zhou (Gerrit)

unread,
Dec 26, 2024, 12:13:55 AM12/26/24
to Nicholas Shahan, Nate Biggs, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Nate Biggs and Nicholas Shahan

Mark Zhou added 3 comments

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Line 75, Patchset 17: var tear = JS('', '(...args) => #[#](...args)', context, property);
Nicholas Shahan . resolved

I'm struggling to understand if it is safe to just pass the arguments here. Does this new representation introduce a type check somewhere to catch when the type of the tearoff has changed on a hot reload?

If you call this tearoff passing the arguments that match the oringial type, does the VM catch the problem?

Nate Biggs

Won't the body of the underlying function include the necessary parametric type checks? So whatever function is bound when this is called should check the arguments are passed to it.

Mark Zhou

ACK - see previous reply.

Line 75, Patchset 18: var tear = JS('', '(...args) => #[#](...args)', context, property);
Nate Biggs . unresolved

Related to Nick's point here, I'm curious about the argument count changing here. I wonder if this can put us in a similar boat to: https://github.com/dart-lang/sdk/issues/59671

Consider:

```
// main.1.dart
void foo(int a) => a + 1;

void main() {
void Function() bar() {
return () => foo(3);
}
final f = bar();
hotReload();
f();
}
```

```
// main.2.dart
void foo(int a, int b) => a + b;

void main() {
void Function() bar() {
return () => foo(3, 4);
}
final f = bar();
hotReload();
f(); // <- f is from before hot reload so it only passes 1 argument to foo.
}
```

If `f` is still the closure `() => foo(3)` after hot reload, then when you invoke it, it seems like it would pass the wrong # of arguments to the new `foo`. Or is the closure's context going to still have access to the old `foo`?

Mark Zhou

Good catch - let me investigate this and get back to you.

Mark Zhou

Following up here, this is more of an issue with how we resolve static functions - not necessarily tearoffs. We don't re-resolve type checks when calling static functions within closures. We effectively have to run a type check on all arguments (as in dynamic calls) whenever we resolve a static function. Given how slow this is, it may be better to add this after the differ is in. I can add a test for this behavior in this change, however.

Line 85, Patchset 18: return existingRti ?? getMethodType(context, property);
Nate Biggs . resolved

If the result isn't already cached and we're calculating it from scratch, should we cache that result?

Mark Zhou

Good idea - aded

Mark Zhou

Woops - I had to remove the caching here since Generics need to be resolved elsewhere. We could split this and cache non-generic types, however.

Open in Gerrit

Related details

Attention is currently required from:
  • Nate Biggs
  • Nicholas Shahan
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: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 25
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nate Biggs <nate...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Comment-Date: Thu, 26 Dec 2024 05:13:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nate Biggs <nate...@google.com>
Comment-In-Reply-To: Nicholas Shahan <nsh...@google.com>
Comment-In-Reply-To: Mark Zhou <mark...@google.com>
unsatisfied_requirement
open
diffy

Nate Biggs (Gerrit)

unread,
Dec 26, 2024, 4:16:55 PM12/26/24
to Mark Zhou, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Mark Zhou and Nicholas Shahan

Nate Biggs added 1 comment

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Nate Biggs

Yeah I was thinking about this and realized it wasn't tear-off specific. If we want to reject changes to parameters until we're able to make this fix, that would be okay too. I'm not sure how trivial adding the checks will be but detecting the diff in parameters should be easy enough.

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Zhou
  • Nicholas Shahan
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: comment
Gerrit-Project: sdk
Gerrit-Branch: main
Gerrit-Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 28
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Mark Zhou <mark...@google.com>
Gerrit-Comment-Date: Thu, 26 Dec 2024 21:16:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nate Biggs <nate...@google.com>
Comment-In-Reply-To: Mark Zhou <mark...@google.com>
unsatisfied_requirement
open
diffy

Nate Biggs (Gerrit)

unread,
Dec 26, 2024, 5:29:46 PM12/26/24
to Mark Zhou, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Mark Zhou and Nicholas Shahan

Nate Biggs voted and added 2 comments

Votes added by Nate Biggs

Code-Review+1

2 comments

File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
Line 6776, Patchset 29 (Latest): js.call('#', [memberName]));
Nate Biggs . unresolved

nit: Can we make this `js.string(memberName)`? The interpolation seems unnecessary.

File pkg/dev_compiler/lib/src/kernel/expression_compiler.dart
Line 236, Patchset 29 (Latest): // We check for '_boundMethod' in case tearoffs are returned.
Nate Biggs . unresolved

Would you mind patching this into a branch in webdev and make sure all the dwds tests are still passing with this change?

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Zhou
  • Nicholas Shahan
Submit Requirements:
  • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 29
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Mark Zhou <mark...@google.com>
Gerrit-Comment-Date: Thu, 26 Dec 2024 22:29:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Mark Zhou (Gerrit)

unread,
Dec 26, 2024, 7:21:10 PM12/26/24
to Nate Biggs, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Nicholas Shahan

Mark Zhou added 1 comment

File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
Line 6776, Patchset 29: js.call('#', [memberName]));
Nate Biggs . resolved

nit: Can we make this `js.string(memberName)`? The interpolation seems unnecessary.

Mark Zhou

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Nicholas Shahan
Submit Requirements:
  • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 32
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Comment-Date: Fri, 27 Dec 2024 00:21:07 +0000
satisfied_requirement
open
diffy

Mark Zhou (Gerrit)

unread,
Dec 30, 2024, 6:28:54 AM12/30/24
to Nate Biggs, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Nicholas Shahan

Mark Zhou added 1 comment

File pkg/dev_compiler/lib/src/kernel/expression_compiler.dart
Line 236, Patchset 29: // We check for '_boundMethod' in case tearoffs are returned.
Nate Biggs . resolved

Would you mind patching this into a branch in webdev and make sure all the dwds tests are still passing with this change?

Mark Zhou

Good catch - webdev tests should be passing as of now - bar some tests that seem to require special permissions.

Open in Gerrit

Related details

Attention is currently required from:
  • Nicholas Shahan
Submit Requirements:
  • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 33
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Comment-Date: Mon, 30 Dec 2024 11:28:51 +0000
satisfied_requirement
open
diffy

Nate Biggs (Gerrit)

unread,
Dec 30, 2024, 2:21:11 PM12/30/24
to Mark Zhou, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Mark Zhou and Nicholas Shahan

Nate Biggs voted and added 6 comments

Votes added by Nate Biggs

Code-Review+1

6 comments

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/debugger.dart
Line 316, Patchset 34 (Latest): ? _get<Object?>(object, 'constructor')
Nate Biggs . unresolved

At this point we should know it's non-nullable.

Line 315, Patchset 34 (Latest): : _hasConstructor(object)
? _get<Object?>(object, 'constructor')
: object;
Nate Biggs . unresolved

nit: Can we add some parens here for readability?

Line 403, Patchset 34 (Latest): _hasConstructor(object) ? _get<Object?>(object, 'constructor') : object;
Nate Biggs . unresolved

At this point we should know it's non-nullable.

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Line 68, Patchset 34 (Latest):/// Static tearoffs are canonicalized at runtime via `tearoffCace`.
Nate Biggs . unresolved

typo

Line 75, Patchset 18: var tear = JS('', '(...args) => #[#](...args)', context, property);
Nate Biggs . resolved

Related to Nick's point here, I'm curious about the argument count changing here. I wonder if this can put us in a similar boat to: https://github.com/dart-lang/sdk/issues/59671

Consider:

```
// main.1.dart
void foo(int a) => a + 1;

void main() {
void Function() bar() {
return () => foo(3);
}
final f = bar();
hotReload();
f();
}
```

```
// main.2.dart
void foo(int a, int b) => a + b;

void main() {
void Function() bar() {
return () => foo(3, 4);
}
final f = bar();
hotReload();
f(); // <- f is from before hot reload so it only passes 1 argument to foo.
}
```

If `f` is still the closure `() => foo(3)` after hot reload, then when you invoke it, it seems like it would pass the wrong # of arguments to the new `foo`. Or is the closure's context going to still have access to the old `foo`?

Mark Zhou

Good catch - let me investigate this and get back to you.

Mark Zhou

Following up here, this is more of an issue with how we resolve static functions - not necessarily tearoffs. We don't re-resolve type checks when calling static functions within closures. We effectively have to run a type check on all arguments (as in dynamic calls) whenever we resolve a static function. Given how slow this is, it may be better to add this after the differ is in. I can add a test for this behavior in this change, however.

Nate Biggs

Yeah I was thinking about this and realized it wasn't tear-off specific. If we want to reject changes to parameters until we're able to make this fix, that would be okay too. I'm not sure how trivial adding the checks will be but detecting the diff in parameters should be easy enough.

Nate Biggs

Resolving this for now. Added a line item to the project: https://github.com/orgs/dart-lang/projects/96/views/1?pane=issue&itemId=92215326

Line 85, Patchset 34 (Latest): // TODO(markzipan): If we canonicalize all tearoffs (not just static
Nate Biggs . unresolved

Same as above. Since we don't have any intention of canonicalizing all tearoffs right now, there isn't an actionable TODO here so this can just be a note.

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Zhou
  • Nicholas Shahan
Submit Requirements:
  • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 34
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Mark Zhou <mark...@google.com>
Gerrit-Comment-Date: Mon, 30 Dec 2024 19:21:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Mark Zhou (Gerrit)

unread,
Dec 30, 2024, 4:32:18 PM12/30/24
to Nate Biggs, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Nicholas Shahan

Mark Zhou added 5 comments

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/debugger.dart
Line 316, Patchset 34: ? _get<Object?>(object, 'constructor')
Nate Biggs . resolved

At this point we should know it's non-nullable.

Mark Zhou

Done

Line 315, Patchset 34: : _hasConstructor(object)

? _get<Object?>(object, 'constructor')
: object;
Nate Biggs . resolved

nit: Can we add some parens here for readability?

Mark Zhou

Done

Line 403, Patchset 34: _hasConstructor(object) ? _get<Object?>(object, 'constructor') : object;
Nate Biggs . resolved

At this point we should know it's non-nullable.

Mark Zhou

Done

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Line 68, Patchset 34:/// Static tearoffs are canonicalized at runtime via `tearoffCace`.
Nate Biggs . resolved

typo

Mark Zhou

Done

Line 85, Patchset 34: // TODO(markzipan): If we canonicalize all tearoffs (not just static
Nate Biggs . resolved

Same as above. Since we don't have any intention of canonicalizing all tearoffs right now, there isn't an actionable TODO here so this can just be a note.

Mark Zhou

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Nicholas Shahan
Submit Requirements:
  • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 34
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Comment-Date: Mon, 30 Dec 2024 21:32:15 +0000
satisfied_requirement
open
diffy

Nate Biggs (Gerrit)

unread,
Dec 30, 2024, 4:37:11 PM12/30/24
to Mark Zhou, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Mark Zhou and Nicholas Shahan

Nate Biggs voted and added 1 comment

Votes added by Nate Biggs

Code-Review+1

1 comment

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Line 68, Patchset 34:/// Static tearoffs are canonicalized at runtime via `tearoffCace`.
Nate Biggs . unresolved

typo

Mark Zhou

Done

Nate Biggs

Reopening, think this one still needs a fix.

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Zhou
  • Nicholas Shahan
Submit Requirements:
  • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 35
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Mark Zhou <mark...@google.com>
Gerrit-Comment-Date: Mon, 30 Dec 2024 21:37:08 +0000
satisfied_requirement
open
diffy

Mark Zhou (Gerrit)

unread,
Dec 30, 2024, 4:58:29 PM12/30/24
to Nate Biggs, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Nicholas Shahan

Mark Zhou added 1 comment

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Line 68, Patchset 34:/// Static tearoffs are canonicalized at runtime via `tearoffCace`.
Nate Biggs . resolved

typo

Mark Zhou

Done

Nate Biggs

Reopening, think this one still needs a fix.

Mark Zhou

Oh dang - I forgot to add that one. Fixed for real

Open in Gerrit

Related details

Attention is currently required from:
  • Nicholas Shahan
Submit Requirements:
  • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 35
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Comment-Date: Mon, 30 Dec 2024 21:58:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
open
diffy

Nate Biggs (Gerrit)

unread,
Dec 30, 2024, 5:15:16 PM12/30/24
to Mark Zhou, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Mark Zhou and Nicholas Shahan

Nate Biggs voted Code-Review+1

Code-Review+1
Open in Gerrit

Related details

Attention is currently required from:
  • Mark Zhou
  • Nicholas Shahan
Submit Requirements:
  • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 36
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Mark Zhou <mark...@google.com>
Gerrit-Comment-Date: Mon, 30 Dec 2024 22:15:13 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Nicholas Shahan (Gerrit)

unread,
Jan 6, 2025, 1:40:48 PMJan 6
to Mark Zhou, Nate Biggs, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Mark Zhou

Nicholas Shahan added 5 comments

File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
Line 927, Patchset 39 (Latest): if (_isBuildingSdk) {
Nicholas Shahan . unresolved

Is this change necessary? I believe this will force these types to be created in every `dart:` library instead of once for the `dart:_runtime` library.

Line 1015, Patchset 16: ..._typeRuleLinks,
..._functionLinks,
Nicholas Shahan . resolved

`typeRuleLinks` ended up here because of a bootstrap ordering issue between the `dart:_runtime` and the `dart:_rti` libraries. That should have been noted in a comment at the time. I suspect that is the same reason the signatures are being declared here as well. Could you add a comment for these two?

That said, I'm curious what

Mark Zhou

Done - but did you accidentally a comment?

Nicholas Shahan

Yeah sorry, I don't know why that last cutoff sentance was there.

Line 2487, Patchset 39 (Latest): if (member.isStatic && _reifyTearoff(member) && !_isBuildingSdk) {
Nicholas Shahan . unresolved

Do static methods in the SDK get types attached some other way when they are torn off?

Line 3621, Patchset 39 (Latest): if (!_isBuildingSdk && p.isStatic) {
Nicholas Shahan . unresolved

ditto

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Line 75, Patchset 17: var tear = JS('', '(...args) => #[#](...args)', context, property);
Nicholas Shahan . resolved

I'm struggling to understand if it is safe to just pass the arguments here. Does this new representation introduce a type check somewhere to catch when the type of the tearoff has changed on a hot reload?

If you call this tearoff passing the arguments that match the oringial type, does the VM catch the problem?

Nate Biggs

Won't the body of the underlying function include the necessary parametric type checks? So whatever function is bound when this is called should check the arguments are passed to it.

Mark Zhou

ACK - see previous reply.

Nicholas Shahan

Calling old closures is actually unsound. Beyond CFE-inserted static checks, you can leak in arbitrarily typed values.

hmmm interesting. This sounds like it can lead to some confusing behavior in JavaScript but hopefully that would trigger the user to restart the app.

Won't the body of the underlying function include the necessary parametric type checks? So whatever function is bound when this is called should check the arguments are passed to it.

No DDC doesn't insert type checks into the body like dart2js does.

When the expected argument types are statically known but the passed arguments are not statically known to be subtypes DDC will insert the necessary type checks at the call site.

When calling a function dynamically, DDC uses a helper method to lookup the function arity, parameter types and validate the passed arguments but that isn't used here.

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Zhou
Submit Requirements:
  • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 39
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Mark Zhou <mark...@google.com>
Gerrit-Comment-Date: Mon, 06 Jan 2025 18:40:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nate Biggs <nate...@google.com>
satisfied_requirement
open
diffy

Mark Zhou (Gerrit)

unread,
Jan 6, 2025, 3:28:33 PMJan 6
to Nate Biggs, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Nicholas Shahan

Mark Zhou added 3 comments

File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
Line 927, Patchset 39 (Latest): if (_isBuildingSdk) {
Nicholas Shahan . unresolved

Is this change necessary? I believe this will force these types to be created in every `dart:` library instead of once for the `dart:_runtime` library.

Mark Zhou

Unfortunately yes. I added a bit that attaches types to static members at link-time rather than tearoff-time, which means these RTI types need to be "warmed up" sooner.

This is because the 'old' late static tagging was happening too late for dynamic tearoffs of static members to read the type (and another case that escapes my memory). Thoughts?

Line 2487, Patchset 39 (Latest): if (member.isStatic && _reifyTearoff(member) && !_isBuildingSdk) {
Nicholas Shahan . resolved

Do static methods in the SDK get types attached some other way when they are torn off?

Mark Zhou

We now attach static methods' types during link phase (so ahead of time). So we can assume they're already on their respective member at tear-off time.

Line 3621, Patchset 39 (Latest): if (!_isBuildingSdk && p.isStatic) {
Nicholas Shahan . resolved

ditto

Mark Zhou

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • Nicholas Shahan
Submit Requirements:
  • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 39
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Comment-Date: Mon, 06 Jan 2025 20:28:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nicholas Shahan <nsh...@google.com>
satisfied_requirement
open
diffy

Nicholas Shahan (Gerrit)

unread,
Jan 6, 2025, 5:48:03 PMJan 6
to Mark Zhou, Nate Biggs, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Mark Zhou

Nicholas Shahan added 2 comments

File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
Line 927, Patchset 39 (Latest): if (_isBuildingSdk) {
Nicholas Shahan . unresolved

Is this change necessary? I believe this will force these types to be created in every `dart:` library instead of once for the `dart:_runtime` library.

Mark Zhou

Unfortunately yes. I added a bit that attaches types to static members at link-time rather than tearoff-time, which means these RTI types need to be "warmed up" sooner.

This is because the 'old' late static tagging was happening too late for dynamic tearoffs of static members to read the type (and another case that escapes my memory). Thoughts?

Nicholas Shahan

This feels counter to the goal of this CL. Tearoff evaluation is being moved to the latest possible point (at the time of call) but the evaluation of their types is being performed even earlier than it was previously.

Would it be possible to delay the evaluation of the type until the first use? I added a comment where I *think* this would go. I'd feel better about that since that means we wont need to spend the time eagerly evaluating the types of every static method in the program before we start running the app.

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Line 95, Patchset 39 (Latest): var existingRti = JS<Object?>('', '#[#][#]', context, property, rtiName);
Nicholas Shahan . unresolved

I think in the case of a static methods this is finding the eagerly evaluated Rti object but what if it could be a function that when called creates it now?

Open in Gerrit

Related details

Attention is currently required from:
  • Mark Zhou
Submit Requirements:
  • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 39
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Mark Zhou <mark...@google.com>
Gerrit-Comment-Date: Mon, 06 Jan 2025 22:48:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nicholas Shahan <nsh...@google.com>
Comment-In-Reply-To: Mark Zhou <mark...@google.com>
satisfied_requirement
open
diffy

Mark Zhou (Gerrit)

unread,
Jan 6, 2025, 7:30:17 PMJan 6
to Nate Biggs, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Nicholas Shahan

Mark Zhou added 4 comments

File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
Line 927, Patchset 39 (Latest): if (_isBuildingSdk) {
Nicholas Shahan . unresolved

Is this change necessary? I believe this will force these types to be created in every `dart:` library instead of once for the `dart:_runtime` library.

Mark Zhou

Unfortunately yes. I added a bit that attaches types to static members at link-time rather than tearoff-time, which means these RTI types need to be "warmed up" sooner.

This is because the 'old' late static tagging was happening too late for dynamic tearoffs of static members to read the type (and another case that escapes my memory). Thoughts?

Nicholas Shahan

This feels counter to the goal of this CL. Tearoff evaluation is being moved to the latest possible point (at the time of call) but the evaluation of their types is being performed even earlier than it was previously.

Would it be possible to delay the evaluation of the type until the first use? I added a comment where I *think* this would go. I'd feel better about that since that means we wont need to spend the time eagerly evaluating the types of every static method in the program before we start running the app.

Mark Zhou

Ack - added context in sister comment.

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Line 75, Patchset 17: var tear = JS('', '(...args) => #[#](...args)', context, property);
Nicholas Shahan . resolved

I'm struggling to understand if it is safe to just pass the arguments here. Does this new representation introduce a type check somewhere to catch when the type of the tearoff has changed on a hot reload?

If you call this tearoff passing the arguments that match the oringial type, does the VM catch the problem?

Nate Biggs

Won't the body of the underlying function include the necessary parametric type checks? So whatever function is bound when this is called should check the arguments are passed to it.

Mark Zhou

ACK - see previous reply.

Nicholas Shahan

Calling old closures is actually unsound. Beyond CFE-inserted static checks, you can leak in arbitrarily typed values.

hmmm interesting. This sounds like it can lead to some confusing behavior in JavaScript but hopefully that would trigger the user to restart the app.

Won't the body of the underlying function include the necessary parametric type checks? So whatever function is bound when this is called should check the arguments are passed to it.

No DDC doesn't insert type checks into the body like dart2js does.

When the expected argument types are statically known but the passed arguments are not statically known to be subtypes DDC will insert the necessary type checks at the call site.

When calling a function dynamically, DDC uses a helper method to lookup the function arity, parameter types and validate the passed arguments but that isn't used here.

Mark Zhou

Yep, so the "solution" here would be to treat all of these functions effectively as dynamic. I'll make a note to only do this for hot-reloaded functions to avoid the extreme slowdown.

Line 95, Patchset 39 (Latest): var existingRti = JS<Object?>('', '#[#][#]', context, property, rtiName);
Nicholas Shahan . unresolved

I think in the case of a static methods this is finding the eagerly evaluated Rti object but what if it could be a function that when called creates it now?

Mark Zhou

The complication here is that the 'type' of the tearoff needs to be bound at tear-off time even for potentially dynamic tearoffs too. So we might have to pipe the RTI through all `dload` and equivalent calls. I can try to experiment with something here though.

Line 95, Patchset 39 (Latest): var existingRti = JS<Object?>('', '#[#][#]', context, property, rtiName);
Nicholas Shahan . unresolved

I think in the case of a static methods this is finding the eagerly evaluated Rti object but what if it could be a function that when called creates it now?

Mark Zhou

I see, so we'd pass in an optional RTI object to bind?

Open in Gerrit

Related details

Attention is currently required from:
  • Nicholas Shahan
Submit Requirements:
  • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
Gerrit-Change-Number: 401321
Gerrit-PatchSet: 39
Gerrit-Owner: Mark Zhou <mark...@google.com>
Gerrit-Reviewer: Nate Biggs <nate...@google.com>
Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
Gerrit-Comment-Date: Tue, 07 Jan 2025 00:30:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nate Biggs <nate...@google.com>
satisfied_requirement
open
diffy

Mark Zhou (Gerrit)

unread,
Jan 7, 2025, 5:23:49 PMJan 7
to Nate Biggs, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
Attention needed from Nate Biggs and Nicholas Shahan

Mark Zhou added 2 comments

File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
Line 927, Patchset 39: if (_isBuildingSdk) {
Nicholas Shahan . resolved

Is this change necessary? I believe this will force these types to be created in every `dart:` library instead of once for the `dart:_runtime` library.

Mark Zhou

Unfortunately yes. I added a bit that attaches types to static members at link-time rather than tearoff-time, which means these RTI types need to be "warmed up" sooner.

This is because the 'old' late static tagging was happening too late for dynamic tearoffs of static members to read the type (and another case that escapes my memory). Thoughts?

Nicholas Shahan

This feels counter to the goal of this CL. Tearoff evaluation is being moved to the latest possible point (at the time of call) but the evaluation of their types is being performed even earlier than it was previously.

Would it be possible to delay the evaluation of the type until the first use? I added a comment where I *think* this would go. I'd feel better about that since that means we wont need to spend the time eagerly evaluating the types of every static method in the program before we start running the app.

Mark Zhou

Ack - added context in sister comment.

Mark Zhou

Done

File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
Line 95, Patchset 39: var existingRti = JS<Object?>('', '#[#][#]', context, property, rtiName);
Nicholas Shahan . resolved

I think in the case of a static methods this is finding the eagerly evaluated Rti object but what if it could be a function that when called creates it now?

Mark Zhou

The complication here is that the 'type' of the tearoff needs to be bound at tear-off time even for potentially dynamic tearoffs too. So we might have to pipe the RTI through all `dload` and equivalent calls. I can try to experiment with something here though.

Mark Zhou

Added updates here after out discussion. PTAL!

Open in Gerrit

Related details

Attention is currently required from:
  • Nate Biggs
  • Nicholas Shahan
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: comment
    Gerrit-Project: sdk
    Gerrit-Branch: main
    Gerrit-Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
    Gerrit-Change-Number: 401321
    Gerrit-PatchSet: 40
    Gerrit-Owner: Mark Zhou <mark...@google.com>
    Gerrit-Reviewer: Nate Biggs <nate...@google.com>
    Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
    Gerrit-Attention: Nate Biggs <nate...@google.com>
    Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
    Gerrit-Comment-Date: Tue, 07 Jan 2025 22:23:46 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Nicholas Shahan (Gerrit)

    unread,
    Jan 7, 2025, 6:53:27 PMJan 7
    to Mark Zhou, Nate Biggs, dart-dc-te...@google.com, rev...@dartlang.org
    Attention needed from Mark Zhou and Nate Biggs

    Nicholas Shahan added 7 comments

    File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
    Line 923, Patchset 41 (Latest): if (_isBuildingSdk) {
    Nicholas Shahan . unresolved

    Now with the delayed evaluation of the types, can we revert this so we only emit the prerequisite types once?

    Line 1013, Patchset 41 (Latest): // We emit type rules and function signature rules due to bootstrapping
    Nicholas Shahan . unresolved

    delete now that that part has been removed.

    Line 1243, Patchset 41 (Latest): // TODO(#57049): We tag all static members because we don't know if they've
    Nicholas Shahan . unresolved

    nit: line length

    Line 1246, Patchset 41 (Latest): if (member.isStatic && _reifyTearoff(member) && !_isBuildingSdk) {
    Nicholas Shahan . unresolved

    What is this guarding? What happens when we tearoff statics from libraries in the SDK.

    Line 1250, Patchset 41 (Latest): // We only need to tag static functions that are torn off at
    // compile-time. We attach these at link-time so late-resolved tearoffs
    // have access to their types.
    Nicholas Shahan . unresolved

    Revise comment to match the new changes.

    Line 3481, Patchset 41 (Latest): // TODO(#57049): We tag all static members because we don't know if they've
    Nicholas Shahan . unresolved

    nit: line length

    Line 3484, Patchset 41 (Latest): if (!_isBuildingSdk && p.isStatic && _reifyTearoff(p)) {
    Nicholas Shahan . unresolved

    ditto

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Mark Zhou
    • Nate Biggs
    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: comment
    Gerrit-Project: sdk
    Gerrit-Branch: main
    Gerrit-Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
    Gerrit-Change-Number: 401321
    Gerrit-PatchSet: 41
    Gerrit-Owner: Mark Zhou <mark...@google.com>
    Gerrit-Reviewer: Nate Biggs <nate...@google.com>
    Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
    Gerrit-Attention: Nate Biggs <nate...@google.com>
    Gerrit-Attention: Mark Zhou <mark...@google.com>
    Gerrit-Comment-Date: Tue, 07 Jan 2025 23:53:24 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    open
    diffy

    Mark Zhou (Gerrit)

    unread,
    Jan 7, 2025, 8:29:00 PMJan 7
    to Nate Biggs, Nicholas Shahan, dart-dc-te...@google.com, rev...@dartlang.org
    Attention needed from Nate Biggs and Nicholas Shahan

    Mark Zhou added 7 comments

    File pkg/dev_compiler/lib/src/kernel/compiler_new.dart
    Line 923, Patchset 41: if (_isBuildingSdk) {
    Nicholas Shahan . resolved

    Now with the delayed evaluation of the types, can we revert this so we only emit the prerequisite types once?

    Mark Zhou

    Done

    Line 1013, Patchset 41: // We emit type rules and function signature rules due to bootstrapping
    Nicholas Shahan . resolved

    delete now that that part has been removed.

    Mark Zhou

    Done

    Line 1243, Patchset 41: // TODO(#57049): We tag all static members because we don't know if they've
    Nicholas Shahan . resolved

    nit: line length

    Mark Zhou

    Done

    Line 1246, Patchset 41: if (member.isStatic && _reifyTearoff(member) && !_isBuildingSdk) {
    Nicholas Shahan . resolved

    What is this guarding? What happens when we tearoff statics from libraries in the SDK.

    Mark Zhou

    Nothing AFAIK. I'll clean this up.

    Line 1250, Patchset 41: // We only need to tag static functions that are torn off at

    // compile-time. We attach these at link-time so late-resolved tearoffs
    // have access to their types.
    Nicholas Shahan . resolved

    Revise comment to match the new changes.

    Mark Zhou

    Done

    Line 3481, Patchset 41: // TODO(#57049): We tag all static members because we don't know if they've
    Nicholas Shahan . resolved

    nit: line length

    Mark Zhou

    Done

    Line 3484, Patchset 41: if (!_isBuildingSdk && p.isStatic && _reifyTearoff(p)) {
    Nicholas Shahan . resolved

    ditto

    Mark Zhou

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Nate Biggs
    • Nicholas Shahan
    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: comment
    Gerrit-Project: sdk
    Gerrit-Branch: main
    Gerrit-Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
    Gerrit-Change-Number: 401321
    Gerrit-PatchSet: 41
    Gerrit-Owner: Mark Zhou <mark...@google.com>
    Gerrit-Reviewer: Nate Biggs <nate...@google.com>
    Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
    Gerrit-Attention: Nate Biggs <nate...@google.com>
    Gerrit-Attention: Nicholas Shahan <nsh...@google.com>
    Gerrit-Comment-Date: Wed, 08 Jan 2025 01:28:57 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Nicholas Shahan <nsh...@google.com>
    unsatisfied_requirement
    open
    diffy

    Nicholas Shahan (Gerrit)

    unread,
    Jan 8, 2025, 1:43:37 PMJan 8
    to Mark Zhou, Nate Biggs, dart-dc-te...@google.com, rev...@dartlang.org
    Attention needed from Mark Zhou and Nate Biggs

    Nicholas Shahan voted and added 2 comments

    Votes added by Nicholas Shahan

    Code-Review+1

    2 comments

    Patchset-level comments
    File-level comment, Patchset 42 (Latest):
    Nicholas Shahan . resolved

    Thanks for all the revisions, I left one more comment but LGTM!

    File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/rtti.dart
    Line 89, Patchset 42 (Latest):/// Tag a generic [closure] with a [type] and its [defaultTypeArgs] values,
    Nicholas Shahan . unresolved

    The names don't match the actual names of the arguments here.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Mark Zhou
    • Nate Biggs
    Submit Requirements:
    • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
    Gerrit-Change-Number: 401321
    Gerrit-PatchSet: 42
    Gerrit-Owner: Mark Zhou <mark...@google.com>
    Gerrit-Reviewer: Nate Biggs <nate...@google.com>
    Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
    Gerrit-Attention: Nate Biggs <nate...@google.com>
    Gerrit-Attention: Mark Zhou <mark...@google.com>
    Gerrit-Comment-Date: Wed, 08 Jan 2025 18:43:32 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Mark Zhou (Gerrit)

    unread,
    Jan 8, 2025, 2:30:52 PMJan 8
    to Nicholas Shahan, Nate Biggs, dart-dc-te...@google.com, rev...@dartlang.org
    Attention needed from Nate Biggs

    Mark Zhou added 1 comment

    File sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/rtti.dart
    Line 89, Patchset 42:/// Tag a generic [closure] with a [type] and its [defaultTypeArgs] values,
    Nicholas Shahan . resolved

    The names don't match the actual names of the arguments here.

    Mark Zhou

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Nate Biggs
    Submit Requirements:
    • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
    Gerrit-Change-Number: 401321
    Gerrit-PatchSet: 43
    Gerrit-Owner: Mark Zhou <mark...@google.com>
    Gerrit-Reviewer: Nate Biggs <nate...@google.com>
    Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
    Gerrit-Attention: Nate Biggs <nate...@google.com>
    Gerrit-Comment-Date: Wed, 08 Jan 2025 19:30:50 +0000
    satisfied_requirement
    open
    diffy

    Mark Zhou (Gerrit)

    unread,
    Jan 8, 2025, 4:40:21 PMJan 8
    to Commit Queue, Nicholas Shahan, Nate Biggs, dart-dc-te...@google.com, rev...@dartlang.org
    Attention needed from Nate Biggs

    Mark Zhou voted Commit-Queue+2

    Commit-Queue+2
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Nate Biggs
    Submit Requirements:
    • requirement satisfiedCode-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: I1f762b8df45e0766d16dbc8688073768c8bfd233
    Gerrit-Change-Number: 401321
    Gerrit-PatchSet: 43
    Gerrit-Owner: Mark Zhou <mark...@google.com>
    Gerrit-Reviewer: Mark Zhou <mark...@google.com>
    Gerrit-Reviewer: Nate Biggs <nate...@google.com>
    Gerrit-Reviewer: Nicholas Shahan <nsh...@google.com>
    Gerrit-Attention: Nate Biggs <nate...@google.com>
    Gerrit-Comment-Date: Wed, 08 Jan 2025 21:40:18 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Commit Queue (Gerrit)

    unread,
    Jan 8, 2025, 4:40:37 PMJan 8
    to Mark Zhou, Nicholas Shahan, Nate Biggs, dart-dc-te...@google.com, rev...@dartlang.org

    Commit Queue submitted the change with unreviewed changes

    Unreviewed changes

    42 is the latest approved patch-set.
    The change was submitted with unreviewed changes in the following files:

    ```
    The name of the file: sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/rtti.dart
    Insertions: 3, Deletions: 2.

    The diff is too large to show. Please review the diff.
    ```

    Change information

    Commit message:
    [ddc] Updating tearoffs to be evaluated on access.

    Tearoffs are now represented as a closure that resolves an underlying bound context and property on access. `_boundMethod` and RTI getters must also be evaluated late.

    Additionally, we now both canonicalize static methods and tag them with their types at class-declaration time (though lazily) - so that late resolved closures have access to their types.

    Some tests have been updated to expect simpler errors. DDC traditionally emits slightly different errors that might aid in debugging.
    Change-Id: I1f762b8df45e0766d16dbc8688073768c8bfd233
    Reviewed-by: Nicholas Shahan <nsh...@google.com>
    Commit-Queue: Mark Zhou <mark...@google.com>
    Files:
    • M pkg/dev_compiler/lib/src/kernel/compiler_new.dart
    • M pkg/dev_compiler/lib/src/kernel/expression_compiler.dart
    • M pkg/dev_compiler/test/expression_compiler/runtime_debugger_api_test.dart
    • M sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/debugger.dart
    • M sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
    • M sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/rtti.dart
    • A tests/dartdevc/debugger/debugger_ddc_test_golden.txt
    • M tests/dartdevc/debugger/debugger_test.dart
    • M tests/dartdevc/no_such_method_errors_test.dart
    • M tests/hot_reload/tear_off_add_arguments/main.0.dart
    • M tests/hot_reload/tear_off_add_arguments/main.1.dart
    • M tests/hot_reload/tear_off_add_arguments2/main.0.dart
    • M tests/hot_reload/tear_off_add_arguments2/main.1.dart
    • A tests/hot_reload/tear_off_add_arguments3/main.0.dart
    • A tests/hot_reload/tear_off_add_arguments3/main.1.dart
    • M tests/hot_reload/tear_off_instance_equality/main.0.dart
    • M tests/hot_reload/tear_off_instance_equality/main.1.dart
    Change size: XL
    Delta: 17 files changed, 7955 insertions(+), 70 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Nicholas Shahan
    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: I1f762b8df45e0766d16dbc8688073768c8bfd233
    Gerrit-Change-Number: 401321
    Gerrit-PatchSet: 44
    Gerrit-Owner: Mark Zhou <mark...@google.com>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages