Ack here as well, this is obviously correct (provided radix_tree_lookup() 
works).

On Tue, 18 Aug 2009 21:41:19 +0300
Pekka Enberg <penb...@cs.helsinki.fi> wrote:

> Lets use radix_tree_lookup() and get rid of the nasty loop in
> bb_last_insn(). For some reason, this seems to fix the infinite loop
> triggered by empty basic blocks.
> 
> Cc: Arthur HUILLET <arthur.huil...@free.fr>
> Cc: Tomek Grabiec <tgrab...@gmail.com>
> Signed-off-by: Pekka Enberg <penb...@cs.helsinki.fi>
> ---
>  jit/basic-block.c  |   16 +---------------
>  jit/spill-reload.c |    2 +-
>  2 files changed, 2 insertions(+), 16 deletions(-)
> 
> diff --git a/jit/basic-block.c b/jit/basic-block.c
> index 6de5c3f..dbf3675 100644
> --- a/jit/basic-block.c
> +++ b/jit/basic-block.c
> @@ -176,21 +176,7 @@ struct insn *bb_first_insn(struct basic_block *bb)
>  
>  struct insn *bb_last_insn(struct basic_block *bb)
>  {
> -     struct insn *this = list_entry(bb->insn_list.prev, struct insn, 
> insn_list_node);
> -
> -     /*
> -      * We want to return the last "real" instruction of the basic block. 
> Taking the
> -      * last of the insn_list will not work in case a live interval has been 
> spilled
> -      * right after the final jump of the basic block.
> -      * This is a side effect of the linear scan algorithm.
> -      *
> -      * As a result, we browse instructions starting from the last, in order 
> to find the one
> -      * that has a LIR position matching the position for the end of the 
> block.
> -      */
> -     while (this->lir_pos != bb->end_insn - 1) {
> -             this = list_entry(this->insn_list_node.prev, struct insn, 
> insn_list_node);
> -     }
> -     return this;
> +     return list_entry(bb->insn_list.prev, struct insn, insn_list_node);
>  }
>  
>  static int __bb_add_neighbor(void *new, void **array, unsigned long *nb)
> diff --git a/jit/spill-reload.c b/jit/spill-reload.c
> index 5ced80e..515db8a 100644
> --- a/jit/spill-reload.c
> +++ b/jit/spill-reload.c
> @@ -183,7 +183,7 @@ static void insert_mov_insns(struct compilation_unit *cu,
>       struct insn *spill_at_insn;
>       int i;
>  
> -     spill_at_insn   = bb_last_insn(from_bb);
> +     spill_at_insn   = radix_tree_lookup(cu->lir_insn_map, from_bb->end_insn 
> - 1);
>  
>       /* Spill all intervals that have to be resolved */
>       for (i = 0; i < nr_mapped; i++) {
> -- 
> 1.5.6.3
> 


-- 
Greetings, 
A. Huillet

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

Reply via email to