From: cloudwalk Date: Thu, 2 Jul 2020 13:37:12 +0000 (+0000) Subject: Create a pointer to globals to reduce instructions needed to deref operand vars X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8c1799cb28a10745836509e202ef6e85df5d5e70;p=xonotic%2Fdarkplaces.git Create a pointer to globals to reduce instructions needed to deref operand vars This should improve performance in debug builds, but is otherwise optimized in release. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12774 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/prvm_exec.c b/prvm_exec.c index d4cf0d83..c82b9e01 100644 --- a/prvm_exec.c +++ b/prvm_exec.c @@ -722,9 +722,9 @@ static void PRVM_StatementCoverageEvent(prvm_prog_t *prog, mfunction_t *func, in # endif #endif -#define OPA ((prvm_eval_t *)&prog->globals.fp[st->operand[0]]) -#define OPB ((prvm_eval_t *)&prog->globals.fp[st->operand[1]]) -#define OPC ((prvm_eval_t *)&prog->globals.fp[st->operand[2]]) +#define OPA ((prvm_eval_t *)&globals[st->operand[0]]) +#define OPB ((prvm_eval_t *)&globals[st->operand[1]]) +#define OPC ((prvm_eval_t *)&globals[st->operand[2]]) extern cvar_t prvm_traceqc; extern cvar_t prvm_statementprofiling; extern qboolean prvm_runawaycheck; @@ -761,6 +761,8 @@ void MVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessag qboolean cached_allowworldwrites = prog->allowworldwrites; unsigned int cached_flag = prog->flag; + prvm_vec_t *globals = prog->globals.fp; + calltime = Sys_DirtyTime(); if (!fnum || fnum >= (unsigned int)prog->numfunctions) @@ -868,6 +870,8 @@ void CLVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessa qboolean cached_allowworldwrites = prog->allowworldwrites; unsigned int cached_flag = prog->flag; + prvm_vec_t *globals = prog->globals.fp; + calltime = Sys_DirtyTime(); if (!fnum || fnum >= (unsigned int)prog->numfunctions) @@ -979,6 +983,8 @@ void PRVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessa qboolean cached_allowworldwrites = prog->allowworldwrites; unsigned int cached_flag = prog->flag; + prvm_vec_t *globals = prog->globals.fp; + calltime = Sys_DirtyTime(); if (!fnum || fnum >= (unsigned int)prog->numfunctions)