2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 char *prvm_opnames[] =
113 char *PRVM_GlobalString (int ofs);
114 char *PRVM_GlobalStringNoContents (int ofs);
115 extern ddef_t *PRVM_ED_FieldAtOfs(int ofs);
118 //=============================================================================
125 extern cvar_t prvm_statementprofiling;
126 void PRVM_PrintStatement (dstatement_t *s)
129 int opnum = (int)(s - prog->statements);
131 Con_Printf("s%i: ", opnum);
132 if( prog->statement_linenums )
133 Con_Printf( "%s:%i: ", PRVM_GetString( prog->xfunction->s_file ), prog->statement_linenums[ opnum ] );
135 if (prvm_statementprofiling.integer)
136 Con_Printf("%7.0f ", prog->statement_profile[s - prog->statements]);
138 if ( (unsigned)s->op < sizeof(prvm_opnames)/sizeof(prvm_opnames[0]))
140 Con_Printf("%s ", prvm_opnames[s->op]);
141 i = strlen(prvm_opnames[s->op]);
142 // don't count a preceding color tag when padding the name
143 if (prvm_opnames[s->op][0] == STRING_COLOR_TAG)
148 if (s->op == OP_IF || s->op == OP_IFNOT)
149 Con_Printf("%s, s%i",PRVM_GlobalString((unsigned short) s->a),(signed short)s->b + opnum);
150 else if (s->op == OP_GOTO)
151 Con_Printf("s%i",(signed short)s->a + opnum);
152 else if ( (unsigned)(s->op - OP_STORE_F) < 6)
154 Con_Print(PRVM_GlobalString((unsigned short) s->a));
156 Con_Print(PRVM_GlobalStringNoContents((unsigned short) s->b));
158 else if (s->op == OP_ADDRESS || (unsigned)(s->op - OP_LOAD_F) < 6)
161 Con_Print(PRVM_GlobalString((unsigned short) s->a));
165 Con_Print(PRVM_GlobalStringNoContents((unsigned short) s->b));
170 Con_Print(PRVM_GlobalStringNoContents((unsigned short) s->c));
176 Con_Print(PRVM_GlobalString((unsigned short) s->a));
180 Con_Print(PRVM_GlobalString((unsigned short) s->b));
185 Con_Print(PRVM_GlobalStringNoContents((unsigned short) s->c));
191 void PRVM_PrintFunctionStatements (const char *name)
193 int i, firststatement, endstatement;
195 func = PRVM_ED_FindFunction (name);
198 Con_Printf("%s progs: no function named %s\n", PRVM_NAME, name);
201 firststatement = func->first_statement;
202 if (firststatement < 0)
204 Con_Printf("%s progs: function %s is builtin #%i\n", PRVM_NAME, name, -firststatement);
208 // find the end statement
209 endstatement = prog->progs->numstatements;
210 for (i = 0;i < prog->progs->numfunctions;i++)
211 if (endstatement > prog->functions[i].first_statement && firststatement < prog->functions[i].first_statement)
212 endstatement = prog->functions[i].first_statement;
214 // now print the range of statements
215 Con_Printf("%s progs: disassembly of function %s (statements %i-%i, locals %i-%i):\n", PRVM_NAME, name, firststatement, endstatement, func->parm_start, func->parm_start + func->locals - 1);
216 for (i = firststatement;i < endstatement;i++)
218 PRVM_PrintStatement(prog->statements + i);
219 prog->statement_profile[i] = 0;
229 void PRVM_PrintFunction_f (void)
233 Con_Printf("usage: prvm_printfunction <program name> <function name>\n");
238 if(!PRVM_SetProgFromString(Cmd_Argv(1)))
241 PRVM_PrintFunctionStatements(Cmd_Argv(2));
251 void PRVM_StackTrace (void)
256 prog->stack[prog->depth].s = prog->xstatement;
257 prog->stack[prog->depth].f = prog->xfunction;
258 for (i = prog->depth;i > 0;i--)
260 f = prog->stack[i].f;
263 Con_Print("<NULL FUNCTION>\n");
265 Con_Printf("%12s : %s : statement %i\n", PRVM_GetString(f->s_file), PRVM_GetString(f->s_name), prog->stack[i].s - f->first_statement);
269 void PRVM_ShortStackTrace(char *buf, size_t bufsize)
276 dpsnprintf(buf, bufsize, "(%s) ", prog->name);
280 strlcpy(buf, "<NO PROG>", bufsize);
284 prog->stack[prog->depth].s = prog->xstatement;
285 prog->stack[prog->depth].f = prog->xfunction;
286 for (i = prog->depth;i > 0;i--)
288 f = prog->stack[i].f;
292 ? va("%s:%s(%i) ", PRVM_GetString(f->s_file), PRVM_GetString(f->s_name), prog->stack[i].s - f->first_statement)
301 void PRVM_CallProfile (void)
303 mfunction_t *f, *best;
308 Con_Printf( "%s Call Profile:\n", PRVM_NAME );
315 for (i=0 ; i<prog->progs->numfunctions ; i++)
317 f = &prog->functions[i];
318 if (max < f->totaltime)
326 sum += best->totaltime;
327 Con_Printf("%9.4f %s\n", best->totaltime, PRVM_GetString(best->s_name));
332 Con_Printf("Total time since last profile reset: %9.4f\n", Sys_DoubleTime() - prog->starttime);
333 Con_Printf(" - used by QC code of this VM: %9.4f\n", sum);
335 prog->starttime = Sys_DoubleTime();
338 void PRVM_Profile (int maxfunctions, int mininstructions, int sortby)
340 mfunction_t *f, *best;
344 Con_Printf( "%s Profile:\n[CallCount] [Statement] [BuiltinCt] [StmtTotal] [BltnTotal] [self]\n", PRVM_NAME );
345 // 12345678901 12345678901 12345678901 12345678901 12345678901 123.45%
352 for (i=0 ; i<prog->progs->numfunctions ; i++)
354 f = &prog->functions[i];
357 if (max < f->profile_total + f->builtinsprofile_total + f->callcount)
359 max = f->profile_total + f->builtinsprofile_total + f->callcount;
365 if (max < f->profile + f->builtinsprofile + f->callcount)
367 max = f->profile + f->builtinsprofile + f->callcount;
374 if (num < maxfunctions && max >= mininstructions)
376 if (best->first_statement < 0)
377 Con_Printf("%11.0f ----------------------- builtin ----------------------- %s\n", best->callcount, PRVM_GetString(best->s_name));
378 // 12345678901 12345678901 12345678901 12345678901 123.45%
380 Con_Printf("%11.0f %11.0f %11.0f %11.0f %11.0f %6.2f%% %s\n", best->callcount, best->profile, best->builtinsprofile, best->profile_total, best->builtinsprofile_total, (best->profile + best->builtinsprofile) * 100.0 / (best->profile_total + best->builtinsprofile_total), PRVM_GetString(best->s_name));
384 best->builtinsprofile = 0;
385 best->profile_total = 0;
386 best->builtinsprofile_total = 0;
398 void PRVM_CallProfile_f (void)
402 Con_Print("prvm_callprofile <program name>\n");
407 if(!PRVM_SetProgFromString(Cmd_Argv(1)))
421 void PRVM_Profile_f (void)
427 howmany = atoi(Cmd_Argv(2));
428 else if (Cmd_Argc() != 2)
430 Con_Print("prvm_profile <program name>\n");
435 if(!PRVM_SetProgFromString(Cmd_Argv(1)))
438 PRVM_Profile(howmany, 1, 0);
443 void PRVM_ChildProfile_f (void)
449 howmany = atoi(Cmd_Argv(2));
450 else if (Cmd_Argc() != 2)
452 Con_Print("prvm_childprofile <program name>\n");
457 if(!PRVM_SetProgFromString(Cmd_Argv(1)))
460 PRVM_Profile(howmany, 1, 1);
465 void PRVM_CrashAll(void)
468 prvm_prog_t *oldprog = prog;
470 for(i = 0; i < PRVM_MAXPROGS; i++)
472 if(!PRVM_ProgLoaded(i))
481 void PRVM_PrintState(void)
484 if(prog->statestring)
486 Con_Printf("Caller-provided information: %s\n", prog->statestring);
490 for (i = -7; i <= 0;i++)
491 if (prog->xstatement + i >= prog->xfunction->first_statement)
492 PRVM_PrintStatement (prog->statements + prog->xstatement + i);
495 Con_Print("null function executing??\n");
499 extern sizebuf_t vm_tempstringsbuf;
500 extern cvar_t prvm_errordump;
501 void Host_Savegame_to (const char *name);
502 void PRVM_Crash(void)
507 prog->funcoffsets.SV_Shutdown = 0; // don't call SV_Shutdown on crash
509 if( prog->depth > 0 )
511 Con_Printf("QuakeC crash report for %s:\n", PRVM_NAME);
515 if(prvm_errordump.integer)
518 Host_Savegame_to(va("crash-%s.dmp", PRVM_NAME));
521 // dump the stack so host_error can shutdown functions
523 prog->localstack_used = 0;
525 // delete all tempstrings (FIXME: is this safe in VM->engine->VM recursion?)
526 vm_tempstringsbuf.cursize = 0;
528 // reset the prog pointer
533 ============================================================================
536 The interpretation main loop
537 ============================================================================
544 Returns the new program statement counter
547 int PRVM_EnterFunction (mfunction_t *f)
552 PRVM_ERROR ("PRVM_EnterFunction: NULL function in %s", PRVM_NAME);
554 prog->stack[prog->depth].s = prog->xstatement;
555 prog->stack[prog->depth].f = prog->xfunction;
556 prog->stack[prog->depth].profile_acc = -f->profile;
557 prog->stack[prog->depth].builtinsprofile_acc = -f->builtinsprofile;
559 if (prog->depth >=PRVM_MAX_STACK_DEPTH)
560 PRVM_ERROR ("stack overflow");
562 // save off any locals that the new function steps on
564 if (prog->localstack_used + c > PRVM_LOCALSTACK_SIZE)
565 PRVM_ERROR ("PRVM_ExecuteProgram: locals stack overflow in %s", PRVM_NAME);
567 for (i=0 ; i < c ; i++)
568 prog->localstack[prog->localstack_used+i] = ((int *)prog->globals.generic)[f->parm_start + i];
569 prog->localstack_used += c;
573 for (i=0 ; i<f->numparms ; i++)
575 for (j=0 ; j<f->parm_size[i] ; j++)
577 ((int *)prog->globals.generic)[o] = ((int *)prog->globals.generic)[OFS_PARM0+i*3+j];
584 return f->first_statement - 1; // offset the s++
592 int PRVM_LeaveFunction (void)
597 if (prog->depth <= 0)
598 PRVM_ERROR ("prog stack underflow in %s", PRVM_NAME);
600 if (!prog->xfunction)
601 PRVM_ERROR ("PR_LeaveFunction: NULL function in %s", PRVM_NAME);
602 // restore locals from the stack
603 c = prog->xfunction->locals;
604 prog->localstack_used -= c;
605 if (prog->localstack_used < 0)
606 PRVM_ERROR ("PRVM_ExecuteProgram: locals stack underflow in %s", PRVM_NAME);
608 for (i=0 ; i < c ; i++)
609 ((int *)prog->globals.generic)[prog->xfunction->parm_start + i] = prog->localstack[prog->localstack_used+i];
615 prog->xfunction = prog->stack[prog->depth].f;
616 prog->stack[prog->depth].profile_acc += f->profile;
617 prog->stack[prog->depth].builtinsprofile_acc += f->builtinsprofile;
620 prog->stack[prog->depth-1].profile_acc += prog->stack[prog->depth].profile_acc;
621 prog->stack[prog->depth-1].builtinsprofile_acc += prog->stack[prog->depth].builtinsprofile_acc;
625 // if f is already on the call stack...
626 // we cannot add this profile data to it now
627 // or we would add it more than once
628 // so, let's only add to the function's profile if it is the outermost call
629 f->profile_total += prog->stack[prog->depth].profile_acc;
630 f->builtinsprofile_total += prog->stack[prog->depth].builtinsprofile_acc;
633 return prog->stack[prog->depth].s;
636 void PRVM_Init_Exec(void)
640 prog->localstack_used = 0;
641 // reset the string table
650 // LordHavoc: optimized
651 #define OPA ((prvm_eval_t *)&prog->globals.generic[(unsigned short) st->a])
652 #define OPB ((prvm_eval_t *)&prog->globals.generic[(unsigned short) st->b])
653 #define OPC ((prvm_eval_t *)&prog->globals.generic[(unsigned short) st->c])
654 extern cvar_t prvm_traceqc;
655 extern cvar_t prvm_statementprofiling;
656 extern sizebuf_t vm_tempstringsbuf;
657 extern qboolean prvm_runawaycheck;
658 extern qboolean prvm_boundscheck;
659 void MVM_ExecuteProgram (func_t fnum, const char *errormessage)
661 dstatement_t *st, *startst;
662 mfunction_t *f, *newf;
665 int jumpcount, cachedpr_trace, exitdepth;
666 int restorevm_tempstringsbuf_cursize;
669 calltime = Sys_DoubleTime();
671 if (!fnum || fnum >= (unsigned int)prog->progs->numfunctions)
673 if (prog->globaloffsets.self >= 0 && PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict)
674 PRVM_ED_Print(PRVM_PROG_TO_EDICT(PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict), NULL);
675 PRVM_ERROR ("MVM_ExecuteProgram: %s", errormessage);
678 f = &prog->functions[fnum];
680 // after executing this function, delete all tempstrings it created
681 restorevm_tempstringsbuf_cursize = vm_tempstringsbuf.cursize;
683 prog->trace = prvm_traceqc.integer;
685 // we know we're done when pr_depth drops to this
686 exitdepth = prog->depth;
688 // make a stack frame
689 st = &prog->statements[PRVM_EnterFunction (f)];
690 // save the starting statement pointer for profiling
691 // (when the function exits or jumps, the (st - startst) integer value is
692 // added to the function's profile counter)
694 // instead of counting instructions, we count jumps
696 // add one to the callcount of this function because otherwise engine-called functions aren't counted
697 prog->xfunction->callcount++;
700 cachedpr_trace = prog->trace;
701 if (prvm_runawaycheck)
703 #define PRVMRUNAWAYCHECK 1
704 if (prvm_statementprofiling.integer)
706 #define PRVMSTATEMENTPROFILING 1
707 if (prvm_boundscheck)
709 #define PRVMBOUNDSCHECK 1
713 #include "prvm_execprogram.h"
718 #include "prvm_execprogram.h"
720 #undef PRVMBOUNDSCHECK
727 #include "prvm_execprogram.h"
732 #include "prvm_execprogram.h"
735 #undef PRVMSTATEMENTPROFILING
739 if (prvm_boundscheck)
741 #define PRVMBOUNDSCHECK 1
745 #include "prvm_execprogram.h"
750 #include "prvm_execprogram.h"
752 #undef PRVMBOUNDSCHECK
759 #include "prvm_execprogram.h"
764 #include "prvm_execprogram.h"
768 #undef PRVMRUNAWAYCHECK
772 if (prvm_statementprofiling.integer)
774 #define PRVMSTATEMENTPROFILING 1
775 if (prvm_boundscheck)
777 #define PRVMBOUNDSCHECK 1
781 #include "prvm_execprogram.h"
786 #include "prvm_execprogram.h"
788 #undef PRVMBOUNDSCHECK
795 #include "prvm_execprogram.h"
800 #include "prvm_execprogram.h"
803 #undef PRVMSTATEMENTPROFILING
807 if (prvm_boundscheck)
809 #define PRVMBOUNDSCHECK 1
813 #include "prvm_execprogram.h"
818 #include "prvm_execprogram.h"
820 #undef PRVMBOUNDSCHECK
827 #include "prvm_execprogram.h"
832 #include "prvm_execprogram.h"
839 if (developer_insane.integer && vm_tempstringsbuf.cursize > restorevm_tempstringsbuf_cursize)
840 Con_DPrintf("MVM_ExecuteProgram: %s used %i bytes of tempstrings\n", PRVM_GetString(prog->functions[fnum].s_name), vm_tempstringsbuf.cursize - restorevm_tempstringsbuf_cursize);
841 // delete tempstrings created by this function
842 vm_tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize;
844 f->totaltime += (Sys_DoubleTime() - calltime);
846 SV_FlushBroadcastMessages();
854 // LordHavoc: optimized
855 #define OPA ((prvm_eval_t *)&prog->globals.generic[(unsigned short) st->a])
856 #define OPB ((prvm_eval_t *)&prog->globals.generic[(unsigned short) st->b])
857 #define OPC ((prvm_eval_t *)&prog->globals.generic[(unsigned short) st->c])
858 extern cvar_t prvm_traceqc;
859 extern cvar_t prvm_statementprofiling;
860 extern sizebuf_t vm_tempstringsbuf;
861 extern qboolean prvm_runawaycheck;
862 extern qboolean prvm_boundscheck;
863 void CLVM_ExecuteProgram (func_t fnum, const char *errormessage)
865 dstatement_t *st, *startst;
866 mfunction_t *f, *newf;
869 int jumpcount, cachedpr_trace, exitdepth;
870 int restorevm_tempstringsbuf_cursize;
873 calltime = Sys_DoubleTime();
875 if (!fnum || fnum >= (unsigned int)prog->progs->numfunctions)
877 if (prog->globaloffsets.self >= 0 && PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict)
878 PRVM_ED_Print(PRVM_PROG_TO_EDICT(PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict), NULL);
879 PRVM_ERROR ("CLVM_ExecuteProgram: %s", errormessage);
882 f = &prog->functions[fnum];
884 // after executing this function, delete all tempstrings it created
885 restorevm_tempstringsbuf_cursize = vm_tempstringsbuf.cursize;
887 prog->trace = prvm_traceqc.integer;
889 // we know we're done when pr_depth drops to this
890 exitdepth = prog->depth;
892 // make a stack frame
893 st = &prog->statements[PRVM_EnterFunction (f)];
894 // save the starting statement pointer for profiling
895 // (when the function exits or jumps, the (st - startst) integer value is
896 // added to the function's profile counter)
898 // instead of counting instructions, we count jumps
900 // add one to the callcount of this function because otherwise engine-called functions aren't counted
901 prog->xfunction->callcount++;
904 cachedpr_trace = prog->trace;
905 if (prvm_runawaycheck)
907 #define PRVMRUNAWAYCHECK 1
908 if (prvm_statementprofiling.integer)
910 #define PRVMSTATEMENTPROFILING 1
911 if (prvm_boundscheck)
913 #define PRVMBOUNDSCHECK 1
917 #include "prvm_execprogram.h"
922 #include "prvm_execprogram.h"
924 #undef PRVMBOUNDSCHECK
931 #include "prvm_execprogram.h"
936 #include "prvm_execprogram.h"
939 #undef PRVMSTATEMENTPROFILING
943 if (prvm_boundscheck)
945 #define PRVMBOUNDSCHECK 1
949 #include "prvm_execprogram.h"
954 #include "prvm_execprogram.h"
956 #undef PRVMBOUNDSCHECK
963 #include "prvm_execprogram.h"
968 #include "prvm_execprogram.h"
972 #undef PRVMRUNAWAYCHECK
976 if (prvm_statementprofiling.integer)
978 #define PRVMSTATEMENTPROFILING 1
979 if (prvm_boundscheck)
981 #define PRVMBOUNDSCHECK 1
985 #include "prvm_execprogram.h"
990 #include "prvm_execprogram.h"
992 #undef PRVMBOUNDSCHECK
999 #include "prvm_execprogram.h"
1004 #include "prvm_execprogram.h"
1007 #undef PRVMSTATEMENTPROFILING
1011 if (prvm_boundscheck)
1013 #define PRVMBOUNDSCHECK 1
1017 #include "prvm_execprogram.h"
1022 #include "prvm_execprogram.h"
1024 #undef PRVMBOUNDSCHECK
1031 #include "prvm_execprogram.h"
1036 #include "prvm_execprogram.h"
1043 if (developer_insane.integer && vm_tempstringsbuf.cursize > restorevm_tempstringsbuf_cursize)
1044 Con_DPrintf("CLVM_ExecuteProgram: %s used %i bytes of tempstrings\n", PRVM_GetString(prog->functions[fnum].s_name), vm_tempstringsbuf.cursize - restorevm_tempstringsbuf_cursize);
1045 // delete tempstrings created by this function
1046 vm_tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize;
1048 f->totaltime += (Sys_DoubleTime() - calltime);
1050 SV_FlushBroadcastMessages();
1054 ====================
1056 ====================
1058 // LordHavoc: optimized
1059 #define OPA ((prvm_eval_t *)&prog->globals.generic[(unsigned short) st->a])
1060 #define OPB ((prvm_eval_t *)&prog->globals.generic[(unsigned short) st->b])
1061 #define OPC ((prvm_eval_t *)&prog->globals.generic[(unsigned short) st->c])
1062 extern cvar_t prvm_traceqc;
1063 extern cvar_t prvm_statementprofiling;
1064 extern sizebuf_t vm_tempstringsbuf;
1065 extern qboolean prvm_runawaycheck;
1066 extern qboolean prvm_boundscheck;
1067 void SVVM_ExecuteProgram (func_t fnum, const char *errormessage)
1069 dstatement_t *st, *startst;
1070 mfunction_t *f, *newf;
1073 int jumpcount, cachedpr_trace, exitdepth;
1074 int restorevm_tempstringsbuf_cursize;
1077 calltime = Sys_DoubleTime();
1079 if (!fnum || fnum >= (unsigned int)prog->progs->numfunctions)
1081 if (prog->globaloffsets.self >= 0 && PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict)
1082 PRVM_ED_Print(PRVM_PROG_TO_EDICT(PRVM_GLOBALFIELDVALUE(prog->globaloffsets.self)->edict), NULL);
1083 PRVM_ERROR ("SVVM_ExecuteProgram: %s", errormessage);
1086 f = &prog->functions[fnum];
1088 // after executing this function, delete all tempstrings it created
1089 restorevm_tempstringsbuf_cursize = vm_tempstringsbuf.cursize;
1091 prog->trace = prvm_traceqc.integer;
1093 // we know we're done when pr_depth drops to this
1094 exitdepth = prog->depth;
1096 // make a stack frame
1097 st = &prog->statements[PRVM_EnterFunction (f)];
1098 // save the starting statement pointer for profiling
1099 // (when the function exits or jumps, the (st - startst) integer value is
1100 // added to the function's profile counter)
1102 // instead of counting instructions, we count jumps
1104 // add one to the callcount of this function because otherwise engine-called functions aren't counted
1105 prog->xfunction->callcount++;
1108 cachedpr_trace = prog->trace;
1109 if (prvm_runawaycheck)
1111 #define PRVMRUNAWAYCHECK 1
1112 if (prvm_statementprofiling.integer)
1114 #define PRVMSTATEMENTPROFILING 1
1115 if (prvm_boundscheck)
1117 #define PRVMBOUNDSCHECK 1
1121 #include "prvm_execprogram.h"
1126 #include "prvm_execprogram.h"
1128 #undef PRVMBOUNDSCHECK
1135 #include "prvm_execprogram.h"
1140 #include "prvm_execprogram.h"
1143 #undef PRVMSTATEMENTPROFILING
1147 if (prvm_boundscheck)
1149 #define PRVMBOUNDSCHECK 1
1153 #include "prvm_execprogram.h"
1158 #include "prvm_execprogram.h"
1160 #undef PRVMBOUNDSCHECK
1167 #include "prvm_execprogram.h"
1172 #include "prvm_execprogram.h"
1176 #undef PRVMRUNAWAYCHECK
1180 if (prvm_statementprofiling.integer)
1182 #define PRVMSTATEMENTPROFILING 1
1183 if (prvm_boundscheck)
1185 #define PRVMBOUNDSCHECK 1
1189 #include "prvm_execprogram.h"
1194 #include "prvm_execprogram.h"
1196 #undef PRVMBOUNDSCHECK
1203 #include "prvm_execprogram.h"
1208 #include "prvm_execprogram.h"
1211 #undef PRVMSTATEMENTPROFILING
1215 if (prvm_boundscheck)
1217 #define PRVMBOUNDSCHECK 1
1221 #include "prvm_execprogram.h"
1226 #include "prvm_execprogram.h"
1228 #undef PRVMBOUNDSCHECK
1235 #include "prvm_execprogram.h"
1240 #include "prvm_execprogram.h"
1247 if (developer_insane.integer && vm_tempstringsbuf.cursize > restorevm_tempstringsbuf_cursize)
1248 Con_DPrintf("SVVM_ExecuteProgram: %s used %i bytes of tempstrings\n", PRVM_GetString(prog->functions[fnum].s_name), vm_tempstringsbuf.cursize - restorevm_tempstringsbuf_cursize);
1249 // delete tempstrings created by this function
1250 vm_tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize;
1252 f->totaltime += (Sys_DoubleTime() - calltime);
1254 SV_FlushBroadcastMessages();