* tests/regression/jasmin/test_verify_fail_load_wrong_type.j:
authoredwin <none@none>
Thu, 14 Sep 2006 16:46:47 +0000 (16:46 +0000)
committeredwin <none@none>
Thu, 14 Sep 2006 16:46:47 +0000 (16:46 +0000)
New test.
* tests/regression/jasmin/
test_verify_fail_load_wrong_type_within_block.j: New test.
* tests/regression/jasmin/test_verify_fail_local_index.j: New test.
* tests/regression/jasmin/test_verify_fail_long_local_index.j:
New test.
* tests/regression/jasmin/test_verify_fail_long_local.j: New test.
* tests/regression/jasmin/test_verify_fail_split_local.j: New test.
* tests/regression/jasmin/test_verify_ok_overwrite_local_type.j:
New test.
* tests/regression/jasmin/test_verify_ok_untyped_local.j: New test.

--HG--
branch : unified_variables

tests/regression/jasmin/test_verify_fail_load_wrong_type.j [new file with mode: 0644]
tests/regression/jasmin/test_verify_fail_load_wrong_type_within_block.j [new file with mode: 0644]
tests/regression/jasmin/test_verify_fail_local_index.j [new file with mode: 0644]
tests/regression/jasmin/test_verify_fail_long_local.j [new file with mode: 0644]
tests/regression/jasmin/test_verify_fail_long_local_index.j [new file with mode: 0644]
tests/regression/jasmin/test_verify_fail_split_local.j [new file with mode: 0644]
tests/regression/jasmin/test_verify_ok_overwrite_local_type.j [new file with mode: 0644]
tests/regression/jasmin/test_verify_ok_untyped_local.j [new file with mode: 0644]

