Checked in jasmin tests.
authoredwin <none@none>
Wed, 6 Sep 2006 14:32:22 +0000 (14:32 +0000)
committeredwin <none@none>
Wed, 6 Sep 2006 14:32:22 +0000 (14:32 +0000)
--HG--
branch : new_instruction_format

21 files changed:
tests/regression/jasmin/runtest [new file with mode: 0755]
tests/regression/jasmin/show [new file with mode: 0755]
tests/regression/jasmin/test.j [new file with mode: 0644]
tests/regression/jasmin/test_coalesce_simple_store.j [new file with mode: 0644]
tests/regression/jasmin/test_dup.j [new file with mode: 0644]
tests/regression/jasmin/test_dup2.j [new file with mode: 0644]
tests/regression/jasmin/test_dup2_x1.j [new file with mode: 0644]
tests/regression/jasmin/test_dup2_x2.j [new file with mode: 0644]
tests/regression/jasmin/test_dup_x1.j [new file with mode: 0644]
tests/regression/jasmin/test_dup_x2.j [new file with mode: 0644]
tests/regression/jasmin/test_load_store_conflict.j [new file with mode: 0644]
tests/regression/jasmin/test_load_store_conflict_by_exception.j [new file with mode: 0644]
tests/regression/jasmin/test_load_store_conflict_by_exception_not_thrown.j [new file with mode: 0644]
tests/regression/jasmin/test_load_store_conflict_via_dup.j [new file with mode: 0644]
tests/regression/jasmin/test_load_store_conflict_via_swap.j [new file with mode: 0644]
tests/regression/jasmin/test_no_store_load_conflict.j [new file with mode: 0644]
tests/regression/jasmin/test_no_store_store_conflict.j [new file with mode: 0644]
tests/regression/jasmin/test_store_load_conflict.j [new file with mode: 0644]
tests/regression/jasmin/test_store_store_conflict.j [new file with mode: 0644]
tests/regression/jasmin/test_store_store_conflict_2.j [new file with mode: 0644]
tests/regression/jasmin/test_swap.j [new file with mode: 0644]

