- Add parameter tracking to VMBuilder::Emit().

SVN r1910 (scripting)
This commit is contained in:
Randy Heit 2009-10-14 02:39:13 +00:00
parent 3001708d16
commit 4fa94390d0
2 changed files with 11 additions and 3 deletions

View file

@ -427,6 +427,14 @@ size_t VMFunctionBuilder::Emit(int opcode, int opa, int opb, int opc)
code[1] = opa; code[1] = opa;
code[2] = opb; code[2] = opb;
code[3] = opc; code[3] = opc;
if (opcode == OP_PARAM)
{
ParamChange(1);
}
else if (opcode == OP_CALL || opcode == OP_CALL_K)
{
ParamChange(-opb);
}
return loc / 4; return loc / 4;
} }

View file

@ -47,9 +47,6 @@ public:
void FillAddressConstants(FVoidObj *konst, VM_ATAG *tags); void FillAddressConstants(FVoidObj *konst, VM_ATAG *tags);
void FillStringConstants(FString *strings); void FillStringConstants(FString *strings);
// PARAM increases ActiveParam; CALL decreases it.
void ParamChange(int delta);
// Track available registers. // Track available registers.
RegAvailability Registers[4]; RegAvailability Registers[4];
@ -77,6 +74,9 @@ private:
int ActiveParam; int ActiveParam;
TArray<VM_UBYTE> Code; TArray<VM_UBYTE> Code;
// PARAM increases ActiveParam; CALL decreases it.
void ParamChange(int delta);
}; };
#endif #endif