diff --git a/SMILEBASIC/VM.d b/SMILEBASIC/VM.d index fd06259..5d4c5cf 100644 --- a/SMILEBASIC/VM.d +++ b/SMILEBASIC/VM.d @@ -173,8 +173,21 @@ class VM setCurrentSlot(value.internalAddress.slot); return; } + dumpStack(stacki + 1); assert(false, format("internal error, compiler bug?(%s)", value)); } + + void dumpStack() + { + dumpStack(stacki); + } + void dumpStack(int stacki) + { + foreach (i; stack[0..stacki]) + { + stderr.writeln(i); + } + } void pushpc() { Value value; @@ -1501,6 +1514,10 @@ class CallBuiltinFunction : Code { vm.stacki -= func.argments.length;// - outcount; } + if (vm.stack[vm.stacki].type == ValueType.Void) + { + vm.dumpStack(); + } ////vm.stacki += outcount; //vm.stacki = old; for(int i = 0; i < result.length; i++) @@ -1510,7 +1527,7 @@ class CallBuiltinFunction : Code } override string toString(VM vm) { - return "callbuiltin " ~ func.name.to!string; + return "callbuiltin argc=" ~ argcount.to!string ~ ", outargc=" ~ outcount.to!string ~ ", name=" ~ func.name.to!string; } } class OnBase : Code