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

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

Open
wants to merge 1 commit into
base: backport-lts-3.3-22434
Choose a base branch
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.

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 force-pushed the backport-lts-3.3-22446 branch from a3379a0 to 42a5667 Compare April 3, 2025 21:07
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