Skip to content

Make the itables field of objects non-nullable. #5040

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 17, 2024

Previously, classes that do not implement any interface had a null value for their itables field. Now, they all use a shared instance of (ref $itables) that contains nulls everywhere.

This removes a code path for interface type tests. More importantly, it removes one source of null checks along the code paths for interface method calls.


@tanishiking Does this improve interface calls a bit more, in your benchmarking setup?

Previously, classes that do not implement any interface had a
`null` value for their `itables` field. Now, they all use a shared
instance of `(ref $itables)` that contains `null`s everywhere.

This removes a code path for interface type tests. More importantly,
it removes one source of null checks along the code paths for
interface method calls.
Copy link
Contributor

@tanishiking tanishiking left a comment

Choose a reason for hiding this comment

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

Does this improve interface calls a bit more, in your benchmarking setup?

I couldn't see noticeable change in the benchmark, but it's LGTM 👍

@sjrd sjrd merged commit 3c34220 into scala-js:main Sep 18, 2024
3 checks passed
@sjrd sjrd deleted the wasm-itables-non-nullable branch September 18, 2024 05:03
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