diff --git a/tests/regression/jasmin/runtest b/tests/regression/jasmin/runtest
new file mode 100755 (executable)
index 0000000..e3e0c3f
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+VERBOSE=0
+EXITCODE=0
+
+if [ "$1" = "--verbose" ] ; then
+       shift
+       VERBOSE=1
+fi
+
+while [ -n "$1" ]
+do
+    TEST="$1"
+    TESTBASENAME=$(basename "$TEST" .j)
+
+    TESTOUT="TESTOUT"
+    TESTEXPECT="TESTEXPECT"
+    TESTLOG="TESTLOG"
+
+    jasmin "$TEST" || exit 2
+    cacao "$TESTBASENAME" >"$TESTOUT" || exit 2
+
+    grep 'OUTPUT:' "$TEST" | sed 's,.*OUTPUT:\s*,,' >"$TESTEXPECT"
+
+    if diff -u "$TESTEXPECT" "$TESTOUT" ; then
+       echo "PASS: $TEST"
+    else
+       echo "FAIL: $TEST"
+       EXITCODE=1
+    fi
+
+    if [ "$VERBOSE" -eq "1" ] ; then
+       cacao -sia "$TESTBASENAME" >"$TESTLOG" || exit 2
+       ./show "$TESTLOG"
+    fi
+
+    shift
+done
+
+#rm -f "$TESTOUT" "$TESTEXPECT" "$TESTLOG"
+
+exit $EXITCODE
diff --git a/tests/regression/jasmin/show b/tests/regression/jasmin/show
new file mode 100755 (executable)
index 0000000..74361e7
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+LOG="$1"
+
+cat "$LOG" | sed -n '/^test_.*\.main/,$p' | sed -n '/=== L002 ===/,$d ; /=== L001 ===/,$p' | sed '/^===/d'
+
diff --git a/tests/regression/jasmin/test.j b/tests/regression/jasmin/test.j
new file mode 100644 (file)
index 0000000..b788921
--- /dev/null
@@ -0,0 +1,46 @@
+.class public test
+.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
+
+       ; --------------------------------------------------
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test/checkI(I)V
+       ; OUTPUT: 35
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_coalesce_simple_store.j b/tests/regression/jasmin/test_coalesce_simple_store.j
new file mode 100644 (file)
index 0000000..e6da63c
--- /dev/null
@@ -0,0 +1,49 @@
+.class public test_coalesce_simple_store
+.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 42
+       istore 1
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test_coalesce_simple_store/checkI(I)V
+       ; OUTPUT: 42
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_dup.j b/tests/regression/jasmin/test_dup.j
new file mode 100644 (file)
index 0000000..5737b85
--- /dev/null
@@ -0,0 +1,60 @@
+.class public test_dup
+.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(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 3
+       .limit locals 2
+
+       ldc 35
+       istore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 32
+       ldc 91
+       dup
+       isub
+       invokestatic test_dup/check(I)V
+       ; OUTPUT: 0
+       invokestatic test_dup/check(I)V
+       ; OUTPUT: 32
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_dup2.j b/tests/regression/jasmin/test_dup2.j
new file mode 100644 (file)
index 0000000..a49c4bb
--- /dev/null
@@ -0,0 +1,71 @@
+.class public test_dup2
+.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(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 4
+       .limit locals 2
+
+       ldc 35
+       istore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 32
+       ldc 91
+       dup2 ; 32 91 32 91 (top)
+       isub ; 32 91 -59 (top)
+       invokestatic test_dup2/check(I)V
+       ; OUTPUT: -59
+       invokestatic test_dup2/check(I)V
+       ; OUTPUT: 91
+       invokestatic test_dup2/check(I)V
+       ; OUTPUT: 32
+
+       ldc 32
+       ldc2_w 91
+       dup2 ; 32 91 91 (top)
+       lsub ; 32 91 0 (top)
+       invokestatic test_dup2/check(J)V
+       ; OUTPUT: 0
+       invokestatic test_dup2/check(I)V
+       ; OUTPUT: 32
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_dup2_x1.j b/tests/regression/jasmin/test_dup2_x1.j
new file mode 100644 (file)
index 0000000..a6f178e
--- /dev/null
@@ -0,0 +1,55 @@
+.class public test_dup2_x1
+.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 5
+       .limit locals 2
+
+       ldc 35
+       istore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 32
+       ldc 91
+       ldc 47
+       dup2_x1 ; 91 47 32 91 47
+       isub
+       invokestatic test_dup2_x1/checkI(I)V
+       ; OUTPUT: 44
+       isub
+       invokestatic test_dup2_x1/checkI(I)V
+       ; OUTPUT:  15
+       invokestatic test_dup2_x1/checkI(I)V
+       ; OUTPUT:  91
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_dup2_x2.j b/tests/regression/jasmin/test_dup2_x2.j
new file mode 100644 (file)
index 0000000..f824c8c
--- /dev/null
@@ -0,0 +1,67 @@
+.class public test_dup2_x2
+.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(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 6
+       .limit locals 2
+
+       ldc 35
+       istore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 11
+       ldc 12
+       ldc 32
+       ldc 91
+       dup2_x2
+       isub
+       invokestatic test_dup2_x2/check(I)V
+       ; OUTPUT: -59
+       invokestatic test_dup2_x2/check(I)V
+       ; OUTPUT: 12
+       isub
+       invokestatic test_dup2_x2/check(I)V
+       ; OUTPUT: 80
+       invokestatic test_dup2_x2/check(I)V
+       ; OUTPUT: 32
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_dup_x1.j b/tests/regression/jasmin/test_dup_x1.j
new file mode 100644 (file)
index 0000000..c649e14
--- /dev/null
@@ -0,0 +1,51 @@
+.class public test_dup_x1
+.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 3
+       .limit locals 2
+
+       ldc 35
+       istore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 32
+       ldc 91
+       dup_x1  ; 91 32 91
+       isub
+       invokestatic test_dup_x1/checkI(I)V
+       ; OUTPUT: -59
+       invokestatic test_dup_x1/checkI(I)V
+       ; OUTPUT: 91
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_dup_x2.j b/tests/regression/jasmin/test_dup_x2.j
new file mode 100644 (file)
index 0000000..103c637
--- /dev/null
@@ -0,0 +1,74 @@
+.class public test_dup_x2
+.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(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 4
+       .limit locals 2
+
+       ldc 35
+       istore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 17
+       ldc 32
+       ldc 91
+       dup_x2 ; 91 17 32 91
+       isub
+       invokestatic test_dup_x2/check(I)V
+       ; OUTPUT: -59
+       isub
+       invokestatic test_dup_x2/check(I)V
+       ; OUTPUT: 74
+
+       ldc 17
+       ldc2_w 32
+       ldc 91
+       dup_x2 ; 17 91 32 91
+       i2l
+       lsub
+       invokestatic test_dup_x2/check(J)V
+       ; OUTPUT: -59
+       isub
+       invokestatic test_dup_x2/check(I)V
+       ; OUTPUT: -74
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_load_store_conflict.j b/tests/regression/jasmin/test_load_store_conflict.j
new file mode 100644 (file)
index 0000000..a339aec
--- /dev/null
@@ -0,0 +1,59 @@
+.class public test_load_store_conflict
+.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 3
+
+       ldc 35
+       istore 1
+       ldc 777
+       istore 2
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 42
+       iload 1  ; loads 35
+       ldc 100
+       iadd     ; result = 135
+       istore 2
+       istore 1
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test_load_store_conflict/checkI(I)V
+       ; OUTPUT: 42
+
+       iload 2
+       invokestatic test_load_store_conflict/checkI(I)V
+       ; OUTPUT: 135
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_load_store_conflict_by_exception.j b/tests/regression/jasmin/test_load_store_conflict_by_exception.j
new file mode 100644 (file)
index 0000000..91126e0
--- /dev/null
@@ -0,0 +1,80 @@
+.class public test_load_store_conflict_by_exception
+.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 3
+       .limit locals 3
+
+       .catch java/lang/Exception from test_start to test_end using handler
+
+       ldc 35
+       istore 1
+       ldc 777
+       istore 2
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+test_start:
+       ldc 42
+       aload 0
+       ldc 1
+       aaload     ; may throw
+       pop
+       istore 1
+test_end:
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test_load_store_conflict_by_exception/checkI(I)V
+
+       iload 2
+       invokestatic test_load_store_conflict_by_exception/checkI(I)V
+       
+       return
+
+handler:
+       pop
+
+       ; output magic number to show we reached the handler
+       ldc 88888
+       invokestatic test_load_store_conflict_by_exception/checkI(I)V
+       ; OUTPUT: 88888
+
+       iload 1
+       invokestatic test_load_store_conflict_by_exception/checkI(I)V
+       ; OUTPUT: 35
+
+       iload 2
+       invokestatic test_load_store_conflict_by_exception/checkI(I)V
+       ; OUTPUT: 777
+
+       return
+.end method
+
diff --git a/tests/regression/jasmin/test_load_store_conflict_by_exception_not_thrown.j b/tests/regression/jasmin/test_load_store_conflict_by_exception_not_thrown.j
new file mode 100644 (file)
index 0000000..78e543c
--- /dev/null
@@ -0,0 +1,78 @@
+.class public test_load_store_conflict_by_exception_not_thrown
+.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 3
+       .limit locals 3
+
+       .catch java/lang/Exception from test_start to test_end using handler
+
+       ldc 35
+       istore 1
+       ldc 777
+       istore 2
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+test_start:
+       ldc 42
+       aload 0
+       arraylength    ; may throw, but does not in this case
+       pop
+       istore 1
+test_end:
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test_load_store_conflict_by_exception_not_thrown/checkI(I)V
+       ; OUTPUT: 42
+
+       iload 2
+       invokestatic test_load_store_conflict_by_exception_not_thrown/checkI(I)V
+       ; OUTPUT: 777
+       
+       return
+
+handler:
+       pop
+
+       ; output magic number to show we reached the handler
+       ldc 88888
+       invokestatic test_load_store_conflict_by_exception_not_thrown/checkI(I)V
+
+       iload 1
+       invokestatic test_load_store_conflict_by_exception_not_thrown/checkI(I)V
+
+       iload 2
+       invokestatic test_load_store_conflict_by_exception_not_thrown/checkI(I)V
+
+       return
+.end method
+
diff --git a/tests/regression/jasmin/test_load_store_conflict_via_dup.j b/tests/regression/jasmin/test_load_store_conflict_via_dup.j
new file mode 100644 (file)
index 0000000..31c4e45
--- /dev/null
@@ -0,0 +1,60 @@
+.class public test_load_store_conflict_via_dup
+.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 4
+       .limit locals 3
+
+       ldc 35
+       istore 1
+       ldc 777
+       istore 2
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       iload 1  ; loads 35
+       ldc 42
+       dup2     ; stack is now 35 42 35 42 (top)
+       iadd     ; stack is now 35 42 77
+       istore 2
+       istore 1
+       pop
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test_load_store_conflict_via_dup/checkI(I)V
+       ; OUTPUT: 42
+
+       iload 2
+       invokestatic test_load_store_conflict_via_dup/checkI(I)V
+       ; OUTPUT: 77
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_load_store_conflict_via_swap.j b/tests/regression/jasmin/test_load_store_conflict_via_swap.j
new file mode 100644 (file)
index 0000000..c300dfd
--- /dev/null
@@ -0,0 +1,58 @@
+.class public test_load_store_conflict_via_swap
+.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 4
+       .limit locals 3
+
+       ldc 35
+       istore 1
+       ldc 777
+       istore 2
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       iload 1  ; loads 35
+       ldc 42
+       swap     ; stack is now 42 35 (top)
+       istore 2 ; stores 35 to L2
+       istore 1 ; stores 42 to L2
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test_load_store_conflict_via_swap/checkI(I)V
+       ; OUTPUT: 42
+
+       iload 2
+       invokestatic test_load_store_conflict_via_swap/checkI(I)V
+       ; OUTPUT: 35
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_no_store_load_conflict.j b/tests/regression/jasmin/test_no_store_load_conflict.j
new file mode 100644 (file)
index 0000000..2d2ddee
--- /dev/null
@@ -0,0 +1,59 @@
+.class public test_no_store_load_conflict
+.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 3
+
+       ldc 35
+       istore 1
+       ldc 777
+       istore 2
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       iload 1   ; loads 35
+       ldc 42
+       istore 2  ; stores 42
+       ldc 100
+       iadd      ; 35 + 100 = 135
+       istore 1
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test_no_store_load_conflict/checkI(I)V
+       ; OUTPUT: 135
+
+       iload 2
+       invokestatic test_no_store_load_conflict/checkI(I)V
+       ; OUTPUT: 42
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_no_store_store_conflict.j b/tests/regression/jasmin/test_no_store_store_conflict.j
new file mode 100644 (file)
index 0000000..8f38392
--- /dev/null
@@ -0,0 +1,57 @@
+.class public test_no_store_store_conflict
+.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 3
+
+       ldc 35
+       istore 1
+       ldc 36
+       istore 2
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 42
+       ldc 7
+       istore 2
+       istore 1
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test_no_store_store_conflict/checkI(I)V
+       ; OUTPUT: 42
+
+       iload 2
+       invokestatic test_no_store_store_conflict/checkI(I)V
+       ; OUTPUT: 7
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_store_load_conflict.j b/tests/regression/jasmin/test_store_load_conflict.j
new file mode 100644 (file)
index 0000000..3c97808
--- /dev/null
@@ -0,0 +1,59 @@
+.class public test_store_load_conflict
+.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 3
+
+       ldc 35
+       istore 1
+       ldc 777
+       istore 2
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       iload 1   ; loads 35
+       ldc 42
+       istore 1  ; stores 42
+       ldc 100
+       iadd      ; 35 + 100 = 135
+       istore 2
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test_store_load_conflict/checkI(I)V
+       ; OUTPUT: 42
+
+       iload 2
+       invokestatic test_store_load_conflict/checkI(I)V
+       ; OUTPUT: 135
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_store_store_conflict.j b/tests/regression/jasmin/test_store_store_conflict.j
new file mode 100644 (file)
index 0000000..37def4f
--- /dev/null
@@ -0,0 +1,51 @@
+.class public test_store_store_conflict
+.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 42
+       ldc 7
+       istore 1        ; stores 7
+       istore 1        ; stores 42
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test_store_store_conflict/checkI(I)V
+       ; OUTPUT: 42
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_store_store_conflict_2.j b/tests/regression/jasmin/test_store_store_conflict_2.j
new file mode 100644 (file)
index 0000000..94d23d5
--- /dev/null
@@ -0,0 +1,53 @@
+.class public test_store_store_conflict_2
+.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 3
+       .limit locals 2
+
+       ldc 35
+       istore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 11
+       ldc 42
+       ldc 7
+       istore 1
+       istore 1
+       istore 1
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       iload 1
+       invokestatic test_store_store_conflict_2/checkI(I)V
+       ; OUTPUT: 11
+
+       return
+.end method
diff --git a/tests/regression/jasmin/test_swap.j b/tests/regression/jasmin/test_swap.j
new file mode 100644 (file)
index 0000000..4e1193d
--- /dev/null
@@ -0,0 +1,58 @@
+.class public test_swap
+.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(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 2
+
+       ldc 35
+       istore 1
+
+       aload 0
+       ifnull force_basic_block_boundary
+
+       ; --------------------------------------------------
+
+       ldc 32
+       ldc 91
+       swap
+       isub
+       invokestatic test_swap/check(I)V
+       ; OUTPUT: 59
+
+       ; --------------------------------------------------
+
+force_basic_block_boundary:
+
+       return
+.end method