[go: up one dir, main page]

WASM/Parser: replace module fields from list to Lazy vectors

Context

List are not that practical for merkleization, however the WASM AST uses them extensively. This MR replaces the fields at top level of modules to Lazy_vector.Int32Vector.t. This has a nice side effect: it removes the spurious Collect/Rev steps that are no longer necessary during parsing, since Lazy_vector are preallocated and can be filled in the correct order directly.

This MR also adds a new Lazy_vector.to_list function. Note this is a transition function until everything is merkleized, and it is obviously not resilient to mutations. Its main usage outside of glueing temporarily the parsing with the initialization is to glue the encoder (AST -> binary), AST writer to text representation, debugging printings and the validator, that are not used by the PVM but only in the testsuite.

This MR should be followed by another one that transforms more lists into lazy maps.

Manually testing the MR

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
Edited by Pierrick Couderc

Merge request reports

Loading