feat(codegen): support narrow immutables#1003
Draft
DaniPopes wants to merge 1 commit into
Draft
Conversation
Carry stable immutable IDs and TypeSize through MIR while encoding fixed placeholder widths in EVM IR and assembly relocations. Patch narrow placeholders without overwriting adjacent runtime bytes, and normalize signed and fixed-bytes loads after PUSH<N>.
Contributor
Codegen benchmark
Peak RSS
Per-benchmark peak RSS
|
Merging this PR will improve performance by 5.41%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | Counter/lex |
12 µs | 11.4 µs | +5.41% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing dani/dynamic-immutable-sizes (43c2f66) with main (341e603)
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.
Immutable references previously carried byte offsets through MIR and were forced into PUSH32 placeholders. This change gives each immutable a stable ImmutableId, records its MirType and TypeSize at the module boundary, and carries the fixed placeholder width through untyped EVM IR as the PUSH opcode and through assembly relocation metadata.
Deployment now patches PUSH1 through PUSH32 immediates without overwriting neighboring runtime bytes. Signed integers are sign-extended after narrow pushes, fixed bytes are restored to their left-aligned MIR representation, and the runtime copy location accounts for the 32-byte patch window. TypeSize also replaces raw integer widths in MIR values and related lowering helpers.
MIR and EVM IR parsing, validation, cost and layout estimates, optimization keys, and round trips have been updated around the typed IDs and sizes. Coverage includes lowering snapshots and deployment/runtime execution for unsigned, signed, fixed-bytes, address, default-width, and UDVT immutables.