[go: up one dir, main page]

MIR: APPLY instruction

Context

Adds APPLY instruction.

The implementation deviates from the protocol a bit. The protocol essentially constructs the intermediary representation (both Micheline and proper instructions) for partially-applied lambdas in the interpreter during the interpretation of APPLY. In MIR, doing that is a bit tricky (need to thread around the Micheline arena), and somewhat wasteful, so instead, I've introduced the Closure type which captures effects of APPLY somewhat more succinctly. This Closure can then be lazily converted to Micheline if needed (e.g. if a partially-applied lambda is PACKed). As a side effect, EXECuting partially-applied lambdas got a bit cheaper, especially in the case of recursive lambdas.

Converting partially-applied lambdas to Micheline requires converting Type to Micheline. To that effect, IntoMicheline trait is introduced and implemented for TypedValue and &Type.

Part of: #6620 (closed)

Based on: !10982 (merged)

Manually testing the MR

cargo test

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR

Merge request reports

Loading