Skip to content

Backport "Scala.js: Emit js.NewArray IR nodes when possible." to 3.3 LTS #213

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

Closed
wants to merge 2 commits into from

Conversation

tgodzik
Copy link

@tgodzik tgodzik commented Apr 3, 2025

Backports scala#22446 to the 3.3.6.

PR submitted by the release tooling.

sjrd and others added 2 commits April 3, 2025 16:16
Although there is a *correct* implementation of `sr.Arrays.newArray`,
it is not efficient when creating 1-dimensional arrays. The JVM
backend special-cases it to emit `newarray` bytecode instructions.

We now also special-case it in the JS backend. In the Scala.js IR
however, `js.NewArray` only accepts a single dimension. For multiple
dimensions, the right thing to do is to emit a direct call to
`jlr.Array.newInstance`.

[Cherry-picked 2852168]
@tgodzik tgodzik closed this Apr 3, 2025
@tgodzik tgodzik deleted the backport-lts-3.3-22446 branch April 3, 2025 18:14
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