Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ddc adds null checks on return values of non-nullable native APIs #42535

Closed
sigmundch opened this issue Jun 30, 2020 · 10 comments
Closed

ddc adds null checks on return values of non-nullable native APIs #42535

sigmundch opened this issue Jun 30, 2020 · 10 comments
Assignees
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug web-dev-compiler
Milestone

Comments

@sigmundch
Copy link
Member

No description provided.

@sigmundch sigmundch added area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. web-dev-compiler labels Jun 30, 2020
@leafpetersen leafpetersen added the type-enhancement A request for a change that isn't a bug label Sep 3, 2020
@leafpetersen
Copy link
Member

@sigmundch also here, blocker for beta?

@sigmundch
Copy link
Member Author

Similar to #42536 - we'd like it as part of beta if at all possible. This is less critical than the dart2js one because DDC is mostly used together with chrome, which is where most of the non-nullable bits are derived from, but I'd prefer to keep it.

@sigmundch sigmundch added the P2 A bug or feature request we're likely to work on label Sep 3, 2020
dart-bot pushed a commit that referenced this issue Sep 25, 2020
Bug: #42535

Adds a runtime flag to ddc to enable runtime checks on native APIs.
In the case where an API is typed non-nullable but returns a null
value, throws a null assertion error.

Change-Id: I4d5d7529ba28d9308687dad5d51f1b9c71274455
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162461
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
@franklinyow
Copy link
Contributor

Is this done?

@sigmundch
Copy link
Member Author

We discovered through testing some changes that need to be made for this bug, so it's still in progress. It is OK if this slips and
and when it lands it will be under a flag, so it's ok if it lands hot. We'll keep it in the current milestone for now and adjust early next week if needed.

@franklinyow
Copy link
Contributor

franklinyow commented Oct 5, 2020

Moved it to the next milestone

@franklinyow
Copy link
Contributor

Any update? Thx

dart-bot pushed a commit that referenced this issue Oct 15, 2020
Bug: #42535

Native null-checks are moved to member definitions, and native
member accesses are changed to use this indirection in the case
where the member type can be checked.

Change-Id: I499bb3a4f6a66021dd0ab7930a55e7233c1ce020
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166785
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
dart-bot pushed a commit that referenced this issue Oct 19, 2020
This reverts commit e02085b.

Reason for revert: This seems to break an internal test
(http://b/171029249).

Original change's description:
> [ddc] Move native null-checks to definitions
>
> Bug: #42535
>
> Native null-checks are moved to member definitions, and native
> member accesses are changed to use this indirection in the case
> where the member type can be checked.
>
> Change-Id: I499bb3a4f6a66021dd0ab7930a55e7233c1ce020
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166785
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

TBR=sigmund@google.com,nshahan@google.com,srujzs@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: #42535
Change-Id: I145ff11a18374d0d63e2042956ad53ea0939baf7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168345
Commit-Queue: Michal Terepeta <michalt@google.com>
Reviewed-by: David Morgan <davidmorgan@google.com>
Reviewed-by: Michal Terepeta <michalt@google.com>
@franklinyow
Copy link
Contributor

@sigmundch It's been reverted. Who's working on this one?

@sigmundch
Copy link
Member Author

@srujzs is pushing forward with the original change, but will make the behavior only to be enabled on libraries that are opted in. This strategy doesn't change the essence of the change, but will make it less disruptive and will allow the roll to happen without issues.

There are a couple changes involved here (relanding the change, adding a flag), but our expectation is that we'll manage to land it this week.

@franklinyow
Copy link
Contributor

@srujzs any update?

@srujzs
Copy link
Contributor

srujzs commented Oct 28, 2020

More info in #42536 that's directly related. Adding on to that, we're planning on only including this in sound null-safety for now with maybe the potential for opt-in unsound null-safety for DDC only. My goal is to land CLs related to this ASAP.

dart-bot pushed a commit that referenced this issue Oct 28, 2020
Bug: #42536
Bug: #42535

Since ddc would require a potentially breaking change to emit these
checks in unsound mode without opt-in and it's currently not possible
to emit these checks only in opt-in with dart2js, both are changed
to only emit checks in sound mode. In ddc, calling convention is
changed conditionally on sound mode as well to avoid emitting
unnecessary code in unsound mode.

Change-Id: I42f7bb5a53550f4ee5412fbbbfb6ca533c393e96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169247
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug web-dev-compiler
Projects
None yet
Development

No branches or pull requests

4 participants