mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-05-31 09:21:36 +00:00
- allow the VM to run on one global stack per thread.
It is utterly pointless to require every function that wants to make a VM call to allocate a new stack first. The allocation overhead doubles the time to set up the call. With one stack, previously allocated memory can be reused. The only important thing is, if this ever gets used in a multithreaded environment to have the stack being declared as thread_local, although for ZDoom this is of no consequence. - eliminated all cases where native code was calling other native code through the VM interface. After scriptifying the game code, only 5 places were left which were quickly eliminated. This was mostly to ensure that the native VM function parameters do not need to be propagated further than absolutely necessary.
This commit is contained in:
parent
47884f8a71
commit
86544086df
23 changed files with 176 additions and 229 deletions
|
@ -148,7 +148,6 @@ bool ACustomInventory::CallStateChain (AActor *actor, FState *state)
|
|||
state->ActionFunc = nullptr;
|
||||
}
|
||||
|
||||
VMFrameStack stack;
|
||||
PPrototype *proto = state->ActionFunc->Proto;
|
||||
VMReturn *wantret;
|
||||
FStateParamInfo stp = { state, STATE_StateChain, PSP_WEAPON };
|
||||
|
@ -184,7 +183,7 @@ bool ACustomInventory::CallStateChain (AActor *actor, FState *state)
|
|||
numret = 2;
|
||||
}
|
||||
}
|
||||
stack.Call(state->ActionFunc, params, state->ActionFunc->ImplicitArgs, wantret, numret);
|
||||
GlobalVMStack.Call(state->ActionFunc, params, state->ActionFunc->ImplicitArgs, wantret, numret);
|
||||
// As long as even one state succeeds, the whole chain succeeds unless aborted below.
|
||||
// A state that wants to jump does not count as "succeeded".
|
||||
if (nextstate == NULL)
|
||||
|
@ -3802,8 +3801,6 @@ static void CheckStopped(AActor *self)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
DECLARE_ACTION(A_RestoreSpecialPosition)
|
||||
|
||||
enum RS_Flags
|
||||
{
|
||||
RSF_FOG=1,
|
||||
|
@ -3822,7 +3819,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Respawn)
|
|||
self->flags |= MF_SOLID;
|
||||
self->Height = self->GetDefault()->Height;
|
||||
self->radius = self->GetDefault()->radius;
|
||||
CALL_ACTION(A_RestoreSpecialPosition, self);
|
||||
self->RestoreSpecialPosition();
|
||||
|
||||
if (flags & RSF_TELEFRAG)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue