-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[RyuJit/WASM] Create a WASM-targeting RyuJit #121341
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
base: main
Are you sure you want to change the base?
Conversation
3391b90 to
52024d2
Compare
1ceabfa to
e47623b
Compare
src/coreclr/jit/targetwasm.h
Outdated
| #define EMIT_TRACK_STACK_DEPTH 1 // TODO-WASM: set to 0. | ||
| #define EMIT_GENERATE_GCINFO 0 // We don't (can't) use code metadata-based GCInfo on WASM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: when should I use EMIT_GENERATE_GCINFO instead of TARGET_WASM?
A: use it when the code you are conditioning away relates to:
- Tracking GCness of variables and registers in codegen.
- Tracking GCness of variables and registers in emit.
- Emitting GCInfo via GcInfoEncoder in the emitter.
A useful mental test here is the hypothetical target of "CoreCLR interpreter bytecode", which would have HAS_FIXED_REGISTER_SET set to 0, but EMIT_GENERATE_GCINFO - 1 (it would need to use variable-size bitsets, something we don't need to deal with for WASM).
Alternatively, we can just go ahead and add it to alljits right now.
e47623b to
980a171
Compare
Notable build system changes:
1) Not included in clr.alljits yet. Build with clr.wasmjit.
Notable factoring choices:
1) Introduce some new target defines for features which WASM won't need,
like fixed size register mask support and GCInfo based on code metadata.
2) For this initial commit, the amount of changes has been intentionally
minimized. In the future, more things will be moved around and ifdefed
out.
980a171 to
15893ed
Compare
|
|
||
| if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) | ||
| create_standalone_jit(TARGET clrjit_universal_arm64_${ARCH_HOST_NAME} OS universal ARCH arm64) | ||
| create_standalone_jit(TARGET clrjit_universal_wasm_${ARCH_HOST_NAME} OS universal ARCH wasm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went back and forth a bit on whether to use the "more proper" wasm32 name for the target architecture. In the JIT source (and I expect in the broader /runtime source as well) TARGET_WASM will always mean TARGET_WASM32 || TARGET_WASM64 - a mismatch with _wasm being a TARGET_WASM32-only Jit. On the other hand, wasm32 would be a mismatch with Architecture.Wasm. Matching the Architecture enum seems more important.
| // TODO-WASM: implement the following functions in terms of a "locals registry" that would hold information | ||
| // about the registers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking on this is that we will re-use the regNumber concept to denote WASM locals. So e. g. STORE_LCL_VAR GetRegNum() would return the register being defined for "enregistered" locals, and similar. So many of the properties that usual registers have (type aka register file) would also hold as well. There would just be an unlimited number of them, so we'd have a growable array for holding that metadata, or perhaps the type could be packed into the upper bits.
|
@dotnet/jit-contrib |
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
Notable build system changes:
Notable factoring choices:
like fixed size register mask support and GCInfo based on code metadata.
minimized. In the future, more things will be moved around and ifdefed out.
Contributes to #121208.