- avoid creating labels when they are not used

- remove variable from class as it is only used locally
- set default values in the class
- remove unused field
This commit is contained in:
Magnus Norddahl 2018-12-19 01:12:57 +01:00
parent 650e6a9c1b
commit e296d2819b
2 changed files with 13 additions and 13 deletions

View file

@ -98,7 +98,7 @@ asmjit::CCFunc *JitCompiler::Codegen()
{ {
Setup(); Setup();
LatestLine = { 0, (ptrdiff_t)0, -1, {} }; int lastLine = -1;
pc = sfunc->Code; pc = sfunc->Code;
auto end = pc + sfunc->CodeSize; auto end = pc + sfunc->CodeSize;
@ -108,14 +108,17 @@ asmjit::CCFunc *JitCompiler::Codegen()
op = pc->op; op = pc->op;
int curLine = sfunc->PCToLine(pc); int curLine = sfunc->PCToLine(pc);
auto label = cc.newLabel (); if (curLine != lastLine)
cc.bind (label);
LatestLine.Label = label;
if (curLine != LatestLine.LineNumber)
{ {
LatestLine.LineNumber = curLine; lastLine = curLine;
LatestLine.VMInstructionIndex = i;
LineInfo.Push (LatestLine); auto label = cc.newLabel();
cc.bind(label);
JitLineInfo info;
info.Label = label;
info.LineNumber = curLine;
LineInfo.Push(info);
} }
if (op != OP_PARAM && op != OP_PARAMI && op != OP_VTBL) if (op != OP_PARAM && op != OP_PARAMI && op != OP_VTBL)

View file

@ -27,9 +27,8 @@ extern int VMCalls[10];
struct JitLineInfo struct JitLineInfo
{ {
uint16_t VMInstructionIndex; ptrdiff_t InstructionIndex = 0;
ptrdiff_t InstructionIndex; int32_t LineNumber = -1;
int32_t LineNumber;
asmjit::Label Label; asmjit::Label Label;
}; };
@ -270,8 +269,6 @@ private:
TArray<asmjit::X86Gp> regA; TArray<asmjit::X86Gp> regA;
TArray<asmjit::X86Gp> regS; TArray<asmjit::X86Gp> regS;
JitLineInfo LatestLine;
struct OpcodeLabel struct OpcodeLabel
{ {
asmjit::CBNode *cursor = nullptr; asmjit::CBNode *cursor = nullptr;