Skip to content
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

Some operands reordering in serialization #10136

Open
jeanmon opened this issue Nov 22, 2024 · 2 comments
Open

Some operands reordering in serialization #10136

jeanmon opened this issue Nov 22, 2024 · 2 comments
Assignees
Labels
C-avm Component: AVM related tickets (aka public VM)

Comments

@jeanmon
Copy link
Contributor

jeanmon commented Nov 22, 2024

After some analysis on the addressing resolution and bytecode decomposition (rather gluing), we expect relations to be simpler if we systematically put the address operands just after indirect byte and any immediate values at the end.

This entails the following modifications:

  • CAST_8 and CAST_16: move tag at the end

  • GETENVVAR: Move immediate (env variable value UINT8) to the end

  • JUMPI: move jumpDst (UINT32) to the end

  • SET family opcodes: move address just after the INIDRECT, then the order is: INDIRECT8, ADDRESS, TAG, immediate

  • GETCONTRACTINSTANCE: move enum (UINT8) after the addresses

  • DEBUGLOG: move message_size at the end (deserialisation layout sizes does not change, but the order of arguments in the serialisation do)

@jeanmon jeanmon added the C-avm Component: AVM related tickets (aka public VM) label Nov 22, 2024
@jeanmon jeanmon added this to A3 Nov 22, 2024
@github-project-automation github-project-automation bot moved this to Todo in A3 Nov 22, 2024
@fcarreiro
Copy link
Contributor

fcarreiro commented Nov 22, 2024

I don't think TAG needs to be moved, because it's not one of the operands, it's separate (just like ind) and doesn't ever need resolution. We only need to move immediates I think. (for addressing)

@jeanmon
Copy link
Contributor Author

jeanmon commented Nov 22, 2024

@fcarreiro For SET, the immediate is before the address which are both after TAG. We have to move the address anyway so I would directly place it before the tag because I expect some simplified equations in byte code decomposition if the operands are placed similarly to other opcodes. It is clearly not a blocker but would be nice if work is moderate.

For CAST, the same reasoning apply. What I expect by putting addresses systematically before the tag, is that equations like:

O1 = selectors_1 * (B2 + B3 * 2^8)
O2 = selectors_2 * (B4 + B5 * 2^8)

I expect to have more opcodes falling into selectors_1 and selectors_2. True for TAG you need a specific equation anyway and the suggested changes will not help that, but I think it will help with the other operands

@jeanmon jeanmon self-assigned this Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-avm Component: AVM related tickets (aka public VM)
Projects
Status: Todo
Development

No branches or pull requests

2 participants