-
Notifications
You must be signed in to change notification settings - Fork 19
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
Change definition of m
in EXCHANGE
#174
Open
frangio
wants to merge
2
commits into
ipsilon:main
Choose a base branch
from
frangio:exchange-imms
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4
−3
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Oops, something went wrong.
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.
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.
ah, I didn't see this has been changed to i/j already. I propose to align with EEST (and be compatible with past version), so:
x
th stack item is swapped withy
th stack item (1-based)."This way, any EVM/test/whatever code, which doesn't update to your convention, still uses the same names for the same things.
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.
given the SWAPn/SWAPN/EXCHANGE consistency argument, I take the above comment back. Pls make sure then that conventions are sound within this document (I think they are as of 44b5781), and I think we'll work from there
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.
welp, there's no equivalence with the old SWAP1..16, but that I think is not fixable, so
EXCHANGE x y ≡ SWAPN x SWAPN y SWAPN x ≡ SWAP[x-1] SWAP[y-1] SWAP[x-1]
encoded in bytecode as
0xe8nibble[x-2]nibble[y-x-1] ≡ 0xe7[x-2] 0xe7[y-2] 0xe7[x-2] ≡ 0x[90+x-2][90+y-2][90+x-2]
Concretely
EXCHANGE 2 3 ≡ SWAPN 2 SWAPN 3 SWAPN 2 ≡ SWAP1 SWAP2 SWAP3
0xe800 ≡ 0xe700e701e700 ≡ 0x909190
The not fixable part can be swept under the rug by the assembler, which would not allow verbatim SWAP1..16 in assembler code, but would use them in output bytecode for low instances of SWAPN[...] as optimization.
I risk to say that DUP/DUPN are aligned (and similarly "unfixable" and it's similarly "fine"). But please double check my above ramblings, I made like 3 errors in the
+-1
's thereThere 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.
This is not the notation/encoding I have in mind. For example, I'd write
SWAPN 1
(n=1, encoded0xe700
) as equivalent toSWAP1
(0x90
).I'm going to write some more comprehensive notes to try to get everyone aligned.