2 * Copyright (C) 2014 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include "base/logging.h"
20 #include "driver/compiler_driver.h"
21 #include "optimizing/optimizing_compiler.h"
26 Compiler* Compiler::Create(CompilerDriver* driver, Compiler::Kind kind) {
29 // TODO: Remove Quick in options.
31 return CreateOptimizingCompiler(driver);
34 LOG(FATAL) << "UNREACHABLE";
39 bool Compiler::IsPathologicalCase(const DexFile::CodeItem& code_item,
41 const DexFile& dex_file) {
43 * Skip compilation for pathologically large methods - either by instruction count or num vregs.
44 * Dalvik uses 16-bit uints for instruction and register counts. We'll limit to a quarter
45 * of that, which also guarantees we cannot overflow our 16-bit internal Quick SSA name space.
47 if (code_item.insns_size_in_code_units_ >= UINT16_MAX / 4) {
48 LOG(INFO) << "Method exceeds compiler instruction limit: "
49 << code_item.insns_size_in_code_units_
50 << " in " << dex_file.PrettyMethod(method_idx);
53 if (code_item.registers_size_ >= UINT16_MAX / 4) {
54 LOG(INFO) << "Method exceeds compiler virtual register limit: "
55 << code_item.registers_size_ << " in " << dex_file.PrettyMethod(method_idx);