diff --git a/tests/regression/jasmin/test_verify_fail_load_wrong_type.j b/tests/regression/jasmin/test_verify_fail_load_wrong_type.j
new file mode 100644 (file)
index 0000000..aa330f8
--- /dev/null
@@ -0,0 +1,49 @@
+.class public test_verify_fail_load_wrong_type
+.super java/lang/Object
+
+; ======================================================================
+
+.method public <init>()V
+   aload_0
+   invokenonvirtual java/lang/Object/<init>()V
+   return
+.end method
+
+; ======================================================================
+
+.method public static checkI(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 2
+
+       ldc 35
+       istore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       fload 1
+       ; ERROR: VerifyError
+       pop
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test_verify_fail_load_wrong_type/checkI(I)V
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_verify_fail_load_wrong_type_within_block.j b/tests/regression/jasmin/test_verify_fail_load_wrong_type_within_block.j
new file mode 100644 (file)
index 0000000..6745ee4
--- /dev/null
@@ -0,0 +1,52 @@
+.class public test_verify_fail_load_wrong_type_within_block
+.super java/lang/Object
+
+; ======================================================================
+
+.method public <init>()V
+   aload_0
+   invokenonvirtual java/lang/Object/<init>()V
+   return
+.end method
+
+; ======================================================================
+
+.method public static checkI(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 2
+
+       ldc 35
+       istore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc "string constant"
+       astore 1
+
+       iload 1
+       ; ERROR: VerifyError
+       invokestatic test_verify_fail_load_wrong_type_within_block/checkI(I)V
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test_verify_fail_load_wrong_type_within_block/checkI(I)V
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_verify_fail_local_index.j b/tests/regression/jasmin/test_verify_fail_local_index.j
new file mode 100644 (file)
index 0000000..35a5135
--- /dev/null
@@ -0,0 +1,35 @@
+.class public test_verify_fail_local_index
+.super java/lang/Object
+
+; ======================================================================
+
+.method public <init>()V
+   aload_0
+   invokenonvirtual java/lang/Object/<init>()V
+   return
+.end method
+
+; ======================================================================
+
+.method public static main([Ljava/lang/String;)V
+       .limit stack 2
+       .limit locals 2
+
+       ldc 42
+       istore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 1234
+       istore 2
+       ; ERROR: VerifyError
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_verify_fail_long_local.j b/tests/regression/jasmin/test_verify_fail_long_local.j
new file mode 100644 (file)
index 0000000..380528b
--- /dev/null
@@ -0,0 +1,49 @@
+.class public test_verify_fail_long_local
+.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 42
+       istore 2
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc2_w 1234567890987654321
+       lstore 1
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 2
+       ; ERROR: VerifyError
+       invokestatic test_verify_fail_long_local/check(I)V
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_verify_fail_long_local_index.j b/tests/regression/jasmin/test_verify_fail_long_local_index.j
new file mode 100644 (file)
index 0000000..baf8655
--- /dev/null
@@ -0,0 +1,35 @@
+.class public test_verify_fail_long_local_index
+.super java/lang/Object
+
+; ======================================================================
+
+.method public <init>()V
+   aload_0
+   invokenonvirtual java/lang/Object/<init>()V
+   return
+.end method
+
+; ======================================================================
+
+.method public static main([Ljava/lang/String;)V
+       .limit stack 2
+       .limit locals 2
+
+       ldc 42
+       istore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc2_w 1234567890987654321
+       lstore 1
+       ; ERROR: VerifyError
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_verify_fail_split_local.j b/tests/regression/jasmin/test_verify_fail_split_local.j
new file mode 100644 (file)
index 0000000..6c1b6e2
--- /dev/null
@@ -0,0 +1,49 @@
+.class public test_verify_fail_split_local
+.super java/lang/Object
+
+; ======================================================================
+
+.method public <init>()V
+   aload_0
+   invokenonvirtual java/lang/Object/<init>()V
+   return
+.end method
+
+; ======================================================================
+
+.method public static check(J)V
+       .limit locals 2
+       .limit stack 10
+       getstatic java/lang/System/out Ljava/io/PrintStream;
+       lload_0
+       invokevirtual java/io/PrintStream/println(J)V
+       return
+.end method
+
+; ======================================================================
+
+.method public static main([Ljava/lang/String;)V
+       .limit stack 2
+       .limit locals 3
+
+       ldc2_w 123456789
+       lstore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 42
+       istore 2
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       lload 1
+       ; ERROR: VerifyError
+       invokestatic test_verify_fail_split_local/check(J)V
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_verify_ok_overwrite_local_type.j b/tests/regression/jasmin/test_verify_ok_overwrite_local_type.j
new file mode 100644 (file)
index 0000000..cbcd686
--- /dev/null
@@ -0,0 +1,40 @@
+.class public test_verify_ok_overwrite_local_type
+.super java/lang/Object
+
+; ======================================================================
+
+.method public <init>()V
+   aload_0
+   invokenonvirtual java/lang/Object/<init>()V
+   return
+.end method
+
+; ======================================================================
+
+.method public static checkI(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 2
+
+       ldc "a string"
+       astore 1
+
+       ldc 42
+       istore 1
+
+       iload 1
+       invokestatic test_verify_ok_overwrite_local_type/checkI(I)V
+       ; OUTPUT: 42
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_verify_ok_untyped_local.j b/tests/regression/jasmin/test_verify_ok_untyped_local.j
new file mode 100644 (file)
index 0000000..7b16d58
--- /dev/null
@@ -0,0 +1,66 @@
+.class public test_verify_ok_untyped_local
+.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 check(Ljava/lang/String;)V
+       .limit locals 1
+       .limit stack 10
+       getstatic java/lang/System/out Ljava/io/PrintStream;
+       aload_0
+       invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
+       return
+.end method
+
+; ======================================================================
+
+.method public static main([Ljava/lang/String;)V
+       .limit stack 2
+       .limit locals 2
+
+       ldc "will it work?"
+       astore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 42
+       istore 1
+
+       iload 1
+       invokestatic test_verify_ok_untyped_local/check(I)V
+       ; OUTPUT: 42
+
+       ldc "wow, it works!"
+       astore 1
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       aload 1
+       invokestatic test_verify_ok_untyped_local/check(Ljava/lang/String;)V
+       ; OUTPUT: wow, it works!
+
+       return
+.end method
+