mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-22 11:21:09 +00:00
- fix missing line number for the function throwing the exception and remove the duplicate call stack line
This commit is contained in:
parent
d80d4bb228
commit
4d160c8cd1
3 changed files with 39 additions and 24 deletions
|
@ -156,6 +156,8 @@ asmjit::CCFunc *JitCompiler::Codegen()
|
||||||
LineInfo[j] = info;
|
LineInfo[j] = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::stable_sort(LineInfo.begin(), LineInfo.end(), [](const JitLineInfo &a, const JitLineInfo &b) { return a.InstructionIndex < b.InstructionIndex; });
|
||||||
|
|
||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,17 +446,15 @@ void JitCompiler::EmitNullPointerThrow(int index, EVMAbortException reason)
|
||||||
cc.je(label);
|
cc.je(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitCompiler::ThrowException(VMScriptFunction *func, VMOP *line, int reason)
|
void JitCompiler::ThrowException(int reason)
|
||||||
{
|
{
|
||||||
ThrowAbortException(func, line, (EVMAbortException)reason, nullptr);
|
ThrowAbortException((EVMAbortException)reason, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitCompiler::EmitThrowException(EVMAbortException reason)
|
void JitCompiler::EmitThrowException(EVMAbortException reason)
|
||||||
{
|
{
|
||||||
auto call = CreateCall<void, VMScriptFunction *, VMOP *, int>(&JitCompiler::ThrowException);
|
auto call = CreateCall<void, int>(&JitCompiler::ThrowException);
|
||||||
call->setArg(0, asmjit::imm_ptr(sfunc));
|
call->setArg(0, asmjit::imm(reason));
|
||||||
call->setArg(1, asmjit::imm_ptr(pc));
|
|
||||||
call->setArg(2, asmjit::imm(reason));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
asmjit::Label JitCompiler::EmitThrowExceptionLabel(EVMAbortException reason)
|
asmjit::Label JitCompiler::EmitThrowExceptionLabel(EVMAbortException reason)
|
||||||
|
@ -464,6 +464,12 @@ asmjit::Label JitCompiler::EmitThrowExceptionLabel(EVMAbortException reason)
|
||||||
cc.bind(label);
|
cc.bind(label);
|
||||||
EmitThrowException(reason);
|
EmitThrowException(reason);
|
||||||
cc.setCursor(cursor);
|
cc.setCursor(cursor);
|
||||||
|
|
||||||
|
JitLineInfo info;
|
||||||
|
info.Label = label;
|
||||||
|
info.LineNumber = sfunc->PCToLine(pc);
|
||||||
|
LineInfo.Push(info);
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -330,15 +330,18 @@ void JitCompiler::EmitBOUND()
|
||||||
auto cursor = cc.getCursor();
|
auto cursor = cc.getCursor();
|
||||||
auto label = cc.newLabel();
|
auto label = cc.newLabel();
|
||||||
cc.bind(label);
|
cc.bind(label);
|
||||||
auto call = CreateCall<void, VMScriptFunction *, VMOP *, int, int>(&JitCompiler::ThrowArrayOutOfBounds);
|
auto call = CreateCall<void, int, int>(&JitCompiler::ThrowArrayOutOfBounds);
|
||||||
call->setArg(0, asmjit::imm_ptr(sfunc));
|
call->setArg(0, regD[A]);
|
||||||
call->setArg(1, asmjit::imm_ptr(pc));
|
call->setArg(1, asmjit::imm(BC));
|
||||||
call->setArg(2, regD[A]);
|
|
||||||
call->setArg(3, asmjit::imm(BC));
|
|
||||||
cc.setCursor(cursor);
|
cc.setCursor(cursor);
|
||||||
|
|
||||||
cc.cmp(regD[A], (int)BC);
|
cc.cmp(regD[A], (int)BC);
|
||||||
cc.jae(label);
|
cc.jae(label);
|
||||||
|
|
||||||
|
JitLineInfo info;
|
||||||
|
info.Label = label;
|
||||||
|
info.LineNumber = sfunc->PCToLine(pc);
|
||||||
|
LineInfo.Push(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitCompiler::EmitBOUND_K()
|
void JitCompiler::EmitBOUND_K()
|
||||||
|
@ -346,15 +349,18 @@ void JitCompiler::EmitBOUND_K()
|
||||||
auto cursor = cc.getCursor();
|
auto cursor = cc.getCursor();
|
||||||
auto label = cc.newLabel();
|
auto label = cc.newLabel();
|
||||||
cc.bind(label);
|
cc.bind(label);
|
||||||
auto call = CreateCall<void, VMScriptFunction *, VMOP *, int, int>(&JitCompiler::ThrowArrayOutOfBounds);
|
auto call = CreateCall<void, int, int>(&JitCompiler::ThrowArrayOutOfBounds);
|
||||||
call->setArg(0, asmjit::imm_ptr(sfunc));
|
call->setArg(0, regD[A]);
|
||||||
call->setArg(1, asmjit::imm_ptr(pc));
|
call->setArg(1, asmjit::imm(konstd[BC]));
|
||||||
call->setArg(2, regD[A]);
|
|
||||||
call->setArg(3, asmjit::imm(konstd[BC]));
|
|
||||||
cc.setCursor(cursor);
|
cc.setCursor(cursor);
|
||||||
|
|
||||||
cc.cmp(regD[A], (int)konstd[BC]);
|
cc.cmp(regD[A], (int)konstd[BC]);
|
||||||
cc.jae(label);
|
cc.jae(label);
|
||||||
|
|
||||||
|
JitLineInfo info;
|
||||||
|
info.Label = label;
|
||||||
|
info.LineNumber = sfunc->PCToLine(pc);
|
||||||
|
LineInfo.Push(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitCompiler::EmitBOUND_R()
|
void JitCompiler::EmitBOUND_R()
|
||||||
|
@ -362,18 +368,21 @@ void JitCompiler::EmitBOUND_R()
|
||||||
auto cursor = cc.getCursor();
|
auto cursor = cc.getCursor();
|
||||||
auto label = cc.newLabel();
|
auto label = cc.newLabel();
|
||||||
cc.bind(label);
|
cc.bind(label);
|
||||||
auto call = CreateCall<void, VMScriptFunction *, VMOP *, int, int>(&JitCompiler::ThrowArrayOutOfBounds);
|
auto call = CreateCall<void, int, int>(&JitCompiler::ThrowArrayOutOfBounds);
|
||||||
call->setArg(0, asmjit::imm_ptr(sfunc));
|
call->setArg(0, regD[A]);
|
||||||
call->setArg(1, asmjit::imm_ptr(pc));
|
call->setArg(1, regD[B]);
|
||||||
call->setArg(2, regD[A]);
|
|
||||||
call->setArg(3, regD[B]);
|
|
||||||
cc.setCursor(cursor);
|
cc.setCursor(cursor);
|
||||||
|
|
||||||
cc.cmp(regD[A], regD[B]);
|
cc.cmp(regD[A], regD[B]);
|
||||||
cc.jae(label);
|
cc.jae(label);
|
||||||
|
|
||||||
|
JitLineInfo info;
|
||||||
|
info.Label = label;
|
||||||
|
info.LineNumber = sfunc->PCToLine(pc);
|
||||||
|
LineInfo.Push(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitCompiler::ThrowArrayOutOfBounds(VMScriptFunction *func, VMOP *line, int index, int size)
|
void JitCompiler::ThrowArrayOutOfBounds(int index, int size)
|
||||||
{
|
{
|
||||||
if (index >= size)
|
if (index >= size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -219,8 +219,8 @@ private:
|
||||||
void EmitThrowException(EVMAbortException reason);
|
void EmitThrowException(EVMAbortException reason);
|
||||||
asmjit::Label EmitThrowExceptionLabel(EVMAbortException reason);
|
asmjit::Label EmitThrowExceptionLabel(EVMAbortException reason);
|
||||||
|
|
||||||
static void ThrowArrayOutOfBounds(VMScriptFunction *func, VMOP *line, int index, int size);
|
static void ThrowArrayOutOfBounds(int index, int size);
|
||||||
static void ThrowException(VMScriptFunction *func, VMOP *line, int reason);
|
static void ThrowException(int reason);
|
||||||
|
|
||||||
asmjit::X86Gp CheckRegD(int r0, int r1);
|
asmjit::X86Gp CheckRegD(int r0, int r1);
|
||||||
asmjit::X86Xmm CheckRegF(int r0, int r1);
|
asmjit::X86Xmm CheckRegF(int r0, int r1);
|
||||||
|
|
Loading…
Reference in a new issue