Repository navigation
Conversation
|
Azure Pipelines: Successfully started running 8 pipeline(s). 7 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
c562509 to
dd5154f
Compare
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
|
Tagging subscribers to this area: @JulieLeeMSFT, @BrzVlad, @janvorli |
|
This is the parts of #138027 required to stand up the browser-wasm64 interpreter. Excluding the newly generated call helpers the diff is +1,311 / −647 lines |
davidwrighton
left a comment
There was a problem hiding this comment.
Generally looks pretty good.
dd5154f to
8370fed
Compare
2abf630 to
4ead760
Compare
| arch=wasm | ||
| # Keep the existing wasm default unless wasm64 was explicitly requested. | ||
| if [[ "$arch" != "wasm64" ]]; then | ||
| arch=wasm |
There was a problem hiding this comment.
Perhaps simpler to only replace the host-arch default rather than override -arch, so wasm64 (and later wasi-wasm64) goes through like any other arch and we don't need to revisit this:
diff --git a/eng/build.sh b/eng/build.sh
index c1b89e78d7e..54c3e1308ad 100755
--- a/eng/build.sh
+++ b/eng/build.sh
@@ -542,20 +542,16 @@ if [ ${#actInt[@]} -eq 0 ]; then
arguments=("-restore" "-build" ${arguments[@]+"${arguments[@]}"})
fi
+if [[ -z "$passedArch" && ( "$os" == "browser" || "$os" == "wasi" ) ]]; then
+ # the host arch default doesn't apply to WebAssembly targets
+ arch=wasm
+fi
if [[ "$os" == "browser" ]]; then
- # Keep the existing wasm default unless wasm64 was explicitly requested.
- if [[ "$arch" != "wasm64" ]]; then
- arch=wasm
- fi
# because on docker instance without swap file, MSBuild nodes need to make some room for LLVM
# https://github.com/dotnet/runtime/issues/113724
# this is hexa percentage: 46-> 70%
export DOTNET_GCHeapHardLimitPercent="46"
fi
-if [[ "$os" == "wasi" ]]; then
- # override default arch for wasi, we only support wasm
- arch=wasm
-fi
# Default dynamiccodecompiled based on target OS if not explicitly set
if [[ -z "$dynamiccodecompiled" ]]; thenThere was a problem hiding this comment.
Good idea, applied in 1054af9. One tweak: build.sh runs with set -u and passedArch is only set when -arch is given, so the check uses "${passedArch:-}". Otherwise ./build.sh -os browser fails with "unbound variable". build.ps1 still forces wasm for browser/wasi; I left it alone since its -arch validation doesn't allow wasm64 yet, and Windows wasm64 isn't in scope here.
Note
This reply was drafted with GitHub Copilot.
This PR makes the WebAssembly predicate names consistent ahead of wasm64 support. It's split out of #138166 at @jkotas's request. - Bare names mean 32-bit WebAssembly, matching the `browser-wasm`/`wasi-wasm` RIDs: `TARGET_WASM`/`HOST_WASM`, `CLR_CMAKE_*_ARCH_WASM` and MSBuild `TargetsWasm`. - New names on the ARMARCH pattern mean any WebAssembly width: `TARGET_WASMARCH`/`HOST_WASMARCH`, `CLR_CMAKE_*_ARCH_WASMARCH` and `TargetsWasmArch`. - `TARGET_WASM32` is replaced by `TARGET_WASM`. Only 32-bit WebAssembly exists on main, so this is a mechanical rename of the existing any-width uses and behavior is unchanged. Mono's own sources keep their existing defines. Validated locally with `./build.sh clr+libs+host -os browser -c Debug -lc Release`. > [!NOTE] > This PR description was generated with GitHub Copilot. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Recognize the wasm64 architecture in the build scripts, CMake configuration and subsets. The wasm64 cross components build only the jitinterface needed by crossgen2; there is no wasm64 JIT yet. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
VM, PAL, GC and CoreLib changes for 64-bit pointers on browser-wasm64, plus corerun host updates. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Teach the call-helper generator and its crossgen2 calling-convention and instruction-set support about wasm64, and check in the generated tables. The tables are produced by generate-coreclr-helpers.proj. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Includes the Emscripten __sig declarations for pointer-taking browser imports. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add the browser-wasm64 RID and packs. ReadyToRun is disabled and rejected for wasm64 until R2R support lands. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add the CI lane with ReadyToRun passes disabled, wasm64 test infrastructure, and test exclusions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
memory64 lifts the 4 GB address limit; use the engine's memory64 cap rather than the wasm32 2 GB default so large-allocation workloads can run. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> (cherry picked from commit 081c20e)
Architecture has no Wasm64 value, so browser-wasm64 reports Architecture.Wasm. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> (cherry picked from commit 0d8a717)
…ated source The ExecutionManager.md usage table is generated from data-descriptor-meanings.json, so record the wasm-optional field description there. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
crossgen2 rejects wasm64 until ReadyToRun support is added, so tests with AlwaysUseCrossGen2 can't run on the wasm64 interpreter lane yet. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
4ead760 to
c6f6b12
Compare
Replace the browser and wasi -arch overrides with a single default that applies only when no architecture was requested, so wasm64 goes through like any other architecture. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
| <DefineConstants Condition="'$(WasmEnableThreads)' == 'true'">$(DefineConstants);FEATURE_WASM_MANAGED_THREADS</DefineConstants> | ||
| <DefineConstants Condition="'$(WasmEnableJsInteropByValue)' == 'true'">$(DefineConstants);ENABLE_JS_INTEROP_BY_VALUE</DefineConstants> | ||
| <DefineConstants>$(DefineConstants);CORECLR</DefineConstants> | ||
| <DefineConstants Condition="'$(TargetsWasm64)' == 'true'">$(DefineConstants);TARGET_WASM64</DefineConstants> |
There was a problem hiding this comment.
Libraries are not setup to be architecture specific. I think this will lead to e.g. both 32-bit and 64-bit binary overwriting each other if you build both from the same enlistment.
It would be better to refactor JSMarshalerArgumentImpl so that it does not have hardcoded architecture specific offsets.
There was a problem hiding this comment.
Agreed. JSMarshalerArgumentImpl now uses a sequential layout with a nested explicit union and pointer-sized fields, so the offsets fall out of the pointer size. The TARGET_WASM64 define is gone and the assembly is identical for wasm and wasm64. I checked that the runtime layouts match marshal.ts exactly (32 and 56 bytes), and wasm32 ReadyToRun codegen is unchanged apart from relocations.
Note
This reply was drafted with GitHub Copilot.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…tyle Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
gen-buildsys.sh already passes CLR_CMAKE_TARGET_ARCH=wasm64 for browser builds. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use a sequential layout with a nested explicit union and pointer-sized fields instead of architecture-specific field offsets, so one System.Runtime.InteropServices.JavaScript assembly matches both the wasm (32-byte) and wasm64 (56-byte) layouts, and drop the TARGET_WASM64 define. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adds browser-wasm64 (memory64) support to the CoreCLR interpreter. This is layer 1 of a stack: ReadyToRun (JIT/crossgen2) and library outerloop CI follow in separate PRs.
-os browser -arch wasm64. The cross components build only the jitinterface; there is no wasm64 JIT in this layer.src/coreclr/vm/wasm/browser-wasm64/.__sigdeclarations for pointer-taking imports.browser-wasm64. ReadyToRun is disabled and rejected for wasm64 until the R2R layer.Validated locally (macOS arm64):
./build.sh clr+libs+host -os browser -arch wasm64 -c Debug -lc Releasepassed../build.sh clr+libs -os browser -c Debug -lc Releasepassed (wasm32 regression check).corerun.jsunder node 26 and exited 100.Note
This PR description was generated with GitHub Copilot.