Comment out actor and player versions of gamevar manipulation opcodes as they aren't performant with our current switch-based method of processing instructions. This also tweaks the beginning of VM_Execute() to gain a little more performance.

git-svn-id: https://svn.eduke32.com/eduke32@7268 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-12-15 01:38:27 +00:00
parent fad17a83c0
commit d2f16606c5

View file

@ -74,16 +74,6 @@ GAMEEXEC_STATIC void VM_Execute(native_t loop);
# include "gamestructures.cpp" # include "gamestructures.cpp"
#endif #endif
// be careful when changing this--the assignment used as a condition doubles as a null pointer check
#define VM_CONDITIONAL(xxx) \
{ \
if ((xxx) || ((insptr = (intptr_t *)insptr[1]) && ((*insptr & VM_INSTMASK) == CON_ELSE))) \
{ \
insptr += 2; \
VM_Execute(0); \
} \
}
#if !defined LUNATIC #if !defined LUNATIC
void VM_ScriptInfo(intptr_t const *ptr, int range) void VM_ScriptInfo(intptr_t const *ptr, int range)
{ {
@ -1266,15 +1256,26 @@ void Screen_Play(void)
} }
#if !defined LUNATIC #if !defined LUNATIC
GAMEEXEC_STATIC void VM_Execute(native_t loop) // be careful when changing this--the assignment used as a condition doubles as a null pointer check
#define VM_CONDITIONAL(xxx) \
{ \
if ((xxx) || ((insptr = (intptr_t *)insptr[1]) && ((*insptr & VM_INSTMASK) == CON_ELSE))) \
{ \
insptr += 2; \
VM_Execute(0); \
} \
}
GAMEEXEC_STATIC void VM_Execute(native_t const poop)
{ {
native_t tw; native_t loop = poop;
auto &p = *(vm.pPlayer);
do do
{ {
next_instruction: next_instruction:
tw = *insptr; native_t tw = *insptr;
// set up "p" in between tw and g_errorLineNum to avoid read after write penalty
auto &p = *(vm.pPlayer);
g_errorLineNum = tw >> 12; g_errorLineNum = tw >> 12;
g_tw = tw &= VM_INSTMASK; g_tw = tw &= VM_INSTMASK;
@ -1295,15 +1296,6 @@ next_instruction:
} }
else switch (tw) else switch (tw)
{ {
case CON_STATE:
{
auto tempscrptr = &insptr[2];
insptr = (intptr_t *)insptr[1];
VM_Execute(1);
insptr = tempscrptr;
}
continue;
case CON_IFVARE_GLOBAL: case CON_IFVARE_GLOBAL:
insptr++; insptr++;
tw = aGameVars[*insptr++].global; tw = aGameVars[*insptr++].global;
@ -1425,6 +1417,15 @@ next_instruction:
aGameVars[*insptr].global >>= insptr[1]; aGameVars[*insptr].global >>= insptr[1];
insptr += 2; insptr += 2;
continue; continue;
case CON_STATE:
{
auto tempscrptr = &insptr[2];
insptr = (intptr_t *)insptr[1];
VM_Execute(1);
insptr = tempscrptr;
}
continue;
/*
case CON_IFVARE_ACTOR: case CON_IFVARE_ACTOR:
insptr++; insptr++;
@ -1669,6 +1670,7 @@ next_instruction:
aGameVars[*insptr].pValues[vm.playerNum & (MAXPLAYERS-1)] >>= insptr[1]; aGameVars[*insptr].pValues[vm.playerNum & (MAXPLAYERS-1)] >>= insptr[1];
insptr += 2; insptr += 2;
continue; continue;
*/
case CON_WHILEVARN_GLOBAL: case CON_WHILEVARN_GLOBAL:
{ {