~madcapjake/rhi

18a392fa9627f5be3f8e7bd809db0fb59ed082fb — Jake Russo 1 year, 9 months ago 8438450
Fix for execution debug logging
3 files changed, 3 insertions(+), 3 deletions(-)

M internal/vm/primitives.go
M internal/vm/vm.go
M internal/vm/word.go
M internal/vm/primitives.go => internal/vm/primitives.go +1 -1
@@ 119,7 119,7 @@ func (vm *VirtualMachine) unwindToSentinel() error {
			return nil
		}
	}
	return fmt.Errorf("No sentinel found")
	return fmt.Errorf("no sentinel found")
}

// Replace all sub stack values with one final result

M internal/vm/vm.go => internal/vm/vm.go +1 -1
@@ 53,7 53,7 @@ func (vm *VirtualMachine) Execute() {
}

func logAddedToStack(stack []Word, txt string) {
	logStr := fmt.Sprint("Added ", txt, " to stack: [")
	logStr := fmt.Sprintf("▏ %-7s ⇾ [", txt)
	for s := range stack {
		logStr = fmt.Sprint(logStr, " ")
		if s == len(stack)-1 {

M internal/vm/word.go => internal/vm/word.go +1 -1
@@ 123,7 123,7 @@ func WordFromAddress(a int) Word { return Word(VAL_ADDR | uint64(a)) }
func (w Word) isVal(v uint64) bool { return uint64(w)&MASK_ONE == v }

func (w Word) IsFloat() bool   { return uint64(w)&MASK_NAN != MASK_NAN }
func (w Word) IsAddress() bool { return w.isVal(VAL_ADDR) }
func (w Word) IsAddress() bool { return uint64(w)&VAL_ADDR == VAL_ADDR }
func (w Word) IsTrue() bool    { return uint64(w) == VAL_TRUE }
func (w Word) IsFalse() bool   { return uint64(w) == VAL_FALS }
func (w Word) IsBool() bool    { return w.IsTrue() || w.IsFalse() }