Skip to content

Introduce UnaryOp.CheckNotNull in the IR. #5037

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

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented Sep 16, 2024

Now that we have non-nullable reference types in the IR, it makes sense to offer that operation at the IR level. It replaces the Transient of the same name.

We use it in the compiler instead of GetClass, as it is more direct.

@sjrd sjrd requested a review from gzm0 September 16, 2024 21:04
@sjrd sjrd force-pushed the check-not-null-in-ir branch 2 times, most recently from d38ebf5 to 2fff817 Compare September 17, 2024 10:05
Copy link
Contributor

@gzm0 gzm0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one nit RE the backwards compat.


@deprecated("use the overload with the argument type instead", since = "1.17.0")
def resultTypeOf(op: Code): Type =
resultTypeOf(op, NothingType): Type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove this. It doesn't yield a correct result for CheckNotNull.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -2056,7 +2056,7 @@ object Build {
Some(ExpectedSizes(
fastLink = 425000 to 426000,
fullLink = 282000 to 283000,
fastLinkGz = 61000 to 62000,
fastLinkGz = 60000 to 61000,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, nice. Do you know what that is?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not exactly sure. Apparently the inlining of vals can be a little bit better in some cases. This is the diff: https://gist.github.com/sjrd/28e5929fa16e0e030a3384bfad1fe59b

Now that we have non-nullable reference types in the IR, it makes
sense to offer that operation at the IR level. It replaces the
`Transient` of the same name.

We use it in the compiler instead of `GetClass`, as it is more
direct.
@sjrd sjrd force-pushed the check-not-null-in-ir branch from 2fff817 to a707dea Compare September 17, 2024 16:02
@sjrd sjrd merged commit 4f88eb6 into scala-js:main Sep 18, 2024
3 checks passed
@sjrd sjrd deleted the check-not-null-in-ir branch September 18, 2024 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants