mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
regain about 5000 globals for customTF, but this fixes possible breakage with
premature temp var re-usage (ie, it puts the temps back into the locals space).
This commit is contained in:
parent
55d58f8d46
commit
17e19f3892
3 changed files with 17 additions and 0 deletions
|
@ -443,6 +443,7 @@ def_t *PR_GetDef (type_t *type, const char *name, def_t *scope,
|
|||
def_t *PR_NewDef (type_t *type, const char *name, def_t *scope);
|
||||
def_t *PR_GetTempDef (type_t *type);
|
||||
void PR_FreeTempDefs ();
|
||||
void PR_ResetTempDefs ();
|
||||
void PR_FlushScope (def_t *scope);
|
||||
|
||||
void PR_PrintDefs (void);
|
||||
|
|
|
@ -552,6 +552,7 @@ PR_ParseDefs (void)
|
|||
pr_scope = def;
|
||||
f = PR_ParseImmediateStatements (type);
|
||||
PR_FlushScope (pr_scope);
|
||||
PR_ResetTempDefs ();
|
||||
pr_scope = NULL;
|
||||
def->initialized = 1;
|
||||
G_FUNCTION (def->ofs) = numfunctions;
|
||||
|
|
|
@ -155,6 +155,8 @@ PR_GetTempDef (type_t *type)
|
|||
free_temps[t] = d->next;
|
||||
} else {
|
||||
d = PR_NewDef (type, 0, 0);
|
||||
}
|
||||
if (!d->ofs) {
|
||||
d->ofs = numpr_globals;
|
||||
numpr_globals += type_size[t];
|
||||
}
|
||||
|
@ -177,6 +179,19 @@ PR_FreeTempDefs (void)
|
|||
temp_scope.scope_next = 0;
|
||||
}
|
||||
|
||||
void
|
||||
PR_ResetTempDefs (void)
|
||||
{
|
||||
int i;
|
||||
def_t *d;
|
||||
|
||||
for (i = 0; i < ev_type_count; i++) {
|
||||
for (d = free_temps[i]; d && d->ofs; d = d->next) {
|
||||
d->ofs = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PR_FlushScope (def_t *scope)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue