- Added the TAIL instruction to perform a CALL and a RET in the same instruction. The called

function will pass its results directly to this function's caller. Eventually, this should
  be changed to do a proper tail call for scripted functions.

SVN r3769 (scripting)
This commit is contained in:
Randy Heit 2012-07-17 04:06:28 +00:00
commit e1a2f3b546
5 changed files with 58 additions and 9 deletions

View file

@ -300,8 +300,7 @@ static void FinishThingdef()
p->Emit(&buildit);
delete p;
}
buildit.Emit(OP_CALL_K, buildit.GetConstantAddress(tcall->Function, ATAG_OBJECT), NAP + j, 0);
buildit.Emit(OP_RET, 0, REGT_NIL, 0);
buildit.Emit(OP_TAIL_K, buildit.GetConstantAddress(tcall->Function, ATAG_OBJECT), NAP + j, 0);
VMScriptFunction *sfunc = buildit.MakeFunction();
sfunc->NumArgs = NAP;
func = sfunc;