diff options
Diffstat (limited to 'test/537-checker-arraycopy/src/Main.java')
| -rw-r--r-- | test/537-checker-arraycopy/src/Main.java | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/test/537-checker-arraycopy/src/Main.java b/test/537-checker-arraycopy/src/Main.java index 30ccc56b80..7c124caa8e 100644 --- a/test/537-checker-arraycopy/src/Main.java +++ b/test/537-checker-arraycopy/src/Main.java @@ -50,7 +50,7 @@ public class Main { } /// CHECK-START-X86_64: void Main.arraycopy() disassembly (after) - /// CHECK: InvokeStaticOrDirect + /// CHECK: InvokeStaticOrDirect intrinsic:SystemArrayCopy /// CHECK-NOT: test /// CHECK-NOT: call /// CHECK: ReturnVoid @@ -65,7 +65,36 @@ public class Main { System.arraycopy(obj, 1, obj, 0, 1); } + // Test case for having enough registers on x86 for the arraycopy intrinsic. + /// CHECK-START-X86: void Main.arraycopy(java.lang.Object[], int) disassembly (after) + /// CHECK: InvokeStaticOrDirect intrinsic:SystemArrayCopy + /// CHECK-NOT: mov {{[a-z]+}}, [esp + {{[0-9]+}}] + /// CHECK: ReturnVoid public static void arraycopy(Object[] obj, int pos) { System.arraycopy(obj, pos, obj, 0, obj.length); } + + // Test case for having enough registers on x86 for the arraycopy intrinsic + // when an input is passed twice. + /// CHECK-START-X86: int Main.arraycopy2(java.lang.Object[], int) disassembly (after) + /// CHECK: InvokeStaticOrDirect intrinsic:SystemArrayCopy + /// CHECK-NOT: mov {{[a-z]+}}, [esp + {{[0-9]+}}] + /// CHECK: Return + public static int arraycopy2(Object[] obj, int pos) { + System.arraycopy(obj, pos, obj, pos - 1, obj.length); + return pos; + } + + // Test case for not having enough registers on x86. The arraycopy intrinsic + // will ask for length to be in stack and load it. + /// CHECK-START-X86: int Main.arraycopy3(java.lang.Object[], java.lang.Object[], int, int, int) disassembly (after) + /// CHECK: InvokeStaticOrDirect intrinsic:SystemArrayCopy + /// CHECK: mov {{[a-z]+}}, [esp + {{[0-9]+}}] + /// CHECK: Return + public static int arraycopy3(Object[] obj1, Object[] obj2, int input1, int input3, int input4) { + System.arraycopy(obj1, input1, obj2, input3, input4); + System.out.println(obj1); + System.out.println(obj2); + return input1 + input3 + input4; + } } |