ProgramMemory refactor - eliminate copies of memory (#5273)
* refactor program memory for encapsulation and remove special treatment of return values Signed-off-by: Nick Cameron <nrc@ncameron.org> * Refactor ProgramMemory to isolate mutation Signed-off-by: Nick Cameron <nrc@ncameron.org> * Refactor ProgramMemory Signed-off-by: Nick Cameron <nrc@ncameron.org> * Generated output Signed-off-by: Nick Cameron <nrc@ncameron.org> * Cache the result of executing modules for their items Signed-off-by: Nick Cameron <nrc@ncameron.org> * Compress envs when popped Signed-off-by: Nick Cameron <nrc@ncameron.org> * Remove the last traces of geometry from the memory module Signed-off-by: Nick Cameron <nrc@ncameron.org> * docs Signed-off-by: Nick Cameron <nrc@ncameron.org> * Fixups Signed-off-by: Nick Cameron <nrc@ncameron.org> * Frontend Signed-off-by: Nick Cameron <nrc@ncameron.org> * Improve Environment GC Signed-off-by: Nick Cameron <nrc@ncameron.org> * Fixup mock execution frontend and interpreter, misc bug fixes Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -315,7 +315,7 @@ yo2 = hmm([identifierGuy + 5])`
|
||||
const startIndex = code.indexOf('100 + 100') + 1
|
||||
const { modifiedAst } = moveValueIntoNewVariable(
|
||||
ast,
|
||||
execState.memory,
|
||||
execState.variables,
|
||||
topLevelRange(startIndex, startIndex),
|
||||
'newVar'
|
||||
)
|
||||
@ -329,7 +329,7 @@ yo2 = hmm([identifierGuy + 5])`
|
||||
const startIndex = code.indexOf('2.8') + 1
|
||||
const { modifiedAst } = moveValueIntoNewVariable(
|
||||
ast,
|
||||
execState.memory,
|
||||
execState.variables,
|
||||
topLevelRange(startIndex, startIndex),
|
||||
'newVar'
|
||||
)
|
||||
@ -343,7 +343,7 @@ yo2 = hmm([identifierGuy + 5])`
|
||||
const startIndex = code.indexOf('def(')
|
||||
const { modifiedAst } = moveValueIntoNewVariable(
|
||||
ast,
|
||||
execState.memory,
|
||||
execState.variables,
|
||||
topLevelRange(startIndex, startIndex),
|
||||
'newVar'
|
||||
)
|
||||
@ -357,7 +357,7 @@ yo2 = hmm([identifierGuy + 5])`
|
||||
const startIndex = code.indexOf('jkl(') + 1
|
||||
const { modifiedAst } = moveValueIntoNewVariable(
|
||||
ast,
|
||||
execState.memory,
|
||||
execState.variables,
|
||||
topLevelRange(startIndex, startIndex),
|
||||
'newVar'
|
||||
)
|
||||
@ -371,7 +371,7 @@ yo2 = hmm([identifierGuy + 5])`
|
||||
const startIndex = code.indexOf('identifierGuy +') + 1
|
||||
const { modifiedAst } = moveValueIntoNewVariable(
|
||||
ast,
|
||||
execState.memory,
|
||||
execState.variables,
|
||||
topLevelRange(startIndex, startIndex),
|
||||
'newVar'
|
||||
)
|
||||
@ -557,7 +557,7 @@ describe('Testing deleteSegmentFromPipeExpression', () => {
|
||||
const modifiedAst = deleteSegmentFromPipeExpression(
|
||||
[],
|
||||
ast,
|
||||
execState.memory,
|
||||
execState.variables,
|
||||
code,
|
||||
pathToNode
|
||||
)
|
||||
@ -639,7 +639,7 @@ ${!replace1 ? ` |> ${line}\n` : ''} |> angledLine([-65, ${
|
||||
const modifiedAst = deleteSegmentFromPipeExpression(
|
||||
dependentSegments,
|
||||
ast,
|
||||
execState.memory,
|
||||
execState.variables,
|
||||
code,
|
||||
pathToNode
|
||||
)
|
||||
@ -745,7 +745,7 @@ describe('Testing removeSingleConstraintInfo', () => {
|
||||
pathToNode,
|
||||
argPosition,
|
||||
ast,
|
||||
execState.memory
|
||||
execState.variables
|
||||
)
|
||||
if (!mod) return new Error('mod is undefined')
|
||||
const recastCode = recast(mod.modifiedAst)
|
||||
@ -794,7 +794,7 @@ describe('Testing removeSingleConstraintInfo', () => {
|
||||
pathToNode,
|
||||
argPosition,
|
||||
ast,
|
||||
execState.memory
|
||||
execState.variables
|
||||
)
|
||||
if (!mod) return new Error('mod is undefined')
|
||||
const recastCode = recast(mod.modifiedAst)
|
||||
@ -978,7 +978,7 @@ sketch002 = startSketchOn({
|
||||
codeRef: codeRefFromRange(range, ast),
|
||||
artifact,
|
||||
},
|
||||
execState.memory,
|
||||
execState.variables,
|
||||
async () => {
|
||||
await new Promise((resolve) => setTimeout(resolve, 100))
|
||||
return {
|
||||
|
Reference in New Issue
Block a user