From 3069162838edf955238117034f77c03eb41d08bf Mon Sep 17 00:00:00 2001 From: edwin Date: Wed, 6 Sep 2006 14:32:22 +0000 Subject: [PATCH] Checked in jasmin tests. --HG-- branch : new_instruction_format --- tests/regression/jasmin/runtest | 42 ++++++++++ tests/regression/jasmin/show | 6 ++ tests/regression/jasmin/test.j | 46 +++++++++++ .../jasmin/test_coalesce_simple_store.j | 49 ++++++++++++ tests/regression/jasmin/test_dup.j | 60 ++++++++++++++ tests/regression/jasmin/test_dup2.j | 71 ++++++++++++++++ tests/regression/jasmin/test_dup2_x1.j | 55 +++++++++++++ tests/regression/jasmin/test_dup2_x2.j | 67 ++++++++++++++++ tests/regression/jasmin/test_dup_x1.j | 51 ++++++++++++ tests/regression/jasmin/test_dup_x2.j | 74 +++++++++++++++++ .../jasmin/test_load_store_conflict.j | 59 ++++++++++++++ .../test_load_store_conflict_by_exception.j | 80 +++++++++++++++++++ ...d_store_conflict_by_exception_not_thrown.j | 78 ++++++++++++++++++ .../jasmin/test_load_store_conflict_via_dup.j | 60 ++++++++++++++ .../test_load_store_conflict_via_swap.j | 58 ++++++++++++++ .../jasmin/test_no_store_load_conflict.j | 59 ++++++++++++++ .../jasmin/test_no_store_store_conflict.j | 57 +++++++++++++ .../jasmin/test_store_load_conflict.j | 59 ++++++++++++++ .../jasmin/test_store_store_conflict.j | 51 ++++++++++++ .../jasmin/test_store_store_conflict_2.j | 53 ++++++++++++ tests/regression/jasmin/test_swap.j | 58 ++++++++++++++ 21 files changed, 1193 insertions(+) create mode 100755 tests/regression/jasmin/runtest create mode 100755 tests/regression/jasmin/show create mode 100644 tests/regression/jasmin/test.j create mode 100644 tests/regression/jasmin/test_coalesce_simple_store.j create mode 100644 tests/regression/jasmin/test_dup.j create mode 100644 tests/regression/jasmin/test_dup2.j create mode 100644 tests/regression/jasmin/test_dup2_x1.j create mode 100644 tests/regression/jasmin/test_dup2_x2.j create mode 100644 tests/regression/jasmin/test_dup_x1.j create mode 100644 tests/regression/jasmin/test_dup_x2.j create mode 100644 tests/regression/jasmin/test_load_store_conflict.j create mode 100644 tests/regression/jasmin/test_load_store_conflict_by_exception.j create mode 100644 tests/regression/jasmin/test_load_store_conflict_by_exception_not_thrown.j create mode 100644 tests/regression/jasmin/test_load_store_conflict_via_dup.j create mode 100644 tests/regression/jasmin/test_load_store_conflict_via_swap.j create mode 100644 tests/regression/jasmin/test_no_store_load_conflict.j create mode 100644 tests/regression/jasmin/test_no_store_store_conflict.j create mode 100644 tests/regression/jasmin/test_store_load_conflict.j create mode 100644 tests/regression/jasmin/test_store_store_conflict.j create mode 100644 tests/regression/jasmin/test_store_store_conflict_2.j create mode 100644 tests/regression/jasmin/test_swap.j diff --git a/tests/regression/jasmin/runtest b/tests/regression/jasmin/runtest new file mode 100755 index 000000000..e3e0c3f18 --- /dev/null +++ b/tests/regression/jasmin/runtest @@ -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 index 000000000..74361e79e --- /dev/null +++ b/tests/regression/jasmin/show @@ -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 index 000000000..b788921db --- /dev/null +++ b/tests/regression/jasmin/test.j @@ -0,0 +1,46 @@ +.class public test +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..e6da63c4d --- /dev/null +++ b/tests/regression/jasmin/test_coalesce_simple_store.j @@ -0,0 +1,49 @@ +.class public test_coalesce_simple_store +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..5737b8534 --- /dev/null +++ b/tests/regression/jasmin/test_dup.j @@ -0,0 +1,60 @@ +.class public test_dup +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..a49c4bba4 --- /dev/null +++ b/tests/regression/jasmin/test_dup2.j @@ -0,0 +1,71 @@ +.class public test_dup2 +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..a6f178ef8 --- /dev/null +++ b/tests/regression/jasmin/test_dup2_x1.j @@ -0,0 +1,55 @@ +.class public test_dup2_x1 +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..f824c8c79 --- /dev/null +++ b/tests/regression/jasmin/test_dup2_x2.j @@ -0,0 +1,67 @@ +.class public test_dup2_x2 +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..c649e1471 --- /dev/null +++ b/tests/regression/jasmin/test_dup_x1.j @@ -0,0 +1,51 @@ +.class public test_dup_x1 +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..103c637cd --- /dev/null +++ b/tests/regression/jasmin/test_dup_x2.j @@ -0,0 +1,74 @@ +.class public test_dup_x2 +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..a339aec58 --- /dev/null +++ b/tests/regression/jasmin/test_load_store_conflict.j @@ -0,0 +1,59 @@ +.class public test_load_store_conflict +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..91126e099 --- /dev/null +++ b/tests/regression/jasmin/test_load_store_conflict_by_exception.j @@ -0,0 +1,80 @@ +.class public test_load_store_conflict_by_exception +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..78e543c33 --- /dev/null +++ b/tests/regression/jasmin/test_load_store_conflict_by_exception_not_thrown.j @@ -0,0 +1,78 @@ +.class public test_load_store_conflict_by_exception_not_thrown +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..31c4e4583 --- /dev/null +++ b/tests/regression/jasmin/test_load_store_conflict_via_dup.j @@ -0,0 +1,60 @@ +.class public test_load_store_conflict_via_dup +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..c300dfd82 --- /dev/null +++ b/tests/regression/jasmin/test_load_store_conflict_via_swap.j @@ -0,0 +1,58 @@ +.class public test_load_store_conflict_via_swap +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..2d2ddee4c --- /dev/null +++ b/tests/regression/jasmin/test_no_store_load_conflict.j @@ -0,0 +1,59 @@ +.class public test_no_store_load_conflict +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..8f3839201 --- /dev/null +++ b/tests/regression/jasmin/test_no_store_store_conflict.j @@ -0,0 +1,57 @@ +.class public test_no_store_store_conflict +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..3c97808c7 --- /dev/null +++ b/tests/regression/jasmin/test_store_load_conflict.j @@ -0,0 +1,59 @@ +.class public test_store_load_conflict +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..37def4f84 --- /dev/null +++ b/tests/regression/jasmin/test_store_store_conflict.j @@ -0,0 +1,51 @@ +.class public test_store_store_conflict +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..94d23d51c --- /dev/null +++ b/tests/regression/jasmin/test_store_store_conflict_2.j @@ -0,0 +1,53 @@ +.class public test_store_store_conflict_2 +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 index 000000000..4e1193d13 --- /dev/null +++ b/tests/regression/jasmin/test_swap.j @@ -0,0 +1,58 @@ +.class public test_swap +.super java/lang/Object + +; ====================================================================== + +.method public ()V + aload_0 + invokenonvirtual java/lang/Object/()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 -- 2.25.1