1
0

Add VM.dumpStack

This commit is contained in:
otya128
2016-12-22 22:55:38 +09:00
parent fe20da9827
commit be1473e339

View File

@@ -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