ARM: VIXL32: Fix PackedSwitch.
Fix the case when the jumptable is very far and offset doesn't
fit ADR offset field.
Test: export ART_USE_VIXL_ARM_BACKEND=true && \
mma test-art-host dist && mma test-art-target dist
Change-Id: I2b8ac04eb343947f9a9301f3ce6285794ddad4b8
diff --git a/test/015-switch/src/Main.java b/test/015-switch/src/Main.java
index 2a7995a..2b724a1 100644
--- a/test/015-switch/src/Main.java
+++ b/test/015-switch/src/Main.java
@@ -113,7 +113,7 @@
}
// Long packed-switch that might lead to not creating chained-ifs.
- public static void packedSwitch7(int value) {
+ public static long packedSwitch7(int value) {
switch (value) {
case 1:
System.out.println(1); break;
@@ -148,6 +148,113 @@
default:
System.out.println("default"); break;
}
+
+ // Jump tables previously were emitted in the end of the method code buffer. The
+ // following boilerplate code aims to fill the emitted code buffer extensively
+ // and check that even for big method jump table is correctly emitted, its address
+ // is within a range of corresponded pc-relative instructions (this applies to
+ // ARM mainly).
+ long temp = value;
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+ temp = Long.rotateLeft(temp, value);
+
+ return temp;
}
// Sparse switch, just leave a gap.