mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[gamecode] Rearrange bfunction_t in preparation for param offsets
The builtin and progs function data is overlaid so the extra data doesn't cause too much memory to be used (it's actually 8 bytes smaller now). The plan is to pre-compute the offsets based on the parameter size and alignment data.
This commit is contained in:
parent
a6b932025c
commit
a818fa4b8e
2 changed files with 22 additions and 8 deletions
|
@ -1221,13 +1221,25 @@ typedef struct {
|
|||
*/
|
||||
typedef struct {
|
||||
pr_int_t first_statement;
|
||||
pr_int_t parm_start;
|
||||
pr_int_t locals;
|
||||
pr_uint_t profile;
|
||||
pr_int_t numparms;
|
||||
dparmsize_t parm_size[PR_MAX_PARAMS];
|
||||
dfunction_t *descriptor;
|
||||
builtin_proc func;
|
||||
union {
|
||||
struct {
|
||||
dparmsize_t parm_size[PR_MAX_PARAMS];
|
||||
dfunction_t *descriptor;
|
||||
pr_uint_t parm_start;
|
||||
pr_uint_t locals;
|
||||
pr_uint_t profile;
|
||||
};
|
||||
struct {
|
||||
// although Ruamoko progs support more than PR_MAX_PARAMS
|
||||
// arguments, only the first PR_MAX_PARAMS parameter pointers
|
||||
// are initialized. This keeps builtins meant for both ISAs
|
||||
// simple as they either will never accept more tha PR_MAX_PARAMS
|
||||
// arugments, or they'll be modified to do the right thing.
|
||||
pr_ushort_t param_offsets[PR_MAX_PARAMS];
|
||||
builtin_proc func;
|
||||
};
|
||||
};
|
||||
} bfunction_t;
|
||||
|
||||
/** Register a set of builtin functions with the VM. Different VMs within the
|
||||
|
|
|
@ -284,9 +284,11 @@ PR_EnterFunction (progs_t *pr, bfunction_t *f)
|
|||
sizeof (pr_type_t) * f->locals);
|
||||
pr->localstack_used += f->locals;
|
||||
|
||||
if (pr_deadbeef_locals->int_val)
|
||||
for (i = f->parm_start; i < f->parm_start + f->locals; i++)
|
||||
if (pr_deadbeef_locals->int_val) {
|
||||
for (pr_uint_t i = f->parm_start; i < f->parm_start + f->locals; i++) {
|
||||
pr->pr_globals[i].int_var = 0xdeadbeef;
|
||||
}
|
||||
}
|
||||
|
||||
// copy parameters
|
||||
if (f->numparms >= 0) {
|
||||
|
|
Loading…
Reference in a new issue