On Sat, 2009-06-27 at 03:30 +0200, Tomek Grabiec wrote:
> Expressions with volatile content should not be pushed onto mimic-stack
> because there is a possibility that their content will be modified
> before their value is accessed. An example of this situation is this
> java snippet:
> 
> int x = 0;
> int y;
> 
> y = x++;
> 
> Which compiles to the following instructions:
>    0:   iconst_0
>    1:   istore_1
>    2:   iload_1
>    3:   iinc    1, 1
>    6:   istore_2
> 
> Instriction at pc=2 pushes EXPR_LOCAL onto mimic-stack.
> Instruction at pc=3 modifies value of local variable.
> Instruction at pc=6 generates STMT_STORE with source popped
> from mimic-stack (EXPR_LOCAL) which has invalid value - it was
> modified while in mimic-stack. The solution for this is to
> generate STMT_STORE which copies the value of local variable
> into a new temporary at *load bytecodes and push corresponding
> EXPR_TEMPORARY on stack.
> 
> Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>

I did apply this as a bug fix but I'm wonder if this is too generic fix.
Isn't the only problematic bytecode iinc? Can we fix that instead? Doing
this at EXPR_LOCAL level generates tons of unnecessary copies.

                        Pekka


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

Reply via email to