[gamecode] Split out the old quake c execution loop

There is no reasonable way (due to hardware-enforced alignment issues)
to simply convert old bytecode to new (probably best done with an
off-line tool, preferably just recompiling when I get qfcc up to the
job), so both loops will need to be present. This just moves the
original loop into its own function in order to make it easy to bring in
the new (and iron out integration issues).
This commit is contained in:
Bill Currie 2022-01-02 20:16:45 +09:00
parent ba5f6d97c6
commit 7b0eceda32

View file

@ -436,15 +436,10 @@ pr_memset (pr_type_t *dst, int val, int count)
} }
} }
/* static void
PR_ExecuteProgram pr_exec_quakec (progs_t *pr, int exitdepth)
The interpretation main loop
*/
VISIBLE void
PR_ExecuteProgram (progs_t *pr, func_t fnum)
{ {
int exitdepth, profile, startprofile; int profile, startprofile;
int fldofs; int fldofs;
pr_uint_t pointer; pr_uint_t pointer;
dstatement_t *st; dstatement_t *st;
@ -452,26 +447,13 @@ PR_ExecuteProgram (progs_t *pr, func_t fnum)
pr_type_t old_val = {0}; pr_type_t old_val = {0};
// make a stack frame // make a stack frame
exitdepth = pr->pr_depth;
startprofile = profile = 0; startprofile = profile = 0;
Sys_PushSignalHook (signal_hook, pr);
Sys_PushErrorHandler (error_handler, pr);
if (pr->debug_handler) {
pr->debug_handler (prd_subenter, &fnum, pr->debug_data);
}
if (!PR_CallFunction (pr, fnum)) {
// called a builtin instead of progs code
goto exit_program;
}
st = pr->pr_statements + pr->pr_xstatement; st = pr->pr_statements + pr->pr_xstatement;
if (pr->watch) { if (pr->watch) {
old_val = *pr->watch; old_val = *pr->watch;
} }
while (1) { while (1) {
pr_type_t *op_a, *op_b, *op_c; pr_type_t *op_a, *op_b, *op_c;
@ -1737,6 +1719,32 @@ op_call:
old_val.integer_var = pr->watch->integer_var; old_val.integer_var = pr->watch->integer_var;
} }
} }
exit_program:
}
/*
PR_ExecuteProgram
The interpretation main loop
*/
VISIBLE void
PR_ExecuteProgram (progs_t *pr, func_t fnum)
{
Sys_PushSignalHook (signal_hook, pr);
Sys_PushErrorHandler (error_handler, pr);
if (pr->debug_handler) {
pr->debug_handler (prd_subenter, &fnum, pr->debug_data);
}
int exitdepth = pr->pr_depth;
if (!PR_CallFunction (pr, fnum)) {
// called a builtin instead of progs code
goto exit_program;
}
if (1) {
pr_exec_quakec (pr, exitdepth);
}
exit_program: exit_program:
if (pr->debug_handler) { if (pr->debug_handler) {
pr->debug_handler (prd_subexit, 0, pr->debug_data); pr->debug_handler (prd_subexit, 0, pr->debug_data);