- 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();
LatestLine = { 0, (ptrdiff_t)0, -1, {} };
int lastLine = -1;
pc = sfunc->Code;
auto end = pc + sfunc->CodeSize;
@ -108,14 +108,17 @@ asmjit::CCFunc *JitCompiler::Codegen()
op = pc->op;
int curLine = sfunc->PCToLine(pc);
auto label = cc.newLabel ();
cc.bind (label);
LatestLine.Label = label;
if (curLine != LatestLine.LineNumber)
if (curLine != lastLine)
{
LatestLine.LineNumber = curLine;
LatestLine.VMInstructionIndex = i;
LineInfo.Push (LatestLine);
lastLine = curLine;
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)

View File

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