Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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 | |
Nicolas Geoffray | f5df897 | 2014-02-14 18:37:08 +0000 | [diff] [blame] | 17 | #include "compiler_backend.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 18 | #include "compiler_internals.h" |
| 19 | #include "driver/compiler_driver.h" |
| 20 | #include "dataflow_iterator-inl.h" |
| 21 | #include "leb128.h" |
| 22 | #include "mirror/object.h" |
Jean Christophe Beyler | 4e97c53 | 2014-01-07 10:07:18 -0800 | [diff] [blame] | 23 | #include "pass_driver.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 24 | #include "runtime.h" |
| 25 | #include "backend.h" |
| 26 | #include "base/logging.h" |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 27 | #include "base/timing_logger.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 28 | |
Vladimir Marko | 5c96e6b | 2013-11-14 15:34:17 +0000 | [diff] [blame] | 29 | #include "dex/quick/dex_file_to_method_inliner_map.h" |
| 30 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 31 | namespace art { |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 32 | |
Vladimir Marko | 867a2b3 | 2013-12-10 13:01:13 +0000 | [diff] [blame] | 33 | extern "C" void ArtInitQuickCompilerContext(art::CompilerDriver& driver) { |
| 34 | CHECK(driver.GetCompilerContext() == NULL); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 35 | } |
| 36 | |
Vladimir Marko | 867a2b3 | 2013-12-10 13:01:13 +0000 | [diff] [blame] | 37 | extern "C" void ArtUnInitQuickCompilerContext(art::CompilerDriver& driver) { |
Vladimir Marko | 5816ed4 | 2013-11-27 17:04:20 +0000 | [diff] [blame] | 38 | CHECK(driver.GetCompilerContext() == NULL); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | /* Default optimizer/debug setting for the compiler. */ |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 42 | static uint32_t kCompilerOptimizerDisableFlags = 0 | // Disable specific optimizations |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 43 | (1 << kLoadStoreElimination) | |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 44 | // (1 << kLoadHoisting) | |
| 45 | // (1 << kSuppressLoads) | |
| 46 | // (1 << kNullCheckElimination) | |
| 47 | // (1 << kPromoteRegs) | |
| 48 | // (1 << kTrackLiveTemps) | |
| 49 | // (1 << kSafeOptimizations) | |
| 50 | // (1 << kBBOpt) | |
| 51 | // (1 << kMatch) | |
| 52 | // (1 << kPromoteCompilerTemps) | |
buzbee | 17189ac | 2013-11-08 11:07:02 -0800 | [diff] [blame] | 53 | // (1 << kSuppressExceptionEdges) | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 54 | 0; |
| 55 | |
| 56 | static uint32_t kCompilerDebugFlags = 0 | // Enable debug/testing modes |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 57 | // (1 << kDebugDisplayMissingTargets) | |
| 58 | // (1 << kDebugVerbose) | |
| 59 | // (1 << kDebugDumpCFG) | |
| 60 | // (1 << kDebugSlowFieldPath) | |
| 61 | // (1 << kDebugSlowInvokePath) | |
| 62 | // (1 << kDebugSlowStringPath) | |
| 63 | // (1 << kDebugSlowestFieldPath) | |
| 64 | // (1 << kDebugSlowestStringPath) | |
| 65 | // (1 << kDebugExerciseResolveMethod) | |
| 66 | // (1 << kDebugVerifyDataflow) | |
| 67 | // (1 << kDebugShowMemoryUsage) | |
| 68 | // (1 << kDebugShowNops) | |
| 69 | // (1 << kDebugCountOpcodes) | |
| 70 | // (1 << kDebugDumpCheckStats) | |
| 71 | // (1 << kDebugDumpBitcodeFile) | |
| 72 | // (1 << kDebugVerifyBitcode) | |
| 73 | // (1 << kDebugShowSummaryMemoryUsage) | |
buzbee | ee17e0a | 2013-07-31 10:47:37 -0700 | [diff] [blame] | 74 | // (1 << kDebugShowFilterStats) | |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 75 | // (1 << kDebugTimings) | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 76 | 0; |
| 77 | |
Vladimir Marko | 25724ef | 2013-11-12 15:09:20 +0000 | [diff] [blame] | 78 | CompilationUnit::CompilationUnit(ArenaPool* pool) |
| 79 | : compiler_driver(NULL), |
| 80 | class_linker(NULL), |
| 81 | dex_file(NULL), |
| 82 | class_loader(NULL), |
| 83 | class_def_idx(0), |
| 84 | method_idx(0), |
| 85 | code_item(NULL), |
| 86 | access_flags(0), |
| 87 | invoke_type(kDirect), |
| 88 | shorty(NULL), |
| 89 | disable_opt(0), |
| 90 | enable_debug(0), |
| 91 | verbose(false), |
Nicolas Geoffray | f5df897 | 2014-02-14 18:37:08 +0000 | [diff] [blame] | 92 | compiler_backend(NULL), |
Vladimir Marko | 25724ef | 2013-11-12 15:09:20 +0000 | [diff] [blame] | 93 | instruction_set(kNone), |
| 94 | num_dalvik_registers(0), |
| 95 | insns(NULL), |
| 96 | num_ins(0), |
| 97 | num_outs(0), |
| 98 | num_regs(0), |
Vladimir Marko | 25724ef | 2013-11-12 15:09:20 +0000 | [diff] [blame] | 99 | compiler_flip_match(false), |
| 100 | arena(pool), |
Vladimir Marko | 83cc7ae | 2014-02-12 18:02:05 +0000 | [diff] [blame] | 101 | arena_stack(pool), |
Vladimir Marko | 25724ef | 2013-11-12 15:09:20 +0000 | [diff] [blame] | 102 | mir_graph(NULL), |
| 103 | cg(NULL), |
| 104 | timings("QuickCompiler", true, false) { |
| 105 | } |
| 106 | |
| 107 | CompilationUnit::~CompilationUnit() { |
| 108 | } |
| 109 | |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 110 | void CompilationUnit::StartTimingSplit(const char* label) { |
Nicolas Geoffray | ea3fa0b | 2014-02-10 11:59:41 +0000 | [diff] [blame] | 111 | if (compiler_driver->GetDumpPasses()) { |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 112 | timings.StartSplit(label); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | void CompilationUnit::NewTimingSplit(const char* label) { |
Nicolas Geoffray | ea3fa0b | 2014-02-10 11:59:41 +0000 | [diff] [blame] | 117 | if (compiler_driver->GetDumpPasses()) { |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 118 | timings.NewSplit(label); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | void CompilationUnit::EndTiming() { |
Nicolas Geoffray | ea3fa0b | 2014-02-10 11:59:41 +0000 | [diff] [blame] | 123 | if (compiler_driver->GetDumpPasses()) { |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 124 | timings.EndSplit(); |
Nicolas Geoffray | ea3fa0b | 2014-02-10 11:59:41 +0000 | [diff] [blame] | 125 | if (enable_debug & (1 << kDebugTimings)) { |
| 126 | LOG(INFO) << "TIMINGS " << PrettyMethod(method_idx, *dex_file); |
| 127 | LOG(INFO) << Dumpable<TimingLogger>(timings); |
| 128 | } |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 129 | } |
| 130 | } |
| 131 | |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 132 | static CompiledMethod* CompileMethod(CompilerDriver& driver, |
Nicolas Geoffray | f5df897 | 2014-02-14 18:37:08 +0000 | [diff] [blame] | 133 | CompilerBackend* compiler_backend, |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 134 | const DexFile::CodeItem* code_item, |
| 135 | uint32_t access_flags, InvokeType invoke_type, |
Ian Rogers | 8b2c0b9 | 2013-09-19 02:56:49 -0700 | [diff] [blame] | 136 | uint16_t class_def_idx, uint32_t method_idx, |
Nicolas Geoffray | f5df897 | 2014-02-14 18:37:08 +0000 | [diff] [blame] | 137 | jobject class_loader, const DexFile& dex_file, |
| 138 | void* llvm_compilation_unit) { |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 139 | VLOG(compiler) << "Compiling " << PrettyMethod(method_idx, dex_file) << "..."; |
buzbee | b48819d | 2013-09-14 16:15:25 -0700 | [diff] [blame] | 140 | if (code_item->insns_size_in_code_units_ >= 0x10000) { |
| 141 | LOG(INFO) << "Method size exceeds compiler limits: " << code_item->insns_size_in_code_units_ |
| 142 | << " in " << PrettyMethod(method_idx, dex_file); |
| 143 | return NULL; |
| 144 | } |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 145 | |
| 146 | ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 147 | CompilationUnit cu(driver.GetArenaPool()); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 148 | |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 149 | cu.compiler_driver = &driver; |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 150 | cu.class_linker = class_linker; |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 151 | cu.instruction_set = driver.GetInstructionSet(); |
Andreas Gampe | 2da8823 | 2014-02-27 12:26:20 -0800 | [diff] [blame] | 152 | cu.target64 = cu.instruction_set == kX86_64; |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 153 | cu.compiler_backend = compiler_backend; |
Andreas Gampe | 2da8823 | 2014-02-27 12:26:20 -0800 | [diff] [blame] | 154 | // TODO: x86_64 is not yet implemented. |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 155 | DCHECK((cu.instruction_set == kThumb2) || |
| 156 | (cu.instruction_set == kX86) || |
| 157 | (cu.instruction_set == kMips)); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 158 | |
| 159 | |
| 160 | /* Adjust this value accordingly once inlining is performed */ |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 161 | cu.num_dalvik_registers = code_item->registers_size_; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 162 | // TODO: set this from command line |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 163 | cu.compiler_flip_match = false; |
| 164 | bool use_match = !cu.compiler_method_match.empty(); |
| 165 | bool match = use_match && (cu.compiler_flip_match ^ |
| 166 | (PrettyMethod(method_idx, dex_file).find(cu.compiler_method_match) != |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 167 | std::string::npos)); |
| 168 | if (!use_match || match) { |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 169 | cu.disable_opt = kCompilerOptimizerDisableFlags; |
| 170 | cu.enable_debug = kCompilerDebugFlags; |
| 171 | cu.verbose = VLOG_IS_ON(compiler) || |
| 172 | (cu.enable_debug & (1 << kDebugVerbose)); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | /* |
| 176 | * TODO: rework handling of optimization and debug flags. Should we split out |
| 177 | * MIR and backend flags? Need command-line setting as well. |
| 178 | */ |
| 179 | |
Nicolas Geoffray | f5df897 | 2014-02-14 18:37:08 +0000 | [diff] [blame] | 180 | compiler_backend->InitCompilationUnit(cu); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 181 | |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 182 | if (cu.instruction_set == kMips) { |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 183 | // Disable some optimizations for mips for now |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 184 | cu.disable_opt |= ( |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 185 | (1 << kLoadStoreElimination) | |
| 186 | (1 << kLoadHoisting) | |
| 187 | (1 << kSuppressLoads) | |
| 188 | (1 << kNullCheckElimination) | |
| 189 | (1 << kPromoteRegs) | |
| 190 | (1 << kTrackLiveTemps) | |
| 191 | (1 << kSafeOptimizations) | |
| 192 | (1 << kBBOpt) | |
| 193 | (1 << kMatch) | |
| 194 | (1 << kPromoteCompilerTemps)); |
| 195 | } |
| 196 | |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 197 | cu.StartTimingSplit("BuildMIRGraph"); |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 198 | cu.mir_graph.reset(new MIRGraph(&cu, &cu.arena)); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 199 | |
Razvan A Lupusoru | da7a69b | 2014-01-08 15:09:50 -0800 | [diff] [blame] | 200 | /* |
| 201 | * After creation of the MIR graph, also create the code generator. |
| 202 | * The reason we do this is that optimizations on the MIR graph may need to get information |
| 203 | * that is only available if a CG exists. |
| 204 | */ |
Nicolas Geoffray | f5df897 | 2014-02-14 18:37:08 +0000 | [diff] [blame] | 205 | cu.cg.reset(compiler_backend->GetCodeGenerator(&cu, llvm_compilation_unit)); |
Razvan A Lupusoru | da7a69b | 2014-01-08 15:09:50 -0800 | [diff] [blame] | 206 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 207 | /* Gathering opcode stats? */ |
| 208 | if (kCompilerDebugFlags & (1 << kDebugCountOpcodes)) { |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 209 | cu.mir_graph->EnableOpcodeCounting(); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | /* Build the raw MIR graph */ |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 213 | cu.mir_graph->InlineMethod(code_item, access_flags, invoke_type, class_def_idx, method_idx, |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 214 | class_loader, dex_file); |
| 215 | |
buzbee | 1da1e2f | 2013-11-15 13:37:01 -0800 | [diff] [blame] | 216 | cu.NewTimingSplit("MIROpt:CheckFilters"); |
Brian Carlstrom | 6449c62 | 2014-02-10 23:48:36 -0800 | [diff] [blame] | 217 | if (cu.mir_graph->SkipCompilation()) { |
buzbee | ee17e0a | 2013-07-31 10:47:37 -0700 | [diff] [blame] | 218 | return NULL; |
| 219 | } |
| 220 | |
Jean Christophe Beyler | 4e97c53 | 2014-01-07 10:07:18 -0800 | [diff] [blame] | 221 | /* Create the pass driver and launch it */ |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 222 | PassDriver pass_driver(&cu); |
| 223 | pass_driver.Launch(); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 224 | |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 225 | if (cu.enable_debug & (1 << kDebugDumpCheckStats)) { |
| 226 | cu.mir_graph->DumpCheckStats(); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | if (kCompilerDebugFlags & (1 << kDebugCountOpcodes)) { |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 230 | cu.mir_graph->ShowOpcodeStats(); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 231 | } |
| 232 | |
buzbee | 1da1e2f | 2013-11-15 13:37:01 -0800 | [diff] [blame] | 233 | /* Reassociate sreg names with original Dalvik vreg names. */ |
| 234 | cu.mir_graph->RemapRegLocations(); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 235 | |
| 236 | CompiledMethod* result = NULL; |
| 237 | |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 238 | cu.cg->Materialize(); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 239 | |
buzbee | 1da1e2f | 2013-11-15 13:37:01 -0800 | [diff] [blame] | 240 | cu.NewTimingSplit("Dedupe"); /* deduping takes up the vast majority of time in GetCompiledMethod(). */ |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 241 | result = cu.cg->GetCompiledMethod(); |
buzbee | 1da1e2f | 2013-11-15 13:37:01 -0800 | [diff] [blame] | 242 | cu.NewTimingSplit("Cleanup"); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 243 | |
| 244 | if (result) { |
| 245 | VLOG(compiler) << "Compiled " << PrettyMethod(method_idx, dex_file); |
| 246 | } else { |
| 247 | VLOG(compiler) << "Deferred " << PrettyMethod(method_idx, dex_file); |
| 248 | } |
| 249 | |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 250 | if (cu.enable_debug & (1 << kDebugShowMemoryUsage)) { |
Vladimir Marko | 83cc7ae | 2014-02-12 18:02:05 +0000 | [diff] [blame] | 251 | if (cu.arena.BytesAllocated() > (1 * 1024 *1024) || |
| 252 | cu.arena_stack.PeakBytesAllocated() > 256 * 1024) { |
| 253 | MemStats mem_stats(cu.arena.GetMemStats()); |
| 254 | MemStats peak_stats(cu.arena_stack.GetPeakStats()); |
| 255 | LOG(INFO) << PrettyMethod(method_idx, dex_file) << " " << Dumpable<MemStats>(mem_stats) |
| 256 | << Dumpable<MemStats>(peak_stats); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 257 | } |
| 258 | } |
| 259 | |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 260 | if (cu.enable_debug & (1 << kDebugShowSummaryMemoryUsage)) { |
| 261 | LOG(INFO) << "MEMINFO " << cu.arena.BytesAllocated() << " " << cu.mir_graph->GetNumBlocks() |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 262 | << " " << PrettyMethod(method_idx, dex_file); |
| 263 | } |
| 264 | |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 265 | cu.EndTiming(); |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 266 | driver.GetTimingsLogger()->Start(); |
| 267 | driver.GetTimingsLogger()->AddLogger(cu.timings); |
| 268 | driver.GetTimingsLogger()->End(); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 269 | return result; |
| 270 | } |
| 271 | |
| 272 | CompiledMethod* CompileOneMethod(CompilerDriver& compiler, |
Nicolas Geoffray | f5df897 | 2014-02-14 18:37:08 +0000 | [diff] [blame] | 273 | CompilerBackend* backend, |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 274 | const DexFile::CodeItem* code_item, |
| 275 | uint32_t access_flags, |
| 276 | InvokeType invoke_type, |
Ian Rogers | 8b2c0b9 | 2013-09-19 02:56:49 -0700 | [diff] [blame] | 277 | uint16_t class_def_idx, |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 278 | uint32_t method_idx, |
| 279 | jobject class_loader, |
| 280 | const DexFile& dex_file, |
Nicolas Geoffray | f5df897 | 2014-02-14 18:37:08 +0000 | [diff] [blame] | 281 | void* compilation_unit) { |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 282 | return CompileMethod(compiler, backend, code_item, access_flags, invoke_type, class_def_idx, |
Nicolas Geoffray | f5df897 | 2014-02-14 18:37:08 +0000 | [diff] [blame] | 283 | method_idx, class_loader, dex_file, compilation_unit); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | } // namespace art |
| 287 | |
| 288 | extern "C" art::CompiledMethod* |
| 289 | ArtQuickCompileMethod(art::CompilerDriver& compiler, |
| 290 | const art::DexFile::CodeItem* code_item, |
| 291 | uint32_t access_flags, art::InvokeType invoke_type, |
Ian Rogers | 8b2c0b9 | 2013-09-19 02:56:49 -0700 | [diff] [blame] | 292 | uint16_t class_def_idx, uint32_t method_idx, jobject class_loader, |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 293 | const art::DexFile& dex_file) { |
| 294 | // TODO: check method fingerprint here to determine appropriate backend type. Until then, use build default |
Nicolas Geoffray | f5df897 | 2014-02-14 18:37:08 +0000 | [diff] [blame] | 295 | art::CompilerBackend* backend = compiler.GetCompilerBackend(); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 296 | return art::CompileOneMethod(compiler, backend, code_item, access_flags, invoke_type, |
| 297 | class_def_idx, method_idx, class_loader, dex_file, |
| 298 | NULL /* use thread llvm_info */); |
| 299 | } |