mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- fix wrong registers getting saved when passing parameters by reference
This commit is contained in:
parent
d643fbd077
commit
367b60d88c
1 changed files with 11 additions and 10 deletions
|
@ -238,13 +238,14 @@ void JitCompiler::StoreInOuts(int b)
|
||||||
for (unsigned int i = ParamOpcodes.Size() - b; i < ParamOpcodes.Size(); i++)
|
for (unsigned int i = ParamOpcodes.Size() - b; i < ParamOpcodes.Size(); i++)
|
||||||
{
|
{
|
||||||
asmjit::X86Gp stackPtr;
|
asmjit::X86Gp stackPtr;
|
||||||
|
auto c = ParamOpcodes[i]->c;
|
||||||
switch (ParamOpcodes[i]->b)
|
switch (ParamOpcodes[i]->b)
|
||||||
{
|
{
|
||||||
case REGT_INT | REGT_ADDROF:
|
case REGT_INT | REGT_ADDROF:
|
||||||
stackPtr = newTempIntPtr();
|
stackPtr = newTempIntPtr();
|
||||||
cc.mov(stackPtr, frameD);
|
cc.mov(stackPtr, frameD);
|
||||||
cc.add(stackPtr, (int)(C * sizeof(int32_t)));
|
cc.add(stackPtr, (int)(c * sizeof(int32_t)));
|
||||||
cc.mov(x86::dword_ptr(stackPtr), regD[C]);
|
cc.mov(x86::dword_ptr(stackPtr), regD[c]);
|
||||||
break;
|
break;
|
||||||
case REGT_STRING | REGT_ADDROF:
|
case REGT_STRING | REGT_ADDROF:
|
||||||
// We don't have to do anything in this case. String values are never moved to virtual registers.
|
// We don't have to do anything in this case. String values are never moved to virtual registers.
|
||||||
|
@ -252,25 +253,25 @@ void JitCompiler::StoreInOuts(int b)
|
||||||
case REGT_POINTER | REGT_ADDROF:
|
case REGT_POINTER | REGT_ADDROF:
|
||||||
stackPtr = newTempIntPtr();
|
stackPtr = newTempIntPtr();
|
||||||
cc.mov(stackPtr, frameA);
|
cc.mov(stackPtr, frameA);
|
||||||
cc.add(stackPtr, (int)(C * sizeof(void*)));
|
cc.add(stackPtr, (int)(c * sizeof(void*)));
|
||||||
cc.mov(x86::ptr(stackPtr), regA[C]);
|
cc.mov(x86::ptr(stackPtr), regA[c]);
|
||||||
break;
|
break;
|
||||||
case REGT_FLOAT | REGT_ADDROF:
|
case REGT_FLOAT | REGT_ADDROF:
|
||||||
stackPtr = newTempIntPtr();
|
stackPtr = newTempIntPtr();
|
||||||
cc.mov(stackPtr, frameF);
|
cc.mov(stackPtr, frameF);
|
||||||
cc.add(stackPtr, (int)(C * sizeof(double)));
|
cc.add(stackPtr, (int)(c * sizeof(double)));
|
||||||
cc.movsd(x86::qword_ptr(stackPtr), regF[C]);
|
cc.movsd(x86::qword_ptr(stackPtr), regF[c]);
|
||||||
|
|
||||||
// When passing the address to a float we don't know if the receiving function will treat it as float, vec2 or vec3.
|
// When passing the address to a float we don't know if the receiving function will treat it as float, vec2 or vec3.
|
||||||
if ((unsigned int)C + 1 < regF.Size())
|
if ((unsigned int)c + 1 < regF.Size())
|
||||||
{
|
{
|
||||||
cc.add(stackPtr, (int)sizeof(double));
|
cc.add(stackPtr, (int)sizeof(double));
|
||||||
cc.movsd(x86::qword_ptr(stackPtr), regF[C + 1]);
|
cc.movsd(x86::qword_ptr(stackPtr), regF[c + 1]);
|
||||||
}
|
}
|
||||||
if ((unsigned int)C + 2 < regF.Size())
|
if ((unsigned int)c + 2 < regF.Size())
|
||||||
{
|
{
|
||||||
cc.add(stackPtr, (int)sizeof(double));
|
cc.add(stackPtr, (int)sizeof(double));
|
||||||
cc.movsd(x86::qword_ptr(stackPtr), regF[C + 2]);
|
cc.movsd(x86::qword_ptr(stackPtr), regF[c + 2]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue