Converter for dup_x2 didn't check the stack size of second stack operand which caused that the forst value was put one level deeper when second value was J_LONG or J_DOUBLE.
Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- jit/ostack-bc.c | 4 ++++ regression/jvm/DupTest.j | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 0 deletions(-) diff --git a/jit/ostack-bc.c b/jit/ostack-bc.c index 54f8dd1..c31ed3c 100644 --- a/jit/ostack-bc.c +++ b/jit/ostack-bc.c @@ -105,6 +105,10 @@ int convert_dup_x2(struct parse_context *ctx) value1 = stack_pop(ctx->bb->mimic_stack); value2 = stack_pop(ctx->bb->mimic_stack); + + if (vm_type_slot_size(value2->vm_type) == 2) + return __convert_dup_x1(ctx, value1, value2); + value3 = stack_pop(ctx->bb->mimic_stack); return __convert_dup_x2(ctx, value1, value2, value3); diff --git a/regression/jvm/DupTest.j b/regression/jvm/DupTest.j index 4c7122f..644f1a5 100644 --- a/regression/jvm/DupTest.j +++ b/regression/jvm/DupTest.j @@ -123,6 +123,42 @@ invokestatic jvm/TestCase/assertEquals(II)V .end method +; Test 'dup_x2' instruction when value2 has computational type of category 2 +.method public static testDup_x2_long()V + .limit locals 5 + + iconst_0 + putstatic jvm/DupTest/counter I + + dconst_0 + invokestatic jvm/DupTest/advanceCounter()I + dup_x2 + + iconst_1 + iadd + istore_1 + + dconst_1 + dadd + dstore_2 + + iconst_3 + iadd + istore 4 + + iconst_2 + iload_1 + invokestatic jvm/TestCase/assertEquals(II)V + + dconst_1 + dload_2 + invokestatic jvm/TestCase/assertEquals(DD)V + + bipush 4 + iload 4 + invokestatic jvm/TestCase/assertEquals(II)V +.end method + ; Test 'dup2' instruction .method public static testDup2()V .limit locals 5 @@ -287,6 +323,7 @@ invokestatic jvm/DupTest/testDup()V invokestatic jvm/DupTest/testDup_x1()V invokestatic jvm/DupTest/testDup_x2()V + invokestatic jvm/DupTest/testDup_x2_long()V invokestatic jvm/DupTest/testDup2()V invokestatic jvm/DupTest/testDup2_x1()V invokestatic jvm/DupTest/testDup2_x2()V -- 1.6.0.4 ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel