CSE machine: support for StreamViz drawing arrows#1939
Conversation
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces stream visualization features by tracking stream lineage and execution steps. It adds streamLineage, streamsPointSteps, and pendingStreamFnStack to the execution context and updates the CSE machine interpreter to manage these properties. Review feedback highlights opportunities to improve type safety by using specific tuple types for the function stack and to enhance performance by storing control stack heights as numbers rather than strings, thereby avoiding redundant parsing. Additionally, a redundant property in the runtime initialization was identified for removal to maintain consistency with the defined interfaces.
There was a problem hiding this comment.
Code Review
This pull request introduces infrastructure for stream visualization by tracking stream lineage and execution steps within the CSE machine. Key changes include the addition of streamLineage, streamsPointSteps, and a pendingStreamFnStack to the execution context to map nullary function calls to their results. The review feedback focuses on improving type safety by storing stack heights as numbers rather than strings, removing redundant property initializations that deviate from the defined interface, and addressing minor style issues such as strict equality and trailing whitespace.
Coverage Report for CI Build 24542781792Coverage increased (+0.03%) to 78.391%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
|
/gemini review |
|
Thank you for the update. I have reviewed the changes in this pull request. The implementation correctly introduces the |
|
/gemini review |
Description
The map streamLineage (Found in context object, types.ts) that maps the ID of nullary functions to the pairs it returns.
Everytime a CALL0 is called in the control, we push a tuple (nullaryFnID, controlStackHeight) to the pendingStreamFnStack[]. Within generateCSEMachineStateStream, we check the whether the height of the control stack has reached the height of i-1, where i is the controlStackHeight when we pendingStreamFnStack.peek(). If so, we pop pendingStreamFnStack.pop() and we map (using streamLineage) the nullaryFnID to the pair that is at the top of the stash.
We store breakpoints in streamPointSteps[]. This array is calculated within envChangingStreams. The criteria for a breakpoint is exactly the same as updating streamLineage.
See: source-academy/frontend#3727 (comment)
and source-academy/frontend#3747
This PR is blocking: source-academy/frontend#3747
Type of change
How to test
Checklist
yarn testjs-slangexecutable is verified to work