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:
Bill Currie 2001-06-04 22:35:54 +00:00
parent 55d58f8d46
commit 17e19f3892
3 changed files with 17 additions and 0 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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)
{