[svn:parrot] r39464 - trunk/compilers/imcc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Tue Jun 9 07:59:21 UTC 2009
Author: chromatic
Date: Tue Jun 9 07:59:21 2009
New Revision: 39464
URL: https://trac.parrot.org/parrot/changeset/39464
Log:
[IMCC] Plugged a memory leak in the register allocator when counting the number
of necessary typed registers. Though this code is still algorithmically
terrible, I managed to knock one at least one exponent off of it, making it run
slightly faster (especially for complex compilation units) and leak less
memory.
Modified:
trunk/compilers/imcc/reg_alloc.c
Modified: trunk/compilers/imcc/reg_alloc.c
==============================================================================
--- trunk/compilers/imcc/reg_alloc.c Tue Jun 9 07:22:26 2009 (r39463)
+++ trunk/compilers/imcc/reg_alloc.c Tue Jun 9 07:59:21 2009 (r39464)
@@ -1189,8 +1189,9 @@
&& (r->usage & usage)
&& r->use_count) {
Set *avail = sets[j];
- int first_reg = first_avail(unit, (int)r->set, &avail);
-
+ int first_reg = avail
+ ? set_first_zero(avail)
+ : first_avail(unit, (int)r->set, &avail);
set_add(avail, first_reg);
r->color = first_reg++;
@@ -1200,6 +1201,10 @@
(int)r->set, r->name, r->color);
unit->first_avail[j] = first_reg;
+
+ /* don't lose this set; we must free it */
+ if (!sets[j])
+ sets[j] = avail;
}
}
}
More information about the parrot-commits
mailing list