[Interpreter] Indexed IR and flattening the interpreter state #1183
EclecticGriffin
started this conversation in
General
Replies: 1 comment
-
Really exciting overview! I think the flat IR makes a lot of sense overall and using it within Cider could be a good demonstration of its utility for the overall infrastructure. I think one way to pitch this whole effort, as summarized by @sampsyo, is that it makes the interpreter more maintainable and extensible. Implement the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Related to #1051. Discussion of IR changes can be had on that discussion thread. Supposing the existence of a variant Indexed IR for the interpreter, or a general move to an indexed/unstructured IR CFG, lets consider changes to the interpreter.
A non-structured control program would potentially let the interpreter be less recursive in its core interpretation algorithms as rather than performing recursive calls down the entire active tree, the program stack could instead be represented explicitly as a stack of indexes into the control program and their associated state machines.
A related concern is whether or not it is possible to flatten the interpreter environment such that all ports, cell-state, and program counters are in a single environment rather than having sub-components hold an entire state-map inside themselves. This would make it generally easier to inspect all state and in particular greatly streamline working with deeply nested components. Having an environment structure entirely detached from the interpretation mechanisms would also make it easier to handle time-travel debugging & check-pointing in the debugger.
There are a few issues that make this more complicated.
The above suggests that component instances require a mapping from their ports & cells to the appropriate value/state indices.
State:
Cell State:
| index to reg or reg
| index/reference to memory
| other (mult/div buffers)
| empty (combinational only)
This adds more explicit indirection which previously happened via objects and pointers. This also allows a form of JITing where groups could be "compiled" for a specific component instance by creating an alternate set of assignments which use the direct port and cell indices.
Beta Was this translation helpful? Give feedback.
All reactions