Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mir: remove the tree delimiter nodes #1334

Merged
merged 16 commits into from
Jun 11, 2024

Commits on Jun 6, 2024

  1. mir: add the mnkBinding node

    It has the same role as the `cnkBinding` node in the CGIR, that is, to
    group a field name and value expression in an object construction
    expression together.
    
    Previously, the `mnkField` and expression nodes loosely followed each
    other, making `mnkObjConstr` subtrees heterogenous, which complicates
    some traversal (or at least it will, once more traversal is tree-
    length-based).
    zerbina committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    f73bdda View commit details
    Browse the repository at this point in the history
  2. replace some manual tree constructions

    `mnkPathNamed`, `mnkPathVariant`, `mnkPathPosition`, and `mnkName` are
    all going to change shape. For better forward compatibility, dedicated
    construction template for them are added and used.
    
    The `ekNone` effect kind is introduced for being able to signal "no
    effect" when constructing a `mnkName` tree.
    zerbina committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    4bdd6e4 View commit details
    Browse the repository at this point in the history
  3. mir: remove the mnkEnd delimiter nodes

    Instead of requiring delimiter nodes, subtree root nodes now store a
    their number of subnodes. Multiple subtree root nodes previously stored
    extra information, which is now no longer possible.
    
    Most tree traversal routines are updated accordingly, and those
    specific to `mnkEnd` nodes are removed.
    
    Since it's obsolete now, the `GeneralEffect` enum type is removed.
    zerbina committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    37199cb View commit details
    Browse the repository at this point in the history
  4. update MIR tree traversal

    * skipping end nodes is unnecessary and wrong now
    * instead of iterating until an `mnkEnd` node is found, a for loop
      using the node count suffices
    zerbina committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    89ebf14 View commit details
    Browse the repository at this point in the history
  5. mirconstr: adjust the builder

    A `MirBuffer` instance keeps the track of the number of the subnodes in
    the currently constructed tree, updating the `len` field in the root
    node on subtree completion.
    
    The value is saved on the stack when starting a nested subtree. For
    manual subtree construction (i.e., not using the `subTree` template),
    the `start` and `finish` procedures are provided.
    
    Since the builder manages updating the length field, manually providing
    the number of nodes is unnecessary (`mirgen` is updated accordingly).
    zerbina committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    661aea2 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c4edb64 View commit details
    Browse the repository at this point in the history
  7. mir: restore the missing information

    Subtree nodes no longer being able to store non-length information
    requires the information to be stored elsewhere. The `mnkImmediate`
    node is added, and used as an ad-hoc way of storing information in
    the tree.
    
    * call trees store whether the call modifies some global state in
      an immediate value in the first slot
    * `mnkName` trees store the tag as an immediate value in the first
      subnode -- `mnkTag` nodes are removed
    * the named-field-access trees store the field position in an
      `mnkField` node in the second slot
    * `mnkPathPos` stores the position as an immediate value in the
      second slot
    
    The tree construction throught the MIR processing is updated
    accordingly.
    zerbina committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    e35cc7e View commit details
    Browse the repository at this point in the history
  8. mirtrees: add and use last routine

    It replaces the now-unavailable `findEnd` + `previous` combination.
    zerbina committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    fb8aacd View commit details
    Browse the repository at this point in the history
  9. update the various places where MIR is inspected

    * inspection of call, path, and `mnkName` is adjusted to work with the
      new tree shapes
    * dedicated query procedures are used instead of manual indexing where
      sensible
    zerbina committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    92c7492 View commit details
    Browse the repository at this point in the history
  10. treechangesets: update changeTree

    There's no more end node that needs to be patched.
    zerbina committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    9122d2e View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    fd1d639 View commit details
    Browse the repository at this point in the history

Commits on Jun 9, 2024

  1. replace manual call tree construction

    Manually constructing a `mnkCall`/`mnkCheckedCall` sub-tree is prone to
    mistakes, and it also complicates future changes to the syntax (should
    any be made). `mirconstr` now provides the `rawBuildCall` template for
    building call trees where full control over the makeup is needed.
    zerbina committed Jun 9, 2024
    Configuration menu
    Copy the full SHA
    95eda13 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4b4c338 View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2024

  1. fix typos

    Co-authored-by: Saem Ghani <[email protected]>
    zerbina and saem committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    7d8ac59 View commit details
    Browse the repository at this point in the history
  2. correct a doc comment link

    zerbina committed Jun 10, 2024
    Configuration menu
    Copy the full SHA
    6abf8f3 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d917f98 View commit details
    Browse the repository at this point in the history