diff options
author | 2016-07-22 10:52:24 +0100 | |
---|---|---|
committer | 2016-07-22 13:36:21 +0100 | |
commit | d9ad357ca598996f7c44727bf6772b74e50e74e9 (patch) | |
tree | 8c123c8ae6341357f64e7f423f23fae9027a5cb6 /test/412-new-array/src/Main.java | |
parent | 41c7e2e6ac0a59da2f3e066e20630b295fbe4661 (diff) |
ARM64/x86-64: Fix mterp fill-array-data-payload pointer calculation.
Fix the pointer calculation to sign-extend the offset
instead of zero-extending it, just like we do for the switch
table pointer calculation. Clean up comments for the switch.
Test: Additional test in 412-new-array.
Change-Id: Ibb1d2d3fcb109f59280aca08de21e42edc4ce66b
Diffstat (limited to 'test/412-new-array/src/Main.java')
-rw-r--r-- | test/412-new-array/src/Main.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/412-new-array/src/Main.java b/test/412-new-array/src/Main.java index b9c2a053e0..d95d2c52f3 100644 --- a/test/412-new-array/src/Main.java +++ b/test/412-new-array/src/Main.java @@ -259,6 +259,45 @@ public class Main extends TestCase { } { + Method m = c.getMethod("intArrayFillInstructionAfterData", int[].class); + int[] array = new int[7]; + Object[] args = { array }; + m.invoke(null, args); + assertEquals(7, array.length); + assertEquals(1, array[0]); + assertEquals(2, array[1]); + assertEquals(3, array[2]); + assertEquals(4, array[3]); + assertEquals(5, array[4]); + assertEquals(0, array[5]); + assertEquals(0, array[6]); + + array = new int[2]; + args[0] = array; + Throwable exception = null; + try { + m.invoke(null, args); + } catch (InvocationTargetException e) { + exception = e.getCause(); + assertTrue(exception instanceof IndexOutOfBoundsException); + } + assertNotNull(exception); + exception = null; + // Test that nothing has been written to the array. + assertEquals(0, array[0]); + assertEquals(0, array[1]); + + args[0] = null; + try { + m.invoke(null, args); + } catch (InvocationTargetException e) { + exception = e.getCause(); + assertTrue(exception instanceof NullPointerException); + } + assertNotNull(exception); + } + + { Method m = c.getMethod("shortArray", short[].class); short[] array = new short[7]; Object[] args = { array }; |