Skip to content

Improve readability of memory64 compat in fact#4581

Merged
alexcrichton merged 1 commit intobytecodealliance:mainfrom
alexcrichton:fact-memory64-readable
Aug 3, 2022
Merged

Improve readability of memory64 compat in fact#4581
alexcrichton merged 1 commit intobytecodealliance:mainfrom
alexcrichton:fact-memory64-readable

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This commit aims to improve the readability of supporting the memory64
proposal in the fact adapter trampoline compiler. Previously there
were a few sprinkled blocks that used if to generate different
instructions inline, but as I've worked on support for strings this has
become pretty unwieldy as strings do far more memory manipulation than
other type conversions. A pattern that's easier to read is to have
small instruction helpers that take the pointer width as an argument and
internally dispatch to the correct instruction. This keeps the main
translation code branch-free and a bit easier to follow. Additionally
for more complicated branching logic it allows for deduplicating the
main translation path by having lots of little branches instead of one
large branch with everything duplicated on both halves.

@alexcrichton alexcrichton requested a review from fitzgen August 2, 2022 21:59
Copy link
Copy Markdown
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup 👍

This commit aims to improve the readability of supporting the memory64
proposal in the `fact` adapter trampoline compiler. Previously there
were a few sprinkled blocks that used `if` to generate different
instructions inline, but as I've worked on support for strings this has
become pretty unwieldy as strings do far more memory manipulation than
other type conversions. A pattern that's easier to read is to have
small instruction helpers that take the pointer width as an argument and
internally dispatch to the correct instruction. This keeps the main
translation code branch-free and a bit easier to follow. Additionally
for more complicated branching logic it allows for deduplicating the
main translation path by having lots of little branches instead of one
large branch with everything duplicated on both halves.
@alexcrichton alexcrichton force-pushed the fact-memory64-readable branch from afbdc7f to be0798d Compare August 3, 2022 16:22
@alexcrichton alexcrichton enabled auto-merge (squash) August 3, 2022 16:23
@alexcrichton alexcrichton merged commit ff6082c into bytecodealliance:main Aug 3, 2022
@alexcrichton alexcrichton deleted the fact-memory64-readable branch August 3, 2022 17:12
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