summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-02-06 00:42:58 -0500
committerOri Bernstein <ori@eigenstate.org>2013-02-06 00:43:04 -0500
commitcef9f9cc57105139c4157fdfb14036c724271271 (patch)
tree08a404353f72e34fb6b4318027f41859c1d4da5a
parenta3a707822d301c6c1e3cfd164c35e67463406397 (diff)
downloadmc-cef9f9cc57105139c4157fdfb14036c724271271.tar.gz
Document decdegree()'s subtlety.
It's tricky, the way that we use worklists as sets, but only here.
-rw-r--r--6/ra.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/6/ra.c b/6/ra.c
index 6d87125..577cd4f 100644
--- a/6/ra.c
+++ b/6/ra.c
@@ -556,6 +556,18 @@ static void decdegree(Isel *s, regid m)
enablemove(s, m);
for (n = 0; adjiter(s, m, &n); n++)
enablemove(s, n);
+
+ /* Subtle:
+ *
+ * If this code is being called from coalesce(),
+ * then the degree could have been bumped up only
+ * temporarily. This means that the node can already
+ * be on wlfreeze or wlsimp.
+ *
+ * Therefore, if we don't find it on wlspill, we assert
+ * that the node is already on the list that we'd be
+ * moving it to.
+ */
found = wlhas(s->wlspill, s->nwlspill, m, &idx);
if (found)
ldel(&s->wlspill, &s->nwlspill, idx);