Skip to content

Optimizations on mutable variables

Motivation and Context

Description

let mut <lhs> = <rhs> in <body> is inlined in <body> iif:

  • <lhs> is never mutated (the mutation (i.e. E_assign's) count is 0)
  • <rhs> is pure

also (was a TODO from @tomjack, put I did not see any difference in the tests after this one): let mut <lhs> = <rhs> in <body> is pure only iif:

  • <rhs> is pure
  • <body> only impurities are assigns/deref of <lhs>

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement (non-breaking change that improves performance)
  • None (change with no changelog)

Changelog

Apply michelson optimizations on mutable variables

Checklist:

  • Changes follow the existing coding style (use dune @fmt to check).
  • Tests for the changes have been added (for bug fixes / feature).
  • Documentation has been updated.
  • Changelog description has been added (if appropriate).
  • Examples in changed behaviour have been added to the changelog (for breaking change / feature).
Edited by Rémi

Merge request reports

Loading