Skip to content

[TM-368] New duupX

Ivan Gromakovskii requested to merge gromak/tm368-better-duup into master

Description

We have duupX which is equivalent to DUU*P macro from Michelson. Its implementation in Michelson has changed because there are new instructions. If number of Us is greater than 2, it is implemented as DIP (n - 1) { DUP }; DIG n. It is more efficient. For DUUP the old implementation is still better.

Note that DIG n can be replaced with DIG (n -1). n-th and (n-1)-th items are the same. I use the most efficient implementation in Lorentz, even though it slightly differs from DUUP.

So this MR:

  1. Updates duupX in Lorentz.
  2. Updates macro expansion (to be precisely the same as in Michelson).

Related issue(s)

https://issues.serokell.io/issue/TM-368

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:

Stylistic guide (mandatory)

Merge request reports