diff options
3 files changed, 338 insertions, 187 deletions
diff --git a/test/458-checker-instruct-simplification/build b/test/458-checker-instruct-simplification/build deleted file mode 100755 index 10ffcc537d..0000000000 --- a/test/458-checker-instruct-simplification/build +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# Copyright 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# See b/65168732 -export USE_D8=false - -./default-build "$@" diff --git a/test/458-checker-instruct-simplification/smali/SmaliTests2.smali b/test/458-checker-instruct-simplification/smali/SmaliTests2.smali new file mode 100644 index 0000000000..99fb049510 --- /dev/null +++ b/test/458-checker-instruct-simplification/smali/SmaliTests2.smali @@ -0,0 +1,305 @@ +# Copyright (C) 2018 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +.class public LSmaliTests2; +.super Ljava/lang/Object; + +## CHECK-START: int SmaliTests2.$noinline$XorAllOnes(int) instruction_simplifier (before) +## CHECK-DAG: <<Arg:i\d+>> ParameterValue +## CHECK-DAG: <<ConstF:i\d+>> IntConstant -1 +## CHECK-DAG: <<Xor:i\d+>> Xor [<<Arg>>,<<ConstF>>] +## CHECK-DAG: Return [<<Xor>>] + +## CHECK-START: int SmaliTests2.$noinline$XorAllOnes(int) instruction_simplifier (after) +## CHECK-DAG: <<Arg:i\d+>> ParameterValue +## CHECK-DAG: <<Not:i\d+>> Not [<<Arg>>] +## CHECK-DAG: Return [<<Not>>] + +## CHECK-START: int SmaliTests2.$noinline$XorAllOnes(int) instruction_simplifier (after) +## CHECK-NOT: Xor + +# Original java source: +# +# return arg ^ -1; +# +.method public static $noinline$XorAllOnes(I)I + .registers 2 + .param p0, "arg" # I + + .prologue + .line 658 + xor-int/lit8 v0, p0, -0x1 + + return v0 +.end method + +# Test simplification of the `~~var` pattern. +# The transformation tested is implemented in `InstructionSimplifierVisitor::VisitNot`. + +## CHECK-START: long SmaliTests2.$noinline$NotNot1(long) instruction_simplifier (before) +## CHECK-DAG: <<Arg:j\d+>> ParameterValue +## CHECK-DAG: <<ConstNeg1:j\d+>> LongConstant -1 +## CHECK-DAG: <<Not1:j\d+>> Xor [<<Arg>>,<<ConstNeg1>>] +## CHECK-DAG: <<Not2:j\d+>> Xor [<<Not1>>,<<ConstNeg1>>] +## CHECK-DAG: Return [<<Not2>>] + +## CHECK-START: long SmaliTests2.$noinline$NotNot1(long) instruction_simplifier (after) +## CHECK-DAG: <<Arg:j\d+>> ParameterValue +## CHECK-DAG: Return [<<Arg>>] + +## CHECK-START: long SmaliTests2.$noinline$NotNot1(long) instruction_simplifier (after) +## CHECK-NOT: Xor + +# Original java source: +# +# return ~~arg; +.method public static $noinline$NotNot1(J)J + .registers 6 + .param p0, "arg" # J + + .prologue + const-wide/16 v2, -0x1 + + .line 1001 + xor-long v0, p0, v2 + + xor-long/2addr v0, v2 + + return-wide v0 +.end method + +## CHECK-START: int SmaliTests2.$noinline$NotNot2(int) instruction_simplifier (before) +## CHECK-DAG: <<Arg:i\d+>> ParameterValue +## CHECK-DAG: <<ConstNeg1:i\d+>> IntConstant -1 +## CHECK-DAG: <<Not1:i\d+>> Xor [<<Arg>>,<<ConstNeg1>>] +## CHECK-DAG: <<Not2:i\d+>> Xor [<<Not1>>,<<ConstNeg1>>] +## CHECK-DAG: <<Add:i\d+>> Add [<<Not2>>,<<Not1>>] +## CHECK-DAG: Return [<<Add>>] + +## CHECK-START: int SmaliTests2.$noinline$NotNot2(int) instruction_simplifier (after) +## CHECK-DAG: <<Arg:i\d+>> ParameterValue +## CHECK-DAG: <<Not:i\d+>> Not [<<Arg>>] +## CHECK-DAG: <<Add:i\d+>> Add [<<Arg>>,<<Not>>] +## CHECK-DAG: Return [<<Add>>] + +## CHECK-START: int SmaliTests2.$noinline$NotNot2(int) instruction_simplifier (after) +## CHECK: Not +## CHECK-NOT: Not + +## CHECK-START: int SmaliTests2.$noinline$NotNot2(int) instruction_simplifier (after) +## CHECK-NOT: Xor + +# Original java source: +# +# int temp = ~arg; +# return temp + ~temp; +# +.method public static $noinline$NotNot2(I)I + .registers 3 + .param p0, "arg" # I + + .prologue + .line 1026 + xor-int/lit8 v0, p0, -0x1 + + .line 1027 + .local v0, "temp":I + xor-int/lit8 v1, v0, -0x1 + + add-int/2addr v1, v0 + + return v1 +.end method + +# Original java source: +# +# return !arg; +# +.method public static NegateValue(Z)Z + .registers 2 + .param p0, "arg" # Z + + .prologue + .line 1216 + if-nez p0, :cond_4 + + const/4 v0, 0x1 + + :goto_3 + return v0 + + :cond_4 + const/4 v0, 0x0 + + goto :goto_3 +.end method + +# Test simplification of double Boolean negation. Note that sometimes +# both negations can be removed but we only expect the simplifier to +# remove the second. + +## CHECK-START: boolean SmaliTests2.$noinline$NotNotBool(boolean) instruction_simplifier (before) +## CHECK-DAG: <<Arg:z\d+>> ParameterValue +## CHECK-DAG: <<Const1:i\d+>> IntConstant 0 +## CHECK-DAG: <<Result:z\d+>> InvokeStaticOrDirect method_name:SmaliTests2.NegateValue +## CHECK-DAG: <<NotResult:z\d+>> NotEqual [<<Result>>,<<Const1>>] +## CHECK-DAG: If [<<NotResult>>] + +## CHECK-START: boolean SmaliTests2.$noinline$NotNotBool(boolean) instruction_simplifier (after) +## CHECK-NOT: NotEqual + +## CHECK-START: boolean SmaliTests2.$noinline$NotNotBool(boolean) instruction_simplifier (after) +## CHECK-DAG: <<Arg:z\d+>> ParameterValue +## CHECK-DAG: <<Result:z\d+>> InvokeStaticOrDirect method_name:SmaliTests2.NegateValue +## CHECK-DAG: <<Const0:i\d+>> IntConstant 0 +## CHECK-DAG: <<Const1:i\d+>> IntConstant 1 +## CHECK-DAG: <<Phi:i\d+>> Phi [<<Const1>>,<<Const0>>] +## CHECK-DAG: Return [<<Phi>>] + +## CHECK-START: boolean SmaliTests2.$noinline$NotNotBool(boolean) instruction_simplifier$after_inlining (before) +## CHECK-DAG: <<Arg:z\d+>> ParameterValue +## CHECK-DAG: <<Const0:i\d+>> IntConstant 0 +## CHECK-DAG: <<Const1:i\d+>> IntConstant 1 +## CHECK-DAG: If [<<Arg>>] +## CHECK-DAG: <<Phi:i\d+>> Phi [<<Const1>>,<<Const0>>] +## CHECK-DAG: Return [<<Phi>>] + +## CHECK-START: boolean SmaliTests2.$noinline$NotNotBool(boolean) instruction_simplifier$after_gvn (after) +## CHECK-DAG: <<Arg:z\d+>> ParameterValue +## CHECK-DAG: Return [<<Arg>>] + +# Original java source: +# +# return !(NegateValue(arg)); +# +.method public static $noinline$NotNotBool(Z)Z + .registers 2 + .param p0, "arg" # Z + + .prologue + .line 1220 + invoke-static {p0}, LSmaliTests2;->NegateValue(Z)Z + + move-result v0 + + if-nez v0, :cond_8 + + const/4 v0, 0x1 + + :goto_7 + return v0 + + :cond_8 + const/4 v0, 0x0 + + goto :goto_7 +.end method + +## CHECK-START: int SmaliTests2.$noinline$bug68142795Short(short) instruction_simplifier (before) +## CHECK-DAG: <<Arg:s\d+>> ParameterValue +## CHECK-DAG: <<Const:i\d+>> IntConstant 65535 +## CHECK-DAG: <<And1:i\d+>> And [<<Arg>>,<<Const>>] +## CHECK-DAG: <<And2:i\d+>> And [<<And1>>,<<Const>>] +## CHECK-DAG: <<Conv:s\d+>> TypeConversion [<<And2>>] +## CHECK-DAG: Return [<<Conv>>] + +## CHECK-START: int SmaliTests2.$noinline$bug68142795Short(short) instruction_simplifier (after) +## CHECK-DAG: <<Arg:s\d+>> ParameterValue +## CHECK-DAG: Return [<<Arg>>] + +# Original java source +# +# return (short)(0xffff & (s & 0xffff)); +# +.method public static $noinline$bug68142795Short(S)I + .registers 3 + .param p0, "s" # S + + .prologue + const v1, 0xffff + + .line 2562 + and-int v0, p0, v1 + + and-int/2addr v0, v1 + + int-to-short v0, v0 + + return v0 +.end method + +# Original java source +# +# return 255; +# +.method private static $inline$get255()I + .registers 1 + + .prologue + .line 2849 + const/16 v0, 0xff + + return v0 +.end method + +## CHECK-START: int SmaliTests2.$noinline$bug68142795Boolean(boolean) instruction_simplifier$after_inlining (before) +## CHECK-DAG: <<Arg:z\d+>> ParameterValue +## CHECK-DAG: <<Const0:i\d+>> IntConstant 0 +## CHECK-DAG: <<Const1:i\d+>> IntConstant 1 +## CHECK-DAG: <<Const255:i\d+>> IntConstant 255 +## CHECK-DAG: If [<<Arg>>] +## CHECK-DAG: <<Phi:i\d+>> Phi [<<Const1>>,<<Const0>>] +## CHECK-DAG: <<And:i\d+>> And [<<Const255>>,<<Phi>>] +## CHECK-DAG: <<Conv:b\d+>> TypeConversion [<<And>>] +## CHECK-DAG: Return [<<Conv>>] + +## CHECK-START: int SmaliTests2.$noinline$bug68142795Boolean(boolean) instruction_simplifier$after_gvn (after) +## CHECK-DAG: <<Arg:z\d+>> ParameterValue +## CHECK-DAG: Return [<<Arg>>] + +# Original java source +# +# int v = b ? 1 : 0; // Should be simplified to "b" after inlining. +# return (byte)($inline$get255() & v); +# +.method public static $noinline$bug68142795Boolean(Z)I + .registers 3 + .param p0, "b" # Z + + .prologue + .line 2580 + if-eqz p0, :cond_a + + const/4 v0, 0x1 + + .line 2581 + .local v0, "v":I + :goto_3 + invoke-static {}, LSmaliTests2;->$inline$get255()I + + move-result v1 + + and-int/2addr v1, v0 + + int-to-byte v1, v1 + + return v1 + + .line 2580 + .end local v0 # "v":I + :cond_a + const/4 v0, 0x0 + + goto :goto_3 +.end method diff --git a/test/458-checker-instruct-simplification/src/Main.java b/test/458-checker-instruct-simplification/src/Main.java index b24cfcb775..40e3778109 100644 --- a/test/458-checker-instruct-simplification/src/Main.java +++ b/test/458-checker-instruct-simplification/src/Main.java @@ -640,24 +640,6 @@ public class Main { return arg ^ 0; } - /// CHECK-START: int Main.$noinline$XorAllOnes(int) instruction_simplifier (before) - /// CHECK-DAG: <<Arg:i\d+>> ParameterValue - /// CHECK-DAG: <<ConstF:i\d+>> IntConstant -1 - /// CHECK-DAG: <<Xor:i\d+>> Xor [<<Arg>>,<<ConstF>>] - /// CHECK-DAG: Return [<<Xor>>] - - /// CHECK-START: int Main.$noinline$XorAllOnes(int) instruction_simplifier (after) - /// CHECK-DAG: <<Arg:i\d+>> ParameterValue - /// CHECK-DAG: <<Not:i\d+>> Not [<<Arg>>] - /// CHECK-DAG: Return [<<Not>>] - - /// CHECK-START: int Main.$noinline$XorAllOnes(int) instruction_simplifier (after) - /// CHECK-NOT: Xor - - public static int $noinline$XorAllOnes(int arg) { - return arg ^ -1; - } - /** * Test that addition or subtraction operation with both inputs negated are * optimized to use a single negation after the operation. @@ -978,56 +960,7 @@ public class Main { return -temp | -temp; } - /** - * Test simplification of the `~~var` pattern. - * The transformation tested is implemented in `InstructionSimplifierVisitor::VisitNot`. - */ - - /// CHECK-START: long Main.$noinline$NotNot1(long) instruction_simplifier (before) - /// CHECK-DAG: <<Arg:j\d+>> ParameterValue - /// CHECK-DAG: <<ConstNeg1:j\d+>> LongConstant -1 - /// CHECK-DAG: <<Not1:j\d+>> Xor [<<Arg>>,<<ConstNeg1>>] - /// CHECK-DAG: <<Not2:j\d+>> Xor [<<Not1>>,<<ConstNeg1>>] - /// CHECK-DAG: Return [<<Not2>>] - - /// CHECK-START: long Main.$noinline$NotNot1(long) instruction_simplifier (after) - /// CHECK-DAG: <<Arg:j\d+>> ParameterValue - /// CHECK-DAG: Return [<<Arg>>] - - /// CHECK-START: long Main.$noinline$NotNot1(long) instruction_simplifier (after) - /// CHECK-NOT: Xor - - public static long $noinline$NotNot1(long arg) { - return ~~arg; - } - - /// CHECK-START: int Main.$noinline$NotNot2(int) instruction_simplifier (before) - /// CHECK-DAG: <<Arg:i\d+>> ParameterValue - /// CHECK-DAG: <<ConstNeg1:i\d+>> IntConstant -1 - /// CHECK-DAG: <<Not1:i\d+>> Xor [<<Arg>>,<<ConstNeg1>>] - /// CHECK-DAG: <<Not2:i\d+>> Xor [<<Not1>>,<<ConstNeg1>>] - /// CHECK-DAG: <<Add:i\d+>> Add [<<Not2>>,<<Not1>>] - /// CHECK-DAG: Return [<<Add>>] - - /// CHECK-START: int Main.$noinline$NotNot2(int) instruction_simplifier (after) - /// CHECK-DAG: <<Arg:i\d+>> ParameterValue - /// CHECK-DAG: <<Not:i\d+>> Not [<<Arg>>] - /// CHECK-DAG: <<Add:i\d+>> Add [<<Arg>>,<<Not>>] - /// CHECK-DAG: Return [<<Add>>] - - /// CHECK-START: int Main.$noinline$NotNot2(int) instruction_simplifier (after) - /// CHECK: Not - /// CHECK-NOT: Not - - /// CHECK-START: int Main.$noinline$NotNot2(int) instruction_simplifier (after) - /// CHECK-NOT: Xor - - public static int $noinline$NotNot2(int arg) { - int temp = ~arg; - return temp + ~temp; - } - - /** + /** * Test the simplification of a subtraction with a negated argument. * The transformation tested is implemented in `InstructionSimplifierVisitor::VisitSub`. */ @@ -1176,50 +1109,6 @@ public class Main { return (arg ? $inline$ReturnArg(0) : $inline$ReturnArg(1)) == 2; } - /* - * Test simplification of double Boolean negation. Note that sometimes - * both negations can be removed but we only expect the simplifier to - * remove the second. - */ - - /// CHECK-START: boolean Main.$noinline$NotNotBool(boolean) instruction_simplifier (before) - /// CHECK-DAG: <<Arg:z\d+>> ParameterValue - /// CHECK-DAG: <<Const1:i\d+>> IntConstant 0 - /// CHECK-DAG: <<Result:z\d+>> InvokeStaticOrDirect method_name:Main.NegateValue - /// CHECK-DAG: <<NotResult:z\d+>> NotEqual [<<Result>>,<<Const1>>] - /// CHECK-DAG: If [<<NotResult>>] - - /// CHECK-START: boolean Main.$noinline$NotNotBool(boolean) instruction_simplifier (after) - /// CHECK-NOT: NotEqual - - /// CHECK-START: boolean Main.$noinline$NotNotBool(boolean) instruction_simplifier (after) - /// CHECK-DAG: <<Arg:z\d+>> ParameterValue - /// CHECK-DAG: <<Result:z\d+>> InvokeStaticOrDirect method_name:Main.NegateValue - /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 - /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 - /// CHECK-DAG: <<Phi:i\d+>> Phi [<<Const1>>,<<Const0>>] - /// CHECK-DAG: Return [<<Phi>>] - - /// CHECK-START: boolean Main.$noinline$NotNotBool(boolean) instruction_simplifier$after_inlining (before) - /// CHECK-DAG: <<Arg:z\d+>> ParameterValue - /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 - /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 - /// CHECK-DAG: If [<<Arg>>] - /// CHECK-DAG: <<Phi:i\d+>> Phi [<<Const1>>,<<Const0>>] - /// CHECK-DAG: Return [<<Phi>>] - - /// CHECK-START: boolean Main.$noinline$NotNotBool(boolean) instruction_simplifier$after_gvn (after) - /// CHECK-DAG: <<Arg:z\d+>> ParameterValue - /// CHECK-DAG: Return [<<Arg>>] - - public static boolean NegateValue(boolean arg) { - return !arg; - } - - public static boolean $noinline$NotNotBool(boolean arg) { - return !(NegateValue(arg)); - } - /// CHECK-START: float Main.$noinline$Div2(float) instruction_simplifier (before) /// CHECK-DAG: <<Arg:f\d+>> ParameterValue /// CHECK-DAG: <<Const2:f\d+>> FloatConstant 2 @@ -1911,9 +1800,9 @@ public class Main { } } - public static boolean $noinline$runSmaliTestBoolean(String name, boolean input) { + public static boolean $noinline$runSmaliTest2Boolean(String name, boolean input) { try { - Class<?> c = Class.forName("SmaliTests"); + Class<?> c = Class.forName("SmaliTests2"); Method m = c.getMethod(name, boolean.class); return (Boolean) m.invoke(null, input); } catch (Exception ex) { @@ -1921,9 +1810,9 @@ public class Main { } } - public static int $noinline$runSmaliTestInt(String name, int arg) { + public static int $noinline$runSmaliTestInt(String postfix, String name, int arg) { try { - Class<?> c = Class.forName("SmaliTests"); + Class<?> c = Class.forName("SmaliTests" + postfix); Method m = c.getMethod(name, int.class); return (Integer) m.invoke(null, arg); } catch (Exception ex) { @@ -1931,9 +1820,13 @@ public class Main { } } - public static long $noinline$runSmaliTestLong(String name, long arg) { + public static int $noinline$runSmaliTestInt(String name, int arg) { + return $noinline$runSmaliTestInt("", name, arg); + } + + public static long $noinline$runSmaliTest2Long(String name, long arg) { try { - Class<?> c = Class.forName("SmaliTests"); + Class<?> c = Class.forName("SmaliTests2"); Method m = c.getMethod(name, long.class); return (Long) m.invoke(null, arg); } catch (Exception ex) { @@ -2547,40 +2440,6 @@ public class Main { return (byte)(0xff & (b & 0xff)); } - /// CHECK-START: int Main.$noinline$bug68142795Short(short) instruction_simplifier (before) - /// CHECK-DAG: <<Arg:s\d+>> ParameterValue - /// CHECK-DAG: <<Const:i\d+>> IntConstant 65535 - /// CHECK-DAG: <<And1:i\d+>> And [<<Arg>>,<<Const>>] - /// CHECK-DAG: <<And2:i\d+>> And [<<And1>>,<<Const>>] - /// CHECK-DAG: <<Conv:s\d+>> TypeConversion [<<And2>>] - /// CHECK-DAG: Return [<<Conv>>] - - /// CHECK-START: int Main.$noinline$bug68142795Short(short) instruction_simplifier (after) - /// CHECK-DAG: <<Arg:s\d+>> ParameterValue - /// CHECK-DAG: Return [<<Arg>>] - public static int $noinline$bug68142795Short(short s) { - return (short)(0xffff & (s & 0xffff)); - } - - /// CHECK-START: int Main.$noinline$bug68142795Boolean(boolean) instruction_simplifier$after_inlining (before) - /// CHECK-DAG: <<Arg:z\d+>> ParameterValue - /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0 - /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1 - /// CHECK-DAG: <<Const255:i\d+>> IntConstant 255 - /// CHECK-DAG: If [<<Arg>>] - /// CHECK-DAG: <<Phi:i\d+>> Phi [<<Const1>>,<<Const0>>] - /// CHECK-DAG: <<And:i\d+>> And [<<Const255>>,<<Phi>>] - /// CHECK-DAG: <<Conv:b\d+>> TypeConversion [<<And>>] - /// CHECK-DAG: Return [<<Conv>>] - - /// CHECK-START: int Main.$noinline$bug68142795Boolean(boolean) instruction_simplifier$after_gvn (after) - /// CHECK-DAG: <<Arg:z\d+>> ParameterValue - /// CHECK-DAG: Return [<<Arg>>] - public static int $noinline$bug68142795Boolean(boolean b) { - int v = b ? 1 : 0; // Should be simplified to "b" after inlining. - return (byte)($inline$get255() & v); - } - /// CHECK-START: int Main.$noinline$bug68142795Elaborate(byte) instruction_simplifier (before) /// CHECK-DAG: <<Arg:b\d+>> ParameterValue /// CHECK-DAG: <<Int255:i\d+>> IntConstant 255 @@ -2599,7 +2458,15 @@ public class Main { return (byte)((int)(((long)(b & 0xff)) & 255L)); } - public static void main(String[] args) { + public static void main(String[] args) throws Exception { + Class smaliTests2 = Class.forName("SmaliTests2"); + Method $noinline$XorAllOnes = smaliTests2.getMethod("$noinline$XorAllOnes", int.class); + Method $noinline$NotNot1 = smaliTests2.getMethod("$noinline$NotNot1", long.class); + Method $noinline$NotNot2 = smaliTests2.getMethod("$noinline$NotNot2", int.class); + Method $noinline$NotNotBool = smaliTests2.getMethod("$noinline$NotNotBool", boolean.class); + Method $noinline$bug68142795Short = smaliTests2.getMethod("$noinline$bug68142795Short", short.class); + Method $noinline$bug68142795Boolean = smaliTests2.getMethod("$noinline$bug68142795Boolean", boolean.class); + int arg = 123456; float floatArg = 123456.125f; @@ -2624,7 +2491,7 @@ public class Main { assertLongEquals(3, $noinline$SubSubConst(4)); assertLongEquals(arg, $noinline$UShr0(arg)); assertIntEquals(arg, $noinline$Xor0(arg)); - assertIntEquals(~arg, $noinline$XorAllOnes(arg)); + assertIntEquals(~arg, (int)$noinline$XorAllOnes.invoke(null, arg)); assertIntEquals(-(arg + arg + 1), $noinline$AddNegs1(arg, arg + 1)); assertIntEquals(-(arg + arg + 1), $noinline$AddNegs2(arg, arg + 1)); assertLongEquals(-(2 * arg + 1), $noinline$AddNegs3(arg, arg + 1)); @@ -2635,10 +2502,10 @@ public class Main { assertLongEquals(arg, $noinline$NegNeg3(arg)); assertIntEquals(1, $noinline$NegSub1(arg, arg + 1)); assertIntEquals(1, $noinline$NegSub2(arg, arg + 1)); - assertLongEquals(arg, $noinline$NotNot1(arg)); - assertLongEquals(arg, $noinline$runSmaliTestLong("$noinline$NotNot1", arg)); - assertIntEquals(-1, $noinline$NotNot2(arg)); - assertIntEquals(-1, $noinline$runSmaliTestInt("$noinline$NotNot2", arg)); + assertLongEquals(arg, (long)$noinline$NotNot1.invoke(null, arg)); + assertLongEquals(arg, $noinline$runSmaliTest2Long("$noinline$NotNot1", arg)); + assertIntEquals(-1, (int)$noinline$NotNot2.invoke(null, arg)); + assertIntEquals(-1, $noinline$runSmaliTestInt("2", "$noinline$NotNot2", arg)); assertIntEquals(-(arg + arg + 1), $noinline$SubNeg1(arg, arg + 1)); assertIntEquals(-(arg + arg + 1), $noinline$SubNeg2(arg, arg + 1)); assertLongEquals(-(2 * arg + 1), $noinline$SubNeg3(arg, arg + 1)); @@ -2646,10 +2513,10 @@ public class Main { assertBooleanEquals(true, $noinline$EqualBoolVsIntConst(true)); assertBooleanEquals(false, $noinline$NotEqualBoolVsIntConst(false)); assertBooleanEquals(false, $noinline$NotEqualBoolVsIntConst(false)); - assertBooleanEquals(true, $noinline$NotNotBool(true)); - assertBooleanEquals(true, $noinline$runSmaliTestBoolean("$noinline$NotNotBool", true)); - assertBooleanEquals(false, $noinline$NotNotBool(false)); - assertBooleanEquals(false, $noinline$runSmaliTestBoolean("$noinline$NotNotBool", false)); + assertBooleanEquals(true, (boolean)$noinline$NotNotBool.invoke(null, true)); + assertBooleanEquals(true, $noinline$runSmaliTest2Boolean("$noinline$NotNotBool", true)); + assertBooleanEquals(false, (boolean)$noinline$NotNotBool.invoke(null, false)); + assertBooleanEquals(false, $noinline$runSmaliTest2Boolean("$noinline$NotNotBool", false)); assertFloatEquals(50.0f, $noinline$Div2(100.0f)); assertDoubleEquals(75.0, $noinline$Div2(150.0)); assertFloatEquals(-400.0f, $noinline$DivMP25(100.0f)); @@ -2836,17 +2703,16 @@ public class Main { assertIntEquals(0x7f, $noinline$bug68142795Byte((byte) 0x7f)); assertIntEquals((byte) 0x80, $noinline$bug68142795Byte((byte) 0x80)); - assertIntEquals(0x7fff, $noinline$bug68142795Short((short) 0x7fff)); - assertIntEquals((short) 0x8000, $noinline$bug68142795Short((short) 0x8000)); - assertIntEquals(0, $noinline$bug68142795Boolean(false)); - assertIntEquals(1, $noinline$bug68142795Boolean(true)); + assertIntEquals(0x7fff, (int)$noinline$bug68142795Short.invoke(null, (short) 0x7fff)); + assertIntEquals((short) 0x8000, (int)$noinline$bug68142795Short.invoke(null, (short) 0x8000)); + assertIntEquals(0, (int)$noinline$bug68142795Boolean.invoke(null, false)); + assertIntEquals(1, (int)$noinline$bug68142795Boolean.invoke(null, true)); assertIntEquals(0x7f, $noinline$bug68142795Elaborate((byte) 0x7f)); assertIntEquals((byte) 0x80, $noinline$bug68142795Elaborate((byte) 0x80)); } private static boolean $inline$true() { return true; } private static boolean $inline$false() { return false; } - private static int $inline$get255() { return 255; } public static boolean booleanField; |