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

Announcing Scala.js 1.17.0, and add doc for the Wasm backend. #646

Merged
merged 1 commit into from
Sep 28, 2024

Conversation

sjrd
Copy link
Member

@sjrd sjrd commented Sep 22, 2024

Preparing a bit in advance this time, to review the docs about the Wasm backend and communicate its experimental status.

@sjrd sjrd requested a review from gzm0 September 22, 2024 11:44
@sjrd sjrd force-pushed the scalajs-1.17.0 branch 2 times, most recently from 95df5a2 to 2642144 Compare September 24, 2024 07:53
Copy link
Contributor

@gzm0 gzm0 left a comment

Choose a reason for hiding this comment

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

Only nits. Maybe it makes sense for @tanishiking to have a look at webassembly.md?

_data/doc.yml Outdated
@@ -28,7 +28,9 @@
- text: Emitting modules
url: /doc/project/module.html
- text: JavaScript Environments
url: /doc/project/js-environments.html
url: /doc/project/js-environments.htmlhtml
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
url: /doc/project/js-environments.htmlhtml
url: /doc/project/js-environments.html

This is a **minor** release:

* It is backward binary compatible with all earlier versions in the 1.x series: libraries compiled with 1.0.x through 1.16.x can be used with 1.17.0 without change.
* It is *not* forward binary compatible with 1.15.x: libraries compiled with 1.17.0 cannot be used with 1.16.x or earlier.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* It is *not* forward binary compatible with 1.15.x: libraries compiled with 1.17.0 cannot be used with 1.16.x or earlier.
* It is *not* forward binary compatible with 1.16.x: libraries compiled with 1.17.0 cannot be used with 1.16.x or earlier.

* The reference types in the IR, such as `ClassType` and `ArrayType`, now have a `nullable: Boolean` flag.
There is also a new type `AnyNotNullType`.
* The `NewArray` node does not accept multiple dimensions anymore.
If you want to emit a multi-dimensional array creation, emit a call to `java.lang.reflect.Array.newInstance` instead.
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to double check: The only other change was the jl.Class change?

Copy link
Member Author

Choose a reason for hiding this comment

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

That and CheckNotNull, which is also an addition to UnaryOp. These are unlikely to hit other people who manipulate IR nodes, since they are confined to the javalib in practice.

.withArgs(List(
"--experimental-wasm-exnref", // required
"--experimental-wasm-imported-strings", // optional (good for performance)
"--turboshaft-wasm", // optional, bug significantly increases stability
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"--turboshaft-wasm", // optional, bug significantly increases stability
"--turboshaft-wasm", // optional, but significantly increases stability

Otherwise it's funny :P

Moreover, the codebase must not contain any feature that require emitting multiple modules: `@JSExportToplevel` annotations with several module names, or `js.dynamicImport`.
We expect to lift that limitation in the future.

Other than that, we expect the WebAssembly backend to support all of Scala.js semantics.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Other than that, we expect the WebAssembly backend to support all of Scala.js semantics.
Other than that, we expect the WebAssembly backend to support all of Scala.js' semantics.

or

Suggested change
Other than that, we expect the WebAssembly backend to support all of Scala.js semantics.
Other than that, we expect the WebAssembly backend to support all Scala.js semantics.

Copy link

@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.

Only one comment on requirements, otherwise looks good to me :)

If you want to use it in browsers, you will need:

* For Firefox: in `about:config`, enable `javascript.options.wasm_exnref`.
Also make sure to *disable* `javascript.options.wasm_js_string_builtins`: Firefox has two issues with it that break Scala.js ([1919901](https://bugzilla.mozilla.org/show_bug.cgi?id=1919901) and [1920337](https://bugzilla.mozilla.org/show_bug.cgi?id=1920337))

Choose a reason for hiding this comment

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

Nice catch! 😮


* A JavaScript host (i.e., we do not currently generate standalone Wasm)
* A Wasm engine with support for:
* Wasm 3.0

Choose a reason for hiding this comment

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

Suggested change
* Wasm 3.0
* Wasm 2.0

?

Copy link
Member Author

Choose a reason for hiding this comment

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

Wasm 2.0 does not contain return_call yet, which we also use. Wasm 3.0 does contain GC, so we could omit it in theory, but in practice IMO it matters a lot more that we need GC, since that has less widespread support.

Copy link

@tanishiking tanishiking Sep 27, 2024

Choose a reason for hiding this comment

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

Ah, that makes sense. Didn't know return_call is not in 2.0

* Future versions of Scala.js may emit Wasm that requires *newer* versions of Wasm engines, dropping support for older engines.

However, we do *not* expect the *quality* of the Wasm backend to be any lower than the JS backend.
Feel free to report any issue you may experience with the same expectations as for the JS backend.
Copy link
Contributor

Choose a reason for hiding this comment

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

Just thought about this: You might want to drop a line here about semantics v.s. performance:
IIUC as far as semantics are concerned, we expect full parity, as far as performance is concerned, we still expect improvements. (IMHO the text in the release announcement captures this quite nicely, probably can just be copied).

Copy link
Contributor

Choose a reason for hiding this comment

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

Also codesize and linker incrementality, actually?

Copy link
Member Author

@sjrd sjrd left a comment

Choose a reason for hiding this comment

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

Updated.

* The reference types in the IR, such as `ClassType` and `ArrayType`, now have a `nullable: Boolean` flag.
There is also a new type `AnyNotNullType`.
* The `NewArray` node does not accept multiple dimensions anymore.
If you want to emit a multi-dimensional array creation, emit a call to `java.lang.reflect.Array.newInstance` instead.
Copy link
Member Author

Choose a reason for hiding this comment

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

That and CheckNotNull, which is also an addition to UnaryOp. These are unlikely to hit other people who manipulate IR nodes, since they are confined to the javalib in practice.


* A JavaScript host (i.e., we do not currently generate standalone Wasm)
* A Wasm engine with support for:
* Wasm 3.0
Copy link
Member Author

Choose a reason for hiding this comment

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

Wasm 2.0 does not contain return_call yet, which we also use. Wasm 3.0 does contain GC, so we could omit it in theory, but in practice IMO it matters a lot more that we need GC, since that has less widespread support.

@sjrd sjrd marked this pull request as ready for review September 28, 2024 08:12
@sjrd sjrd merged commit 41707f6 into scala-js:main Sep 28, 2024
1 check passed
@sjrd sjrd deleted the scalajs-1.17.0 branch September 28, 2024 08:13
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.

3 participants