From 8c1799cb28a10745836509e202ef6e85df5d5e70 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Thu, 2 Jul 2020 13:37:12 +0000 Subject: [PATCH] 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 --- prvm_exec.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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) -- 2.39.2