aeternity / aesophia

Stand alone compiler for the Sophia smart contract language
https://docs.aeternity.com/aesophia
ISC License
51 stars 19 forks source link

Improve independence analysis in code optimizer #483

Closed hanssv closed 1 year ago

hanssv commented 1 year ago

There is an omission in the logic checking whether two byte code instructions are independent - as demonstrated by #482

This adds a check that an instruction reading the store/state is not pushed past an impure instruction (for example a function call).

This results in:

FUNCTION foo( integer) : integer
  ;; BB : 0
          MAP_LOOKUP var0 store1 arg0
          PUSH arg0
          CALL "IBB"
  ;; BB : 1
          POP var9999
          RETURNR var0

Fixes #482

This PR is supported by the Æternity Crypto Foundation