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 | b34f69a | 2014-03-07 15:28:39 +0000 | [diff] [blame] | 17 | #include "compiler.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 18 | #include "compiler_internals.h" |
| 19 | #include "driver/compiler_driver.h" |
Dave Allison | 39c3bfb | 2014-01-28 18:33:52 -0800 | [diff] [blame] | 20 | #include "driver/compiler_options.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 21 | #include "dataflow_iterator-inl.h" |
| 22 | #include "leb128.h" |
| 23 | #include "mirror/object.h" |
James C Scott | 4f59668 | 2014-05-01 05:52:04 -0700 | [diff] [blame] | 24 | #include "pass_driver_me.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 25 | #include "runtime.h" |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 26 | #include "base/logging.h" |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 27 | #include "base/timing_logger.h" |
Dave Allison | 39c3bfb | 2014-01-28 18:33:52 -0800 | [diff] [blame] | 28 | #include "driver/compiler_options.h" |
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 | |
Ian Rogers | 72d3262 | 2014-05-06 16:20:11 -0700 | [diff] [blame] | 33 | extern "C" void ArtInitQuickCompilerContext(art::CompilerDriver* driver) { |
| 34 | CHECK(driver->GetCompilerContext() == nullptr); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 35 | } |
| 36 | |
Ian Rogers | 72d3262 | 2014-05-06 16:20:11 -0700 | [diff] [blame] | 37 | extern "C" void ArtUnInitQuickCompilerContext(art::CompilerDriver* driver) { |
| 38 | CHECK(driver->GetCompilerContext() == nullptr); |
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 |
buzbee | 091cc40 | 2014-03-31 10:14:40 -0700 | [diff] [blame] | 43 | (1 << kLoadStoreElimination) | // TODO: this pass has been broken for awhile - fix or delete. |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 44 | // (1 << kLoadHoisting) | |
| 45 | // (1 << kSuppressLoads) | |
| 46 | // (1 << kNullCheckElimination) | |
Vladimir Marko | bfea9c2 | 2014-01-17 17:49:33 +0000 | [diff] [blame] | 47 | // (1 << kClassInitCheckElimination) | |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 48 | // (1 << kPromoteRegs) | |
buzbee | 30adc73 | 2014-05-09 15:10:18 -0700 | [diff] [blame] | 49 | // (1 << kTrackLiveTemps) | |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 50 | // (1 << kSafeOptimizations) | |
| 51 | // (1 << kBBOpt) | |
| 52 | // (1 << kMatch) | |
| 53 | // (1 << kPromoteCompilerTemps) | |
buzbee | 17189ac | 2013-11-08 11:07:02 -0800 | [diff] [blame] | 54 | // (1 << kSuppressExceptionEdges) | |
Vladimir Marko | 9820b7c | 2014-01-02 16:40:37 +0000 | [diff] [blame] | 55 | // (1 << kSuppressMethodInlining) | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 56 | 0; |
| 57 | |
| 58 | static uint32_t kCompilerDebugFlags = 0 | // Enable debug/testing modes |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 59 | // (1 << kDebugDisplayMissingTargets) | |
| 60 | // (1 << kDebugVerbose) | |
| 61 | // (1 << kDebugDumpCFG) | |
| 62 | // (1 << kDebugSlowFieldPath) | |
| 63 | // (1 << kDebugSlowInvokePath) | |
| 64 | // (1 << kDebugSlowStringPath) | |
| 65 | // (1 << kDebugSlowestFieldPath) | |
| 66 | // (1 << kDebugSlowestStringPath) | |
| 67 | // (1 << kDebugExerciseResolveMethod) | |
| 68 | // (1 << kDebugVerifyDataflow) | |
| 69 | // (1 << kDebugShowMemoryUsage) | |
| 70 | // (1 << kDebugShowNops) | |
| 71 | // (1 << kDebugCountOpcodes) | |
| 72 | // (1 << kDebugDumpCheckStats) | |
| 73 | // (1 << kDebugDumpBitcodeFile) | |
| 74 | // (1 << kDebugVerifyBitcode) | |
| 75 | // (1 << kDebugShowSummaryMemoryUsage) | |
buzbee | ee17e0a | 2013-07-31 10:47:37 -0700 | [diff] [blame] | 76 | // (1 << kDebugShowFilterStats) | |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 77 | // (1 << kDebugTimings) | |
buzbee | b01bf15 | 2014-05-13 15:59:07 -0700 | [diff] [blame] | 78 | // (1 << kDebugCodegenDump) | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 79 | 0; |
| 80 | |
Vladimir Marko | 25724ef | 2013-11-12 15:09:20 +0000 | [diff] [blame] | 81 | CompilationUnit::CompilationUnit(ArenaPool* pool) |
Ian Rogers | 93dcff3 | 2014-05-15 09:11:23 -0700 | [diff] [blame] | 82 | : compiler_driver(nullptr), |
| 83 | class_linker(nullptr), |
| 84 | dex_file(nullptr), |
| 85 | class_loader(nullptr), |
Vladimir Marko | 25724ef | 2013-11-12 15:09:20 +0000 | [diff] [blame] | 86 | class_def_idx(0), |
| 87 | method_idx(0), |
Ian Rogers | 93dcff3 | 2014-05-15 09:11:23 -0700 | [diff] [blame] | 88 | code_item(nullptr), |
Vladimir Marko | 25724ef | 2013-11-12 15:09:20 +0000 | [diff] [blame] | 89 | access_flags(0), |
| 90 | invoke_type(kDirect), |
Ian Rogers | 93dcff3 | 2014-05-15 09:11:23 -0700 | [diff] [blame] | 91 | shorty(nullptr), |
Vladimir Marko | 25724ef | 2013-11-12 15:09:20 +0000 | [diff] [blame] | 92 | disable_opt(0), |
| 93 | enable_debug(0), |
| 94 | verbose(false), |
Ian Rogers | 93dcff3 | 2014-05-15 09:11:23 -0700 | [diff] [blame] | 95 | compiler(nullptr), |
Vladimir Marko | 25724ef | 2013-11-12 15:09:20 +0000 | [diff] [blame] | 96 | instruction_set(kNone), |
Ian Rogers | 93dcff3 | 2014-05-15 09:11:23 -0700 | [diff] [blame] | 97 | target64(false), |
Vladimir Marko | 25724ef | 2013-11-12 15:09:20 +0000 | [diff] [blame] | 98 | num_dalvik_registers(0), |
Ian Rogers | 93dcff3 | 2014-05-15 09:11:23 -0700 | [diff] [blame] | 99 | insns(nullptr), |
Vladimir Marko | 25724ef | 2013-11-12 15:09:20 +0000 | [diff] [blame] | 100 | num_ins(0), |
| 101 | num_outs(0), |
| 102 | num_regs(0), |
Vladimir Marko | 25724ef | 2013-11-12 15:09:20 +0000 | [diff] [blame] | 103 | compiler_flip_match(false), |
| 104 | arena(pool), |
Vladimir Marko | 83cc7ae | 2014-02-12 18:02:05 +0000 | [diff] [blame] | 105 | arena_stack(pool), |
Ian Rogers | 93dcff3 | 2014-05-15 09:11:23 -0700 | [diff] [blame] | 106 | mir_graph(nullptr), |
| 107 | cg(nullptr), |
Vladimir Marko | 25724ef | 2013-11-12 15:09:20 +0000 | [diff] [blame] | 108 | timings("QuickCompiler", true, false) { |
| 109 | } |
| 110 | |
| 111 | CompilationUnit::~CompilationUnit() { |
| 112 | } |
| 113 | |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 114 | void CompilationUnit::StartTimingSplit(const char* label) { |
Nicolas Geoffray | ea3fa0b | 2014-02-10 11:59:41 +0000 | [diff] [blame] | 115 | if (compiler_driver->GetDumpPasses()) { |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 116 | timings.StartSplit(label); |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | void CompilationUnit::NewTimingSplit(const char* label) { |
Nicolas Geoffray | ea3fa0b | 2014-02-10 11:59:41 +0000 | [diff] [blame] | 121 | if (compiler_driver->GetDumpPasses()) { |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 122 | timings.NewSplit(label); |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | void CompilationUnit::EndTiming() { |
Nicolas Geoffray | ea3fa0b | 2014-02-10 11:59:41 +0000 | [diff] [blame] | 127 | if (compiler_driver->GetDumpPasses()) { |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 128 | timings.EndSplit(); |
Nicolas Geoffray | ea3fa0b | 2014-02-10 11:59:41 +0000 | [diff] [blame] | 129 | if (enable_debug & (1 << kDebugTimings)) { |
| 130 | LOG(INFO) << "TIMINGS " << PrettyMethod(method_idx, *dex_file); |
| 131 | LOG(INFO) << Dumpable<TimingLogger>(timings); |
| 132 | } |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 133 | } |
| 134 | } |
| 135 | |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 136 | // TODO: Remove this when we are able to compile everything. |
| 137 | int arm64_support_list[] = { |
| 138 | Instruction::NOP, |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame^] | 139 | Instruction::MOVE, |
| 140 | Instruction::MOVE_FROM16, |
| 141 | Instruction::MOVE_16, |
| 142 | Instruction::MOVE_WIDE, |
| 143 | Instruction::MOVE_WIDE_FROM16, |
| 144 | Instruction::MOVE_WIDE_16, |
| 145 | Instruction::MOVE_OBJECT, |
| 146 | Instruction::MOVE_OBJECT_FROM16, |
| 147 | Instruction::MOVE_OBJECT_16, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 148 | // Instruction::MOVE_RESULT, |
| 149 | // Instruction::MOVE_RESULT_WIDE, |
| 150 | // Instruction::MOVE_RESULT_OBJECT, |
Zheng Xu | c830430 | 2014-05-15 17:21:01 +0100 | [diff] [blame] | 151 | Instruction::MOVE_EXCEPTION, |
| 152 | Instruction::RETURN_VOID, |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame^] | 153 | Instruction::RETURN, |
| 154 | Instruction::RETURN_WIDE, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 155 | // Instruction::RETURN_OBJECT, |
| 156 | // Instruction::CONST_4, |
| 157 | // Instruction::CONST_16, |
| 158 | // Instruction::CONST, |
| 159 | // Instruction::CONST_HIGH16, |
| 160 | // Instruction::CONST_WIDE_16, |
| 161 | // Instruction::CONST_WIDE_32, |
| 162 | // Instruction::CONST_WIDE, |
| 163 | // Instruction::CONST_WIDE_HIGH16, |
| 164 | // Instruction::CONST_STRING, |
| 165 | // Instruction::CONST_STRING_JUMBO, |
| 166 | // Instruction::CONST_CLASS, |
Zheng Xu | c830430 | 2014-05-15 17:21:01 +0100 | [diff] [blame] | 167 | Instruction::MONITOR_ENTER, |
| 168 | Instruction::MONITOR_EXIT, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 169 | // Instruction::CHECK_CAST, |
| 170 | // Instruction::INSTANCE_OF, |
| 171 | // Instruction::ARRAY_LENGTH, |
| 172 | // Instruction::NEW_INSTANCE, |
| 173 | // Instruction::NEW_ARRAY, |
| 174 | // Instruction::FILLED_NEW_ARRAY, |
| 175 | // Instruction::FILLED_NEW_ARRAY_RANGE, |
| 176 | // Instruction::FILL_ARRAY_DATA, |
Zheng Xu | c830430 | 2014-05-15 17:21:01 +0100 | [diff] [blame] | 177 | Instruction::THROW, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 178 | // Instruction::GOTO, |
| 179 | // Instruction::GOTO_16, |
| 180 | // Instruction::GOTO_32, |
| 181 | // Instruction::PACKED_SWITCH, |
| 182 | // Instruction::SPARSE_SWITCH, |
| 183 | // Instruction::CMPL_FLOAT, |
| 184 | // Instruction::CMPG_FLOAT, |
| 185 | // Instruction::CMPL_DOUBLE, |
| 186 | // Instruction::CMPG_DOUBLE, |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame^] | 187 | Instruction::CMP_LONG, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 188 | // Instruction::IF_EQ, |
| 189 | // Instruction::IF_NE, |
| 190 | // Instruction::IF_LT, |
| 191 | // Instruction::IF_GE, |
| 192 | // Instruction::IF_GT, |
| 193 | // Instruction::IF_LE, |
| 194 | // Instruction::IF_EQZ, |
| 195 | // Instruction::IF_NEZ, |
| 196 | // Instruction::IF_LTZ, |
| 197 | // Instruction::IF_GEZ, |
| 198 | // Instruction::IF_GTZ, |
| 199 | // Instruction::IF_LEZ, |
| 200 | // Instruction::UNUSED_3E, |
| 201 | // Instruction::UNUSED_3F, |
| 202 | // Instruction::UNUSED_40, |
| 203 | // Instruction::UNUSED_41, |
| 204 | // Instruction::UNUSED_42, |
| 205 | // Instruction::UNUSED_43, |
| 206 | // Instruction::AGET, |
| 207 | // Instruction::AGET_WIDE, |
| 208 | // Instruction::AGET_OBJECT, |
| 209 | // Instruction::AGET_BOOLEAN, |
| 210 | // Instruction::AGET_BYTE, |
| 211 | // Instruction::AGET_CHAR, |
| 212 | // Instruction::AGET_SHORT, |
| 213 | // Instruction::APUT, |
| 214 | // Instruction::APUT_WIDE, |
| 215 | // Instruction::APUT_OBJECT, |
| 216 | // Instruction::APUT_BOOLEAN, |
| 217 | // Instruction::APUT_BYTE, |
| 218 | // Instruction::APUT_CHAR, |
| 219 | // Instruction::APUT_SHORT, |
| 220 | // Instruction::IGET, |
| 221 | // Instruction::IGET_WIDE, |
| 222 | // Instruction::IGET_OBJECT, |
| 223 | // Instruction::IGET_BOOLEAN, |
| 224 | // Instruction::IGET_BYTE, |
| 225 | // Instruction::IGET_CHAR, |
| 226 | // Instruction::IGET_SHORT, |
| 227 | // Instruction::IPUT, |
| 228 | // Instruction::IPUT_WIDE, |
| 229 | // Instruction::IPUT_OBJECT, |
| 230 | // Instruction::IPUT_BOOLEAN, |
| 231 | // Instruction::IPUT_BYTE, |
| 232 | // Instruction::IPUT_CHAR, |
| 233 | // Instruction::IPUT_SHORT, |
Zheng Xu | c830430 | 2014-05-15 17:21:01 +0100 | [diff] [blame] | 234 | Instruction::SGET, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 235 | // Instruction::SGET_WIDE, |
Zheng Xu | c830430 | 2014-05-15 17:21:01 +0100 | [diff] [blame] | 236 | Instruction::SGET_OBJECT, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 237 | // Instruction::SGET_BOOLEAN, |
| 238 | // Instruction::SGET_BYTE, |
| 239 | // Instruction::SGET_CHAR, |
| 240 | // Instruction::SGET_SHORT, |
Zheng Xu | c830430 | 2014-05-15 17:21:01 +0100 | [diff] [blame] | 241 | Instruction::SPUT, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 242 | // Instruction::SPUT_WIDE, |
| 243 | // Instruction::SPUT_OBJECT, |
| 244 | // Instruction::SPUT_BOOLEAN, |
| 245 | // Instruction::SPUT_BYTE, |
| 246 | // Instruction::SPUT_CHAR, |
| 247 | // Instruction::SPUT_SHORT, |
| 248 | Instruction::INVOKE_VIRTUAL, |
| 249 | Instruction::INVOKE_SUPER, |
| 250 | Instruction::INVOKE_DIRECT, |
| 251 | Instruction::INVOKE_STATIC, |
| 252 | Instruction::INVOKE_INTERFACE, |
| 253 | // Instruction::RETURN_VOID_BARRIER, |
| 254 | // Instruction::INVOKE_VIRTUAL_RANGE, |
| 255 | // Instruction::INVOKE_SUPER_RANGE, |
| 256 | // Instruction::INVOKE_DIRECT_RANGE, |
| 257 | // Instruction::INVOKE_STATIC_RANGE, |
| 258 | // Instruction::INVOKE_INTERFACE_RANGE, |
| 259 | // Instruction::UNUSED_79, |
| 260 | // Instruction::UNUSED_7A, |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame^] | 261 | Instruction::NEG_INT, |
| 262 | Instruction::NOT_INT, |
| 263 | Instruction::NEG_LONG, |
| 264 | Instruction::NOT_LONG, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 265 | // Instruction::NEG_FLOAT, |
| 266 | // Instruction::NEG_DOUBLE, |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame^] | 267 | Instruction::INT_TO_LONG, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 268 | // Instruction::INT_TO_FLOAT, |
| 269 | // Instruction::INT_TO_DOUBLE, |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame^] | 270 | Instruction::LONG_TO_INT, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 271 | // Instruction::LONG_TO_FLOAT, |
| 272 | // Instruction::LONG_TO_DOUBLE, |
| 273 | // Instruction::FLOAT_TO_INT, |
| 274 | // Instruction::FLOAT_TO_LONG, |
| 275 | // Instruction::FLOAT_TO_DOUBLE, |
| 276 | // Instruction::DOUBLE_TO_INT, |
| 277 | // Instruction::DOUBLE_TO_LONG, |
| 278 | // Instruction::DOUBLE_TO_FLOAT, |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame^] | 279 | Instruction::INT_TO_BYTE, |
| 280 | Instruction::INT_TO_CHAR, |
| 281 | Instruction::INT_TO_SHORT, |
| 282 | Instruction::ADD_INT, |
| 283 | Instruction::SUB_INT, |
| 284 | Instruction::MUL_INT, |
| 285 | Instruction::DIV_INT, |
| 286 | Instruction::REM_INT, |
| 287 | Instruction::AND_INT, |
| 288 | Instruction::OR_INT, |
| 289 | Instruction::XOR_INT, |
| 290 | Instruction::SHL_INT, |
| 291 | Instruction::SHR_INT, |
| 292 | Instruction::USHR_INT, |
| 293 | Instruction::ADD_LONG, |
| 294 | Instruction::SUB_LONG, |
| 295 | Instruction::MUL_LONG, |
| 296 | Instruction::DIV_LONG, |
| 297 | Instruction::REM_LONG, |
| 298 | Instruction::AND_LONG, |
| 299 | Instruction::OR_LONG, |
| 300 | Instruction::XOR_LONG, |
| 301 | Instruction::SHL_LONG, |
| 302 | Instruction::SHR_LONG, |
| 303 | Instruction::USHR_LONG, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 304 | // Instruction::ADD_FLOAT, |
| 305 | // Instruction::SUB_FLOAT, |
| 306 | // Instruction::MUL_FLOAT, |
| 307 | // Instruction::DIV_FLOAT, |
| 308 | // Instruction::REM_FLOAT, |
| 309 | // Instruction::ADD_DOUBLE, |
| 310 | // Instruction::SUB_DOUBLE, |
| 311 | // Instruction::MUL_DOUBLE, |
| 312 | // Instruction::DIV_DOUBLE, |
| 313 | // Instruction::REM_DOUBLE, |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame^] | 314 | Instruction::ADD_INT_2ADDR, |
| 315 | Instruction::SUB_INT_2ADDR, |
| 316 | Instruction::MUL_INT_2ADDR, |
| 317 | Instruction::DIV_INT_2ADDR, |
| 318 | Instruction::REM_INT_2ADDR, |
| 319 | Instruction::AND_INT_2ADDR, |
| 320 | Instruction::OR_INT_2ADDR, |
| 321 | Instruction::XOR_INT_2ADDR, |
| 322 | Instruction::SHL_INT_2ADDR, |
| 323 | Instruction::SHR_INT_2ADDR, |
| 324 | Instruction::USHR_INT_2ADDR, |
| 325 | Instruction::ADD_LONG_2ADDR, |
| 326 | Instruction::SUB_LONG_2ADDR, |
| 327 | Instruction::MUL_LONG_2ADDR, |
| 328 | Instruction::DIV_LONG_2ADDR, |
| 329 | Instruction::REM_LONG_2ADDR, |
| 330 | Instruction::AND_LONG_2ADDR, |
| 331 | Instruction::OR_LONG_2ADDR, |
| 332 | Instruction::XOR_LONG_2ADDR, |
| 333 | Instruction::SHL_LONG_2ADDR, |
| 334 | Instruction::SHR_LONG_2ADDR, |
| 335 | Instruction::USHR_LONG_2ADDR, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 336 | // Instruction::ADD_FLOAT_2ADDR, |
| 337 | // Instruction::SUB_FLOAT_2ADDR, |
| 338 | // Instruction::MUL_FLOAT_2ADDR, |
| 339 | // Instruction::DIV_FLOAT_2ADDR, |
| 340 | // Instruction::REM_FLOAT_2ADDR, |
| 341 | // Instruction::ADD_DOUBLE_2ADDR, |
| 342 | // Instruction::SUB_DOUBLE_2ADDR, |
| 343 | // Instruction::MUL_DOUBLE_2ADDR, |
| 344 | // Instruction::DIV_DOUBLE_2ADDR, |
| 345 | // Instruction::REM_DOUBLE_2ADDR, |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame^] | 346 | Instruction::ADD_INT_LIT16, |
| 347 | Instruction::RSUB_INT, |
| 348 | Instruction::MUL_INT_LIT16, |
| 349 | Instruction::DIV_INT_LIT16, |
| 350 | Instruction::REM_INT_LIT16, |
| 351 | Instruction::AND_INT_LIT16, |
| 352 | Instruction::OR_INT_LIT16, |
| 353 | Instruction::XOR_INT_LIT16, |
Zheng Xu | c830430 | 2014-05-15 17:21:01 +0100 | [diff] [blame] | 354 | Instruction::ADD_INT_LIT8, |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame^] | 355 | Instruction::RSUB_INT_LIT8, |
| 356 | Instruction::MUL_INT_LIT8, |
| 357 | Instruction::DIV_INT_LIT8, |
| 358 | Instruction::REM_INT_LIT8, |
| 359 | Instruction::AND_INT_LIT8, |
| 360 | Instruction::OR_INT_LIT8, |
| 361 | Instruction::XOR_INT_LIT8, |
| 362 | Instruction::SHL_INT_LIT8, |
| 363 | Instruction::SHR_INT_LIT8, |
| 364 | Instruction::USHR_INT_LIT8, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 365 | // Instruction::IGET_QUICK, |
| 366 | // Instruction::IGET_WIDE_QUICK, |
| 367 | // Instruction::IGET_OBJECT_QUICK, |
| 368 | // Instruction::IPUT_QUICK, |
| 369 | // Instruction::IPUT_WIDE_QUICK, |
| 370 | // Instruction::IPUT_OBJECT_QUICK, |
| 371 | // Instruction::INVOKE_VIRTUAL_QUICK, |
| 372 | // Instruction::INVOKE_VIRTUAL_RANGE_QUICK, |
| 373 | // Instruction::UNUSED_EB, |
| 374 | // Instruction::UNUSED_EC, |
| 375 | // Instruction::UNUSED_ED, |
| 376 | // Instruction::UNUSED_EE, |
| 377 | // Instruction::UNUSED_EF, |
| 378 | // Instruction::UNUSED_F0, |
| 379 | // Instruction::UNUSED_F1, |
| 380 | // Instruction::UNUSED_F2, |
| 381 | // Instruction::UNUSED_F3, |
| 382 | // Instruction::UNUSED_F4, |
| 383 | // Instruction::UNUSED_F5, |
| 384 | // Instruction::UNUSED_F6, |
| 385 | // Instruction::UNUSED_F7, |
| 386 | // Instruction::UNUSED_F8, |
| 387 | // Instruction::UNUSED_F9, |
| 388 | // Instruction::UNUSED_FA, |
| 389 | // Instruction::UNUSED_FB, |
| 390 | // Instruction::UNUSED_FC, |
| 391 | // Instruction::UNUSED_FD, |
| 392 | // Instruction::UNUSED_FE, |
| 393 | // Instruction::UNUSED_FF, |
| 394 | |
| 395 | // ----- ExtendedMIROpcode ----- |
| 396 | // kMirOpPhi, |
| 397 | // kMirOpCopy, |
| 398 | // kMirOpFusedCmplFloat, |
| 399 | // kMirOpFusedCmpgFloat, |
| 400 | // kMirOpFusedCmplDouble, |
| 401 | // kMirOpFusedCmpgDouble, |
| 402 | // kMirOpFusedCmpLong, |
| 403 | // kMirOpNop, |
| 404 | // kMirOpNullCheck, |
| 405 | // kMirOpRangeCheck, |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame^] | 406 | kMirOpDivZeroCheck, |
Zheng Xu | c830430 | 2014-05-15 17:21:01 +0100 | [diff] [blame] | 407 | kMirOpCheck, |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 408 | // kMirOpCheckPart2, |
| 409 | // kMirOpSelect, |
| 410 | // kMirOpLast, |
| 411 | }; |
| 412 | |
| 413 | // TODO: Remove this when we are able to compile everything. |
Vladimir Kostyukov | 5678455 | 2014-05-13 12:12:00 +0700 | [diff] [blame] | 414 | int x86_64_support_list[] = { |
| 415 | Instruction::NOP, |
| 416 | // Instruction::MOVE, |
| 417 | // Instruction::MOVE_FROM16, |
| 418 | // Instruction::MOVE_16, |
| 419 | // Instruction::MOVE_WIDE, |
| 420 | // Instruction::MOVE_WIDE_FROM16, |
| 421 | // Instruction::MOVE_WIDE_16, |
| 422 | // Instruction::MOVE_OBJECT, |
| 423 | // Instruction::MOVE_OBJECT_FROM16, |
| 424 | // Instruction::MOVE_OBJECT_16, |
| 425 | // Instruction::MOVE_RESULT, |
| 426 | // Instruction::MOVE_RESULT_WIDE, |
| 427 | // Instruction::MOVE_RESULT_OBJECT, |
| 428 | // Instruction::MOVE_EXCEPTION, |
| 429 | Instruction::RETURN_VOID, |
| 430 | Instruction::RETURN, |
| 431 | // Instruction::RETURN_WIDE, |
| 432 | Instruction::RETURN_OBJECT, |
| 433 | // Instruction::CONST_4, |
| 434 | // Instruction::CONST_16, |
| 435 | // Instruction::CONST, |
| 436 | // Instruction::CONST_HIGH16, |
| 437 | // Instruction::CONST_WIDE_16, |
| 438 | // Instruction::CONST_WIDE_32, |
| 439 | // Instruction::CONST_WIDE, |
| 440 | // Instruction::CONST_WIDE_HIGH16, |
| 441 | // Instruction::CONST_STRING, |
| 442 | // Instruction::CONST_STRING_JUMBO, |
| 443 | // Instruction::CONST_CLASS, |
| 444 | // Instruction::MONITOR_ENTER, |
| 445 | // Instruction::MONITOR_EXIT, |
| 446 | // Instruction::CHECK_CAST, |
| 447 | // Instruction::INSTANCE_OF, |
| 448 | // Instruction::ARRAY_LENGTH, |
| 449 | // Instruction::NEW_INSTANCE, |
| 450 | // Instruction::NEW_ARRAY, |
| 451 | // Instruction::FILLED_NEW_ARRAY, |
| 452 | // Instruction::FILLED_NEW_ARRAY_RANGE, |
| 453 | // Instruction::FILL_ARRAY_DATA, |
| 454 | // Instruction::THROW, |
| 455 | // Instruction::GOTO, |
| 456 | // Instruction::GOTO_16, |
| 457 | // Instruction::GOTO_32, |
| 458 | // Instruction::PACKED_SWITCH, |
| 459 | // Instruction::SPARSE_SWITCH, |
| 460 | // Instruction::CMPL_FLOAT, |
| 461 | // Instruction::CMPG_FLOAT, |
| 462 | // Instruction::CMPL_DOUBLE, |
| 463 | // Instruction::CMPG_DOUBLE, |
| 464 | // Instruction::CMP_LONG, |
| 465 | // Instruction::IF_EQ, |
| 466 | // Instruction::IF_NE, |
| 467 | // Instruction::IF_LT, |
| 468 | // Instruction::IF_GE, |
| 469 | // Instruction::IF_GT, |
| 470 | // Instruction::IF_LE, |
| 471 | // Instruction::IF_EQZ, |
| 472 | // Instruction::IF_NEZ, |
| 473 | // Instruction::IF_LTZ, |
| 474 | // Instruction::IF_GEZ, |
| 475 | // Instruction::IF_GTZ, |
| 476 | // Instruction::IF_LEZ, |
| 477 | // Instruction::UNUSED_3E, |
| 478 | // Instruction::UNUSED_3F, |
| 479 | // Instruction::UNUSED_40, |
| 480 | // Instruction::UNUSED_41, |
| 481 | // Instruction::UNUSED_42, |
| 482 | // Instruction::UNUSED_43, |
| 483 | // Instruction::AGET, |
| 484 | // Instruction::AGET_WIDE, |
| 485 | // Instruction::AGET_OBJECT, |
| 486 | // Instruction::AGET_BOOLEAN, |
| 487 | // Instruction::AGET_BYTE, |
| 488 | // Instruction::AGET_CHAR, |
| 489 | // Instruction::AGET_SHORT, |
| 490 | // Instruction::APUT, |
| 491 | // Instruction::APUT_WIDE, |
| 492 | // Instruction::APUT_OBJECT, |
| 493 | // Instruction::APUT_BOOLEAN, |
| 494 | // Instruction::APUT_BYTE, |
| 495 | // Instruction::APUT_CHAR, |
| 496 | // Instruction::APUT_SHORT, |
| 497 | // Instruction::IGET, |
| 498 | // Instruction::IGET_WIDE, |
| 499 | // Instruction::IGET_OBJECT, |
| 500 | // Instruction::IGET_BOOLEAN, |
| 501 | // Instruction::IGET_BYTE, |
| 502 | // Instruction::IGET_CHAR, |
| 503 | // Instruction::IGET_SHORT, |
| 504 | // Instruction::IPUT, |
| 505 | // Instruction::IPUT_WIDE, |
| 506 | // Instruction::IPUT_OBJECT, |
| 507 | // Instruction::IPUT_BOOLEAN, |
| 508 | // Instruction::IPUT_BYTE, |
| 509 | // Instruction::IPUT_CHAR, |
| 510 | // Instruction::IPUT_SHORT, |
| 511 | Instruction::SGET, |
| 512 | // Instruction::SGET_WIDE, |
| 513 | Instruction::SGET_OBJECT, |
| 514 | Instruction::SGET_BOOLEAN, |
| 515 | Instruction::SGET_BYTE, |
| 516 | Instruction::SGET_CHAR, |
| 517 | Instruction::SGET_SHORT, |
| 518 | Instruction::SPUT, |
| 519 | // Instruction::SPUT_WIDE, |
| 520 | Instruction::SPUT_OBJECT, |
| 521 | Instruction::SPUT_BOOLEAN, |
| 522 | Instruction::SPUT_BYTE, |
| 523 | Instruction::SPUT_CHAR, |
| 524 | Instruction::SPUT_SHORT, |
| 525 | Instruction::INVOKE_VIRTUAL, |
| 526 | Instruction::INVOKE_SUPER, |
| 527 | Instruction::INVOKE_DIRECT, |
| 528 | Instruction::INVOKE_STATIC, |
| 529 | Instruction::INVOKE_INTERFACE, |
| 530 | // Instruction::RETURN_VOID_BARRIER, |
| 531 | // Instruction::INVOKE_VIRTUAL_RANGE, |
| 532 | // Instruction::INVOKE_SUPER_RANGE, |
| 533 | // Instruction::INVOKE_DIRECT_RANGE, |
| 534 | // Instruction::INVOKE_STATIC_RANGE, |
| 535 | // Instruction::INVOKE_INTERFACE_RANGE, |
| 536 | // Instruction::UNUSED_79, |
| 537 | // Instruction::UNUSED_7A, |
| 538 | // Instruction::NEG_INT, |
| 539 | // Instruction::NOT_INT, |
| 540 | // Instruction::NEG_LONG, |
| 541 | // Instruction::NOT_LONG, |
| 542 | // Instruction::NEG_FLOAT, |
| 543 | // Instruction::NEG_DOUBLE, |
| 544 | // Instruction::INT_TO_LONG, |
| 545 | // Instruction::INT_TO_FLOAT, |
| 546 | // Instruction::INT_TO_DOUBLE, |
| 547 | // Instruction::LONG_TO_INT, |
| 548 | // Instruction::LONG_TO_FLOAT, |
| 549 | // Instruction::LONG_TO_DOUBLE, |
| 550 | // Instruction::FLOAT_TO_INT, |
| 551 | // Instruction::FLOAT_TO_LONG, |
| 552 | // Instruction::FLOAT_TO_DOUBLE, |
| 553 | // Instruction::DOUBLE_TO_INT, |
| 554 | // Instruction::DOUBLE_TO_LONG, |
| 555 | // Instruction::DOUBLE_TO_FLOAT, |
| 556 | // Instruction::INT_TO_BYTE, |
| 557 | // Instruction::INT_TO_CHAR, |
| 558 | // Instruction::INT_TO_SHORT, |
| 559 | // Instruction::ADD_INT, |
| 560 | // Instruction::SUB_INT, |
| 561 | // Instruction::MUL_INT, |
| 562 | // Instruction::DIV_INT, |
| 563 | // Instruction::REM_INT, |
| 564 | // Instruction::AND_INT, |
| 565 | // Instruction::OR_INT, |
| 566 | // Instruction::XOR_INT, |
| 567 | // Instruction::SHL_INT, |
| 568 | // Instruction::SHR_INT, |
| 569 | // Instruction::USHR_INT, |
| 570 | // Instruction::ADD_LONG, |
| 571 | // Instruction::SUB_LONG, |
| 572 | // Instruction::MUL_LONG, |
| 573 | // Instruction::DIV_LONG, |
| 574 | // Instruction::REM_LONG, |
| 575 | // Instruction::AND_LONG, |
| 576 | // Instruction::OR_LONG, |
| 577 | // Instruction::XOR_LONG, |
| 578 | // Instruction::SHL_LONG, |
| 579 | // Instruction::SHR_LONG, |
| 580 | // Instruction::USHR_LONG, |
| 581 | // Instruction::ADD_FLOAT, |
| 582 | // Instruction::SUB_FLOAT, |
| 583 | // Instruction::MUL_FLOAT, |
| 584 | // Instruction::DIV_FLOAT, |
| 585 | // Instruction::REM_FLOAT, |
| 586 | // Instruction::ADD_DOUBLE, |
| 587 | // Instruction::SUB_DOUBLE, |
| 588 | // Instruction::MUL_DOUBLE, |
| 589 | // Instruction::DIV_DOUBLE, |
| 590 | // Instruction::REM_DOUBLE, |
| 591 | // Instruction::ADD_INT_2ADDR, |
| 592 | // Instruction::SUB_INT_2ADDR, |
| 593 | // Instruction::MUL_INT_2ADDR, |
| 594 | // Instruction::DIV_INT_2ADDR, |
| 595 | // Instruction::REM_INT_2ADDR, |
| 596 | // Instruction::AND_INT_2ADDR, |
| 597 | // Instruction::OR_INT_2ADDR, |
| 598 | // Instruction::XOR_INT_2ADDR, |
| 599 | // Instruction::SHL_INT_2ADDR, |
| 600 | // Instruction::SHR_INT_2ADDR, |
| 601 | // Instruction::USHR_INT_2ADDR, |
| 602 | // Instruction::ADD_LONG_2ADDR, |
| 603 | // Instruction::SUB_LONG_2ADDR, |
| 604 | // Instruction::MUL_LONG_2ADDR, |
| 605 | // Instruction::DIV_LONG_2ADDR, |
| 606 | // Instruction::REM_LONG_2ADDR, |
| 607 | // Instruction::AND_LONG_2ADDR, |
| 608 | // Instruction::OR_LONG_2ADDR, |
| 609 | // Instruction::XOR_LONG_2ADDR, |
| 610 | // Instruction::SHL_LONG_2ADDR, |
| 611 | // Instruction::SHR_LONG_2ADDR, |
| 612 | // Instruction::USHR_LONG_2ADDR, |
| 613 | // Instruction::ADD_FLOAT_2ADDR, |
| 614 | // Instruction::SUB_FLOAT_2ADDR, |
| 615 | // Instruction::MUL_FLOAT_2ADDR, |
| 616 | // Instruction::DIV_FLOAT_2ADDR, |
| 617 | // Instruction::REM_FLOAT_2ADDR, |
| 618 | // Instruction::ADD_DOUBLE_2ADDR, |
| 619 | // Instruction::SUB_DOUBLE_2ADDR, |
| 620 | // Instruction::MUL_DOUBLE_2ADDR, |
| 621 | // Instruction::DIV_DOUBLE_2ADDR, |
| 622 | // Instruction::REM_DOUBLE_2ADDR, |
| 623 | // Instruction::ADD_INT_LIT16, |
| 624 | // Instruction::RSUB_INT, |
| 625 | // Instruction::MUL_INT_LIT16, |
| 626 | // Instruction::DIV_INT_LIT16, |
| 627 | // Instruction::REM_INT_LIT16, |
| 628 | // Instruction::AND_INT_LIT16, |
| 629 | // Instruction::OR_INT_LIT16, |
| 630 | // Instruction::XOR_INT_LIT16, |
| 631 | // Instruction::ADD_INT_LIT8, |
| 632 | // Instruction::RSUB_INT_LIT8, |
| 633 | // Instruction::MUL_INT_LIT8, |
| 634 | // Instruction::DIV_INT_LIT8, |
| 635 | // Instruction::REM_INT_LIT8, |
| 636 | // Instruction::AND_INT_LIT8, |
| 637 | // Instruction::OR_INT_LIT8, |
| 638 | // Instruction::XOR_INT_LIT8, |
| 639 | // Instruction::SHL_INT_LIT8, |
| 640 | // Instruction::SHR_INT_LIT8, |
| 641 | // Instruction::USHR_INT_LIT8, |
| 642 | // Instruction::IGET_QUICK, |
| 643 | // Instruction::IGET_WIDE_QUICK, |
| 644 | // Instruction::IGET_OBJECT_QUICK, |
| 645 | // Instruction::IPUT_QUICK, |
| 646 | // Instruction::IPUT_WIDE_QUICK, |
| 647 | // Instruction::IPUT_OBJECT_QUICK, |
| 648 | // Instruction::INVOKE_VIRTUAL_QUICK, |
| 649 | // Instruction::INVOKE_VIRTUAL_RANGE_QUICK, |
| 650 | // Instruction::UNUSED_EB, |
| 651 | // Instruction::UNUSED_EC, |
| 652 | // Instruction::UNUSED_ED, |
| 653 | // Instruction::UNUSED_EE, |
| 654 | // Instruction::UNUSED_EF, |
| 655 | // Instruction::UNUSED_F0, |
| 656 | // Instruction::UNUSED_F1, |
| 657 | // Instruction::UNUSED_F2, |
| 658 | // Instruction::UNUSED_F3, |
| 659 | // Instruction::UNUSED_F4, |
| 660 | // Instruction::UNUSED_F5, |
| 661 | // Instruction::UNUSED_F6, |
| 662 | // Instruction::UNUSED_F7, |
| 663 | // Instruction::UNUSED_F8, |
| 664 | // Instruction::UNUSED_F9, |
| 665 | // Instruction::UNUSED_FA, |
| 666 | // Instruction::UNUSED_FB, |
| 667 | // Instruction::UNUSED_FC, |
| 668 | // Instruction::UNUSED_FD, |
| 669 | // Instruction::UNUSED_FE, |
| 670 | // Instruction::UNUSED_FF, |
| 671 | |
| 672 | // ----- ExtendedMIROpcode ----- |
| 673 | // kMirOpPhi, |
| 674 | // kMirOpCopy, |
| 675 | // kMirOpFusedCmplFloat, |
| 676 | // kMirOpFusedCmpgFloat, |
| 677 | // kMirOpFusedCmplDouble, |
| 678 | // kMirOpFusedCmpgDouble, |
| 679 | // kMirOpFusedCmpLong, |
| 680 | // kMirOpNop, |
| 681 | // kMirOpNullCheck, |
| 682 | // kMirOpRangeCheck, |
| 683 | // kMirOpDivZeroCheck, |
| 684 | // kMirOpCheck, |
| 685 | // kMirOpCheckPart2, |
| 686 | // kMirOpSelect, |
| 687 | // kMirOpLast, |
| 688 | }; |
| 689 | |
| 690 | // Z : boolean |
| 691 | // B : byte |
| 692 | // S : short |
| 693 | // C : char |
| 694 | // I : int |
| 695 | // L : long |
| 696 | // F : float |
| 697 | // D : double |
| 698 | // L : reference(object, array) |
| 699 | // V : void |
| 700 | // (ARM64) Current calling conversion only support 32bit softfp |
| 701 | // which has problems with long, float, double |
Serban Constantinescu | ed65c5e | 2014-05-22 15:10:18 +0100 | [diff] [blame^] | 702 | constexpr char arm64_supported_types[] = "ZBSCILVJ"; |
Vladimir Kostyukov | 5678455 | 2014-05-13 12:12:00 +0700 | [diff] [blame] | 703 | // (x84_64) We still have troubles with compiling longs/doubles/floats |
| 704 | constexpr char x86_64_supported_types[] = "ZBSCILV"; |
| 705 | |
| 706 | // TODO: Remove this when we are able to compile everything. |
| 707 | static bool CanCompileShorty(const char* shorty, InstructionSet instruction_set) { |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 708 | uint32_t shorty_size = strlen(shorty); |
| 709 | CHECK_GE(shorty_size, 1u); |
| 710 | // Set a limitation on maximum number of parameters. |
| 711 | // Note : there is an implied "method*" parameter, and probably "this" as well. |
| 712 | // 1 is for the return type. Currently, we only accept 2 parameters at the most. |
Vladimir Kostyukov | 5678455 | 2014-05-13 12:12:00 +0700 | [diff] [blame] | 713 | // (x86_64): For now we have the same limitation. But we might want to split this |
| 714 | // check in future into two separate cases for arm64 and x86_64. |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 715 | if (shorty_size > (1 + 2)) { |
| 716 | return false; |
| 717 | } |
Vladimir Kostyukov | 5678455 | 2014-05-13 12:12:00 +0700 | [diff] [blame] | 718 | |
| 719 | const char* supported_types = arm64_supported_types; |
| 720 | if (instruction_set == kX86_64) { |
| 721 | supported_types = x86_64_supported_types; |
| 722 | } |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 723 | for (uint32_t i = 0; i < shorty_size; i++) { |
| 724 | if (strchr(supported_types, shorty[i]) == nullptr) { |
| 725 | return false; |
| 726 | } |
| 727 | } |
| 728 | return true; |
| 729 | }; |
| 730 | |
| 731 | // TODO: Remove this when we are able to compile everything. |
| 732 | // Skip the method that we do not support currently. |
| 733 | static bool CanCompileMethod(uint32_t method_idx, const DexFile& dex_file, |
| 734 | CompilationUnit& cu) { |
| 735 | // There is some limitation with current ARM 64 backend. |
Vladimir Kostyukov | 5678455 | 2014-05-13 12:12:00 +0700 | [diff] [blame] | 736 | if (cu.instruction_set == kArm64 || cu.instruction_set == kX86_64) { |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 737 | // Check if we can compile the prototype. |
| 738 | const char* shorty = dex_file.GetMethodShorty(dex_file.GetMethodId(method_idx)); |
Vladimir Kostyukov | 5678455 | 2014-05-13 12:12:00 +0700 | [diff] [blame] | 739 | if (!CanCompileShorty(shorty, cu.instruction_set)) { |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 740 | VLOG(compiler) << "Unsupported shorty : " << shorty; |
| 741 | return false; |
| 742 | } |
| 743 | |
Vladimir Kostyukov | 5678455 | 2014-05-13 12:12:00 +0700 | [diff] [blame] | 744 | const int *support_list = arm64_support_list; |
| 745 | int support_list_size = arraysize(arm64_support_list); |
| 746 | if (cu.instruction_set == kX86_64) { |
| 747 | support_list = x86_64_support_list; |
| 748 | support_list_size = arraysize(x86_64_support_list); |
| 749 | } |
| 750 | |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 751 | for (int idx = 0; idx < cu.mir_graph->GetNumBlocks(); idx++) { |
| 752 | BasicBlock *bb = cu.mir_graph->GetBasicBlock(idx); |
| 753 | if (bb == NULL) continue; |
| 754 | if (bb->block_type == kDead) continue; |
| 755 | for (MIR* mir = bb->first_mir_insn; mir != nullptr; mir = mir->next) { |
| 756 | int opcode = mir->dalvikInsn.opcode; |
| 757 | // Check if we support the byte code. |
Vladimir Kostyukov | 5678455 | 2014-05-13 12:12:00 +0700 | [diff] [blame] | 758 | if (std::find(support_list, support_list + support_list_size, |
| 759 | opcode) == support_list + support_list_size) { |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 760 | if (opcode < kMirOpFirst) { |
| 761 | VLOG(compiler) << "Unsupported dalvik byte code : " |
| 762 | << mir->dalvikInsn.opcode; |
| 763 | } else { |
| 764 | VLOG(compiler) << "Unsupported extended MIR opcode : " |
| 765 | << MIRGraph::extended_mir_op_names_[opcode - kMirOpFirst]; |
| 766 | } |
| 767 | return false; |
| 768 | } |
| 769 | // Check if it invokes a prototype that we cannot support. |
| 770 | if (Instruction::INVOKE_VIRTUAL == opcode || |
| 771 | Instruction::INVOKE_SUPER == opcode || |
| 772 | Instruction::INVOKE_DIRECT == opcode || |
| 773 | Instruction::INVOKE_STATIC == opcode || |
| 774 | Instruction::INVOKE_INTERFACE == opcode) { |
| 775 | uint32_t invoke_method_idx = mir->dalvikInsn.vB; |
| 776 | const char* invoke_method_shorty = dex_file.GetMethodShorty( |
| 777 | dex_file.GetMethodId(invoke_method_idx)); |
Vladimir Kostyukov | 5678455 | 2014-05-13 12:12:00 +0700 | [diff] [blame] | 778 | if (!CanCompileShorty(invoke_method_shorty, cu.instruction_set)) { |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 779 | VLOG(compiler) << "Unsupported to invoke '" |
| 780 | << PrettyMethod(invoke_method_idx, dex_file) |
| 781 | << "' with shorty : " << invoke_method_shorty; |
| 782 | return false; |
| 783 | } |
| 784 | } |
| 785 | } |
| 786 | } |
| 787 | |
| 788 | LOG(INFO) << "Using experimental instruction set A64 for " |
| 789 | << PrettyMethod(method_idx, dex_file); |
| 790 | } |
| 791 | return true; |
| 792 | } |
| 793 | |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 794 | static CompiledMethod* CompileMethod(CompilerDriver& driver, |
Nicolas Geoffray | b34f69a | 2014-03-07 15:28:39 +0000 | [diff] [blame] | 795 | Compiler* compiler, |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 796 | const DexFile::CodeItem* code_item, |
| 797 | uint32_t access_flags, InvokeType invoke_type, |
Ian Rogers | 8b2c0b9 | 2013-09-19 02:56:49 -0700 | [diff] [blame] | 798 | uint16_t class_def_idx, uint32_t method_idx, |
Nicolas Geoffray | f5df897 | 2014-02-14 18:37:08 +0000 | [diff] [blame] | 799 | jobject class_loader, const DexFile& dex_file, |
| 800 | void* llvm_compilation_unit) { |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 801 | VLOG(compiler) << "Compiling " << PrettyMethod(method_idx, dex_file) << "..."; |
buzbee | b48819d | 2013-09-14 16:15:25 -0700 | [diff] [blame] | 802 | if (code_item->insns_size_in_code_units_ >= 0x10000) { |
| 803 | LOG(INFO) << "Method size exceeds compiler limits: " << code_item->insns_size_in_code_units_ |
| 804 | << " in " << PrettyMethod(method_idx, dex_file); |
| 805 | return NULL; |
| 806 | } |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 807 | |
Jeff Hao | 4a200f5 | 2014-04-01 14:58:49 -0700 | [diff] [blame] | 808 | if (!driver.GetCompilerOptions().IsCompilationEnabled()) { |
Ian Rogers | a03de6d | 2014-03-08 23:37:07 +0000 | [diff] [blame] | 809 | return nullptr; |
| 810 | } |
| 811 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 812 | ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 813 | CompilationUnit cu(driver.GetArenaPool()); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 814 | |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 815 | cu.compiler_driver = &driver; |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 816 | cu.class_linker = class_linker; |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 817 | cu.instruction_set = driver.GetInstructionSet(); |
Mathieu Chartier | 53bee42 | 2014-04-04 16:10:05 -0700 | [diff] [blame] | 818 | if (cu.instruction_set == kArm) { |
| 819 | cu.instruction_set = kThumb2; |
| 820 | } |
Andreas Gampe | af13ad9 | 2014-04-11 12:07:48 -0700 | [diff] [blame] | 821 | cu.target64 = Is64BitInstructionSet(cu.instruction_set); |
Nicolas Geoffray | b34f69a | 2014-03-07 15:28:39 +0000 | [diff] [blame] | 822 | cu.compiler = compiler; |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 823 | // TODO: x86_64 & arm64 are not yet implemented. |
Mathieu Chartier | 53bee42 | 2014-04-04 16:10:05 -0700 | [diff] [blame] | 824 | CHECK((cu.instruction_set == kThumb2) || |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 825 | (cu.instruction_set == kArm64) || |
Mathieu Chartier | 53bee42 | 2014-04-04 16:10:05 -0700 | [diff] [blame] | 826 | (cu.instruction_set == kX86) || |
| 827 | (cu.instruction_set == kX86_64) || |
| 828 | (cu.instruction_set == kMips)); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 829 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 830 | /* Adjust this value accordingly once inlining is performed */ |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 831 | cu.num_dalvik_registers = code_item->registers_size_; |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 832 | // TODO: set this from command line |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 833 | cu.compiler_flip_match = false; |
| 834 | bool use_match = !cu.compiler_method_match.empty(); |
| 835 | bool match = use_match && (cu.compiler_flip_match ^ |
| 836 | (PrettyMethod(method_idx, dex_file).find(cu.compiler_method_match) != |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 837 | std::string::npos)); |
| 838 | if (!use_match || match) { |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 839 | cu.disable_opt = kCompilerOptimizerDisableFlags; |
| 840 | cu.enable_debug = kCompilerDebugFlags; |
| 841 | cu.verbose = VLOG_IS_ON(compiler) || |
| 842 | (cu.enable_debug & (1 << kDebugVerbose)); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 843 | } |
| 844 | |
Mingyao Yang | 42d65c5 | 2014-04-18 16:49:39 -0700 | [diff] [blame] | 845 | if (gVerboseMethods.size() != 0) { |
| 846 | cu.verbose = false; |
| 847 | for (size_t i = 0; i < gVerboseMethods.size(); ++i) { |
| 848 | if (PrettyMethod(method_idx, dex_file).find(gVerboseMethods[i]) |
| 849 | != std::string::npos) { |
| 850 | cu.verbose = true; |
| 851 | break; |
| 852 | } |
| 853 | } |
| 854 | } |
| 855 | |
buzbee | b01bf15 | 2014-05-13 15:59:07 -0700 | [diff] [blame] | 856 | if (cu.verbose) { |
| 857 | cu.enable_debug |= (1 << kDebugCodegenDump); |
| 858 | } |
| 859 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 860 | /* |
| 861 | * TODO: rework handling of optimization and debug flags. Should we split out |
| 862 | * MIR and backend flags? Need command-line setting as well. |
| 863 | */ |
| 864 | |
Nicolas Geoffray | b34f69a | 2014-03-07 15:28:39 +0000 | [diff] [blame] | 865 | compiler->InitCompilationUnit(cu); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 866 | |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 867 | if (cu.instruction_set == kMips) { |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 868 | // Disable some optimizations for mips for now |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 869 | cu.disable_opt |= ( |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 870 | (1 << kLoadStoreElimination) | |
| 871 | (1 << kLoadHoisting) | |
| 872 | (1 << kSuppressLoads) | |
| 873 | (1 << kNullCheckElimination) | |
| 874 | (1 << kPromoteRegs) | |
| 875 | (1 << kTrackLiveTemps) | |
| 876 | (1 << kSafeOptimizations) | |
| 877 | (1 << kBBOpt) | |
| 878 | (1 << kMatch) | |
| 879 | (1 << kPromoteCompilerTemps)); |
| 880 | } |
| 881 | |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 882 | if (cu.instruction_set == kArm64) { |
| 883 | // TODO(Arm64): enable optimizations once backend is mature enough. |
| 884 | cu.disable_opt = ~(uint32_t)0; |
buzbee | b01bf15 | 2014-05-13 15:59:07 -0700 | [diff] [blame] | 885 | cu.enable_debug |= (1 << kDebugCodegenDump); |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 886 | } |
| 887 | |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 888 | cu.StartTimingSplit("BuildMIRGraph"); |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 889 | cu.mir_graph.reset(new MIRGraph(&cu, &cu.arena)); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 890 | |
Razvan A Lupusoru | da7a69b | 2014-01-08 15:09:50 -0800 | [diff] [blame] | 891 | /* |
| 892 | * After creation of the MIR graph, also create the code generator. |
| 893 | * The reason we do this is that optimizations on the MIR graph may need to get information |
| 894 | * that is only available if a CG exists. |
| 895 | */ |
Nicolas Geoffray | b34f69a | 2014-03-07 15:28:39 +0000 | [diff] [blame] | 896 | cu.cg.reset(compiler->GetCodeGenerator(&cu, llvm_compilation_unit)); |
Razvan A Lupusoru | da7a69b | 2014-01-08 15:09:50 -0800 | [diff] [blame] | 897 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 898 | /* Gathering opcode stats? */ |
| 899 | if (kCompilerDebugFlags & (1 << kDebugCountOpcodes)) { |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 900 | cu.mir_graph->EnableOpcodeCounting(); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 901 | } |
| 902 | |
Dave Allison | 39c3bfb | 2014-01-28 18:33:52 -0800 | [diff] [blame] | 903 | // Check early if we should skip this compilation if using the profiled filter. |
| 904 | if (cu.compiler_driver->ProfilePresent()) { |
| 905 | std::string methodname = PrettyMethod(method_idx, dex_file); |
| 906 | if (cu.mir_graph->SkipCompilation(methodname)) { |
| 907 | return NULL; |
| 908 | } |
| 909 | } |
| 910 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 911 | /* Build the raw MIR graph */ |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 912 | 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] | 913 | class_loader, dex_file); |
| 914 | |
Zheng Xu | 9e06c8c | 2014-05-06 18:06:07 +0100 | [diff] [blame] | 915 | // TODO(Arm64): Remove this when we are able to compile everything. |
| 916 | if (!CanCompileMethod(method_idx, dex_file, cu)) { |
| 917 | VLOG(compiler) << "Cannot compile method : " << PrettyMethod(method_idx, dex_file); |
| 918 | return nullptr; |
| 919 | } |
| 920 | |
buzbee | 1da1e2f | 2013-11-15 13:37:01 -0800 | [diff] [blame] | 921 | cu.NewTimingSplit("MIROpt:CheckFilters"); |
Jeff Hao | 4a200f5 | 2014-04-01 14:58:49 -0700 | [diff] [blame] | 922 | if (cu.mir_graph->SkipCompilation()) { |
| 923 | return NULL; |
buzbee | ee17e0a | 2013-07-31 10:47:37 -0700 | [diff] [blame] | 924 | } |
| 925 | |
Jean Christophe Beyler | 4e97c53 | 2014-01-07 10:07:18 -0800 | [diff] [blame] | 926 | /* Create the pass driver and launch it */ |
James C Scott | 4f59668 | 2014-05-01 05:52:04 -0700 | [diff] [blame] | 927 | PassDriverME pass_driver(&cu); |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 928 | pass_driver.Launch(); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 929 | |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 930 | if (cu.enable_debug & (1 << kDebugDumpCheckStats)) { |
| 931 | cu.mir_graph->DumpCheckStats(); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 932 | } |
| 933 | |
| 934 | if (kCompilerDebugFlags & (1 << kDebugCountOpcodes)) { |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 935 | cu.mir_graph->ShowOpcodeStats(); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 936 | } |
| 937 | |
buzbee | 1da1e2f | 2013-11-15 13:37:01 -0800 | [diff] [blame] | 938 | /* Reassociate sreg names with original Dalvik vreg names. */ |
| 939 | cu.mir_graph->RemapRegLocations(); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 940 | |
Vladimir Marko | 53b6afc | 2014-03-21 14:21:20 +0000 | [diff] [blame] | 941 | /* Free Arenas from the cu.arena_stack for reuse by the cu.arena in the codegen. */ |
| 942 | if (cu.enable_debug & (1 << kDebugShowMemoryUsage)) { |
| 943 | if (cu.arena_stack.PeakBytesAllocated() > 256 * 1024) { |
| 944 | MemStats stack_stats(cu.arena_stack.GetPeakStats()); |
| 945 | LOG(INFO) << PrettyMethod(method_idx, dex_file) << " " << Dumpable<MemStats>(stack_stats); |
| 946 | } |
| 947 | } |
| 948 | cu.arena_stack.Reset(); |
| 949 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 950 | CompiledMethod* result = NULL; |
| 951 | |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 952 | cu.cg->Materialize(); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 953 | |
buzbee | 1da1e2f | 2013-11-15 13:37:01 -0800 | [diff] [blame] | 954 | 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] | 955 | result = cu.cg->GetCompiledMethod(); |
buzbee | 1da1e2f | 2013-11-15 13:37:01 -0800 | [diff] [blame] | 956 | cu.NewTimingSplit("Cleanup"); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 957 | |
| 958 | if (result) { |
| 959 | VLOG(compiler) << "Compiled " << PrettyMethod(method_idx, dex_file); |
| 960 | } else { |
| 961 | VLOG(compiler) << "Deferred " << PrettyMethod(method_idx, dex_file); |
| 962 | } |
| 963 | |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 964 | if (cu.enable_debug & (1 << kDebugShowMemoryUsage)) { |
Vladimir Marko | 53b6afc | 2014-03-21 14:21:20 +0000 | [diff] [blame] | 965 | if (cu.arena.BytesAllocated() > (1 * 1024 *1024)) { |
Vladimir Marko | 83cc7ae | 2014-02-12 18:02:05 +0000 | [diff] [blame] | 966 | MemStats mem_stats(cu.arena.GetMemStats()); |
Vladimir Marko | 53b6afc | 2014-03-21 14:21:20 +0000 | [diff] [blame] | 967 | LOG(INFO) << PrettyMethod(method_idx, dex_file) << " " << Dumpable<MemStats>(mem_stats); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 968 | } |
| 969 | } |
| 970 | |
Mathieu Chartier | f6c4b3b | 2013-08-24 16:11:37 -0700 | [diff] [blame] | 971 | if (cu.enable_debug & (1 << kDebugShowSummaryMemoryUsage)) { |
| 972 | LOG(INFO) << "MEMINFO " << cu.arena.BytesAllocated() << " " << cu.mir_graph->GetNumBlocks() |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 973 | << " " << PrettyMethod(method_idx, dex_file); |
| 974 | } |
| 975 | |
buzbee | a61f495 | 2013-08-23 14:27:06 -0700 | [diff] [blame] | 976 | cu.EndTiming(); |
Ian Rogers | 3d50407 | 2014-03-01 09:16:49 -0800 | [diff] [blame] | 977 | driver.GetTimingsLogger()->AddLogger(cu.timings); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 978 | return result; |
| 979 | } |
| 980 | |
Nicolas Geoffray | b34f69a | 2014-03-07 15:28:39 +0000 | [diff] [blame] | 981 | CompiledMethod* CompileOneMethod(CompilerDriver& driver, |
| 982 | Compiler* compiler, |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 983 | const DexFile::CodeItem* code_item, |
| 984 | uint32_t access_flags, |
| 985 | InvokeType invoke_type, |
Ian Rogers | 8b2c0b9 | 2013-09-19 02:56:49 -0700 | [diff] [blame] | 986 | uint16_t class_def_idx, |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 987 | uint32_t method_idx, |
| 988 | jobject class_loader, |
| 989 | const DexFile& dex_file, |
Nicolas Geoffray | f5df897 | 2014-02-14 18:37:08 +0000 | [diff] [blame] | 990 | void* compilation_unit) { |
Nicolas Geoffray | b34f69a | 2014-03-07 15:28:39 +0000 | [diff] [blame] | 991 | return CompileMethod(driver, compiler, code_item, access_flags, invoke_type, class_def_idx, |
Nicolas Geoffray | f5df897 | 2014-02-14 18:37:08 +0000 | [diff] [blame] | 992 | method_idx, class_loader, dex_file, compilation_unit); |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 993 | } |
| 994 | |
| 995 | } // namespace art |
| 996 | |
| 997 | extern "C" art::CompiledMethod* |
Nicolas Geoffray | b34f69a | 2014-03-07 15:28:39 +0000 | [diff] [blame] | 998 | ArtQuickCompileMethod(art::CompilerDriver& driver, |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 999 | const art::DexFile::CodeItem* code_item, |
| 1000 | uint32_t access_flags, art::InvokeType invoke_type, |
Ian Rogers | 8b2c0b9 | 2013-09-19 02:56:49 -0700 | [diff] [blame] | 1001 | uint16_t class_def_idx, uint32_t method_idx, jobject class_loader, |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 1002 | const art::DexFile& dex_file) { |
| 1003 | // TODO: check method fingerprint here to determine appropriate backend type. Until then, use build default |
Nicolas Geoffray | b34f69a | 2014-03-07 15:28:39 +0000 | [diff] [blame] | 1004 | art::Compiler* compiler = driver.GetCompiler(); |
| 1005 | return art::CompileOneMethod(driver, compiler, code_item, access_flags, invoke_type, |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 1006 | class_def_idx, method_idx, class_loader, dex_file, |
| 1007 | NULL /* use thread llvm_info */); |
| 1008 | } |