mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
Restore "direct" call optimization for DECORATE
This commit is contained in:
parent
ade780d810
commit
b1098ede93
3 changed files with 18 additions and 22 deletions
|
@ -277,7 +277,7 @@ static void FinishThingdef()
|
||||||
|
|
||||||
// Can we call this function directly without wrapping it in an
|
// Can we call this function directly without wrapping it in an
|
||||||
// anonymous function? e.g. Are we passing any parameters to it?
|
// anonymous function? e.g. Are we passing any parameters to it?
|
||||||
func = NULL;//tcall->Code->GetDirectFunction();
|
func = tcall->Code->GetDirectFunction();
|
||||||
if (func == NULL)
|
if (func == NULL)
|
||||||
{
|
{
|
||||||
FCompileContext ctx(tcall->ActorClass);
|
FCompileContext ctx(tcall->ActorClass);
|
||||||
|
|
|
@ -835,9 +835,9 @@ public:
|
||||||
FxExpression *Resolve(FCompileContext&);
|
FxExpression *Resolve(FCompileContext&);
|
||||||
ExpEmit Emit(VMFunctionBuilder *build);
|
ExpEmit Emit(VMFunctionBuilder *build);
|
||||||
ExpEmit Emit(VMFunctionBuilder *build, bool tailcall);
|
ExpEmit Emit(VMFunctionBuilder *build, bool tailcall);
|
||||||
unsigned GetArgCount() { return ArgList == NULL ? 0 : ArgList->Size(); }
|
unsigned GetArgCount() const { return ArgList == NULL ? 0 : ArgList->Size(); }
|
||||||
VMFunction *GetVMFunction() { return Function->Variants[0].Implementation; }
|
VMFunction *GetVMFunction() const { return Function->Variants[0].Implementation; }
|
||||||
VMFunction *GetDirectFunction();
|
bool IsDirectFunction();
|
||||||
};
|
};
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -891,6 +891,7 @@ public:
|
||||||
FxReturnStatement(FxVMFunctionCall *call, const FScriptPosition &pos);
|
FxReturnStatement(FxVMFunctionCall *call, const FScriptPosition &pos);
|
||||||
FxExpression *Resolve(FCompileContext&);
|
FxExpression *Resolve(FCompileContext&);
|
||||||
ExpEmit Emit(VMFunctionBuilder *build);
|
ExpEmit Emit(VMFunctionBuilder *build);
|
||||||
|
VMFunction *GetDirectFunction();
|
||||||
};
|
};
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -3202,24 +3202,6 @@ ExpEmit FxVMFunctionCall::Emit(VMFunctionBuilder *build, bool tailcall)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// FxVMFunctionCall :: GetDirectFunction
|
|
||||||
//
|
|
||||||
// If the function is not passed any explicit arguments, returns the
|
|
||||||
// function. Otherwise returns NULL.
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
VMFunction *FxVMFunctionCall::GetDirectFunction()
|
|
||||||
{
|
|
||||||
if (GetArgCount() == 0)
|
|
||||||
{
|
|
||||||
return GetVMFunction();
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -3505,6 +3487,19 @@ ExpEmit FxReturnStatement::Emit(VMFunctionBuilder *build)
|
||||||
return ExpEmit();
|
return ExpEmit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VMFunction *FxReturnStatement::GetDirectFunction()
|
||||||
|
{
|
||||||
|
// If this return statement calls a function with no arguments,
|
||||||
|
// then it can be a "direct" function. That is, the DECORATE
|
||||||
|
// definition can call that function directly without wrapping
|
||||||
|
// it inside VM code.
|
||||||
|
if (Call != NULL && Call->GetArgCount() == 0)
|
||||||
|
{
|
||||||
|
return Call->GetVMFunction();
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue