The bug resulted in attempt to spill an interval which has no register assigned.
Initial interval for vreg 20 has use positions at 4 and 29. Register is available only for positions 4-11 which results in interval splitting. There are no free registers available for the new interval (11-29) so it is split at next use position, which results in new interval 24-29. This interval is marked as needing to be reloaded. The parent interval however has no register assigned. 20 (pos: 4-11): ECX non-fixed spill (5) no reload 20 (pos: 11-24): - non-fixed spill (6) reload (5) 20 (pos: 24-29): ESI non-fixed no spill reload (6) Proposed solution for this problem is to not generate intervals which do not start with use position in try_to_allocate_free_reg(). In this example, we throw away the interval 11-24 will be dropped. We can do that because register is not used in this range. After this fix, we will have the following regalloc: 20 (pos: 4-11): ECX non-fixed spill (5) no reload 20 (pos: 24-29): ESI non-fixed no spill reload (5) Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- jit/linear-scan.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/jit/linear-scan.c b/jit/linear-scan.c index 21dd112..d2a3c92 100644 --- a/jit/linear-scan.c +++ b/jit/linear-scan.c @@ -315,6 +315,7 @@ static void try_to_allocate_free_reg(struct live_interval *current, new = split_interval_at(current, free_until_pos[reg]); if (has_use_positions(new)) { + new = split_interval_at(new, next_use_pos(new, 0)); mark_need_reload(new, current); insert_to_list(new, unhandled); } -- 1.6.0.6 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel