From: Nicolas Geoffray Date: Thu, 18 Jun 2015 17:04:12 +0000 (+0100) Subject: Don't check the return type in the builder. X-Git-Tag: android-x86-7.1-r1~889^2~963^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=69505f86a1a653bf86c1f2b423b3e0605137d5d1;p=android-x86%2Fart.git Don't check the return type in the builder. The verifier will not complain about dead code. For the compiler, it is benign. bug:21863767 Change-Id: I6ef7be233d1cd69dddcc4499e4e4fad54753099f --- diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index 793dd2815..946c0602c 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -1463,21 +1463,16 @@ bool HGraphBuilder::AnalyzeDexInstruction(const Instruction& instruction, uint32 } case Instruction::RETURN: { - DCHECK_NE(return_type_, Primitive::kPrimNot); - DCHECK_NE(return_type_, Primitive::kPrimLong); - DCHECK_NE(return_type_, Primitive::kPrimDouble); BuildReturn(instruction, return_type_); break; } case Instruction::RETURN_OBJECT: { - DCHECK(return_type_ == Primitive::kPrimNot); BuildReturn(instruction, return_type_); break; } case Instruction::RETURN_WIDE: { - DCHECK(return_type_ == Primitive::kPrimDouble || return_type_ == Primitive::kPrimLong); BuildReturn(instruction, return_type_); break; } diff --git a/test/800-smali/expected.txt b/test/800-smali/expected.txt index 85656374c..5927ee385 100644 --- a/test/800-smali/expected.txt +++ b/test/800-smali/expected.txt @@ -17,4 +17,5 @@ MoveExceptionOnEntry EmptySparseSwitch b/20224106 b/17410612 +b/21865464 Done! diff --git a/test/800-smali/smali/b_21865464.smali b/test/800-smali/smali/b_21865464.smali new file mode 100644 index 000000000..df56a54aa --- /dev/null +++ b/test/800-smali/smali/b_21865464.smali @@ -0,0 +1,29 @@ +# Copyright (C) 2015 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 LB21865464; + +.super Ljava/lang/Object; + +.method public static run()V + .registers 2 + return-void + goto :start + :start + # The following is dead code but used to crash the compiler. + const/4 v0, 0 + return-wide v0 + return v0 + return-object v0 +.end method diff --git a/test/800-smali/src/Main.java b/test/800-smali/src/Main.java index 33df06d87..0e1151935 100644 --- a/test/800-smali/src/Main.java +++ b/test/800-smali/src/Main.java @@ -83,6 +83,8 @@ public class Main { 0)); testCases.add(new TestCase("b/17410612", "B17410612", "run", null, new VerifyError(), 0)); + testCases.add(new TestCase("b/21865464", "B21865464", "run", null, null, + null)); } public void runTests() {