Skip to content
This repository was archived by the owner on Dec 15, 2017. It is now read-only.
This repository was archived by the owner on Dec 15, 2017. It is now read-only.

Automatic recursion analysis #4

@ed-cooper

Description

@ed-cooper
  • Create a directed graph of connected methods, store at each node all the nodes it is possible to reach from there (broadcast without wait should not be counted as execution occurs after the end of the block)
  • This can be used to identify all recursive functions
  • On a new pass, for each point at which recursion occurs, all the scope variables / arrays whose values are still needed after the recursion should be temporarily saved to the stack
  • After the recursive call, restore and delete the values from the stack

Notes:

  • This optimisation only applies to atomic methods, where thread safety is guaranteed
  • It may be beneficial to only add values to the stack at the start of a method and delete them at the end, in order to avoid multiple add/delete actions
  • Broadcast and wait should be counted as a link as execution does halt, but should throw a warning anyway due to exceptionally poor performance
  • Consider rethink of general stack system / usage

Requirements:

  • Add IsRecursive to method declarations
  • Have list of methods called (both direct and indirect) by the method
  • Have list of values to preserve in a MethodCall
  • Add 2 new passes to compiler, to occur after modules have been imported, but before the translation to the block model

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions