mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-16 09:31:14 +00:00
- create a very basic OP_IJMP implementation
This commit is contained in:
parent
812a4290b1
commit
e0f0511d29
2 changed files with 21 additions and 6 deletions
|
@ -144,11 +144,6 @@ bool JitCompiler::CanJit(VMScriptFunction *sfunc)
|
|||
int size = sfunc->CodeSize;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
// Functions not implemented at all yet:
|
||||
|
||||
if (sfunc->Code[i].op == OP_IJMP)
|
||||
return false;
|
||||
|
||||
// Partially implemented functions:
|
||||
|
||||
auto pc = sfunc->Code + i;
|
||||
|
|
|
@ -25,7 +25,27 @@ void JitCompiler::EmitJMP()
|
|||
|
||||
void JitCompiler::EmitIJMP()
|
||||
{
|
||||
I_FatalError("EmitIJMP not implemented\n");
|
||||
// This uses the whole function as potential jump targets. Can the range be reduced?
|
||||
|
||||
int i = (int)(ptrdiff_t)(pc - sfunc->Code);
|
||||
auto val = cc.newInt32();
|
||||
cc.mov(val, regD[A]);
|
||||
cc.add(val, i + (int)BCs + 1);
|
||||
|
||||
int size = sfunc->CodeSize;
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
if (sfunc->Code[i].op == OP_JMP)
|
||||
{
|
||||
int target = i + JMPOFS(&sfunc->Code[i]) + 1;
|
||||
|
||||
cc.cmp(val, i);
|
||||
cc.je(labels[target]);
|
||||
}
|
||||
}
|
||||
|
||||
// This should never happen. It means we are jumping to something that is not a JMP instruction!
|
||||
EmitThrowException(X_OTHER);
|
||||
}
|
||||
|
||||
void JitCompiler::EmitVTBL()
|
||||
|
|
Loading…
Reference in a new issue