Skip to content

Migrate some VM* type fields to macro-generated helpers - #14195

Merged
fitzgen merged 4 commits into
bytecodealliance:mainfrom
fitzgen:migrate-some-fields-to-macro-generated-helpers
Aug 24, 2026
Merged

Migrate some VM* type fields to macro-generated helpers#14195
fitzgen merged 4 commits into
bytecodealliance:mainfrom
fitzgen:migrate-some-fields-to-macro-generated-helpers

Conversation

@fitzgen

@fitzgen fitzgen commented Aug 24, 2026

Copy link
Copy Markdown
Member

See each commit for details.

@fitzgen
fitzgen requested review from a team as code owners August 24, 2026 17:26
@fitzgen
fitzgen requested review from cfallin and removed request for a team August 24, 2026 17:26
@cfallin

cfallin commented Aug 24, 2026

Copy link
Copy Markdown
Member

(Merge conflict to fix before merging but LGTM)

`Field::readonly`, `Field::can_move`, and `Field::cast` took `&mut self` and
returned `&mut Self`, while `Field::relative_to` consumed `self`. That mix meant
a caller that needed to set a flag *and* rebase the access could not write it as
one chain, and instead had to bind a `let mut` and set flags in separate
statements.

Make all three consume and return `Self`, and add `readonly_if` / `can_move_if`
for the common case where the flag depends on a dynamic property of the module
being compiled.
Also add `Field::trap_code`, so that a `Field` can express the optional trap
code that `VMFuncRef` loads carry for the null-funcref case, and add
`AliasRegions::offsets` so that callers can compute the offset needed to rebase
a `Field` onto a containing structure.
@fitzgen
fitzgen force-pushed the migrate-some-fields-to-macro-generated-helpers branch from bb79f85 to 9c961ef Compare August 24, 2026 21:08
@fitzgen
fitzgen enabled auto-merge August 24, 2026 21:09
@fitzgen
fitzgen added this pull request to the merge queue Aug 24, 2026
Merged via the queue into bytecodealliance:main with commit dece27d Aug 24, 2026
54 checks passed
@fitzgen
fitzgen deleted the migrate-some-fields-to-macro-generated-helpers branch August 24, 2026 21:59
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.

2 participants