2009/6/27 Vegard Nossum <vegard.nos...@gmail.com>:
> From: Tomek Grabiec <tgrab...@gmail.com>
>

When compiling the expression (x % array.length), the "array.length"
would put the result in %eax. The "idiv" instruction (used by the %
operator) takes a fixed input in %eax and one additional operand; the
result is that we were outputting "idiv %eax", which is nonsensical
(and wrong) because it divides %eax by itself.

> Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com>
> ---
>  arch/x86/insn-selector_32.brg |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/insn-selector_32.brg b/arch/x86/insn-selector_32.brg
> index 94d7783..ba4d8b6 100644
> --- a/arch/x86/insn-selector_32.brg
> +++ b/arch/x86/insn-selector_32.brg
> @@ -986,7 +986,7 @@ reg:    EXPR_ARRAYLENGTH(reg)
>
>        arrayref = state->left->reg1;
>
> -       arraylength = get_fixed_var(s->b_parent, REG_EAX);
> +       arraylength = get_var(s->b_parent);
>        state->reg1 = arraylength;
>
>        select_insn(s, tree, membase_reg_insn(INSN_MOV_MEMBASE_REG, arrayref,
> --
> 1.6.0.4
>
>



-- 
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
        -- E. W. Dijkstra, EWD1036

------------------------------------------------------------------------------
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to