1
0

位置情報を記録するようにした

This commit is contained in:
otya128
2015-08-30 12:33:54 +09:00
parent 9be57613f4
commit 87e86b6219
6 changed files with 196 additions and 100 deletions

View File

@@ -23,12 +23,6 @@ struct VMVariable
this.index = index;
}
}
struct SourceLocation
{
int line;//何行目
int pos;//何文字目
byte slot;//スロット
}
class VM
{
DataTable globalDataTable;
@@ -43,8 +37,9 @@ class VM
int[wstring] globalLabel;
int bp;
PetitComputer petitcomputer;
DebugInfo debugInfo;
this(Code[] code, int len, VMVariable[wstring] globalTable, Function[wstring] functions, DataTable gdt/*GNU Debugging Tools*/,
int[wstring] globalLabel)
int[wstring] globalLabel, DebugInfo dinfo)
{
this.code = code;
this.stack = new Value[16384];
@@ -58,6 +53,7 @@ class VM
this.functions = functions;
this.globalDataTable = gdt;
this.globalLabel = globalLabel;
this.debugInfo = dinfo;
}
Code getCurrent()
{
@@ -75,6 +71,10 @@ class VM
stderr.writeln("CompilerBug?:stack");
}
}
SourceLocation currentLocation()
{
return debugInfo.getLocationByAddress(pc);
}
void init(PetitComputer petitcomputer)
{
this.petitcomputer = petitcomputer;