bunch of changes
Some checks failed
Build / build (push) Failing after 5m54s
Publish Image / publish (push) Failing after 35s
Test / build (push) Failing after 5m46s

This commit is contained in:
Chuck Smith
2024-03-28 17:19:23 -04:00
parent 244b71d245
commit fb0cebaf56
16 changed files with 174 additions and 320 deletions

View File

@@ -13,6 +13,7 @@ import (
"os"
"path/filepath"
"strings"
"time"
"unicode"
)
@@ -201,22 +202,16 @@ func (vm *VM) LastPoppedStackElem() object.Object {
}
func (vm *VM) Run() error {
var n int
var ip int
var ins code.Instructions
var op code.Opcode
if vm.Debug {
log.Printf(
"%-25s %-20s\n",
fmt.Sprintf(
"%04d %s", ip,
strings.Split(ins[ip:].String(), "\n")[0][4:],
),
fmt.Sprintf(
"[ip=%02d fp=%02d, sp=%02d]",
ip, vm.fp-1, vm.sp,
),
)
start := time.Now()
defer func() {
log.Printf("%d instructions executed in %s", n, time.Now().Sub(start))
}()
}
for vm.frame.ip < len(vm.frame.Instructions())-1 {
@@ -487,6 +482,7 @@ func (vm *VM) Run() error {
}
if vm.Debug {
n++
log.Printf(
"%-25s [ip=%02d fp=%02d, sp=%02d]",
"", ip, vm.fp-1, vm.sp,