Add $noinline$ tag to make sure a method has not been inlined.
Change-Id: Ic166cf43be566a0fa44c3c9e1939f647806fc500
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc
index 83f8d83..5c73fd8 100644
--- a/compiler/optimizing/inliner.cc
+++ b/compiler/optimizing/inliner.cc
@@ -69,6 +69,13 @@
bool should_inline = callee_name.find("$inline$") != std::string::npos;
CHECK(!should_inline) << "Could not inline " << callee_name;
}
+ } else {
+ if (kIsDebugBuild) {
+ std::string callee_name =
+ PrettyMethod(call->GetDexMethodIndex(), *outer_compilation_unit_.GetDexFile());
+ bool must_not_inline = callee_name.find("$noinline$") != std::string::npos;
+ CHECK(!must_not_inline) << "Should not have inlined " << callee_name;
+ }
}
}
instruction = next;
diff --git a/test/004-StackWalk/src/Main.java b/test/004-StackWalk/src/Main.java
index 782f51d..9a1d0ab 100644
--- a/test/004-StackWalk/src/Main.java
+++ b/test/004-StackWalk/src/Main.java
@@ -2,7 +2,7 @@
public Main() {
}
- int f() throws Exception {
+ int $noinline$f() throws Exception {
g(1);
g(2);
@@ -93,6 +93,6 @@
public static void main(String[] args) throws Exception {
Main st = new Main();
- st.f();
+ st.$noinline$f();
}
}
diff --git a/test/422-type-conversion/src/Main.java b/test/422-type-conversion/src/Main.java
index 447b9b8..9f8f417 100644
--- a/test/422-type-conversion/src/Main.java
+++ b/test/422-type-conversion/src/Main.java
@@ -138,554 +138,554 @@
}
private static void byteToLong() {
- assertLongEquals(1L, $opt$ByteToLong((byte)1));
- assertLongEquals(0L, $opt$ByteToLong((byte)0));
- assertLongEquals(-1L, $opt$ByteToLong((byte)-1));
- assertLongEquals(51L, $opt$ByteToLong((byte)51));
- assertLongEquals(-51L, $opt$ByteToLong((byte)-51));
- assertLongEquals(127L, $opt$ByteToLong((byte)127)); // 2^7 - 1
- assertLongEquals(-127L, $opt$ByteToLong((byte)-127)); // -(2^7 - 1)
- assertLongEquals(-128L, $opt$ByteToLong((byte)-128)); // -(2^7)
+ assertLongEquals(1L, $opt$noinline$ByteToLong((byte)1));
+ assertLongEquals(0L, $opt$noinline$ByteToLong((byte)0));
+ assertLongEquals(-1L, $opt$noinline$ByteToLong((byte)-1));
+ assertLongEquals(51L, $opt$noinline$ByteToLong((byte)51));
+ assertLongEquals(-51L, $opt$noinline$ByteToLong((byte)-51));
+ assertLongEquals(127L, $opt$noinline$ByteToLong((byte)127)); // 2^7 - 1
+ assertLongEquals(-127L, $opt$noinline$ByteToLong((byte)-127)); // -(2^7 - 1)
+ assertLongEquals(-128L, $opt$noinline$ByteToLong((byte)-128)); // -(2^7)
}
private static void shortToLong() {
- assertLongEquals(1L, $opt$ShortToLong((short)1));
- assertLongEquals(0L, $opt$ShortToLong((short)0));
- assertLongEquals(-1L, $opt$ShortToLong((short)-1));
- assertLongEquals(51L, $opt$ShortToLong((short)51));
- assertLongEquals(-51L, $opt$ShortToLong((short)-51));
- assertLongEquals(32767L, $opt$ShortToLong((short)32767)); // 2^15 - 1
- assertLongEquals(-32767L, $opt$ShortToLong((short)-32767)); // -(2^15 - 1)
- assertLongEquals(-32768L, $opt$ShortToLong((short)-32768)); // -(2^15)
+ assertLongEquals(1L, $opt$noinline$ShortToLong((short)1));
+ assertLongEquals(0L, $opt$noinline$ShortToLong((short)0));
+ assertLongEquals(-1L, $opt$noinline$ShortToLong((short)-1));
+ assertLongEquals(51L, $opt$noinline$ShortToLong((short)51));
+ assertLongEquals(-51L, $opt$noinline$ShortToLong((short)-51));
+ assertLongEquals(32767L, $opt$noinline$ShortToLong((short)32767)); // 2^15 - 1
+ assertLongEquals(-32767L, $opt$noinline$ShortToLong((short)-32767)); // -(2^15 - 1)
+ assertLongEquals(-32768L, $opt$noinline$ShortToLong((short)-32768)); // -(2^15)
}
private static void intToLong() {
- assertLongEquals(1L, $opt$IntToLong(1));
- assertLongEquals(0L, $opt$IntToLong(0));
- assertLongEquals(-1L, $opt$IntToLong(-1));
- assertLongEquals(51L, $opt$IntToLong(51));
- assertLongEquals(-51L, $opt$IntToLong(-51));
- assertLongEquals(2147483647L, $opt$IntToLong(2147483647)); // 2^31 - 1
- assertLongEquals(-2147483647L, $opt$IntToLong(-2147483647)); // -(2^31 - 1)
- assertLongEquals(-2147483648L, $opt$IntToLong(-2147483648)); // -(2^31)
+ assertLongEquals(1L, $opt$noinline$IntToLong(1));
+ assertLongEquals(0L, $opt$noinline$IntToLong(0));
+ assertLongEquals(-1L, $opt$noinline$IntToLong(-1));
+ assertLongEquals(51L, $opt$noinline$IntToLong(51));
+ assertLongEquals(-51L, $opt$noinline$IntToLong(-51));
+ assertLongEquals(2147483647L, $opt$noinline$IntToLong(2147483647)); // 2^31 - 1
+ assertLongEquals(-2147483647L, $opt$noinline$IntToLong(-2147483647)); // -(2^31 - 1)
+ assertLongEquals(-2147483648L, $opt$noinline$IntToLong(-2147483648)); // -(2^31)
}
private static void charToLong() {
- assertLongEquals(1L, $opt$CharToLong((char)1));
- assertLongEquals(0L, $opt$CharToLong((char)0));
- assertLongEquals(51L, $opt$CharToLong((char)51));
- assertLongEquals(32767L, $opt$CharToLong((char)32767)); // 2^15 - 1
- assertLongEquals(65535L, $opt$CharToLong((char)65535)); // 2^16 - 1
- assertLongEquals(65535L, $opt$CharToLong((char)-1));
- assertLongEquals(65485L, $opt$CharToLong((char)-51));
- assertLongEquals(32769L, $opt$CharToLong((char)-32767)); // -(2^15 - 1)
- assertLongEquals(32768L, $opt$CharToLong((char)-32768)); // -(2^15)
+ assertLongEquals(1L, $opt$noinline$CharToLong((char)1));
+ assertLongEquals(0L, $opt$noinline$CharToLong((char)0));
+ assertLongEquals(51L, $opt$noinline$CharToLong((char)51));
+ assertLongEquals(32767L, $opt$noinline$CharToLong((char)32767)); // 2^15 - 1
+ assertLongEquals(65535L, $opt$noinline$CharToLong((char)65535)); // 2^16 - 1
+ assertLongEquals(65535L, $opt$noinline$CharToLong((char)-1));
+ assertLongEquals(65485L, $opt$noinline$CharToLong((char)-51));
+ assertLongEquals(32769L, $opt$noinline$CharToLong((char)-32767)); // -(2^15 - 1)
+ assertLongEquals(32768L, $opt$noinline$CharToLong((char)-32768)); // -(2^15)
}
private static void byteToFloat() {
- assertFloatEquals(1F, $opt$ByteToFloat((byte)1));
- assertFloatEquals(0F, $opt$ByteToFloat((byte)0));
- assertFloatEquals(-1F, $opt$ByteToFloat((byte)-1));
- assertFloatEquals(51F, $opt$ByteToFloat((byte)51));
- assertFloatEquals(-51F, $opt$ByteToFloat((byte)-51));
- assertFloatEquals(127F, $opt$ByteToFloat((byte)127)); // 2^7 - 1
- assertFloatEquals(-127F, $opt$ByteToFloat((byte)-127)); // -(2^7 - 1)
- assertFloatEquals(-128F, $opt$ByteToFloat((byte)-128)); // -(2^7)
+ assertFloatEquals(1F, $opt$noinline$ByteToFloat((byte)1));
+ assertFloatEquals(0F, $opt$noinline$ByteToFloat((byte)0));
+ assertFloatEquals(-1F, $opt$noinline$ByteToFloat((byte)-1));
+ assertFloatEquals(51F, $opt$noinline$ByteToFloat((byte)51));
+ assertFloatEquals(-51F, $opt$noinline$ByteToFloat((byte)-51));
+ assertFloatEquals(127F, $opt$noinline$ByteToFloat((byte)127)); // 2^7 - 1
+ assertFloatEquals(-127F, $opt$noinline$ByteToFloat((byte)-127)); // -(2^7 - 1)
+ assertFloatEquals(-128F, $opt$noinline$ByteToFloat((byte)-128)); // -(2^7)
}
private static void shortToFloat() {
- assertFloatEquals(1F, $opt$ShortToFloat((short)1));
- assertFloatEquals(0F, $opt$ShortToFloat((short)0));
- assertFloatEquals(-1F, $opt$ShortToFloat((short)-1));
- assertFloatEquals(51F, $opt$ShortToFloat((short)51));
- assertFloatEquals(-51F, $opt$ShortToFloat((short)-51));
- assertFloatEquals(32767F, $opt$ShortToFloat((short)32767)); // 2^15 - 1
- assertFloatEquals(-32767F, $opt$ShortToFloat((short)-32767)); // -(2^15 - 1)
- assertFloatEquals(-32768F, $opt$ShortToFloat((short)-32768)); // -(2^15)
+ assertFloatEquals(1F, $opt$noinline$ShortToFloat((short)1));
+ assertFloatEquals(0F, $opt$noinline$ShortToFloat((short)0));
+ assertFloatEquals(-1F, $opt$noinline$ShortToFloat((short)-1));
+ assertFloatEquals(51F, $opt$noinline$ShortToFloat((short)51));
+ assertFloatEquals(-51F, $opt$noinline$ShortToFloat((short)-51));
+ assertFloatEquals(32767F, $opt$noinline$ShortToFloat((short)32767)); // 2^15 - 1
+ assertFloatEquals(-32767F, $opt$noinline$ShortToFloat((short)-32767)); // -(2^15 - 1)
+ assertFloatEquals(-32768F, $opt$noinline$ShortToFloat((short)-32768)); // -(2^15)
}
private static void intToFloat() {
- assertFloatEquals(1F, $opt$IntToFloat(1));
- assertFloatEquals(0F, $opt$IntToFloat(0));
- assertFloatEquals(-1F, $opt$IntToFloat(-1));
- assertFloatEquals(51F, $opt$IntToFloat(51));
- assertFloatEquals(-51F, $opt$IntToFloat(-51));
- assertFloatEquals(16777215F, $opt$IntToFloat(16777215)); // 2^24 - 1
- assertFloatEquals(-16777215F, $opt$IntToFloat(-16777215)); // -(2^24 - 1)
- assertFloatEquals(16777216F, $opt$IntToFloat(16777216)); // 2^24
- assertFloatEquals(-16777216F, $opt$IntToFloat(-16777216)); // -(2^24)
- assertFloatEquals(2147483647F, $opt$IntToFloat(2147483647)); // 2^31 - 1
- assertFloatEquals(-2147483648F, $opt$IntToFloat(-2147483648)); // -(2^31)
+ assertFloatEquals(1F, $opt$noinline$IntToFloat(1));
+ assertFloatEquals(0F, $opt$noinline$IntToFloat(0));
+ assertFloatEquals(-1F, $opt$noinline$IntToFloat(-1));
+ assertFloatEquals(51F, $opt$noinline$IntToFloat(51));
+ assertFloatEquals(-51F, $opt$noinline$IntToFloat(-51));
+ assertFloatEquals(16777215F, $opt$noinline$IntToFloat(16777215)); // 2^24 - 1
+ assertFloatEquals(-16777215F, $opt$noinline$IntToFloat(-16777215)); // -(2^24 - 1)
+ assertFloatEquals(16777216F, $opt$noinline$IntToFloat(16777216)); // 2^24
+ assertFloatEquals(-16777216F, $opt$noinline$IntToFloat(-16777216)); // -(2^24)
+ assertFloatEquals(2147483647F, $opt$noinline$IntToFloat(2147483647)); // 2^31 - 1
+ assertFloatEquals(-2147483648F, $opt$noinline$IntToFloat(-2147483648)); // -(2^31)
}
private static void charToFloat() {
- assertFloatEquals(1F, $opt$CharToFloat((char)1));
- assertFloatEquals(0F, $opt$CharToFloat((char)0));
- assertFloatEquals(51F, $opt$CharToFloat((char)51));
- assertFloatEquals(32767F, $opt$CharToFloat((char)32767)); // 2^15 - 1
- assertFloatEquals(65535F, $opt$CharToFloat((char)65535)); // 2^16 - 1
- assertFloatEquals(65535F, $opt$CharToFloat((char)-1));
- assertFloatEquals(65485F, $opt$CharToFloat((char)-51));
- assertFloatEquals(32769F, $opt$CharToFloat((char)-32767)); // -(2^15 - 1)
- assertFloatEquals(32768F, $opt$CharToFloat((char)-32768)); // -(2^15)
+ assertFloatEquals(1F, $opt$noinline$CharToFloat((char)1));
+ assertFloatEquals(0F, $opt$noinline$CharToFloat((char)0));
+ assertFloatEquals(51F, $opt$noinline$CharToFloat((char)51));
+ assertFloatEquals(32767F, $opt$noinline$CharToFloat((char)32767)); // 2^15 - 1
+ assertFloatEquals(65535F, $opt$noinline$CharToFloat((char)65535)); // 2^16 - 1
+ assertFloatEquals(65535F, $opt$noinline$CharToFloat((char)-1));
+ assertFloatEquals(65485F, $opt$noinline$CharToFloat((char)-51));
+ assertFloatEquals(32769F, $opt$noinline$CharToFloat((char)-32767)); // -(2^15 - 1)
+ assertFloatEquals(32768F, $opt$noinline$CharToFloat((char)-32768)); // -(2^15)
}
private static void byteToDouble() {
- assertDoubleEquals(1D, $opt$ByteToDouble((byte)1));
- assertDoubleEquals(0D, $opt$ByteToDouble((byte)0));
- assertDoubleEquals(-1D, $opt$ByteToDouble((byte)-1));
- assertDoubleEquals(51D, $opt$ByteToDouble((byte)51));
- assertDoubleEquals(-51D, $opt$ByteToDouble((byte)-51));
- assertDoubleEquals(127D, $opt$ByteToDouble((byte)127)); // 2^7 - 1
- assertDoubleEquals(-127D, $opt$ByteToDouble((byte)-127)); // -(2^7 - 1)
- assertDoubleEquals(-128D, $opt$ByteToDouble((byte)-128)); // -(2^7)
+ assertDoubleEquals(1D, $opt$noinline$ByteToDouble((byte)1));
+ assertDoubleEquals(0D, $opt$noinline$ByteToDouble((byte)0));
+ assertDoubleEquals(-1D, $opt$noinline$ByteToDouble((byte)-1));
+ assertDoubleEquals(51D, $opt$noinline$ByteToDouble((byte)51));
+ assertDoubleEquals(-51D, $opt$noinline$ByteToDouble((byte)-51));
+ assertDoubleEquals(127D, $opt$noinline$ByteToDouble((byte)127)); // 2^7 - 1
+ assertDoubleEquals(-127D, $opt$noinline$ByteToDouble((byte)-127)); // -(2^7 - 1)
+ assertDoubleEquals(-128D, $opt$noinline$ByteToDouble((byte)-128)); // -(2^7)
}
private static void shortToDouble() {
- assertDoubleEquals(1D, $opt$ShortToDouble((short)1));
- assertDoubleEquals(0D, $opt$ShortToDouble((short)0));
- assertDoubleEquals(-1D, $opt$ShortToDouble((short)-1));
- assertDoubleEquals(51D, $opt$ShortToDouble((short)51));
- assertDoubleEquals(-51D, $opt$ShortToDouble((short)-51));
- assertDoubleEquals(32767D, $opt$ShortToDouble((short)32767)); // 2^15 - 1
- assertDoubleEquals(-32767D, $opt$ShortToDouble((short)-32767)); // -(2^15 - 1)
- assertDoubleEquals(-32768D, $opt$ShortToDouble((short)-32768)); // -(2^15)
+ assertDoubleEquals(1D, $opt$noinline$ShortToDouble((short)1));
+ assertDoubleEquals(0D, $opt$noinline$ShortToDouble((short)0));
+ assertDoubleEquals(-1D, $opt$noinline$ShortToDouble((short)-1));
+ assertDoubleEquals(51D, $opt$noinline$ShortToDouble((short)51));
+ assertDoubleEquals(-51D, $opt$noinline$ShortToDouble((short)-51));
+ assertDoubleEquals(32767D, $opt$noinline$ShortToDouble((short)32767)); // 2^15 - 1
+ assertDoubleEquals(-32767D, $opt$noinline$ShortToDouble((short)-32767)); // -(2^15 - 1)
+ assertDoubleEquals(-32768D, $opt$noinline$ShortToDouble((short)-32768)); // -(2^15)
}
private static void intToDouble() {
- assertDoubleEquals(1D, $opt$IntToDouble(1));
- assertDoubleEquals(0D, $opt$IntToDouble(0));
- assertDoubleEquals(-1D, $opt$IntToDouble(-1));
- assertDoubleEquals(51D, $opt$IntToDouble(51));
- assertDoubleEquals(-51D, $opt$IntToDouble(-51));
- assertDoubleEquals(16777216D, $opt$IntToDouble(16777216)); // 2^24
- assertDoubleEquals(-16777216D, $opt$IntToDouble(-16777216)); // -(2^24)
- assertDoubleEquals(2147483647D, $opt$IntToDouble(2147483647)); // 2^31 - 1
- assertDoubleEquals(-2147483648D, $opt$IntToDouble(-2147483648)); // -(2^31)
+ assertDoubleEquals(1D, $opt$noinline$IntToDouble(1));
+ assertDoubleEquals(0D, $opt$noinline$IntToDouble(0));
+ assertDoubleEquals(-1D, $opt$noinline$IntToDouble(-1));
+ assertDoubleEquals(51D, $opt$noinline$IntToDouble(51));
+ assertDoubleEquals(-51D, $opt$noinline$IntToDouble(-51));
+ assertDoubleEquals(16777216D, $opt$noinline$IntToDouble(16777216)); // 2^24
+ assertDoubleEquals(-16777216D, $opt$noinline$IntToDouble(-16777216)); // -(2^24)
+ assertDoubleEquals(2147483647D, $opt$noinline$IntToDouble(2147483647)); // 2^31 - 1
+ assertDoubleEquals(-2147483648D, $opt$noinline$IntToDouble(-2147483648)); // -(2^31)
}
private static void charToDouble() {
- assertDoubleEquals(1D, $opt$CharToDouble((char)1));
- assertDoubleEquals(0D, $opt$CharToDouble((char)0));
- assertDoubleEquals(51D, $opt$CharToDouble((char)51));
- assertDoubleEquals(32767D, $opt$CharToDouble((char)32767)); // 2^15 - 1
- assertDoubleEquals(65535D, $opt$CharToDouble((char)65535)); // 2^16 - 1
- assertDoubleEquals(65535D, $opt$CharToDouble((char)-1));
- assertDoubleEquals(65485D, $opt$CharToDouble((char)-51));
- assertDoubleEquals(32769D, $opt$CharToDouble((char)-32767)); // -(2^15 - 1)
- assertDoubleEquals(32768D, $opt$CharToDouble((char)-32768)); // -(2^15)
+ assertDoubleEquals(1D, $opt$noinline$CharToDouble((char)1));
+ assertDoubleEquals(0D, $opt$noinline$CharToDouble((char)0));
+ assertDoubleEquals(51D, $opt$noinline$CharToDouble((char)51));
+ assertDoubleEquals(32767D, $opt$noinline$CharToDouble((char)32767)); // 2^15 - 1
+ assertDoubleEquals(65535D, $opt$noinline$CharToDouble((char)65535)); // 2^16 - 1
+ assertDoubleEquals(65535D, $opt$noinline$CharToDouble((char)-1));
+ assertDoubleEquals(65485D, $opt$noinline$CharToDouble((char)-51));
+ assertDoubleEquals(32769D, $opt$noinline$CharToDouble((char)-32767)); // -(2^15 - 1)
+ assertDoubleEquals(32768D, $opt$noinline$CharToDouble((char)-32768)); // -(2^15)
}
private static void longToInt() {
- assertIntEquals(1, $opt$LongToInt(1L));
- assertIntEquals(0, $opt$LongToInt(0L));
- assertIntEquals(-1, $opt$LongToInt(-1L));
- assertIntEquals(51, $opt$LongToInt(51L));
- assertIntEquals(-51, $opt$LongToInt(-51L));
- assertIntEquals(2147483647, $opt$LongToInt(2147483647L)); // 2^31 - 1
- assertIntEquals(-2147483647, $opt$LongToInt(-2147483647L)); // -(2^31 - 1)
- assertIntEquals(-2147483648, $opt$LongToInt(-2147483648L)); // -(2^31)
- assertIntEquals(-2147483648, $opt$LongToInt(2147483648L)); // (2^31)
- assertIntEquals(2147483647, $opt$LongToInt(-2147483649L)); // -(2^31 + 1)
- assertIntEquals(-1, $opt$LongToInt(9223372036854775807L)); // 2^63 - 1
- assertIntEquals(1, $opt$LongToInt(-9223372036854775807L)); // -(2^63 - 1)
- assertIntEquals(0, $opt$LongToInt(-9223372036854775808L)); // -(2^63)
+ assertIntEquals(1, $opt$noinline$LongToInt(1L));
+ assertIntEquals(0, $opt$noinline$LongToInt(0L));
+ assertIntEquals(-1, $opt$noinline$LongToInt(-1L));
+ assertIntEquals(51, $opt$noinline$LongToInt(51L));
+ assertIntEquals(-51, $opt$noinline$LongToInt(-51L));
+ assertIntEquals(2147483647, $opt$noinline$LongToInt(2147483647L)); // 2^31 - 1
+ assertIntEquals(-2147483647, $opt$noinline$LongToInt(-2147483647L)); // -(2^31 - 1)
+ assertIntEquals(-2147483648, $opt$noinline$LongToInt(-2147483648L)); // -(2^31)
+ assertIntEquals(-2147483648, $opt$noinline$LongToInt(2147483648L)); // (2^31)
+ assertIntEquals(2147483647, $opt$noinline$LongToInt(-2147483649L)); // -(2^31 + 1)
+ assertIntEquals(-1, $opt$noinline$LongToInt(9223372036854775807L)); // 2^63 - 1
+ assertIntEquals(1, $opt$noinline$LongToInt(-9223372036854775807L)); // -(2^63 - 1)
+ assertIntEquals(0, $opt$noinline$LongToInt(-9223372036854775808L)); // -(2^63)
- assertIntEquals(42, $opt$LongLiteralToInt());
+ assertIntEquals(42, $opt$noinline$LongLiteralToInt());
// Ensure long-to-int conversions truncates values as expected.
- assertLongEquals(1L, $opt$IntToLong($opt$LongToInt(4294967297L))); // 2^32 + 1
- assertLongEquals(0L, $opt$IntToLong($opt$LongToInt(4294967296L))); // 2^32
- assertLongEquals(-1L, $opt$IntToLong($opt$LongToInt(4294967295L))); // 2^32 - 1
- assertLongEquals(0L, $opt$IntToLong($opt$LongToInt(0L)));
- assertLongEquals(1L, $opt$IntToLong($opt$LongToInt(-4294967295L))); // -(2^32 - 1)
- assertLongEquals(0L, $opt$IntToLong($opt$LongToInt(-4294967296L))); // -(2^32)
- assertLongEquals(-1, $opt$IntToLong($opt$LongToInt(-4294967297L))); // -(2^32 + 1)
+ assertLongEquals(1L, $opt$noinline$IntToLong($opt$noinline$LongToInt(4294967297L))); // 2^32 + 1
+ assertLongEquals(0L, $opt$noinline$IntToLong($opt$noinline$LongToInt(4294967296L))); // 2^32
+ assertLongEquals(-1L, $opt$noinline$IntToLong($opt$noinline$LongToInt(4294967295L))); // 2^32 - 1
+ assertLongEquals(0L, $opt$noinline$IntToLong($opt$noinline$LongToInt(0L)));
+ assertLongEquals(1L, $opt$noinline$IntToLong($opt$noinline$LongToInt(-4294967295L))); // -(2^32 - 1)
+ assertLongEquals(0L, $opt$noinline$IntToLong($opt$noinline$LongToInt(-4294967296L))); // -(2^32)
+ assertLongEquals(-1, $opt$noinline$IntToLong($opt$noinline$LongToInt(-4294967297L))); // -(2^32 + 1)
}
private static void longToFloat() {
- assertFloatEquals(1F, $opt$LongToFloat(1L));
- assertFloatEquals(0F, $opt$LongToFloat(0L));
- assertFloatEquals(-1F, $opt$LongToFloat(-1L));
- assertFloatEquals(51F, $opt$LongToFloat(51L));
- assertFloatEquals(-51F, $opt$LongToFloat(-51L));
- assertFloatEquals(2147483647F, $opt$LongToFloat(2147483647L)); // 2^31 - 1
- assertFloatEquals(-2147483647F, $opt$LongToFloat(-2147483647L)); // -(2^31 - 1)
- assertFloatEquals(-2147483648F, $opt$LongToFloat(-2147483648L)); // -(2^31)
- assertFloatEquals(2147483648F, $opt$LongToFloat(2147483648L)); // (2^31)
- assertFloatEquals(-2147483649F, $opt$LongToFloat(-2147483649L)); // -(2^31 + 1)
- assertFloatEquals(4294967296F, $opt$LongToFloat(4294967296L)); // (2^32)
- assertFloatEquals(-4294967296F, $opt$LongToFloat(-4294967296L)); // -(2^32)
- assertFloatEquals(140739635871745F, $opt$LongToFloat(140739635871745L)); // 1 + 2^15 + 2^31 + 2^47
- assertFloatEquals(-140739635871745F, $opt$LongToFloat(-140739635871745L)); // -(1 + 2^15 + 2^31 + 2^47)
- assertFloatEquals(9223372036854775807F, $opt$LongToFloat(9223372036854775807L)); // 2^63 - 1
- assertFloatEquals(-9223372036854775807F, $opt$LongToFloat(-9223372036854775807L)); // -(2^63 - 1)
- assertFloatEquals(-9223372036854775808F, $opt$LongToFloat(-9223372036854775808L)); // -(2^63)
+ assertFloatEquals(1F, $opt$noinline$LongToFloat(1L));
+ assertFloatEquals(0F, $opt$noinline$LongToFloat(0L));
+ assertFloatEquals(-1F, $opt$noinline$LongToFloat(-1L));
+ assertFloatEquals(51F, $opt$noinline$LongToFloat(51L));
+ assertFloatEquals(-51F, $opt$noinline$LongToFloat(-51L));
+ assertFloatEquals(2147483647F, $opt$noinline$LongToFloat(2147483647L)); // 2^31 - 1
+ assertFloatEquals(-2147483647F, $opt$noinline$LongToFloat(-2147483647L)); // -(2^31 - 1)
+ assertFloatEquals(-2147483648F, $opt$noinline$LongToFloat(-2147483648L)); // -(2^31)
+ assertFloatEquals(2147483648F, $opt$noinline$LongToFloat(2147483648L)); // (2^31)
+ assertFloatEquals(-2147483649F, $opt$noinline$LongToFloat(-2147483649L)); // -(2^31 + 1)
+ assertFloatEquals(4294967296F, $opt$noinline$LongToFloat(4294967296L)); // (2^32)
+ assertFloatEquals(-4294967296F, $opt$noinline$LongToFloat(-4294967296L)); // -(2^32)
+ assertFloatEquals(140739635871745F, $opt$noinline$LongToFloat(140739635871745L)); // 1 + 2^15 + 2^31 + 2^47
+ assertFloatEquals(-140739635871745F, $opt$noinline$LongToFloat(-140739635871745L)); // -(1 + 2^15 + 2^31 + 2^47)
+ assertFloatEquals(9223372036854775807F, $opt$noinline$LongToFloat(9223372036854775807L)); // 2^63 - 1
+ assertFloatEquals(-9223372036854775807F, $opt$noinline$LongToFloat(-9223372036854775807L)); // -(2^63 - 1)
+ assertFloatEquals(-9223372036854775808F, $opt$noinline$LongToFloat(-9223372036854775808L)); // -(2^63)
}
private static void longToDouble() {
- assertDoubleEquals(1D, $opt$LongToDouble(1L));
- assertDoubleEquals(0D, $opt$LongToDouble(0L));
- assertDoubleEquals(-1D, $opt$LongToDouble(-1L));
- assertDoubleEquals(51D, $opt$LongToDouble(51L));
- assertDoubleEquals(-51D, $opt$LongToDouble(-51L));
- assertDoubleEquals(2147483647D, $opt$LongToDouble(2147483647L)); // 2^31 - 1
- assertDoubleEquals(-2147483647D, $opt$LongToDouble(-2147483647L)); // -(2^31 - 1)
- assertDoubleEquals(-2147483648D, $opt$LongToDouble(-2147483648L)); // -(2^31)
- assertDoubleEquals(2147483648D, $opt$LongToDouble(2147483648L)); // (2^31)
- assertDoubleEquals(-2147483649D, $opt$LongToDouble(-2147483649L)); // -(2^31 + 1)
- assertDoubleEquals(4294967296D, $opt$LongToDouble(4294967296L)); // (2^32)
- assertDoubleEquals(-4294967296D, $opt$LongToDouble(-4294967296L)); // -(2^32)
- assertDoubleEquals(140739635871745D, $opt$LongToDouble(140739635871745L)); // 1 + 2^15 + 2^31 + 2^47
- assertDoubleEquals(-140739635871745D, $opt$LongToDouble(-140739635871745L)); // -(1 + 2^15 + 2^31 + 2^47)
- assertDoubleEquals(9223372036854775807D, $opt$LongToDouble(9223372036854775807L)); // 2^63 - 1
- assertDoubleEquals(-9223372036854775807D, $opt$LongToDouble(-9223372036854775807L)); // -(2^63 - 1)
- assertDoubleEquals(-9223372036854775808D, $opt$LongToDouble(-9223372036854775808L)); // -(2^63)
+ assertDoubleEquals(1D, $opt$noinline$LongToDouble(1L));
+ assertDoubleEquals(0D, $opt$noinline$LongToDouble(0L));
+ assertDoubleEquals(-1D, $opt$noinline$LongToDouble(-1L));
+ assertDoubleEquals(51D, $opt$noinline$LongToDouble(51L));
+ assertDoubleEquals(-51D, $opt$noinline$LongToDouble(-51L));
+ assertDoubleEquals(2147483647D, $opt$noinline$LongToDouble(2147483647L)); // 2^31 - 1
+ assertDoubleEquals(-2147483647D, $opt$noinline$LongToDouble(-2147483647L)); // -(2^31 - 1)
+ assertDoubleEquals(-2147483648D, $opt$noinline$LongToDouble(-2147483648L)); // -(2^31)
+ assertDoubleEquals(2147483648D, $opt$noinline$LongToDouble(2147483648L)); // (2^31)
+ assertDoubleEquals(-2147483649D, $opt$noinline$LongToDouble(-2147483649L)); // -(2^31 + 1)
+ assertDoubleEquals(4294967296D, $opt$noinline$LongToDouble(4294967296L)); // (2^32)
+ assertDoubleEquals(-4294967296D, $opt$noinline$LongToDouble(-4294967296L)); // -(2^32)
+ assertDoubleEquals(140739635871745D, $opt$noinline$LongToDouble(140739635871745L)); // 1 + 2^15 + 2^31 + 2^47
+ assertDoubleEquals(-140739635871745D, $opt$noinline$LongToDouble(-140739635871745L)); // -(1 + 2^15 + 2^31 + 2^47)
+ assertDoubleEquals(9223372036854775807D, $opt$noinline$LongToDouble(9223372036854775807L)); // 2^63 - 1
+ assertDoubleEquals(-9223372036854775807D, $opt$noinline$LongToDouble(-9223372036854775807L)); // -(2^63 - 1)
+ assertDoubleEquals(-9223372036854775808D, $opt$noinline$LongToDouble(-9223372036854775808L)); // -(2^63)
}
private static void floatToInt() {
- assertIntEquals(1, $opt$FloatToInt(1F));
- assertIntEquals(0, $opt$FloatToInt(0F));
- assertIntEquals(0, $opt$FloatToInt(-0F));
- assertIntEquals(-1, $opt$FloatToInt(-1F));
- assertIntEquals(51, $opt$FloatToInt(51F));
- assertIntEquals(-51, $opt$FloatToInt(-51F));
- assertIntEquals(0, $opt$FloatToInt(0.5F));
- assertIntEquals(0, $opt$FloatToInt(0.4999999F));
- assertIntEquals(0, $opt$FloatToInt(-0.4999999F));
- assertIntEquals(0, $opt$FloatToInt(-0.5F));
- assertIntEquals(42, $opt$FloatToInt(42.199F));
- assertIntEquals(-42, $opt$FloatToInt(-42.199F));
- assertIntEquals(2147483647, $opt$FloatToInt(2147483647F)); // 2^31 - 1
- assertIntEquals(-2147483648, $opt$FloatToInt(-2147483647F)); // -(2^31 - 1)
- assertIntEquals(-2147483648, $opt$FloatToInt(-2147483648F)); // -(2^31)
- assertIntEquals(2147483647, $opt$FloatToInt(2147483648F)); // (2^31)
- assertIntEquals(-2147483648, $opt$FloatToInt(-2147483649F)); // -(2^31 + 1)
- assertIntEquals(2147483647, $opt$FloatToInt(9223372036854775807F)); // 2^63 - 1
- assertIntEquals(-2147483648, $opt$FloatToInt(-9223372036854775807F)); // -(2^63 - 1)
- assertIntEquals(-2147483648, $opt$FloatToInt(-9223372036854775808F)); // -(2^63)
- assertIntEquals(0, $opt$FloatToInt(Float.NaN));
- assertIntEquals(2147483647, $opt$FloatToInt(Float.POSITIVE_INFINITY));
- assertIntEquals(-2147483648, $opt$FloatToInt(Float.NEGATIVE_INFINITY));
+ assertIntEquals(1, $opt$noinline$FloatToInt(1F));
+ assertIntEquals(0, $opt$noinline$FloatToInt(0F));
+ assertIntEquals(0, $opt$noinline$FloatToInt(-0F));
+ assertIntEquals(-1, $opt$noinline$FloatToInt(-1F));
+ assertIntEquals(51, $opt$noinline$FloatToInt(51F));
+ assertIntEquals(-51, $opt$noinline$FloatToInt(-51F));
+ assertIntEquals(0, $opt$noinline$FloatToInt(0.5F));
+ assertIntEquals(0, $opt$noinline$FloatToInt(0.4999999F));
+ assertIntEquals(0, $opt$noinline$FloatToInt(-0.4999999F));
+ assertIntEquals(0, $opt$noinline$FloatToInt(-0.5F));
+ assertIntEquals(42, $opt$noinline$FloatToInt(42.199F));
+ assertIntEquals(-42, $opt$noinline$FloatToInt(-42.199F));
+ assertIntEquals(2147483647, $opt$noinline$FloatToInt(2147483647F)); // 2^31 - 1
+ assertIntEquals(-2147483648, $opt$noinline$FloatToInt(-2147483647F)); // -(2^31 - 1)
+ assertIntEquals(-2147483648, $opt$noinline$FloatToInt(-2147483648F)); // -(2^31)
+ assertIntEquals(2147483647, $opt$noinline$FloatToInt(2147483648F)); // (2^31)
+ assertIntEquals(-2147483648, $opt$noinline$FloatToInt(-2147483649F)); // -(2^31 + 1)
+ assertIntEquals(2147483647, $opt$noinline$FloatToInt(9223372036854775807F)); // 2^63 - 1
+ assertIntEquals(-2147483648, $opt$noinline$FloatToInt(-9223372036854775807F)); // -(2^63 - 1)
+ assertIntEquals(-2147483648, $opt$noinline$FloatToInt(-9223372036854775808F)); // -(2^63)
+ assertIntEquals(0, $opt$noinline$FloatToInt(Float.NaN));
+ assertIntEquals(2147483647, $opt$noinline$FloatToInt(Float.POSITIVE_INFINITY));
+ assertIntEquals(-2147483648, $opt$noinline$FloatToInt(Float.NEGATIVE_INFINITY));
}
private static void floatToLong() {
- assertLongEquals(1L, $opt$FloatToLong(1F));
- assertLongEquals(0L, $opt$FloatToLong(0F));
- assertLongEquals(0L, $opt$FloatToLong(-0F));
- assertLongEquals(-1L, $opt$FloatToLong(-1F));
- assertLongEquals(51L, $opt$FloatToLong(51F));
- assertLongEquals(-51L, $opt$FloatToLong(-51F));
- assertLongEquals(0L, $opt$FloatToLong(0.5F));
- assertLongEquals(0L, $opt$FloatToLong(0.4999999F));
- assertLongEquals(0L, $opt$FloatToLong(-0.4999999F));
- assertLongEquals(0L, $opt$FloatToLong(-0.5F));
- assertLongEquals(42L, $opt$FloatToLong(42.199F));
- assertLongEquals(-42L, $opt$FloatToLong(-42.199F));
- assertLongEquals(2147483648L, $opt$FloatToLong(2147483647F)); // 2^31 - 1
- assertLongEquals(-2147483648L, $opt$FloatToLong(-2147483647F)); // -(2^31 - 1)
- assertLongEquals(-2147483648L, $opt$FloatToLong(-2147483648F)); // -(2^31)
- assertLongEquals(2147483648L, $opt$FloatToLong(2147483648F)); // (2^31)
- assertLongEquals(-2147483648L, $opt$FloatToLong(-2147483649F)); // -(2^31 + 1)
- assertLongEquals(9223372036854775807L, $opt$FloatToLong(9223372036854775807F)); // 2^63 - 1
- assertLongEquals(-9223372036854775808L, $opt$FloatToLong(-9223372036854775807F)); // -(2^63 - 1)
- assertLongEquals(-9223372036854775808L, $opt$FloatToLong(-9223372036854775808F)); // -(2^63)
- assertLongEquals(0L, $opt$FloatToLong(Float.NaN));
- assertLongEquals(9223372036854775807L, $opt$FloatToLong(Float.POSITIVE_INFINITY));
- assertLongEquals(-9223372036854775808L, $opt$FloatToLong(Float.NEGATIVE_INFINITY));
+ assertLongEquals(1L, $opt$noinline$FloatToLong(1F));
+ assertLongEquals(0L, $opt$noinline$FloatToLong(0F));
+ assertLongEquals(0L, $opt$noinline$FloatToLong(-0F));
+ assertLongEquals(-1L, $opt$noinline$FloatToLong(-1F));
+ assertLongEquals(51L, $opt$noinline$FloatToLong(51F));
+ assertLongEquals(-51L, $opt$noinline$FloatToLong(-51F));
+ assertLongEquals(0L, $opt$noinline$FloatToLong(0.5F));
+ assertLongEquals(0L, $opt$noinline$FloatToLong(0.4999999F));
+ assertLongEquals(0L, $opt$noinline$FloatToLong(-0.4999999F));
+ assertLongEquals(0L, $opt$noinline$FloatToLong(-0.5F));
+ assertLongEquals(42L, $opt$noinline$FloatToLong(42.199F));
+ assertLongEquals(-42L, $opt$noinline$FloatToLong(-42.199F));
+ assertLongEquals(2147483648L, $opt$noinline$FloatToLong(2147483647F)); // 2^31 - 1
+ assertLongEquals(-2147483648L, $opt$noinline$FloatToLong(-2147483647F)); // -(2^31 - 1)
+ assertLongEquals(-2147483648L, $opt$noinline$FloatToLong(-2147483648F)); // -(2^31)
+ assertLongEquals(2147483648L, $opt$noinline$FloatToLong(2147483648F)); // (2^31)
+ assertLongEquals(-2147483648L, $opt$noinline$FloatToLong(-2147483649F)); // -(2^31 + 1)
+ assertLongEquals(9223372036854775807L, $opt$noinline$FloatToLong(9223372036854775807F)); // 2^63 - 1
+ assertLongEquals(-9223372036854775808L, $opt$noinline$FloatToLong(-9223372036854775807F)); // -(2^63 - 1)
+ assertLongEquals(-9223372036854775808L, $opt$noinline$FloatToLong(-9223372036854775808F)); // -(2^63)
+ assertLongEquals(0L, $opt$noinline$FloatToLong(Float.NaN));
+ assertLongEquals(9223372036854775807L, $opt$noinline$FloatToLong(Float.POSITIVE_INFINITY));
+ assertLongEquals(-9223372036854775808L, $opt$noinline$FloatToLong(Float.NEGATIVE_INFINITY));
}
private static void floatToDouble() {
- assertDoubleEquals(1D, $opt$FloatToDouble(1F));
- assertDoubleEquals(0D, $opt$FloatToDouble(0F));
- assertDoubleEquals(0D, $opt$FloatToDouble(-0F));
- assertDoubleEquals(-1D, $opt$FloatToDouble(-1F));
- assertDoubleEquals(51D, $opt$FloatToDouble(51F));
- assertDoubleEquals(-51D, $opt$FloatToDouble(-51F));
- assertDoubleEquals(0.5D, $opt$FloatToDouble(0.5F));
- assertDoubleEquals(0.49999991059303284D, $opt$FloatToDouble(0.4999999F));
- assertDoubleEquals(-0.49999991059303284D, $opt$FloatToDouble(-0.4999999F));
- assertDoubleEquals(-0.5D, $opt$FloatToDouble(-0.5F));
- assertDoubleEquals(42.19900131225586D, $opt$FloatToDouble(42.199F));
- assertDoubleEquals(-42.19900131225586D, $opt$FloatToDouble(-42.199F));
- assertDoubleEquals(2147483648D, $opt$FloatToDouble(2147483647F)); // 2^31 - 1
- assertDoubleEquals(-2147483648D, $opt$FloatToDouble(-2147483647F)); // -(2^31 - 1)
- assertDoubleEquals(-2147483648D, $opt$FloatToDouble(-2147483648F)); // -(2^31)
- assertDoubleEquals(2147483648D, $opt$FloatToDouble(2147483648F)); // (2^31)
- assertDoubleEquals(-2147483648D, $opt$FloatToDouble(-2147483649F)); // -(2^31 + 1)
- assertDoubleEquals(9223372036854775807D, $opt$FloatToDouble(9223372036854775807F)); // 2^63 - 1
- assertDoubleEquals(-9223372036854775807D, $opt$FloatToDouble(-9223372036854775807F)); // -(2^63 - 1)
- assertDoubleEquals(-9223372036854775808D, $opt$FloatToDouble(-9223372036854775808F)); // -(2^63)
- assertDoubleIsNaN($opt$FloatToDouble(Float.NaN));
- assertDoubleEquals(Double.POSITIVE_INFINITY, $opt$FloatToDouble(Float.POSITIVE_INFINITY));
- assertDoubleEquals(Double.NEGATIVE_INFINITY, $opt$FloatToDouble(Float.NEGATIVE_INFINITY));
+ assertDoubleEquals(1D, $opt$noinline$FloatToDouble(1F));
+ assertDoubleEquals(0D, $opt$noinline$FloatToDouble(0F));
+ assertDoubleEquals(0D, $opt$noinline$FloatToDouble(-0F));
+ assertDoubleEquals(-1D, $opt$noinline$FloatToDouble(-1F));
+ assertDoubleEquals(51D, $opt$noinline$FloatToDouble(51F));
+ assertDoubleEquals(-51D, $opt$noinline$FloatToDouble(-51F));
+ assertDoubleEquals(0.5D, $opt$noinline$FloatToDouble(0.5F));
+ assertDoubleEquals(0.49999991059303284D, $opt$noinline$FloatToDouble(0.4999999F));
+ assertDoubleEquals(-0.49999991059303284D, $opt$noinline$FloatToDouble(-0.4999999F));
+ assertDoubleEquals(-0.5D, $opt$noinline$FloatToDouble(-0.5F));
+ assertDoubleEquals(42.19900131225586D, $opt$noinline$FloatToDouble(42.199F));
+ assertDoubleEquals(-42.19900131225586D, $opt$noinline$FloatToDouble(-42.199F));
+ assertDoubleEquals(2147483648D, $opt$noinline$FloatToDouble(2147483647F)); // 2^31 - 1
+ assertDoubleEquals(-2147483648D, $opt$noinline$FloatToDouble(-2147483647F)); // -(2^31 - 1)
+ assertDoubleEquals(-2147483648D, $opt$noinline$FloatToDouble(-2147483648F)); // -(2^31)
+ assertDoubleEquals(2147483648D, $opt$noinline$FloatToDouble(2147483648F)); // (2^31)
+ assertDoubleEquals(-2147483648D, $opt$noinline$FloatToDouble(-2147483649F)); // -(2^31 + 1)
+ assertDoubleEquals(9223372036854775807D, $opt$noinline$FloatToDouble(9223372036854775807F)); // 2^63 - 1
+ assertDoubleEquals(-9223372036854775807D, $opt$noinline$FloatToDouble(-9223372036854775807F)); // -(2^63 - 1)
+ assertDoubleEquals(-9223372036854775808D, $opt$noinline$FloatToDouble(-9223372036854775808F)); // -(2^63)
+ assertDoubleIsNaN($opt$noinline$FloatToDouble(Float.NaN));
+ assertDoubleEquals(Double.POSITIVE_INFINITY, $opt$noinline$FloatToDouble(Float.POSITIVE_INFINITY));
+ assertDoubleEquals(Double.NEGATIVE_INFINITY, $opt$noinline$FloatToDouble(Float.NEGATIVE_INFINITY));
}
private static void doubleToInt() {
- assertIntEquals(1, $opt$DoubleToInt(1D));
- assertIntEquals(0, $opt$DoubleToInt(0D));
- assertIntEquals(0, $opt$DoubleToInt(-0D));
- assertIntEquals(-1, $opt$DoubleToInt(-1D));
- assertIntEquals(51, $opt$DoubleToInt(51D));
- assertIntEquals(-51, $opt$DoubleToInt(-51D));
- assertIntEquals(0, $opt$DoubleToInt(0.5D));
- assertIntEquals(0, $opt$DoubleToInt(0.4999999D));
- assertIntEquals(0, $opt$DoubleToInt(-0.4999999D));
- assertIntEquals(0, $opt$DoubleToInt(-0.5D));
- assertIntEquals(42, $opt$DoubleToInt(42.199D));
- assertIntEquals(-42, $opt$DoubleToInt(-42.199D));
- assertIntEquals(2147483647, $opt$DoubleToInt(2147483647D)); // 2^31 - 1
- assertIntEquals(-2147483647, $opt$DoubleToInt(-2147483647D)); // -(2^31 - 1)
- assertIntEquals(-2147483648, $opt$DoubleToInt(-2147483648D)); // -(2^31)
- assertIntEquals(2147483647, $opt$DoubleToInt(2147483648D)); // (2^31)
- assertIntEquals(-2147483648, $opt$DoubleToInt(-2147483649D)); // -(2^31 + 1)
- assertIntEquals(2147483647, $opt$DoubleToInt(9223372036854775807D)); // 2^63 - 1
- assertIntEquals(-2147483648, $opt$DoubleToInt(-9223372036854775807D)); // -(2^63 - 1)
- assertIntEquals(-2147483648, $opt$DoubleToInt(-9223372036854775808D)); // -(2^63)
- assertIntEquals(0, $opt$DoubleToInt(Double.NaN));
- assertIntEquals(2147483647, $opt$DoubleToInt(Double.POSITIVE_INFINITY));
- assertIntEquals(-2147483648, $opt$DoubleToInt(Double.NEGATIVE_INFINITY));
+ assertIntEquals(1, $opt$noinline$DoubleToInt(1D));
+ assertIntEquals(0, $opt$noinline$DoubleToInt(0D));
+ assertIntEquals(0, $opt$noinline$DoubleToInt(-0D));
+ assertIntEquals(-1, $opt$noinline$DoubleToInt(-1D));
+ assertIntEquals(51, $opt$noinline$DoubleToInt(51D));
+ assertIntEquals(-51, $opt$noinline$DoubleToInt(-51D));
+ assertIntEquals(0, $opt$noinline$DoubleToInt(0.5D));
+ assertIntEquals(0, $opt$noinline$DoubleToInt(0.4999999D));
+ assertIntEquals(0, $opt$noinline$DoubleToInt(-0.4999999D));
+ assertIntEquals(0, $opt$noinline$DoubleToInt(-0.5D));
+ assertIntEquals(42, $opt$noinline$DoubleToInt(42.199D));
+ assertIntEquals(-42, $opt$noinline$DoubleToInt(-42.199D));
+ assertIntEquals(2147483647, $opt$noinline$DoubleToInt(2147483647D)); // 2^31 - 1
+ assertIntEquals(-2147483647, $opt$noinline$DoubleToInt(-2147483647D)); // -(2^31 - 1)
+ assertIntEquals(-2147483648, $opt$noinline$DoubleToInt(-2147483648D)); // -(2^31)
+ assertIntEquals(2147483647, $opt$noinline$DoubleToInt(2147483648D)); // (2^31)
+ assertIntEquals(-2147483648, $opt$noinline$DoubleToInt(-2147483649D)); // -(2^31 + 1)
+ assertIntEquals(2147483647, $opt$noinline$DoubleToInt(9223372036854775807D)); // 2^63 - 1
+ assertIntEquals(-2147483648, $opt$noinline$DoubleToInt(-9223372036854775807D)); // -(2^63 - 1)
+ assertIntEquals(-2147483648, $opt$noinline$DoubleToInt(-9223372036854775808D)); // -(2^63)
+ assertIntEquals(0, $opt$noinline$DoubleToInt(Double.NaN));
+ assertIntEquals(2147483647, $opt$noinline$DoubleToInt(Double.POSITIVE_INFINITY));
+ assertIntEquals(-2147483648, $opt$noinline$DoubleToInt(Double.NEGATIVE_INFINITY));
}
private static void doubleToLong() {
- assertLongEquals(1L, $opt$DoubleToLong(1D));
- assertLongEquals(0L, $opt$DoubleToLong(0D));
- assertLongEquals(0L, $opt$DoubleToLong(-0D));
- assertLongEquals(-1L, $opt$DoubleToLong(-1D));
- assertLongEquals(51L, $opt$DoubleToLong(51D));
- assertLongEquals(-51L, $opt$DoubleToLong(-51D));
- assertLongEquals(0L, $opt$DoubleToLong(0.5D));
- assertLongEquals(0L, $opt$DoubleToLong(0.4999999D));
- assertLongEquals(0L, $opt$DoubleToLong(-0.4999999D));
- assertLongEquals(0L, $opt$DoubleToLong(-0.5D));
- assertLongEquals(42L, $opt$DoubleToLong(42.199D));
- assertLongEquals(-42L, $opt$DoubleToLong(-42.199D));
- assertLongEquals(2147483647L, $opt$DoubleToLong(2147483647D)); // 2^31 - 1
- assertLongEquals(-2147483647L, $opt$DoubleToLong(-2147483647D)); // -(2^31 - 1)
- assertLongEquals(-2147483648L, $opt$DoubleToLong(-2147483648D)); // -(2^31)
- assertLongEquals(2147483648L, $opt$DoubleToLong(2147483648D)); // (2^31)
- assertLongEquals(-2147483649L, $opt$DoubleToLong(-2147483649D)); // -(2^31 + 1)
- assertLongEquals(9223372036854775807L, $opt$DoubleToLong(9223372036854775807D)); // 2^63 - 1
- assertLongEquals(-9223372036854775808L, $opt$DoubleToLong(-9223372036854775807D)); // -(2^63 - 1)
- assertLongEquals(-9223372036854775808L, $opt$DoubleToLong(-9223372036854775808D)); // -(2^63)
- assertLongEquals(0L, $opt$DoubleToLong(Double.NaN));
- assertLongEquals(9223372036854775807L, $opt$DoubleToLong(Double.POSITIVE_INFINITY));
- assertLongEquals(-9223372036854775808L, $opt$DoubleToLong(Double.NEGATIVE_INFINITY));
+ assertLongEquals(1L, $opt$noinline$DoubleToLong(1D));
+ assertLongEquals(0L, $opt$noinline$DoubleToLong(0D));
+ assertLongEquals(0L, $opt$noinline$DoubleToLong(-0D));
+ assertLongEquals(-1L, $opt$noinline$DoubleToLong(-1D));
+ assertLongEquals(51L, $opt$noinline$DoubleToLong(51D));
+ assertLongEquals(-51L, $opt$noinline$DoubleToLong(-51D));
+ assertLongEquals(0L, $opt$noinline$DoubleToLong(0.5D));
+ assertLongEquals(0L, $opt$noinline$DoubleToLong(0.4999999D));
+ assertLongEquals(0L, $opt$noinline$DoubleToLong(-0.4999999D));
+ assertLongEquals(0L, $opt$noinline$DoubleToLong(-0.5D));
+ assertLongEquals(42L, $opt$noinline$DoubleToLong(42.199D));
+ assertLongEquals(-42L, $opt$noinline$DoubleToLong(-42.199D));
+ assertLongEquals(2147483647L, $opt$noinline$DoubleToLong(2147483647D)); // 2^31 - 1
+ assertLongEquals(-2147483647L, $opt$noinline$DoubleToLong(-2147483647D)); // -(2^31 - 1)
+ assertLongEquals(-2147483648L, $opt$noinline$DoubleToLong(-2147483648D)); // -(2^31)
+ assertLongEquals(2147483648L, $opt$noinline$DoubleToLong(2147483648D)); // (2^31)
+ assertLongEquals(-2147483649L, $opt$noinline$DoubleToLong(-2147483649D)); // -(2^31 + 1)
+ assertLongEquals(9223372036854775807L, $opt$noinline$DoubleToLong(9223372036854775807D)); // 2^63 - 1
+ assertLongEquals(-9223372036854775808L, $opt$noinline$DoubleToLong(-9223372036854775807D)); // -(2^63 - 1)
+ assertLongEquals(-9223372036854775808L, $opt$noinline$DoubleToLong(-9223372036854775808D)); // -(2^63)
+ assertLongEquals(0L, $opt$noinline$DoubleToLong(Double.NaN));
+ assertLongEquals(9223372036854775807L, $opt$noinline$DoubleToLong(Double.POSITIVE_INFINITY));
+ assertLongEquals(-9223372036854775808L, $opt$noinline$DoubleToLong(Double.NEGATIVE_INFINITY));
}
private static void doubleToFloat() {
- assertFloatEquals(1F, $opt$DoubleToFloat(1D));
- assertFloatEquals(0F, $opt$DoubleToFloat(0D));
- assertFloatEquals(0F, $opt$DoubleToFloat(-0D));
- assertFloatEquals(-1F, $opt$DoubleToFloat(-1D));
- assertFloatEquals(51F, $opt$DoubleToFloat(51D));
- assertFloatEquals(-51F, $opt$DoubleToFloat(-51D));
- assertFloatEquals(0.5F, $opt$DoubleToFloat(0.5D));
- assertFloatEquals(0.4999999F, $opt$DoubleToFloat(0.4999999D));
- assertFloatEquals(-0.4999999F, $opt$DoubleToFloat(-0.4999999D));
- assertFloatEquals(-0.5F, $opt$DoubleToFloat(-0.5D));
- assertFloatEquals(42.199F, $opt$DoubleToFloat(42.199D));
- assertFloatEquals(-42.199F, $opt$DoubleToFloat(-42.199D));
- assertFloatEquals(2147483648F, $opt$DoubleToFloat(2147483647D)); // 2^31 - 1
- assertFloatEquals(-2147483648F, $opt$DoubleToFloat(-2147483647D)); // -(2^31 - 1)
- assertFloatEquals(-2147483648F, $opt$DoubleToFloat(-2147483648D)); // -(2^31)
- assertFloatEquals(2147483648F, $opt$DoubleToFloat(2147483648D)); // (2^31)
- assertFloatEquals(-2147483648F, $opt$DoubleToFloat(-2147483649D)); // -(2^31 + 1)
- assertFloatEquals(9223372036854775807F, $opt$DoubleToFloat(9223372036854775807D)); // 2^63 - 1
- assertFloatEquals(-9223372036854775807F, $opt$DoubleToFloat(-9223372036854775807D)); // -(2^63 - 1)
- assertFloatEquals(-9223372036854775808F, $opt$DoubleToFloat(-9223372036854775808D)); // -(2^63)
- assertFloatIsNaN($opt$DoubleToFloat(Float.NaN));
- assertFloatEquals(Float.POSITIVE_INFINITY, $opt$DoubleToFloat(Double.POSITIVE_INFINITY));
- assertFloatEquals(Float.NEGATIVE_INFINITY, $opt$DoubleToFloat(Double.NEGATIVE_INFINITY));
+ assertFloatEquals(1F, $opt$noinline$DoubleToFloat(1D));
+ assertFloatEquals(0F, $opt$noinline$DoubleToFloat(0D));
+ assertFloatEquals(0F, $opt$noinline$DoubleToFloat(-0D));
+ assertFloatEquals(-1F, $opt$noinline$DoubleToFloat(-1D));
+ assertFloatEquals(51F, $opt$noinline$DoubleToFloat(51D));
+ assertFloatEquals(-51F, $opt$noinline$DoubleToFloat(-51D));
+ assertFloatEquals(0.5F, $opt$noinline$DoubleToFloat(0.5D));
+ assertFloatEquals(0.4999999F, $opt$noinline$DoubleToFloat(0.4999999D));
+ assertFloatEquals(-0.4999999F, $opt$noinline$DoubleToFloat(-0.4999999D));
+ assertFloatEquals(-0.5F, $opt$noinline$DoubleToFloat(-0.5D));
+ assertFloatEquals(42.199F, $opt$noinline$DoubleToFloat(42.199D));
+ assertFloatEquals(-42.199F, $opt$noinline$DoubleToFloat(-42.199D));
+ assertFloatEquals(2147483648F, $opt$noinline$DoubleToFloat(2147483647D)); // 2^31 - 1
+ assertFloatEquals(-2147483648F, $opt$noinline$DoubleToFloat(-2147483647D)); // -(2^31 - 1)
+ assertFloatEquals(-2147483648F, $opt$noinline$DoubleToFloat(-2147483648D)); // -(2^31)
+ assertFloatEquals(2147483648F, $opt$noinline$DoubleToFloat(2147483648D)); // (2^31)
+ assertFloatEquals(-2147483648F, $opt$noinline$DoubleToFloat(-2147483649D)); // -(2^31 + 1)
+ assertFloatEquals(9223372036854775807F, $opt$noinline$DoubleToFloat(9223372036854775807D)); // 2^63 - 1
+ assertFloatEquals(-9223372036854775807F, $opt$noinline$DoubleToFloat(-9223372036854775807D)); // -(2^63 - 1)
+ assertFloatEquals(-9223372036854775808F, $opt$noinline$DoubleToFloat(-9223372036854775808D)); // -(2^63)
+ assertFloatIsNaN($opt$noinline$DoubleToFloat(Float.NaN));
+ assertFloatEquals(Float.POSITIVE_INFINITY, $opt$noinline$DoubleToFloat(Double.POSITIVE_INFINITY));
+ assertFloatEquals(Float.NEGATIVE_INFINITY, $opt$noinline$DoubleToFloat(Double.NEGATIVE_INFINITY));
}
private static void shortToByte() {
- assertByteEquals((byte)1, $opt$ShortToByte((short)1));
- assertByteEquals((byte)0, $opt$ShortToByte((short)0));
- assertByteEquals((byte)-1, $opt$ShortToByte((short)-1));
- assertByteEquals((byte)51, $opt$ShortToByte((short)51));
- assertByteEquals((byte)-51, $opt$ShortToByte((short)-51));
- assertByteEquals((byte)127, $opt$ShortToByte((short)127)); // 2^7 - 1
- assertByteEquals((byte)-127, $opt$ShortToByte((short)-127)); // -(2^7 - 1)
- assertByteEquals((byte)-128, $opt$ShortToByte((short)-128)); // -(2^7)
- assertByteEquals((byte)-128, $opt$ShortToByte((short)128)); // 2^7
- assertByteEquals((byte)127, $opt$ShortToByte((short)-129)); // -(2^7 + 1)
- assertByteEquals((byte)-1, $opt$ShortToByte((short)32767)); // 2^15 - 1
- assertByteEquals((byte)0, $opt$ShortToByte((short)-32768)); // -(2^15)
+ assertByteEquals((byte)1, $opt$noinline$ShortToByte((short)1));
+ assertByteEquals((byte)0, $opt$noinline$ShortToByte((short)0));
+ assertByteEquals((byte)-1, $opt$noinline$ShortToByte((short)-1));
+ assertByteEquals((byte)51, $opt$noinline$ShortToByte((short)51));
+ assertByteEquals((byte)-51, $opt$noinline$ShortToByte((short)-51));
+ assertByteEquals((byte)127, $opt$noinline$ShortToByte((short)127)); // 2^7 - 1
+ assertByteEquals((byte)-127, $opt$noinline$ShortToByte((short)-127)); // -(2^7 - 1)
+ assertByteEquals((byte)-128, $opt$noinline$ShortToByte((short)-128)); // -(2^7)
+ assertByteEquals((byte)-128, $opt$noinline$ShortToByte((short)128)); // 2^7
+ assertByteEquals((byte)127, $opt$noinline$ShortToByte((short)-129)); // -(2^7 + 1)
+ assertByteEquals((byte)-1, $opt$noinline$ShortToByte((short)32767)); // 2^15 - 1
+ assertByteEquals((byte)0, $opt$noinline$ShortToByte((short)-32768)); // -(2^15)
}
private static void intToByte() {
- assertByteEquals((byte)1, $opt$IntToByte(1));
- assertByteEquals((byte)0, $opt$IntToByte(0));
- assertByteEquals((byte)-1, $opt$IntToByte(-1));
- assertByteEquals((byte)51, $opt$IntToByte(51));
- assertByteEquals((byte)-51, $opt$IntToByte(-51));
- assertByteEquals((byte)127, $opt$IntToByte(127)); // 2^7 - 1
- assertByteEquals((byte)-127, $opt$IntToByte(-127)); // -(2^7 - 1)
- assertByteEquals((byte)-128, $opt$IntToByte(-128)); // -(2^7)
- assertByteEquals((byte)-128, $opt$IntToByte(128)); // 2^7
- assertByteEquals((byte)127, $opt$IntToByte(-129)); // -(2^7 + 1)
- assertByteEquals((byte)-1, $opt$IntToByte(2147483647)); // 2^31 - 1
- assertByteEquals((byte)0, $opt$IntToByte(-2147483648)); // -(2^31)
+ assertByteEquals((byte)1, $opt$noinline$IntToByte(1));
+ assertByteEquals((byte)0, $opt$noinline$IntToByte(0));
+ assertByteEquals((byte)-1, $opt$noinline$IntToByte(-1));
+ assertByteEquals((byte)51, $opt$noinline$IntToByte(51));
+ assertByteEquals((byte)-51, $opt$noinline$IntToByte(-51));
+ assertByteEquals((byte)127, $opt$noinline$IntToByte(127)); // 2^7 - 1
+ assertByteEquals((byte)-127, $opt$noinline$IntToByte(-127)); // -(2^7 - 1)
+ assertByteEquals((byte)-128, $opt$noinline$IntToByte(-128)); // -(2^7)
+ assertByteEquals((byte)-128, $opt$noinline$IntToByte(128)); // 2^7
+ assertByteEquals((byte)127, $opt$noinline$IntToByte(-129)); // -(2^7 + 1)
+ assertByteEquals((byte)-1, $opt$noinline$IntToByte(2147483647)); // 2^31 - 1
+ assertByteEquals((byte)0, $opt$noinline$IntToByte(-2147483648)); // -(2^31)
}
private static void charToByte() {
- assertByteEquals((byte)1, $opt$CharToByte((char)1));
- assertByteEquals((byte)0, $opt$CharToByte((char)0));
- assertByteEquals((byte)51, $opt$CharToByte((char)51));
- assertByteEquals((byte)127, $opt$CharToByte((char)127)); // 2^7 - 1
- assertByteEquals((byte)-128, $opt$CharToByte((char)128)); // 2^7
- assertByteEquals((byte)-1, $opt$CharToByte((char)32767)); // 2^15 - 1
- assertByteEquals((byte)-1, $opt$CharToByte((char)65535)); // 2^16 - 1
- assertByteEquals((byte)-1, $opt$CharToByte((char)-1));
- assertByteEquals((byte)-51, $opt$CharToByte((char)-51));
- assertByteEquals((byte)-127, $opt$CharToByte((char)-127)); // -(2^7 - 1)
- assertByteEquals((byte)-128, $opt$CharToByte((char)-128)); // -(2^7)
- assertByteEquals((byte)127, $opt$CharToByte((char)-129)); // -(2^7 + 1)
+ assertByteEquals((byte)1, $opt$noinline$CharToByte((char)1));
+ assertByteEquals((byte)0, $opt$noinline$CharToByte((char)0));
+ assertByteEquals((byte)51, $opt$noinline$CharToByte((char)51));
+ assertByteEquals((byte)127, $opt$noinline$CharToByte((char)127)); // 2^7 - 1
+ assertByteEquals((byte)-128, $opt$noinline$CharToByte((char)128)); // 2^7
+ assertByteEquals((byte)-1, $opt$noinline$CharToByte((char)32767)); // 2^15 - 1
+ assertByteEquals((byte)-1, $opt$noinline$CharToByte((char)65535)); // 2^16 - 1
+ assertByteEquals((byte)-1, $opt$noinline$CharToByte((char)-1));
+ assertByteEquals((byte)-51, $opt$noinline$CharToByte((char)-51));
+ assertByteEquals((byte)-127, $opt$noinline$CharToByte((char)-127)); // -(2^7 - 1)
+ assertByteEquals((byte)-128, $opt$noinline$CharToByte((char)-128)); // -(2^7)
+ assertByteEquals((byte)127, $opt$noinline$CharToByte((char)-129)); // -(2^7 + 1)
}
private static void byteToShort() {
- assertShortEquals((short)1, $opt$ByteToShort((byte)1));
- assertShortEquals((short)0, $opt$ByteToShort((byte)0));
- assertShortEquals((short)-1, $opt$ByteToShort((byte)-1));
- assertShortEquals((short)51, $opt$ByteToShort((byte)51));
- assertShortEquals((short)-51, $opt$ByteToShort((byte)-51));
- assertShortEquals((short)127, $opt$ByteToShort((byte)127)); // 2^7 - 1
- assertShortEquals((short)-127, $opt$ByteToShort((byte)-127)); // -(2^7 - 1)
- assertShortEquals((short)-128, $opt$ByteToShort((byte)-128)); // -(2^7)
+ assertShortEquals((short)1, $opt$noinline$ByteToShort((byte)1));
+ assertShortEquals((short)0, $opt$noinline$ByteToShort((byte)0));
+ assertShortEquals((short)-1, $opt$noinline$ByteToShort((byte)-1));
+ assertShortEquals((short)51, $opt$noinline$ByteToShort((byte)51));
+ assertShortEquals((short)-51, $opt$noinline$ByteToShort((byte)-51));
+ assertShortEquals((short)127, $opt$noinline$ByteToShort((byte)127)); // 2^7 - 1
+ assertShortEquals((short)-127, $opt$noinline$ByteToShort((byte)-127)); // -(2^7 - 1)
+ assertShortEquals((short)-128, $opt$noinline$ByteToShort((byte)-128)); // -(2^7)
}
private static void intToShort() {
- assertShortEquals((short)1, $opt$IntToShort(1));
- assertShortEquals((short)0, $opt$IntToShort(0));
- assertShortEquals((short)-1, $opt$IntToShort(-1));
- assertShortEquals((short)51, $opt$IntToShort(51));
- assertShortEquals((short)-51, $opt$IntToShort(-51));
- assertShortEquals((short)32767, $opt$IntToShort(32767)); // 2^15 - 1
- assertShortEquals((short)-32767, $opt$IntToShort(-32767)); // -(2^15 - 1)
- assertShortEquals((short)-32768, $opt$IntToShort(-32768)); // -(2^15)
- assertShortEquals((short)-32768, $opt$IntToShort(32768)); // 2^15
- assertShortEquals((short)32767, $opt$IntToShort(-32769)); // -(2^15 + 1)
- assertShortEquals((short)-1, $opt$IntToShort(2147483647)); // 2^31 - 1
- assertShortEquals((short)0, $opt$IntToShort(-2147483648)); // -(2^31)
+ assertShortEquals((short)1, $opt$noinline$IntToShort(1));
+ assertShortEquals((short)0, $opt$noinline$IntToShort(0));
+ assertShortEquals((short)-1, $opt$noinline$IntToShort(-1));
+ assertShortEquals((short)51, $opt$noinline$IntToShort(51));
+ assertShortEquals((short)-51, $opt$noinline$IntToShort(-51));
+ assertShortEquals((short)32767, $opt$noinline$IntToShort(32767)); // 2^15 - 1
+ assertShortEquals((short)-32767, $opt$noinline$IntToShort(-32767)); // -(2^15 - 1)
+ assertShortEquals((short)-32768, $opt$noinline$IntToShort(-32768)); // -(2^15)
+ assertShortEquals((short)-32768, $opt$noinline$IntToShort(32768)); // 2^15
+ assertShortEquals((short)32767, $opt$noinline$IntToShort(-32769)); // -(2^15 + 1)
+ assertShortEquals((short)-1, $opt$noinline$IntToShort(2147483647)); // 2^31 - 1
+ assertShortEquals((short)0, $opt$noinline$IntToShort(-2147483648)); // -(2^31)
}
private static void charToShort() {
- assertShortEquals((short)1, $opt$CharToShort((char)1));
- assertShortEquals((short)0, $opt$CharToShort((char)0));
- assertShortEquals((short)51, $opt$CharToShort((char)51));
- assertShortEquals((short)32767, $opt$CharToShort((char)32767)); // 2^15 - 1
- assertShortEquals((short)-32768, $opt$CharToShort((char)32768)); // 2^15
- assertShortEquals((short)-32767, $opt$CharToShort((char)32769)); // 2^15
- assertShortEquals((short)-1, $opt$CharToShort((char)65535)); // 2^16 - 1
- assertShortEquals((short)-1, $opt$CharToShort((char)-1));
- assertShortEquals((short)-51, $opt$CharToShort((char)-51));
- assertShortEquals((short)-32767, $opt$CharToShort((char)-32767)); // -(2^15 - 1)
- assertShortEquals((short)-32768, $opt$CharToShort((char)-32768)); // -(2^15)
- assertShortEquals((short)32767, $opt$CharToShort((char)-32769)); // -(2^15 + 1)
+ assertShortEquals((short)1, $opt$noinline$CharToShort((char)1));
+ assertShortEquals((short)0, $opt$noinline$CharToShort((char)0));
+ assertShortEquals((short)51, $opt$noinline$CharToShort((char)51));
+ assertShortEquals((short)32767, $opt$noinline$CharToShort((char)32767)); // 2^15 - 1
+ assertShortEquals((short)-32768, $opt$noinline$CharToShort((char)32768)); // 2^15
+ assertShortEquals((short)-32767, $opt$noinline$CharToShort((char)32769)); // 2^15
+ assertShortEquals((short)-1, $opt$noinline$CharToShort((char)65535)); // 2^16 - 1
+ assertShortEquals((short)-1, $opt$noinline$CharToShort((char)-1));
+ assertShortEquals((short)-51, $opt$noinline$CharToShort((char)-51));
+ assertShortEquals((short)-32767, $opt$noinline$CharToShort((char)-32767)); // -(2^15 - 1)
+ assertShortEquals((short)-32768, $opt$noinline$CharToShort((char)-32768)); // -(2^15)
+ assertShortEquals((short)32767, $opt$noinline$CharToShort((char)-32769)); // -(2^15 + 1)
}
private static void byteToChar() {
- assertCharEquals((char)1, $opt$ByteToChar((byte)1));
- assertCharEquals((char)0, $opt$ByteToChar((byte)0));
- assertCharEquals((char)65535, $opt$ByteToChar((byte)-1));
- assertCharEquals((char)51, $opt$ByteToChar((byte)51));
- assertCharEquals((char)65485, $opt$ByteToChar((byte)-51));
- assertCharEquals((char)127, $opt$ByteToChar((byte)127)); // 2^7 - 1
- assertCharEquals((char)65409, $opt$ByteToChar((byte)-127)); // -(2^7 - 1)
- assertCharEquals((char)65408, $opt$ByteToChar((byte)-128)); // -(2^7)
+ assertCharEquals((char)1, $opt$noinline$ByteToChar((byte)1));
+ assertCharEquals((char)0, $opt$noinline$ByteToChar((byte)0));
+ assertCharEquals((char)65535, $opt$noinline$ByteToChar((byte)-1));
+ assertCharEquals((char)51, $opt$noinline$ByteToChar((byte)51));
+ assertCharEquals((char)65485, $opt$noinline$ByteToChar((byte)-51));
+ assertCharEquals((char)127, $opt$noinline$ByteToChar((byte)127)); // 2^7 - 1
+ assertCharEquals((char)65409, $opt$noinline$ByteToChar((byte)-127)); // -(2^7 - 1)
+ assertCharEquals((char)65408, $opt$noinline$ByteToChar((byte)-128)); // -(2^7)
}
private static void shortToChar() {
- assertCharEquals((char)1, $opt$ShortToChar((short)1));
- assertCharEquals((char)0, $opt$ShortToChar((short)0));
- assertCharEquals((char)65535, $opt$ShortToChar((short)-1));
- assertCharEquals((char)51, $opt$ShortToChar((short)51));
- assertCharEquals((char)65485, $opt$ShortToChar((short)-51));
- assertCharEquals((char)32767, $opt$ShortToChar((short)32767)); // 2^15 - 1
- assertCharEquals((char)32769, $opt$ShortToChar((short)-32767)); // -(2^15 - 1)
- assertCharEquals((char)32768, $opt$ShortToChar((short)-32768)); // -(2^15)
+ assertCharEquals((char)1, $opt$noinline$ShortToChar((short)1));
+ assertCharEquals((char)0, $opt$noinline$ShortToChar((short)0));
+ assertCharEquals((char)65535, $opt$noinline$ShortToChar((short)-1));
+ assertCharEquals((char)51, $opt$noinline$ShortToChar((short)51));
+ assertCharEquals((char)65485, $opt$noinline$ShortToChar((short)-51));
+ assertCharEquals((char)32767, $opt$noinline$ShortToChar((short)32767)); // 2^15 - 1
+ assertCharEquals((char)32769, $opt$noinline$ShortToChar((short)-32767)); // -(2^15 - 1)
+ assertCharEquals((char)32768, $opt$noinline$ShortToChar((short)-32768)); // -(2^15)
}
private static void intToChar() {
- assertCharEquals((char)1, $opt$IntToChar(1));
- assertCharEquals((char)0, $opt$IntToChar(0));
- assertCharEquals((char)65535, $opt$IntToChar(-1));
- assertCharEquals((char)51, $opt$IntToChar(51));
- assertCharEquals((char)65485, $opt$IntToChar(-51));
- assertCharEquals((char)32767, $opt$IntToChar(32767)); // 2^15 - 1
- assertCharEquals((char)32769, $opt$IntToChar(-32767)); // -(2^15 - 1)
- assertCharEquals((char)32768, $opt$IntToChar(32768)); // 2^15
- assertCharEquals((char)32768, $opt$IntToChar(-32768)); // -(2^15)
- assertCharEquals((char)65535, $opt$IntToChar(65535)); // 2^16 - 1
- assertCharEquals((char)1, $opt$IntToChar(-65535)); // -(2^16 - 1)
- assertCharEquals((char)0, $opt$IntToChar(65536)); // 2^16
- assertCharEquals((char)0, $opt$IntToChar(-65536)); // -(2^16)
- assertCharEquals((char)65535, $opt$IntToChar(2147483647)); // 2^31 - 1
- assertCharEquals((char)0, $opt$IntToChar(-2147483648)); // -(2^31)
+ assertCharEquals((char)1, $opt$noinline$IntToChar(1));
+ assertCharEquals((char)0, $opt$noinline$IntToChar(0));
+ assertCharEquals((char)65535, $opt$noinline$IntToChar(-1));
+ assertCharEquals((char)51, $opt$noinline$IntToChar(51));
+ assertCharEquals((char)65485, $opt$noinline$IntToChar(-51));
+ assertCharEquals((char)32767, $opt$noinline$IntToChar(32767)); // 2^15 - 1
+ assertCharEquals((char)32769, $opt$noinline$IntToChar(-32767)); // -(2^15 - 1)
+ assertCharEquals((char)32768, $opt$noinline$IntToChar(32768)); // 2^15
+ assertCharEquals((char)32768, $opt$noinline$IntToChar(-32768)); // -(2^15)
+ assertCharEquals((char)65535, $opt$noinline$IntToChar(65535)); // 2^16 - 1
+ assertCharEquals((char)1, $opt$noinline$IntToChar(-65535)); // -(2^16 - 1)
+ assertCharEquals((char)0, $opt$noinline$IntToChar(65536)); // 2^16
+ assertCharEquals((char)0, $opt$noinline$IntToChar(-65536)); // -(2^16)
+ assertCharEquals((char)65535, $opt$noinline$IntToChar(2147483647)); // 2^31 - 1
+ assertCharEquals((char)0, $opt$noinline$IntToChar(-2147483648)); // -(2^31)
}
// A dummy value to defeat inlining of these routines.
static boolean doThrow = false;
// These methods produce int-to-long Dex instructions.
- static long $opt$ByteToLong(byte a) { if (doThrow) throw new Error(); return (long)a; }
- static long $opt$ShortToLong(short a) { if (doThrow) throw new Error(); return (long)a; }
- static long $opt$IntToLong(int a) { if (doThrow) throw new Error(); return (long)a; }
- static long $opt$CharToLong(int a) { if (doThrow) throw new Error(); return (long)a; }
+ static long $opt$noinline$ByteToLong(byte a) { if (doThrow) throw new Error(); return (long)a; }
+ static long $opt$noinline$ShortToLong(short a) { if (doThrow) throw new Error(); return (long)a; }
+ static long $opt$noinline$IntToLong(int a) { if (doThrow) throw new Error(); return (long)a; }
+ static long $opt$noinline$CharToLong(int a) { if (doThrow) throw new Error(); return (long)a; }
// These methods produce int-to-float Dex instructions.
- static float $opt$ByteToFloat(byte a) { if (doThrow) throw new Error(); return (float)a; }
- static float $opt$ShortToFloat(short a) { if (doThrow) throw new Error(); return (float)a; }
- static float $opt$IntToFloat(int a) { if (doThrow) throw new Error(); return (float)a; }
- static float $opt$CharToFloat(char a) { if (doThrow) throw new Error(); return (float)a; }
+ static float $opt$noinline$ByteToFloat(byte a) { if (doThrow) throw new Error(); return (float)a; }
+ static float $opt$noinline$ShortToFloat(short a) { if (doThrow) throw new Error(); return (float)a; }
+ static float $opt$noinline$IntToFloat(int a) { if (doThrow) throw new Error(); return (float)a; }
+ static float $opt$noinline$CharToFloat(char a) { if (doThrow) throw new Error(); return (float)a; }
// These methods produce int-to-double Dex instructions.
- static double $opt$ByteToDouble(byte a) { if (doThrow) throw new Error(); return (double)a; }
- static double $opt$ShortToDouble(short a) { if (doThrow) throw new Error(); return (double)a; }
- static double $opt$IntToDouble(int a) { if (doThrow) throw new Error(); return (double)a; }
- static double $opt$CharToDouble(int a) { if (doThrow) throw new Error(); return (double)a; }
+ static double $opt$noinline$ByteToDouble(byte a) { if (doThrow) throw new Error(); return (double)a; }
+ static double $opt$noinline$ShortToDouble(short a) { if (doThrow) throw new Error(); return (double)a; }
+ static double $opt$noinline$IntToDouble(int a) { if (doThrow) throw new Error(); return (double)a; }
+ static double $opt$noinline$CharToDouble(int a) { if (doThrow) throw new Error(); return (double)a; }
// These methods produce long-to-int Dex instructions.
- static int $opt$LongToInt(long a) { if (doThrow) throw new Error(); return (int)a; }
- static int $opt$LongLiteralToInt() { if (doThrow) throw new Error(); return (int)42L; }
+ static int $opt$noinline$LongToInt(long a) { if (doThrow) throw new Error(); return (int)a; }
+ static int $opt$noinline$LongLiteralToInt() { if (doThrow) throw new Error(); return (int)42L; }
// This method produces a long-to-float Dex instruction.
- static float $opt$LongToFloat(long a) { if (doThrow) throw new Error(); return (float)a; }
+ static float $opt$noinline$LongToFloat(long a) { if (doThrow) throw new Error(); return (float)a; }
// This method produces a long-to-double Dex instruction.
- static double $opt$LongToDouble(long a) { if (doThrow) throw new Error(); return (double)a; }
+ static double $opt$noinline$LongToDouble(long a) { if (doThrow) throw new Error(); return (double)a; }
// This method produces a float-to-int Dex instruction.
- static int $opt$FloatToInt(float a) { if (doThrow) throw new Error(); return (int)a; }
+ static int $opt$noinline$FloatToInt(float a) { if (doThrow) throw new Error(); return (int)a; }
// This method produces a float-to-long Dex instruction.
- static long $opt$FloatToLong(float a){ if (doThrow) throw new Error(); return (long)a; }
+ static long $opt$noinline$FloatToLong(float a){ if (doThrow) throw new Error(); return (long)a; }
// This method produces a float-to-double Dex instruction.
- static double $opt$FloatToDouble(float a) { if (doThrow) throw new Error(); return (double)a; }
+ static double $opt$noinline$FloatToDouble(float a) { if (doThrow) throw new Error(); return (double)a; }
// This method produces a double-to-int Dex instruction.
- static int $opt$DoubleToInt(double a){ if (doThrow) throw new Error(); return (int)a; }
+ static int $opt$noinline$DoubleToInt(double a){ if (doThrow) throw new Error(); return (int)a; }
// This method produces a double-to-long Dex instruction.
- static long $opt$DoubleToLong(double a){ if (doThrow) throw new Error(); return (long)a; }
+ static long $opt$noinline$DoubleToLong(double a){ if (doThrow) throw new Error(); return (long)a; }
// This method produces a double-to-float Dex instruction.
- static float $opt$DoubleToFloat(double a) { if (doThrow) throw new Error(); return (float)a; }
+ static float $opt$noinline$DoubleToFloat(double a) { if (doThrow) throw new Error(); return (float)a; }
// These methods produce int-to-byte Dex instructions.
- static byte $opt$ShortToByte(short a) { if (doThrow) throw new Error(); return (byte)a; }
- static byte $opt$IntToByte(int a) { if (doThrow) throw new Error(); return (byte)a; }
- static byte $opt$CharToByte(char a) { if (doThrow) throw new Error(); return (byte)a; }
+ static byte $opt$noinline$ShortToByte(short a) { if (doThrow) throw new Error(); return (byte)a; }
+ static byte $opt$noinline$IntToByte(int a) { if (doThrow) throw new Error(); return (byte)a; }
+ static byte $opt$noinline$CharToByte(char a) { if (doThrow) throw new Error(); return (byte)a; }
// These methods produce int-to-short Dex instructions.
- static short $opt$ByteToShort(byte a) { if (doThrow) throw new Error(); return (short)a; }
- static short $opt$IntToShort(int a) { if (doThrow) throw new Error(); return (short)a; }
- static short $opt$CharToShort(char a) { if (doThrow) throw new Error(); return (short)a; }
+ static short $opt$noinline$ByteToShort(byte a) { if (doThrow) throw new Error(); return (short)a; }
+ static short $opt$noinline$IntToShort(int a) { if (doThrow) throw new Error(); return (short)a; }
+ static short $opt$noinline$CharToShort(char a) { if (doThrow) throw new Error(); return (short)a; }
// These methods produce int-to-char Dex instructions.
- static char $opt$ByteToChar(byte a) { if (doThrow) throw new Error(); return (char)a; }
- static char $opt$ShortToChar(short a) { if (doThrow) throw new Error(); return (char)a; }
- static char $opt$IntToChar(int a) { if (doThrow) throw new Error(); return (char)a; }
+ static char $opt$noinline$ByteToChar(byte a) { if (doThrow) throw new Error(); return (char)a; }
+ static char $opt$noinline$ShortToChar(short a) { if (doThrow) throw new Error(); return (char)a; }
+ static char $opt$noinline$IntToChar(int a) { if (doThrow) throw new Error(); return (char)a; }
}
diff --git a/test/450-checker-types/src/Main.java b/test/450-checker-types/src/Main.java
index 9bf7cdf..4056275 100644
--- a/test/450-checker-types/src/Main.java
+++ b/test/450-checker-types/src/Main.java
@@ -16,25 +16,25 @@
interface Interface {
- void f();
+ void $noinline$f();
}
class Super implements Interface {
- public void f() {
+ public void $noinline$f() {
throw new RuntimeException();
}
}
class SubclassA extends Super {
- public void f() {
+ public void $noinline$f() {
throw new RuntimeException();
}
- public String h() {
+ public String $noinline$h() {
throw new RuntimeException();
}
- void g() {
+ void $noinline$g() {
throw new RuntimeException();
}
}
@@ -43,11 +43,11 @@
}
class SubclassB extends Super {
- public void f() {
+ public void $noinline$f() {
throw new RuntimeException();
}
- void g() {
+ void $noinline$g() {
throw new RuntimeException();
}
}
@@ -61,7 +61,7 @@
/// CHECK-NOT: CheckCast
public void testSimpleRemove() {
Super s = new SubclassA();
- ((SubclassA)s).g();
+ ((SubclassA)s).$noinline$g();
}
/// CHECK-START: void Main.testSimpleKeep(Super) instruction_simplifier_after_types (before)
@@ -70,7 +70,7 @@
/// CHECK-START: void Main.testSimpleKeep(Super) instruction_simplifier_after_types (after)
/// CHECK: CheckCast
public void testSimpleKeep(Super s) {
- ((SubclassA)s).f();
+ ((SubclassA)s).$noinline$f();
}
/// CHECK-START: java.lang.String Main.testClassRemove() instruction_simplifier_after_types (before)
@@ -90,7 +90,7 @@
/// CHECK: CheckCast
public String testClassKeep() {
Object s = SubclassA.class;
- return ((SubclassA)s).h();
+ return ((SubclassA)s).$noinline$h();
}
/// CHECK-START: void Main.testIfRemove(int) instruction_simplifier_after_types (before)
@@ -105,7 +105,7 @@
} else {
s = new SubclassC();
}
- ((SubclassA)s).g();
+ ((SubclassA)s).$noinline$g();
}
/// CHECK-START: void Main.testIfKeep(int) instruction_simplifier_after_types (before)
@@ -120,7 +120,7 @@
} else {
s = new SubclassB();
}
- ((SubclassA)s).g();
+ ((SubclassA)s).$noinline$g();
}
/// CHECK-START: void Main.testForRemove(int) instruction_simplifier_after_types (before)
@@ -135,7 +135,7 @@
s = new SubclassC();
}
}
- ((SubclassA)s).g();
+ ((SubclassA)s).$noinline$g();
}
/// CHECK-START: void Main.testForKeep(int) instruction_simplifier_after_types (before)
@@ -150,7 +150,7 @@
s = new SubclassC();
}
}
- ((SubclassC)s).g();
+ ((SubclassC)s).$noinline$g();
}
/// CHECK-START: void Main.testPhiFromCall(int) instruction_simplifier_after_types (before)
@@ -165,7 +165,7 @@
} else {
x = newObject(); // this one will have an unknown type.
}
- ((SubclassC)x).g();
+ ((SubclassC)x).$noinline$g();
}
/// CHECK-START: void Main.testInstanceOf(java.lang.Object) instruction_simplifier_after_types (before)
@@ -176,10 +176,10 @@
/// CHECK-NOT: CheckCast
public void testInstanceOf(Object o) {
if (o instanceof SubclassC) {
- ((SubclassC)o).g();
+ ((SubclassC)o).$noinline$g();
}
if (o instanceof SubclassB) {
- ((SubclassB)o).g();
+ ((SubclassB)o).$noinline$g();
}
}
@@ -192,10 +192,10 @@
/// CHECK: CheckCast
public void testInstanceOfKeep(Object o) {
if (o instanceof SubclassC) {
- ((SubclassB)o).g();
+ ((SubclassB)o).$noinline$g();
}
if (o instanceof SubclassB) {
- ((SubclassA)o).g();
+ ((SubclassA)o).$noinline$g();
}
}
@@ -208,9 +208,9 @@
public void testInstanceOfNested(Object o) {
if (o instanceof SubclassC) {
if (o instanceof SubclassB) {
- ((SubclassB)o).g();
+ ((SubclassB)o).$noinline$g();
} else {
- ((SubclassC)o).g();
+ ((SubclassC)o).$noinline$g();
}
}
}
@@ -229,7 +229,7 @@
}
if (o instanceof SubclassB) {
- ((SubclassB)o).g();
+ ((SubclassB)o).$noinline$g();
}
}
@@ -245,7 +245,7 @@
o = new SubclassB();
}
if (o instanceof SubclassB) {
- ((SubclassB)o).g();
+ ((SubclassB)o).$noinline$g();
}
}
}
@@ -258,7 +258,7 @@
public void testInstanceOfSubclass() {
Object o = new SubclassA();
if (o instanceof Super) {
- ((SubclassA)o).g();
+ ((SubclassA)o).$noinline$g();
}
}
@@ -276,7 +276,7 @@
}
if (o instanceof Super) {
- ((SubclassA)o).g();
+ ((SubclassA)o).$noinline$g();
}
}
@@ -294,7 +294,7 @@
}
if (o instanceof Super) {
- ((Super)o).f();
+ ((Super)o).$noinline$f();
}
}
@@ -307,7 +307,7 @@
Object o = new SubclassA();
for (int i = 0; i < n; i++) {
if (o instanceof Super) {
- ((SubclassA)o).g();
+ ((SubclassA)o).$noinline$g();
}
if (i / 2 == 0) {
o = new SubclassC();
@@ -324,7 +324,7 @@
Object o = new SubclassA();
for (int i = 0; i < n; i++) {
if (o instanceof Super) {
- ((Super)o).f();
+ ((Super)o).$noinline$f();
}
if (i / 2 == 0) {
o = new Object();
@@ -351,7 +351,7 @@
public void testInstanceFieldGetSimpleRemove() {
Main m = new Main();
Super a = m.a;
- ((SubclassA)a).g();
+ ((SubclassA)a).$noinline$g();
}
/// CHECK-START: void Main.testStaticFieldGetSimpleRemove() instruction_simplifier_after_types (before)
@@ -361,7 +361,7 @@
/// CHECK-NOT: CheckCast
public void testStaticFieldGetSimpleRemove() {
Super b = Main.b;
- ((SubclassA)b).g();
+ ((SubclassA)b).$noinline$g();
}
public static void main(String[] args) {
diff --git a/test/451-spill-splot/src/Main.java b/test/451-spill-splot/src/Main.java
index f631ebd..b2f39f3 100644
--- a/test/451-spill-splot/src/Main.java
+++ b/test/451-spill-splot/src/Main.java
@@ -48,37 +48,37 @@
for (int count = 0; count < 2; count++) {
System.out.println(aa + bb + cc + dd + ee + ff + gg + hh + ii + jj + kk + ll + mm + nn);
System.out.println(a + b + c + d + e + f + g + h + i + j);
- a = computeDouble();
- b = computeDouble();
- c = computeDouble();
- d = computeDouble();
- e = computeDouble();
- f = computeDouble();
- g = computeDouble();
- h = computeDouble();
- i = computeDouble();
- j = computeDouble();
+ a = $noinline$computeDouble();
+ b = $noinline$computeDouble();
+ c = $noinline$computeDouble();
+ d = $noinline$computeDouble();
+ e = $noinline$computeDouble();
+ f = $noinline$computeDouble();
+ g = $noinline$computeDouble();
+ h = $noinline$computeDouble();
+ i = $noinline$computeDouble();
+ j = $noinline$computeDouble();
System.out.println(a + b + c + d + e + f + g + h + i + j);
- aa = computeFloat();
- bb = computeFloat();
- cc = computeFloat();
- dd = computeFloat();
- ee = computeFloat();
- ff = computeFloat();
- gg = computeFloat();
- hh = computeFloat();
- ii = computeFloat();
- jj = computeFloat();
- kk = computeFloat();
- ll = computeFloat();
- mm = computeFloat();
- nn = computeFloat();
+ aa = $noinline$computeFloat();
+ bb = $noinline$computeFloat();
+ cc = $noinline$computeFloat();
+ dd = $noinline$computeFloat();
+ ee = $noinline$computeFloat();
+ ff = $noinline$computeFloat();
+ gg = $noinline$computeFloat();
+ hh = $noinline$computeFloat();
+ ii = $noinline$computeFloat();
+ jj = $noinline$computeFloat();
+ kk = $noinline$computeFloat();
+ ll = $noinline$computeFloat();
+ mm = $noinline$computeFloat();
+ nn = $noinline$computeFloat();
}
}
static boolean doThrow = false;
- public static double computeDouble() {
+ public static double $noinline$computeDouble() {
if (doThrow) {
// Try defeating inlining.
throw new Error();
@@ -86,7 +86,7 @@
return 2.0;
}
- public static float computeFloat() {
+ public static float $noinline$computeFloat() {
if (doThrow) {
// Try defeating inlining.
throw new Error();
diff --git a/test/478-checker-clinit-check-pruning/src/Main.java b/test/478-checker-clinit-check-pruning/src/Main.java
index 51be912..a2c98c9 100644
--- a/test/478-checker-clinit-check-pruning/src/Main.java
+++ b/test/478-checker-clinit-check-pruning/src/Main.java
@@ -90,7 +90,7 @@
/// CHECK-NOT: ClinitCheck
static void invokeStaticNotInlined() {
- ClassWithClinit2.staticMethod();
+ ClassWithClinit2.$noinline$staticMethod();
}
static class ClassWithClinit2 {
@@ -100,7 +100,7 @@
static boolean doThrow = false;
- static void staticMethod() {
+ static void $noinline$staticMethod() {
if (doThrow) {
// Try defeating inlining.
throw new Error();
@@ -169,7 +169,7 @@
// initialization of ClassWithClinit4, meaning that the
// call to staticMethod below does not need a clinit
// check.
- staticMethod();
+ $noinline$staticMethod();
}
static {
@@ -178,7 +178,7 @@
static boolean doThrow = false;
- static void staticMethod() {
+ static void $noinline$staticMethod() {
if (doThrow) {
// Try defeating inlining.
throw new Error();
@@ -242,7 +242,7 @@
static class ClassWithClinit6 {
static boolean doThrow = false;
- static void staticMethod() {
+ static void $noinline$staticMethod() {
if (doThrow) {
// Try defeating inlining.
throw new Error();
@@ -256,7 +256,7 @@
static class SubClassOfClassWithClinit6 extends ClassWithClinit6 {
static void invokeStaticNotInlined() {
- ClassWithClinit6.staticMethod();
+ ClassWithClinit6.$noinline$staticMethod();
}
}
@@ -276,7 +276,7 @@
/// CHECK-NOT: ClinitCheck
static void noClinitBecauseOfInvokeStatic() {
- ClassWithClinit2.staticMethod();
+ ClassWithClinit2.$noinline$staticMethod();
ClassWithClinit2.doThrow = false;
}
@@ -295,7 +295,7 @@
/// CHECK-NOT: ClinitCheck
static void clinitBecauseOfFieldAccess() {
ClassWithClinit2.doThrow = false;
- ClassWithClinit2.staticMethod();
+ ClassWithClinit2.$noinline$staticMethod();
}
// TODO: Add a test for the case of a static method whose declaring
diff --git a/test/486-checker-must-do-null-check/src/Main.java b/test/486-checker-must-do-null-check/src/Main.java
index ea72718..e8ff6a4 100644
--- a/test/486-checker-must-do-null-check/src/Main.java
+++ b/test/486-checker-must-do-null-check/src/Main.java
@@ -36,16 +36,16 @@
/// CHECK: CheckCast must_do_null_check:false
public void CheckCastPreChecked(Object o) {
o.toString();
- ((Main)o).Bar();
+ ((Main)o).$noinline$Bar();
}
/// CHECK-START: void Main.CheckCast(java.lang.Object) instruction_simplifier (after)
/// CHECK: CheckCast must_do_null_check:true
public void CheckCast(Object o) {
- ((Main)o).Bar();
+ ((Main)o).$noinline$Bar();
}
- void Bar() {throw new RuntimeException();}
+ void $noinline$Bar() {throw new RuntimeException();}
public static void main(String[] sa) {
Main t = new Main();