mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 15:52:09 +00:00
- inline VBTL opcode
- remove old META and CLSS implementations
This commit is contained in:
parent
9ef7212f54
commit
6f397854d0
2 changed files with 3 additions and 55 deletions
|
@ -24,13 +24,6 @@ void JitCompiler::EmitVTBL()
|
||||||
// This instruction is handled in the CALL/CALL_K instruction following it
|
// This instruction is handled in the CALL/CALL_K instruction following it
|
||||||
}
|
}
|
||||||
|
|
||||||
static VMFunction *GetVirtual(DObject *o, int c)
|
|
||||||
{
|
|
||||||
auto p = o->GetClass();
|
|
||||||
assert(c < (int)p->Virtuals.Size());
|
|
||||||
return p->Virtuals[c];
|
|
||||||
}
|
|
||||||
|
|
||||||
void JitCompiler::EmitVtbl(const VMOP *op)
|
void JitCompiler::EmitVtbl(const VMOP *op)
|
||||||
{
|
{
|
||||||
int a = op->a;
|
int a = op->a;
|
||||||
|
@ -41,12 +34,9 @@ void JitCompiler::EmitVtbl(const VMOP *op)
|
||||||
cc.test(regA[b], regA[b]);
|
cc.test(regA[b], regA[b]);
|
||||||
cc.jz(label);
|
cc.jz(label);
|
||||||
|
|
||||||
auto result = newResultIntPtr();
|
cc.mov(regA[a], asmjit::x86::qword_ptr(regA[b], myoffsetof(DObject, Class)));
|
||||||
auto call = CreateCall<VMFunction*, DObject*, int>(GetVirtual);
|
cc.mov(regA[a], asmjit::x86::qword_ptr(regA[a], myoffsetof(PClass, Virtuals) + myoffsetof(FArray, Array)));
|
||||||
call->setRet(0, result);
|
cc.mov(regA[a], asmjit::x86::qword_ptr(regA[a], c * (int)sizeof(void*)));
|
||||||
call->setArg(0, regA[b]);
|
|
||||||
call->setArg(1, asmjit::Imm(c));
|
|
||||||
cc.mov(regA[a], result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitCompiler::EmitCALL()
|
void JitCompiler::EmitCALL()
|
||||||
|
|
|
@ -77,8 +77,6 @@ void JitCompiler::EmitLFP()
|
||||||
cc.lea(regA[A], asmjit::x86::ptr(vmframe, offsetExtra));
|
cc.lea(regA[A], asmjit::x86::ptr(vmframe, offsetExtra));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1 // Inline implementation
|
|
||||||
|
|
||||||
void JitCompiler::EmitMETA()
|
void JitCompiler::EmitMETA()
|
||||||
{
|
{
|
||||||
auto label = EmitThrowExceptionLabel(X_READ_NIL);
|
auto label = EmitThrowExceptionLabel(X_READ_NIL);
|
||||||
|
@ -97,46 +95,6 @@ void JitCompiler::EmitCLSS()
|
||||||
cc.mov(regA[A], asmjit::x86::qword_ptr(regA[B], myoffsetof(DObject, Class)));
|
cc.mov(regA[A], asmjit::x86::qword_ptr(regA[B], myoffsetof(DObject, Class)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static uint8_t *GetClassMeta(DObject *o)
|
|
||||||
{
|
|
||||||
return o->GetClass()->Meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
void JitCompiler::EmitMETA()
|
|
||||||
{
|
|
||||||
auto label = EmitThrowExceptionLabel(X_READ_NIL);
|
|
||||||
cc.test(regA[B], regA[B]);
|
|
||||||
cc.je(label);
|
|
||||||
|
|
||||||
auto result = newResultIntPtr();
|
|
||||||
auto call = CreateCall<uint8_t*, DObject*>(GetClassMeta);
|
|
||||||
call->setRet(0, result);
|
|
||||||
call->setArg(0, regA[B]);
|
|
||||||
cc.mov(regA[A], result);
|
|
||||||
}
|
|
||||||
|
|
||||||
static PClass *GetClass(DObject *o)
|
|
||||||
{
|
|
||||||
return o->GetClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
void JitCompiler::EmitCLSS()
|
|
||||||
{
|
|
||||||
auto label = EmitThrowExceptionLabel(X_READ_NIL);
|
|
||||||
cc.test(regA[B], regA[B]);
|
|
||||||
cc.je(label);
|
|
||||||
|
|
||||||
auto result = newResultIntPtr();
|
|
||||||
auto call = CreateCall<PClass*, DObject*>(GetClass);
|
|
||||||
call->setRet(0, result);
|
|
||||||
call->setArg(0, regA[B]);
|
|
||||||
cc.mov(regA[A], result);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Load from memory. rA = *(rB + rkC)
|
// Load from memory. rA = *(rB + rkC)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue