The unhandled intervals list was browsed with list_for_each_safe, which
does not work if the immediate successor is modified. This happens when
splitting intervals and inserting the split child into the list - the
bug was that the child would be iterated over (ie. not treated), which
leads to unassigned registers.

Signed-off-by: Arthur HUILLET <[email protected]>
---
 jit/linear-scan.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/jit/linear-scan.c b/jit/linear-scan.c
index b90f1b6..27bf271 100644
--- a/jit/linear-scan.c
+++ b/jit/linear-scan.c
@@ -309,7 +309,7 @@ int allocate_registers(struct compilation_unit *cu)
        struct list_head unhandled = LIST_HEAD_INIT(unhandled);
        struct list_head inactive = LIST_HEAD_INIT(inactive);
        struct list_head active = LIST_HEAD_INIT(active);
-       struct live_interval *tmp, *current;
+       struct live_interval *current;
        struct bitset *registers;
        struct var_info *var;
 
@@ -334,10 +334,11 @@ int allocate_registers(struct compilation_unit *cu)
                        insert_to_list(var->interval, &unhandled);
        }
 
-       list_for_each_entry_safe(current, tmp, &unhandled, interval_node) {
+       while (!list_is_empty(&unhandled)) {
                struct live_interval *it, *prev;
                unsigned long position;
 
+               current = list_first_entry(&unhandled, struct live_interval, 
interval_node);
                list_del(&current->interval_node);
                position = current->range.start;
 
-- 
1.6.2.2


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to