The bug was in function test_convert_dup_x1(). Expressions value1, value2 and value3 were freed inside first assert_dup2_x1_stack() call. To avoid this expr_get() calls has been inserted. There is also a fix in test_convert_swap() - we should not push not valid pointers onto mimic-stack.
Signed-off-by: Tomek Grabiec <[email protected]> --- test/jit/ostack-bc-test.c | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/test/jit/ostack-bc-test.c b/test/jit/ostack-bc-test.c index b3d7d6f..72c2990 100644 --- a/test/jit/ostack-bc-test.c +++ b/test/jit/ostack-bc-test.c @@ -185,9 +185,14 @@ void test_convert_dup_x1(void) value3 = value_expr(J_LONG, 0xdecacafebabebeef); expr_get(value1); - + expr_get(value2); assert_dup_x1_stack(OPC_DUP_X1, value1, value2); + + expr_get(value1); + expr_get(value2); + expr_get(value3); assert_dup2_x1_stack(OPC_DUP2_X1, value1, value2, value3); + assert_dup2_x1_stack(OPC_DUP2_X1, value3, value2, value1); } @@ -292,7 +297,7 @@ void test_convert_dup_x2(void) } static void -assert_swap_stack(unsigned char opc, void *expected1, void *expected2) +assert_swap_stack(unsigned char opc, struct expression *expected1, struct expression *expected2) { struct basic_block *bb; @@ -311,6 +316,14 @@ assert_swap_stack(unsigned char opc, void *expected1, void *expected2) void test_convert_swap(void) { - assert_swap_stack(OPC_SWAP, (void *)1, (void *)2); - assert_swap_stack(OPC_SWAP, (void *)2, (void *)3); + struct expression *expr1; + struct expression *expr2; + + expr1 = value_expr(J_INT, 1); + expr2 = value_expr(J_INT, 2); + + assert_swap_stack(OPC_SWAP, expr1, expr2); + + expr_put(expr1); + expr_put(expr2); } -- 1.6.0.6 ------------------------------------------------------------------------------ Register Now & Save for Velocity, the Web Performance & Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance & Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf _______________________________________________ Jatovm-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jatovm-devel
