core: Add Cranelift WasmTarget variants for Stylus overflow fallback#645
Merged
core: Add Cranelift WasmTarget variants for Stylus overflow fallback#645
Conversation
- Add three new WasmTarget constants for Cranelift-compiled ASM - Add CraneliftTarget() helper to map a platform target to its Cranelift Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
bragaigor
commented
Apr 1, 2026
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
as far as ActivateWasm goes we activate every wasm program regardless of architecture Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
bragaigor
commented
Apr 2, 2026
| } | ||
| } | ||
|
|
||
| func TestActivateWasmRevert(t *testing.T) { |
Contributor
Author
There was a problem hiding this comment.
lightweight test that now validates the new behavior (cranelift entries stored alongside singlepass). I think it's nice to have a test to make sure activation and revert happens for both.
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
Signed-off-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
eljobe
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a Stylus program overflows the native (Singlepass) coroutine stack, Nitro recompiles it with Cranelift as a fallback. The Cranelift ASM needs to be stored separately from the Singlepass ASM in the wasm store so both remain available — normal execution uses Singlepass, and only the overflow retry path uses Cranelift.
WasmTargetconstants:TargetArm64Cranelift,TargetAmd64Cranelift,TargetHostCranelift{0x00, 'w', 'r/x/h'}), included inWasmPrefixesExceptWavm()CraneliftTarget(),BaseTarget(),IsCraneliftTarget(),SplitAsmMap(),DeduplicateAsmMap(),DeleteActivatedAsm()ActivateWasm: deduplicate cranelift entries into base targets for the consistency check viaDeduplicateAsmMap, then eagerly persist cranelift entries to the wasm store under their own keyswasmActivation) deletes eagerly-written cranelift entries from the wasm store onRevertToSnapshotrawdbhelpers and for the activation/revert path inStateDBpulled in by OffchainLabs/nitro#4538