diff options
| author | 2016-07-08 12:51:01 +0000 | |
|---|---|---|
| committer | 2016-07-08 12:51:02 +0000 | |
| commit | 2e7acaffda05db1df6e0631468f10726e898a20a (patch) | |
| tree | 855e68d438be50fc126d48e6e2fee334169a8e92 /test/537-checker-arraycopy/src | |
| parent | 7d14037d259c4f0adadd97adab11b36cb7f2fd18 (diff) | |
| parent | fea1abd660cc89b31d121c8700fae8d804178391 (diff) | |
Merge "Implement System.arraycopy intrinsic on x86."
Diffstat (limited to 'test/537-checker-arraycopy/src')
| -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; + } } |