]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Create a pointer to globals to reduce instructions needed to deref operand vars
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 2 Jul 2020 13:37:12 +0000 (13:37 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 2 Jul 2020 13:37:12 +0000 (13:37 +0000)
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

index d4cf0d830610c8f59828bc2e60fcf3fef8f8ed54..c82b9e01488e3beadb71976658ed0cc4d310f101 100644 (file)
@@ -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)