Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Opt: Recognize non-nullabe RT long as subtype of LongType#5189

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sjrd merged 1 commit intoscala-js:mainfromgzm0:long-subtype
Jun 2, 2025

Conversation

gzm0
Copy link
Contributor

@gzm0gzm0 commentedJun 1, 2025

Discovered while working on#5077. This allows to remove unnecessary unboxes and unlocks more inlining.

Discovered while working onscala-js#5077. This allows to remove unnecessaryunboxes and unlocks more inlining.
@gzm0
Copy link
ContributorAuthor

gzm0 commentedJun 1, 2025

Full diff on the test suite:https://gist.github.com/gzm0/b6b7b064f0edadbd1b65af827957d9c9 (fast opt).

@gzm0
Copy link
ContributorAuthor

gzm0 commentedJun 1, 2025

@sjrd, a somewhat related question: With nullability in the IR typesystem, why are non-nullable boxed types not subtypes / equivalent to primitive types?

@gzm0gzm0 requested a review fromsjrdJune 1, 2025 11:51
@gzm0
Copy link
ContributorAuthor

gzm0 commentedJun 1, 2025

It seems, this appears quite often in the diff:

-    var t$1 = $uJ(new $c_RTLong(lo$3, hi$4));-    var lo$4 = t$1.RTLong__f_lo;-    var hi$5 = t$1.RTLong__f_hi;

That not only removes an unnecessary unbox but also an unnecessary allocation.

@sjrd
Copy link
Member

sjrd commentedJun 1, 2025

@sjrd, a somewhat related question: With nullability in the IR typesystem, why are non-nullable boxed types not subtypes / equivalent to primitive types?

They may have a different representation. A non-nullableCharacter is an instance of$Char. Achar is a number. The phenomenon is exacerbated in Wasm.

Copy link
Member

@sjrdsjrd left a comment

Choose a reason for hiding this comment

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

Nice!

That diff is both satisfying, and scary that we were previously leaving such allocations on the table.

@sjrdsjrdenabled auto-mergeJune 1, 2025 12:57
@sjrdsjrd merged commit289a5e1 intoscala-js:mainJun 2, 2025
3 checks passed
@gzm0gzm0 deleted the long-subtype branchJune 2, 2025 19:02
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@sjrdsjrdsjrd approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@gzm0@sjrd

[8]ページ先頭

©2009-2025 Movatter.jp