Skip to content

Commit

Permalink
Interpreter: avoid redundant extraction of function arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
rrthomas committed Aug 5, 2024
1 parent 8bb38f8 commit ccbb848
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ark/interpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ function* doEvalFlat(outerArk: ArkState): Operation<ArkVal> {
const result = new ArkContinuation(new ArkState(
callable.body,
new ArkFrame(
makeLocals(callable.params, inst.argIds.map((id) => mem.get(id)!)),
makeLocals(callable.params, args),
callable.captures,
new Map(),
new ArkFrameDebugInfo(inst.name, inst.sourceLoc),
Expand All @@ -254,7 +254,7 @@ function* doEvalFlat(outerArk: ArkState): Operation<ArkVal> {
ark = new ArkState(
callable.body,
new ArkFrame(
makeLocals(callable.params, inst.argIds.map((id) => mem.get(id)!)),
makeLocals(callable.params, args),
callable.captures,
new Map(),
new ArkFrameDebugInfo(inst.name, inst.sourceLoc),
Expand All @@ -267,7 +267,7 @@ function* doEvalFlat(outerArk: ArkState): Operation<ArkVal> {
mem.set(inst.id, ArkNull())
inst = inst.next
} else {
callable.state.frame.memory.set(callable.state.inst!.id, mem.get(inst.argIds[0])!)
callable.state.frame.memory.set(callable.state.inst!.id, args[0])
ark.inst = inst
callable.state.outerState = ark
ark = callable.state
Expand Down

0 comments on commit ccbb848

Please sign in to comment.