From aa67c7090af767e58978cb47bd065f985c77964b Mon Sep 17 00:00:00 2001 From: JothamWong <45916998+JothamWong@users.noreply.github.com> Date: Mon, 8 Apr 2024 01:24:51 +0800 Subject: [PATCH] Properly reset StringPool --- src/vm/oogavm-heap.ts | 1 + src/vm/oogavm-machine.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vm/oogavm-heap.ts b/src/vm/oogavm-heap.ts index 5945c3e..aea61e5 100644 --- a/src/vm/oogavm-heap.ts +++ b/src/vm/oogavm-heap.ts @@ -126,6 +126,7 @@ export function constructHeap(numWords: number, updateRootsFn): DataView { free = 0; allocateLiteralValues(); updateRoots = updateRootsFn; + StringPool.clear(); return heap; } diff --git a/src/vm/oogavm-machine.ts b/src/vm/oogavm-machine.ts index a0afa6e..d09820e 100644 --- a/src/vm/oogavm-machine.ts +++ b/src/vm/oogavm-machine.ts @@ -693,8 +693,9 @@ export function run(numWords = 1000000) { throw Error('execution aborted due to: ' + getErrorType()); } } - log("Program value is " + addressToTSValue(peekStack(OS[0]))); - return addressToTSValue(peekStack(OS[0])); + const returnValue = addressToTSValue(peekStack(OS[0])); + log("Program value is " + returnValue); + return returnValue; } function getErrorType(): string {