1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include "verified_method.h" 18 19 #include <algorithm> 20 #include <memory> 21 22 #include <android-base/logging.h> 23 24 #include "dex/code_item_accessors-inl.h" 25 #include "dex/dex_file.h" 26 #include "dex/dex_instruction-inl.h" 27 #include "runtime.h" 28 #include "verifier/method_verifier-inl.h" 29 #include "verifier/reg_type-inl.h" 30 #include "verifier/register_line-inl.h" 31 #include "verifier/verifier_deps.h" 32 33 namespace art { 34 VerifiedMethod(uint32_t encountered_error_types,bool has_runtime_throw)35VerifiedMethod::VerifiedMethod(uint32_t encountered_error_types, bool has_runtime_throw) 36 : encountered_error_types_(encountered_error_types), 37 has_runtime_throw_(has_runtime_throw) { 38 } 39 Create(verifier::MethodVerifier * method_verifier)40const VerifiedMethod* VerifiedMethod::Create(verifier::MethodVerifier* method_verifier) { 41 DCHECK(Runtime::Current()->IsAotCompiler()); 42 std::unique_ptr<VerifiedMethod> verified_method( 43 new VerifiedMethod(method_verifier->GetEncounteredFailureTypes(), 44 method_verifier->HasInstructionThatWillThrow())); 45 46 return verified_method.release(); 47 } 48 49 } // namespace art 50