* tests/regression/jasmin/test_verify_fail_jsr_polymorphic_pop.j:
authoredwin <none@none>
Sat, 7 Oct 2006 23:02:53 +0000 (23:02 +0000)
committeredwin <none@none>
Sat, 7 Oct 2006 23:02:53 +0000 (23:02 +0000)
New test.

* tests/regression/jasmin/Makefile.am: Added new test.

* src/vm/jit/stack.c (stack_check_invars): Fixed bug exposed by the
new test.
(stack_check_invars_from_outvars): Likewise.

src/vm/jit/stack.c
tests/regression/jasmin/Makefile.am
tests/regression/jasmin/test_verify_fail_jsr_polymorphic_pop.j [new file with mode: 0644]

index 0fa741734a8318f4888ef470e59cb1ae78ee4f77..4b8e136cb23cde6be820296fe05755f7f4cf32ca 100644 (file)
@@ -30,7 +30,7 @@
             Christian Thalinger
             Christian Ullrich
 
-   $Id: stack.c 5715 2006-10-07 12:54:14Z edwin $
+   $Id: stack.c 5717 2006-10-07 23:02:53Z edwin $
 
 */
 
@@ -774,7 +774,7 @@ static basicblock * stack_check_invars(stackdata_t *sd, basicblock *b,
                        if (sp->type == TYPE_RET) {
                                if (sd->var[b->invars[i]].vv.retaddr != sd->var[sp->varnum].vv.retaddr) {
                                        separable = true;
-                                       break;
+                                       /* don't break! have to check the remaining stackslots */
                                }
                        }
                }
@@ -874,7 +874,7 @@ static basicblock * stack_check_invars_from_outvars(stackdata_t *sd, basicblock
                                if (dv->type == TYPE_RET) {
                                        if (sv->vv.retaddr != dv->vv.retaddr) {
                                                separable = true;
-                                               break;
+                                               /* don't break! have to check the remaining stackslots */
                                        }
                                }
                        }
index c052b1bffc6a6085fcb9bb90c97e7443e1a0855c..fd164afd5fcb0133a02f9ccebcaf266656408802 100644 (file)
@@ -72,6 +72,7 @@ JASMIN_TESTS = \
        $(srcdir)/test_verify_fail_jsr_called_with_different_stackdepths.j \
        $(srcdir)/test_verify_fail_jsr_exceptions.j \
        $(srcdir)/test_verify_fail_jsr_handler_in_sub.j \
+       $(srcdir)/test_verify_fail_jsr_polymorphic_pop.j \
        $(srcdir)/test_verify_fail_load_wrong_type.j \
        $(srcdir)/test_verify_fail_load_wrong_type_within_block.j \
        $(srcdir)/test_verify_fail_local_index.j \
diff --git a/tests/regression/jasmin/test_verify_fail_jsr_polymorphic_pop.j b/tests/regression/jasmin/test_verify_fail_jsr_polymorphic_pop.j
new file mode 100644 (file)
index 0000000..670724c
--- /dev/null
@@ -0,0 +1,62 @@
+.class public test_verify_fail_jsr_polymorphic_pop
+.super java/lang/Object
+
+; ======================================================================
+
+.method public <init>()V
+   aload_0
+   invokenonvirtual java/lang/Object/<init>()V
+   return
+.end method
+
+; ======================================================================
+
+.method public static check(I)V
+       .limit locals 1
+       .limit stack 10
+       getstatic java/lang/System/out Ljava/io/PrintStream;
+       iload_0
+       invokevirtual java/io/PrintStream/println(I)V
+       return
+.end method
+
+; ======================================================================
+
+.method public static main([Ljava/lang/String;)V
+       .limit stack 2
+       .limit locals 3
+
+       ldc 35
+       istore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 123
+       jsr sbr_1
+
+       aconst_null
+       jsr sbr_1
+       ; ERROR: VerifyError
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test_verify_fail_jsr_polymorphic_pop/check(I)V
+
+       return
+
+sbr_1:
+       astore 2
+       pop
+       iload 1
+       invokestatic test_verify_fail_jsr_polymorphic_pop/check(I)V
+       iinc 1 1
+       ret 2
+
+.end method
+