Skip to content

Source Mapper Improvements: Small Fixes #681

@tzaffi

Description

@tzaffi
Contributor

Problem

There were a few issues that were not resolved at the time of merging #650 .

Solution - Implement the following small improvements

  • Rename confusing StackFrame._frame_info_is_right_before_core() (renamed in Teal to PyTeal Source Mapper #650)
    Prune unused methods in the StackFrame - PyTealFrame - TealMapItem hierarchy (Better Router Mapping #689)
  • Final status checks (ensure all changes are actually necessary) (Better Router Mapping #689)
    • which of the usages of ._sframes_container are actually necessary. To see all usages: f96ef86
  • audit the following test files and either remove, unskip, or provide clear commentary as to why the skipped test needs to stay in (Better Router Mapping #689 unified using STABLE_SLOT_GENERATION: bool constants currently `False):
    • tests/integration/sourcemap_monkey_integ_test.py
    • tests/unit/sourcemap_constructs311_test.py
    • tests/unit/sourcemap_constructs_allpy_test.py
    • tests/unit/sourcemap_monkey_unit_test.py
    • tests/unit/sourcemap_test.py
  • At the end of Better router mapping #676 pay close attention to _PyTealSourceMap._infer() and see which lines are still being hit. Probably, there will be some situations that are no longer needed. (Better Router Mapping #689 tightened this up)
    Refactor NatalStackFrame to provide a single frame instead of a list
  • Coverage triage
    • first item to notice: we could do better on subroutines such as the recursive fibonacci example:
  • Pull in updated version of mjpieters's SourceMap to get faster R3SourceMap (cf: https://github.com/tzaffi/pyteal/blob/f2a945a8eeb396e9c544b62cd3d1a6383bfc9bff/pyteal/compiler/sourcemap.py#L75)
  • Investigate the feasibility of removing the _sframes_container property from class TealComponent and whenever this is needed, simply overwrite either self.expr.stack_frames or self._stack_frames. (partially removed from much of hierarchy in Better Router Mapping #689)
    • If feasible, implement it
    • Also consider having a new method NatalStackFrame.spawn() that keeps the original NatalStackFrame as a child.
  • It's likely that _PyTealSourceMapper will never be exposed to the end-user. In that case, the logic for caching build items is overly complex. This should be simplified at the end or shortly after Better router mapping #676

Dependencies

None

Urgency

Medium - while the urgency of any improvement individually is Low, addressing at least a few of these issues in the short term will improve the feature's usefuleness.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @winder@tzaffi

        Issue actions

          Source Mapper Improvements: Small Fixes · Issue #681 · algorand/pyteal