Skip to content

Don't use js.Map in ClassValue when targeting pure Wasm#1

Open
lostflydev wants to merge 37 commits intoscala-wasmfrom
fix/147-classvalue-linktime
Open

Don't use js.Map in ClassValue when targeting pure Wasm#1
lostflydev wants to merge 37 commits intoscala-wasmfrom
fix/147-classvalue-linktime

Conversation

@lostflydev
Copy link
Owner

Add LinkingInfo.targetPureWasm guards to ClassValue so the linker can dead-code-eliminate the js.Map branch for pure Wasm builds, always using HashMap instead.

Fixes scala-wasm#147

sjrd and others added 12 commits February 16, 2026 10:58
We display a warning in two places:

* when loading an sbt build with sbt-scalajs, and
* when calling the `link` method of a `StandardLinkerImpl`.
This can be used for code that must adapt to the module kind in a
way that would not link otherwise.
Removes [@tootallnate/once](https://github.com/TooTallNate/once). It's no longer used after updating ancestor dependency [jsdom](https://github.com/jsdom/jsdom). These dependencies need to be updated together.


Removes `@tootallnate/once`

Updates `jsdom` from 16.7.0 to 28.1.0
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Changelog](https://github.com/jsdom/jsdom/blob/main/Changelog.md)
- [Commits](jsdom/jsdom@16.7.0...28.1.0)

---
updated-dependencies:
- dependency-name: "@tootallnate/once"
  dependency-version: 
  dependency-type: indirect
- dependency-name: jsdom
  dependency-version: 28.1.0
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
…n/multi-dae47d5549

Bump @tootallnate/once and jsdom
…nsform

Fix scala-js#5331: Transform the body of a void typed closure as a statement.
Tighten IR checking of NewLambda, and add checker tests.
Add LinkingInfo.moduleKind as a link-time property.
@lostflydev lostflydev force-pushed the fix/147-classvalue-linktime branch from 3f9e613 to d78dc6b Compare March 9, 2026 08:14
lostflydev pushed a commit that referenced this pull request Mar 10, 2026
- Remove top-level vals with JS types (RegExp, js.Function1) that caused
  linker errors in pure Wasm mode; inline them into linkTimeIf JS branches
- Convert quoteStr from val to def so JS function is created lazily
- Restore ClassValueTest exclusion (belongs to separate PR #1)
@lostflydev lostflydev force-pushed the fix/147-classvalue-linktime branch from d78dc6b to 702d48e Compare March 10, 2026 14:45
sjrd and others added 14 commits March 10, 2026 23:17
Fix scala-js#5144: More direct hashing of method names for lambda class names.
Grow linear memory in malloc if required
The comparison was the wrong way around. On the first resize, we
jumped straight to a buffer of size `min(Int.MaxValue, len)`.

That was not too bad for `readNBytes` per se, but devastating for
`readAllBytes`, which calls `readNBytes` with `len = Int.MaxValue`.
Instead of boolean configs in `WasmFeatures`.

It makes more sense to use a `ModuleKind`, because it affects how
the produced artifacts look like to the external world, which is
exactly what a `ModuleKind` specifies.
…nt-config

Fix scala-js#5335: Throw a user-friendly exception on inconsistent config.
Bumps [undici](https://github.com/nodejs/undici) from 7.22.0 to 7.24.1.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](nodejs/undici@v7.22.0...v7.24.1)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 7.24.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
…n/undici-7.24.1

Bump undici from 7.22.0 to 7.24.1
[pull] scala-wasm from scala-js:main
…y-settings

Use dedicated ModuleKind's for Wasm without a JS environment.
sjrd and others added 8 commits March 15, 2026 12:26
Strengthen the tests when in compliant mode.
Instead of a StringIOOBE, which is subject to UB.
It is specified as the more general exception, and in practice that
is what the JVM throws.

This was the only place where we explicitly threw an ArrayIOOBE
not subject to UB.
This was the only place where we explicitly threw an
`ArrayStoreException`, as opposed to a UBE.
The trick we use is to allocate an array of the requested length
and discard it in statement position. We enhance the optimizer to
recognize that pattern, so that we do not actually allocate an
array. This is similar to what we do with `x.getClass()` to
perform a null pointer check.
…-grow-buffer

Fix the buffer growing logic in InputStream.readNBytes.
…xceptions

In the javalib, always trigger UB for exceptions subject to UB.
@lostflydev lostflydev force-pushed the fix/147-classvalue-linktime branch 2 times, most recently from a1fa424 to 8a7442e Compare March 18, 2026 10:05
[pull] scala-wasm from scala-js:main
@lostflydev lostflydev force-pushed the fix/147-classvalue-linktime branch from 8a7442e to 517fc5d Compare March 22, 2026 08:14
@lostflydev lostflydev force-pushed the fix/147-classvalue-linktime branch from 517fc5d to cb6b295 Compare March 22, 2026 08:21
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.

Don't use js.Map in ClassValue when targeting pure Wasm

4 participants