buzbee | 67bf885 | 2011-08-17 17:51:35 -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 | |
| 17 | #include "Dalvik.h" |
| 18 | #include "CompilerInternals.h" |
| 19 | #include "Dataflow.h" |
buzbee | c143c55 | 2011-08-20 17:38:58 -0700 | [diff] [blame] | 20 | #include "constants.h" |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 21 | #include "leb128.h" |
Brian Carlstrom | 9baa4ae | 2011-09-01 21:14:14 -0700 | [diff] [blame] | 22 | #include "object.h" |
Brian Carlstrom | 1f87008 | 2011-08-23 16:02:11 -0700 | [diff] [blame] | 23 | #include "runtime.h" |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 24 | |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 25 | namespace art { |
| 26 | |
buzbee | ce30293 | 2011-10-04 14:32:18 -0700 | [diff] [blame] | 27 | /* Default optimizer/debug setting for the compiler. */ |
| 28 | uint32_t compilerOptimizerDisableFlags = 0 | // Disable specific optimizations |
buzbee | 67bc236 | 2011-10-11 18:08:40 -0700 | [diff] [blame] | 29 | //(1 << kLoadStoreElimination) | |
| 30 | //(1 << kLoadHoisting) | |
| 31 | //(1 << kSuppressLoads) | |
| 32 | //(1 << kNullCheckElimination) | |
buzbee | 769fde1 | 2012-01-05 17:35:23 -0800 | [diff] [blame] | 33 | //(1 << kPromoteRegs) | |
| 34 | //(1 << kTrackLiveTemps) | |
buzbee | 99ba964 | 2012-01-25 14:23:14 -0800 | [diff] [blame^] | 35 | //(1 << kSkipLargeMethodOptimization) | |
buzbee | ce30293 | 2011-10-04 14:32:18 -0700 | [diff] [blame] | 36 | 0; |
| 37 | |
| 38 | uint32_t compilerDebugFlags = 0 | // Enable debug/testing modes |
buzbee | e3de749 | 2011-10-05 13:37:17 -0700 | [diff] [blame] | 39 | //(1 << kDebugDisplayMissingTargets) | |
buzbee | ce30293 | 2011-10-04 14:32:18 -0700 | [diff] [blame] | 40 | //(1 << kDebugVerbose) | |
| 41 | //(1 << kDebugDumpCFG) | |
| 42 | //(1 << kDebugSlowFieldPath) | |
| 43 | //(1 << kDebugSlowInvokePath) | |
| 44 | //(1 << kDebugSlowStringPath) | |
| 45 | //(1 << kDebugSlowestFieldPath) | |
| 46 | //(1 << kDebugSlowestStringPath) | |
buzbee | 34c77ad | 2012-01-11 13:01:32 -0800 | [diff] [blame] | 47 | //(1 << kDebugExerciseResolveMethod) | |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 48 | //(1 << kDebugVerifyDataflow) | |
buzbee | ce30293 | 2011-10-04 14:32:18 -0700 | [diff] [blame] | 49 | 0; |
| 50 | |
| 51 | std::string compilerMethodMatch; // Method name match to apply above flags |
| 52 | |
| 53 | bool compilerFlipMatch = false; // Reverses sense of method name match |
| 54 | |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 55 | STATIC inline bool contentIsInsn(const u2* codePtr) { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 56 | u2 instr = *codePtr; |
| 57 | Opcode opcode = (Opcode)(instr & 0xff); |
| 58 | |
| 59 | /* |
| 60 | * Since the low 8-bit in metadata may look like OP_NOP, we need to check |
| 61 | * both the low and whole sub-word to determine whether it is code or data. |
| 62 | */ |
| 63 | return (opcode != OP_NOP || instr == 0); |
| 64 | } |
| 65 | |
| 66 | /* |
| 67 | * Parse an instruction, return the length of the instruction |
| 68 | */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 69 | STATIC inline int parseInsn(const u2* codePtr, DecodedInstruction* decInsn, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 70 | bool printMe) |
| 71 | { |
| 72 | // Don't parse instruction data |
| 73 | if (!contentIsInsn(codePtr)) { |
| 74 | return 0; |
| 75 | } |
| 76 | |
| 77 | u2 instr = *codePtr; |
| 78 | Opcode opcode = dexOpcodeFromCodeUnit(instr); |
| 79 | |
| 80 | dexDecodeInstruction(codePtr, decInsn); |
| 81 | if (printMe) { |
Elliott Hughes | c1f143d | 2011-12-01 17:31:10 -0800 | [diff] [blame] | 82 | char* decodedString = oatGetDalvikDisassembly(decInsn, NULL); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 83 | LOG(INFO) << codePtr << ": 0x" << std::hex << (int)opcode << |
| 84 | " " << decodedString; |
| 85 | } |
| 86 | return dexGetWidthFromOpcode(opcode); |
| 87 | } |
| 88 | |
| 89 | #define UNKNOWN_TARGET 0xffffffff |
| 90 | |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 91 | STATIC inline bool isGoto(MIR* insn) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 92 | { |
| 93 | switch (insn->dalvikInsn.opcode) { |
| 94 | case OP_GOTO: |
| 95 | case OP_GOTO_16: |
| 96 | case OP_GOTO_32: |
| 97 | return true; |
| 98 | default: |
| 99 | return false; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | /* |
| 104 | * Identify unconditional branch instructions |
| 105 | */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 106 | STATIC inline bool isUnconditionalBranch(MIR* insn) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 107 | { |
| 108 | switch (insn->dalvikInsn.opcode) { |
| 109 | case OP_RETURN_VOID: |
| 110 | case OP_RETURN: |
| 111 | case OP_RETURN_WIDE: |
| 112 | case OP_RETURN_OBJECT: |
| 113 | return true; |
| 114 | default: |
| 115 | return isGoto(insn); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | /* Split an existing block from the specified code offset into two */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 120 | STATIC BasicBlock *splitBlock(CompilationUnit* cUnit, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 121 | unsigned int codeOffset, |
buzbee | 9ab05de | 2012-01-18 15:43:48 -0800 | [diff] [blame] | 122 | BasicBlock* origBlock, |
| 123 | BasicBlock** immedPredBlockP) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 124 | { |
| 125 | MIR* insn = origBlock->firstMIRInsn; |
| 126 | while (insn) { |
| 127 | if (insn->offset == codeOffset) break; |
| 128 | insn = insn->next; |
| 129 | } |
| 130 | if (insn == NULL) { |
| 131 | LOG(FATAL) << "Break split failed"; |
| 132 | } |
| 133 | BasicBlock *bottomBlock = oatNewBB(kDalvikByteCode, |
| 134 | cUnit->numBlocks++); |
| 135 | oatInsertGrowableList(&cUnit->blockList, (intptr_t) bottomBlock); |
| 136 | |
| 137 | bottomBlock->startOffset = codeOffset; |
| 138 | bottomBlock->firstMIRInsn = insn; |
| 139 | bottomBlock->lastMIRInsn = origBlock->lastMIRInsn; |
| 140 | |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 141 | /* Add it to the quick lookup cache */ |
| 142 | cUnit->blockMap.insert(std::make_pair(bottomBlock->startOffset, |
| 143 | bottomBlock)); |
| 144 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 145 | /* Handle the taken path */ |
| 146 | bottomBlock->taken = origBlock->taken; |
| 147 | if (bottomBlock->taken) { |
| 148 | origBlock->taken = NULL; |
| 149 | oatClearBit(bottomBlock->taken->predecessors, origBlock->id); |
| 150 | oatSetBit(bottomBlock->taken->predecessors, bottomBlock->id); |
| 151 | } |
| 152 | |
| 153 | /* Handle the fallthrough path */ |
| 154 | bottomBlock->needFallThroughBranch = origBlock->needFallThroughBranch; |
| 155 | bottomBlock->fallThrough = origBlock->fallThrough; |
| 156 | origBlock->fallThrough = bottomBlock; |
| 157 | origBlock->needFallThroughBranch = true; |
| 158 | oatSetBit(bottomBlock->predecessors, origBlock->id); |
| 159 | if (bottomBlock->fallThrough) { |
| 160 | oatClearBit(bottomBlock->fallThrough->predecessors, |
| 161 | origBlock->id); |
| 162 | oatSetBit(bottomBlock->fallThrough->predecessors, |
| 163 | bottomBlock->id); |
| 164 | } |
| 165 | |
| 166 | /* Handle the successor list */ |
| 167 | if (origBlock->successorBlockList.blockListType != kNotUsed) { |
| 168 | bottomBlock->successorBlockList = origBlock->successorBlockList; |
| 169 | origBlock->successorBlockList.blockListType = kNotUsed; |
| 170 | GrowableListIterator iterator; |
| 171 | |
| 172 | oatGrowableListIteratorInit(&bottomBlock->successorBlockList.blocks, |
| 173 | &iterator); |
| 174 | while (true) { |
| 175 | SuccessorBlockInfo *successorBlockInfo = |
| 176 | (SuccessorBlockInfo *) oatGrowableListIteratorNext(&iterator); |
| 177 | if (successorBlockInfo == NULL) break; |
| 178 | BasicBlock *bb = successorBlockInfo->block; |
| 179 | oatClearBit(bb->predecessors, origBlock->id); |
| 180 | oatSetBit(bb->predecessors, bottomBlock->id); |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | origBlock->lastMIRInsn = insn->prev; |
| 185 | |
| 186 | insn->prev->next = NULL; |
| 187 | insn->prev = NULL; |
buzbee | 9ab05de | 2012-01-18 15:43:48 -0800 | [diff] [blame] | 188 | /* |
| 189 | * Update the immediate predecessor block pointer so that outgoing edges |
| 190 | * can be applied to the proper block. |
| 191 | */ |
| 192 | if (immedPredBlockP) { |
| 193 | DCHECK_EQ(*immedPredBlockP, origBlock); |
| 194 | *immedPredBlockP = bottomBlock; |
| 195 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 196 | return bottomBlock; |
| 197 | } |
| 198 | |
| 199 | /* |
| 200 | * Given a code offset, find out the block that starts with it. If the offset |
buzbee | 9ab05de | 2012-01-18 15:43:48 -0800 | [diff] [blame] | 201 | * is in the middle of an existing block, split it into two. If immedPredBlockP |
| 202 | * is not non-null and is the block being split, update *immedPredBlockP to |
| 203 | * point to the bottom block so that outgoing edges can be set up properly |
| 204 | * (by the caller) |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 205 | * Utilizes a map for fast lookup of the typical cases. |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 206 | */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 207 | STATIC BasicBlock *findBlock(CompilationUnit* cUnit, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 208 | unsigned int codeOffset, |
buzbee | 9ab05de | 2012-01-18 15:43:48 -0800 | [diff] [blame] | 209 | bool split, bool create, |
| 210 | BasicBlock** immedPredBlockP) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 211 | { |
| 212 | GrowableList* blockList = &cUnit->blockList; |
| 213 | BasicBlock* bb; |
| 214 | unsigned int i; |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 215 | std::map<unsigned int, BasicBlock*>::iterator it; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 216 | |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 217 | it = cUnit->blockMap.find(codeOffset); |
| 218 | if (it != cUnit->blockMap.end()) { |
| 219 | return it->second; |
| 220 | } else if (!create) { |
| 221 | return NULL; |
| 222 | } |
| 223 | |
| 224 | if (split) { |
| 225 | for (i = 0; i < blockList->numUsed; i++) { |
| 226 | bb = (BasicBlock *) blockList->elemList[i]; |
| 227 | if (bb->blockType != kDalvikByteCode) continue; |
| 228 | /* Check if a branch jumps into the middle of an existing block */ |
| 229 | if ((codeOffset > bb->startOffset) && (bb->lastMIRInsn != NULL) && |
| 230 | (codeOffset <= bb->lastMIRInsn->offset)) { |
| 231 | BasicBlock *newBB = splitBlock(cUnit, codeOffset, bb, |
| 232 | bb == *immedPredBlockP ? |
| 233 | immedPredBlockP : NULL); |
| 234 | return newBB; |
| 235 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 236 | } |
| 237 | } |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 238 | |
| 239 | /* Create a new one */ |
| 240 | bb = oatNewBB(kDalvikByteCode, cUnit->numBlocks++); |
| 241 | oatInsertGrowableList(&cUnit->blockList, (intptr_t) bb); |
| 242 | bb->startOffset = codeOffset; |
| 243 | cUnit->blockMap.insert(std::make_pair(bb->startOffset, bb)); |
| 244 | return bb; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | /* Dump the CFG into a DOT graph */ |
| 248 | void oatDumpCFG(CompilationUnit* cUnit, const char* dirPrefix) |
| 249 | { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 250 | FILE* file; |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 251 | std::string name(PrettyMethod(cUnit->method_idx, *cUnit->dex_file)); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 252 | char startOffset[80]; |
| 253 | sprintf(startOffset, "_%x", cUnit->entryBlock->fallThrough->startOffset); |
Elliott Hughes | c1f143d | 2011-12-01 17:31:10 -0800 | [diff] [blame] | 254 | char* fileName = (char*) oatNew( |
buzbee | c143c55 | 2011-08-20 17:38:58 -0700 | [diff] [blame] | 255 | strlen(dirPrefix) + |
| 256 | name.length() + |
| 257 | strlen(".dot") + 1, true); |
| 258 | sprintf(fileName, "%s%s%s.dot", dirPrefix, name.c_str(), startOffset); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 259 | |
| 260 | /* |
| 261 | * Convert the special characters into a filesystem- and shell-friendly |
| 262 | * format. |
| 263 | */ |
| 264 | int i; |
| 265 | for (i = strlen(dirPrefix); fileName[i]; i++) { |
| 266 | if (fileName[i] == '/') { |
| 267 | fileName[i] = '_'; |
| 268 | } else if (fileName[i] == ';') { |
| 269 | fileName[i] = '#'; |
| 270 | } else if (fileName[i] == '$') { |
| 271 | fileName[i] = '+'; |
| 272 | } else if (fileName[i] == '(' || fileName[i] == ')') { |
| 273 | fileName[i] = '@'; |
| 274 | } else if (fileName[i] == '<' || fileName[i] == '>') { |
| 275 | fileName[i] = '='; |
| 276 | } |
| 277 | } |
| 278 | file = fopen(fileName, "w"); |
| 279 | if (file == NULL) { |
| 280 | return; |
| 281 | } |
| 282 | fprintf(file, "digraph G {\n"); |
| 283 | |
| 284 | fprintf(file, " rankdir=TB\n"); |
| 285 | |
| 286 | int numReachableBlocks = cUnit->numReachableBlocks; |
| 287 | int idx; |
| 288 | const GrowableList *blockList = &cUnit->blockList; |
| 289 | |
| 290 | for (idx = 0; idx < numReachableBlocks; idx++) { |
| 291 | int blockIdx = cUnit->dfsOrder.elemList[idx]; |
| 292 | BasicBlock *bb = (BasicBlock *) oatGrowableListGetElement(blockList, |
| 293 | blockIdx); |
| 294 | if (bb == NULL) break; |
| 295 | if (bb->blockType == kEntryBlock) { |
| 296 | fprintf(file, " entry [shape=Mdiamond];\n"); |
| 297 | } else if (bb->blockType == kExitBlock) { |
| 298 | fprintf(file, " exit [shape=Mdiamond];\n"); |
| 299 | } else if (bb->blockType == kDalvikByteCode) { |
| 300 | fprintf(file, " block%04x [shape=record,label = \"{ \\\n", |
| 301 | bb->startOffset); |
| 302 | const MIR *mir; |
| 303 | fprintf(file, " {block id %d\\l}%s\\\n", bb->id, |
| 304 | bb->firstMIRInsn ? " | " : " "); |
| 305 | for (mir = bb->firstMIRInsn; mir; mir = mir->next) { |
| 306 | fprintf(file, " {%04x %s\\l}%s\\\n", mir->offset, |
| 307 | mir->ssaRep ? |
| 308 | oatFullDisassembler(cUnit, mir) : |
| 309 | dexGetOpcodeName(mir->dalvikInsn.opcode), |
| 310 | mir->next ? " | " : " "); |
| 311 | } |
| 312 | fprintf(file, " }\"];\n\n"); |
| 313 | } else if (bb->blockType == kExceptionHandling) { |
| 314 | char blockName[BLOCK_NAME_LEN]; |
| 315 | |
| 316 | oatGetBlockName(bb, blockName); |
| 317 | fprintf(file, " %s [shape=invhouse];\n", blockName); |
| 318 | } |
| 319 | |
| 320 | char blockName1[BLOCK_NAME_LEN], blockName2[BLOCK_NAME_LEN]; |
| 321 | |
| 322 | if (bb->taken) { |
| 323 | oatGetBlockName(bb, blockName1); |
| 324 | oatGetBlockName(bb->taken, blockName2); |
| 325 | fprintf(file, " %s:s -> %s:n [style=dotted]\n", |
| 326 | blockName1, blockName2); |
| 327 | } |
| 328 | if (bb->fallThrough) { |
| 329 | oatGetBlockName(bb, blockName1); |
| 330 | oatGetBlockName(bb->fallThrough, blockName2); |
| 331 | fprintf(file, " %s:s -> %s:n\n", blockName1, blockName2); |
| 332 | } |
| 333 | |
| 334 | if (bb->successorBlockList.blockListType != kNotUsed) { |
| 335 | fprintf(file, " succ%04x [shape=%s,label = \"{ \\\n", |
| 336 | bb->startOffset, |
| 337 | (bb->successorBlockList.blockListType == kCatch) ? |
| 338 | "Mrecord" : "record"); |
| 339 | GrowableListIterator iterator; |
| 340 | oatGrowableListIteratorInit(&bb->successorBlockList.blocks, |
| 341 | &iterator); |
| 342 | SuccessorBlockInfo *successorBlockInfo = |
| 343 | (SuccessorBlockInfo *) oatGrowableListIteratorNext(&iterator); |
| 344 | |
| 345 | int succId = 0; |
| 346 | while (true) { |
| 347 | if (successorBlockInfo == NULL) break; |
| 348 | |
| 349 | BasicBlock *destBlock = successorBlockInfo->block; |
| 350 | SuccessorBlockInfo *nextSuccessorBlockInfo = |
| 351 | (SuccessorBlockInfo *) oatGrowableListIteratorNext(&iterator); |
| 352 | |
| 353 | fprintf(file, " {<f%d> %04x: %04x\\l}%s\\\n", |
| 354 | succId++, |
| 355 | successorBlockInfo->key, |
| 356 | destBlock->startOffset, |
| 357 | (nextSuccessorBlockInfo != NULL) ? " | " : " "); |
| 358 | |
| 359 | successorBlockInfo = nextSuccessorBlockInfo; |
| 360 | } |
| 361 | fprintf(file, " }\"];\n\n"); |
| 362 | |
| 363 | oatGetBlockName(bb, blockName1); |
| 364 | fprintf(file, " %s:s -> succ%04x:n [style=dashed]\n", |
| 365 | blockName1, bb->startOffset); |
| 366 | |
| 367 | if (bb->successorBlockList.blockListType == kPackedSwitch || |
| 368 | bb->successorBlockList.blockListType == kSparseSwitch) { |
| 369 | |
| 370 | oatGrowableListIteratorInit(&bb->successorBlockList.blocks, |
| 371 | &iterator); |
| 372 | |
| 373 | succId = 0; |
| 374 | while (true) { |
| 375 | SuccessorBlockInfo *successorBlockInfo = |
| 376 | (SuccessorBlockInfo *) |
| 377 | oatGrowableListIteratorNext(&iterator); |
| 378 | if (successorBlockInfo == NULL) break; |
| 379 | |
| 380 | BasicBlock *destBlock = successorBlockInfo->block; |
| 381 | |
| 382 | oatGetBlockName(destBlock, blockName2); |
| 383 | fprintf(file, " succ%04x:f%d:e -> %s:n\n", |
| 384 | bb->startOffset, succId++, |
| 385 | blockName2); |
| 386 | } |
| 387 | } |
| 388 | } |
| 389 | fprintf(file, "\n"); |
| 390 | |
buzbee | ce30293 | 2011-10-04 14:32:18 -0700 | [diff] [blame] | 391 | /* Display the dominator tree */ |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 392 | oatGetBlockName(bb, blockName1); |
| 393 | fprintf(file, " cfg%s [label=\"%s\", shape=none];\n", |
| 394 | blockName1, blockName1); |
| 395 | if (bb->iDom) { |
| 396 | oatGetBlockName(bb->iDom, blockName2); |
| 397 | fprintf(file, " cfg%s:s -> cfg%s:n\n\n", |
| 398 | blockName2, blockName1); |
| 399 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 400 | } |
| 401 | fprintf(file, "}\n"); |
| 402 | fclose(file); |
| 403 | } |
| 404 | |
| 405 | /* Verify if all the successor is connected with all the claimed predecessors */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 406 | STATIC bool verifyPredInfo(CompilationUnit* cUnit, BasicBlock* bb) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 407 | { |
| 408 | ArenaBitVectorIterator bvIterator; |
| 409 | |
| 410 | oatBitVectorIteratorInit(bb->predecessors, &bvIterator); |
| 411 | while (true) { |
| 412 | int blockIdx = oatBitVectorIteratorNext(&bvIterator); |
| 413 | if (blockIdx == -1) break; |
| 414 | BasicBlock *predBB = (BasicBlock *) |
| 415 | oatGrowableListGetElement(&cUnit->blockList, blockIdx); |
| 416 | bool found = false; |
| 417 | if (predBB->taken == bb) { |
| 418 | found = true; |
| 419 | } else if (predBB->fallThrough == bb) { |
| 420 | found = true; |
| 421 | } else if (predBB->successorBlockList.blockListType != kNotUsed) { |
| 422 | GrowableListIterator iterator; |
| 423 | oatGrowableListIteratorInit(&predBB->successorBlockList.blocks, |
| 424 | &iterator); |
| 425 | while (true) { |
| 426 | SuccessorBlockInfo *successorBlockInfo = |
| 427 | (SuccessorBlockInfo *) |
| 428 | oatGrowableListIteratorNext(&iterator); |
| 429 | if (successorBlockInfo == NULL) break; |
| 430 | BasicBlock *succBB = successorBlockInfo->block; |
| 431 | if (succBB == bb) { |
| 432 | found = true; |
| 433 | break; |
| 434 | } |
| 435 | } |
| 436 | } |
| 437 | if (found == false) { |
| 438 | char blockName1[BLOCK_NAME_LEN], blockName2[BLOCK_NAME_LEN]; |
| 439 | oatGetBlockName(bb, blockName1); |
| 440 | oatGetBlockName(predBB, blockName2); |
| 441 | oatDumpCFG(cUnit, "/sdcard/cfg/"); |
| 442 | LOG(FATAL) << "Successor " << blockName1 << "not found from " |
| 443 | << blockName2; |
| 444 | } |
| 445 | } |
| 446 | return true; |
| 447 | } |
| 448 | |
| 449 | /* Identify code range in try blocks and set up the empty catch blocks */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 450 | STATIC void processTryCatchBlocks(CompilationUnit* cUnit) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 451 | { |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 452 | const DexFile::CodeItem* code_item = cUnit->code_item; |
buzbee | e9a72f6 | 2011-09-04 17:59:07 -0700 | [diff] [blame] | 453 | int triesSize = code_item->tries_size_; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 454 | int offset; |
| 455 | |
| 456 | if (triesSize == 0) { |
| 457 | return; |
| 458 | } |
| 459 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 460 | ArenaBitVector* tryBlockAddr = cUnit->tryBlockAddr; |
| 461 | |
buzbee | e9a72f6 | 2011-09-04 17:59:07 -0700 | [diff] [blame] | 462 | for (int i = 0; i < triesSize; i++) { |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 463 | const DexFile::TryItem* pTry = |
| 464 | DexFile::GetTryItems(*code_item, i); |
buzbee | e9a72f6 | 2011-09-04 17:59:07 -0700 | [diff] [blame] | 465 | int startOffset = pTry->start_addr_; |
| 466 | int endOffset = startOffset + pTry->insn_count_; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 467 | for (offset = startOffset; offset < endOffset; offset++) { |
| 468 | oatSetBit(tryBlockAddr, offset); |
| 469 | } |
| 470 | } |
| 471 | |
buzbee | e9a72f6 | 2011-09-04 17:59:07 -0700 | [diff] [blame] | 472 | // Iterate over each of the handlers to enqueue the empty Catch blocks |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 473 | const byte* handlers_ptr = |
| 474 | DexFile::GetCatchHandlerData(*code_item, 0); |
| 475 | uint32_t handlers_size = DecodeUnsignedLeb128(&handlers_ptr); |
buzbee | e9a72f6 | 2011-09-04 17:59:07 -0700 | [diff] [blame] | 476 | for (uint32_t idx = 0; idx < handlers_size; idx++) { |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 477 | CatchHandlerIterator iterator(handlers_ptr); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 478 | for (; iterator.HasNext(); iterator.Next()) { |
| 479 | uint32_t address = iterator.GetHandlerAddress(); |
buzbee | 9ab05de | 2012-01-18 15:43:48 -0800 | [diff] [blame] | 480 | findBlock(cUnit, address, false /* split */, true /*create*/, |
| 481 | /* immedPredBlockP */ NULL); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 482 | } |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 483 | handlers_ptr = iterator.EndDataPointer(); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 484 | } |
| 485 | } |
| 486 | |
| 487 | /* Process instructions with the kInstrCanBranch flag */ |
buzbee | e941e2c | 2011-12-05 12:38:17 -0800 | [diff] [blame] | 488 | STATIC BasicBlock* processCanBranch(CompilationUnit* cUnit, |
| 489 | BasicBlock* curBlock, MIR* insn, |
| 490 | int curOffset, int width, int flags, |
| 491 | const u2* codePtr, const u2* codeEnd) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 492 | { |
| 493 | int target = curOffset; |
| 494 | switch (insn->dalvikInsn.opcode) { |
| 495 | case OP_GOTO: |
| 496 | case OP_GOTO_16: |
| 497 | case OP_GOTO_32: |
| 498 | target += (int) insn->dalvikInsn.vA; |
| 499 | break; |
| 500 | case OP_IF_EQ: |
| 501 | case OP_IF_NE: |
| 502 | case OP_IF_LT: |
| 503 | case OP_IF_GE: |
| 504 | case OP_IF_GT: |
| 505 | case OP_IF_LE: |
| 506 | target += (int) insn->dalvikInsn.vC; |
| 507 | break; |
| 508 | case OP_IF_EQZ: |
| 509 | case OP_IF_NEZ: |
| 510 | case OP_IF_LTZ: |
| 511 | case OP_IF_GEZ: |
| 512 | case OP_IF_GTZ: |
| 513 | case OP_IF_LEZ: |
| 514 | target += (int) insn->dalvikInsn.vB; |
| 515 | break; |
| 516 | default: |
| 517 | LOG(FATAL) << "Unexpected opcode(" << (int)insn->dalvikInsn.opcode |
| 518 | << ") with kInstrCanBranch set"; |
| 519 | } |
| 520 | BasicBlock *takenBlock = findBlock(cUnit, target, |
| 521 | /* split */ |
| 522 | true, |
| 523 | /* create */ |
buzbee | 9ab05de | 2012-01-18 15:43:48 -0800 | [diff] [blame] | 524 | true, |
| 525 | /* immedPredBlockP */ |
| 526 | &curBlock); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 527 | curBlock->taken = takenBlock; |
| 528 | oatSetBit(takenBlock->predecessors, curBlock->id); |
| 529 | |
| 530 | /* Always terminate the current block for conditional branches */ |
| 531 | if (flags & kInstrCanContinue) { |
| 532 | BasicBlock *fallthroughBlock = findBlock(cUnit, |
| 533 | curOffset + width, |
| 534 | /* |
| 535 | * If the method is processed |
| 536 | * in sequential order from the |
| 537 | * beginning, we don't need to |
| 538 | * specify split for continue |
| 539 | * blocks. However, this |
| 540 | * routine can be called by |
| 541 | * compileLoop, which starts |
| 542 | * parsing the method from an |
| 543 | * arbitrary address in the |
| 544 | * method body. |
| 545 | */ |
| 546 | true, |
| 547 | /* create */ |
buzbee | 9ab05de | 2012-01-18 15:43:48 -0800 | [diff] [blame] | 548 | true, |
| 549 | /* immedPredBlockP */ |
| 550 | &curBlock); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 551 | curBlock->fallThrough = fallthroughBlock; |
| 552 | oatSetBit(fallthroughBlock->predecessors, curBlock->id); |
| 553 | } else if (codePtr < codeEnd) { |
| 554 | /* Create a fallthrough block for real instructions (incl. OP_NOP) */ |
| 555 | if (contentIsInsn(codePtr)) { |
| 556 | findBlock(cUnit, curOffset + width, |
| 557 | /* split */ |
| 558 | false, |
| 559 | /* create */ |
buzbee | 9ab05de | 2012-01-18 15:43:48 -0800 | [diff] [blame] | 560 | true, |
| 561 | /* immedPredBlockP */ |
| 562 | NULL); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 563 | } |
| 564 | } |
buzbee | e941e2c | 2011-12-05 12:38:17 -0800 | [diff] [blame] | 565 | return curBlock; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 566 | } |
| 567 | |
| 568 | /* Process instructions with the kInstrCanSwitch flag */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 569 | STATIC void processCanSwitch(CompilationUnit* cUnit, BasicBlock* curBlock, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 570 | MIR* insn, int curOffset, int width, int flags) |
| 571 | { |
| 572 | u2* switchData= (u2 *) (cUnit->insns + curOffset + |
| 573 | insn->dalvikInsn.vB); |
| 574 | int size; |
| 575 | int* keyTable; |
| 576 | int* targetTable; |
| 577 | int i; |
| 578 | int firstKey; |
| 579 | |
| 580 | /* |
| 581 | * Packed switch data format: |
| 582 | * ushort ident = 0x0100 magic value |
| 583 | * ushort size number of entries in the table |
| 584 | * int first_key first (and lowest) switch case value |
| 585 | * int targets[size] branch targets, relative to switch opcode |
| 586 | * |
| 587 | * Total size is (4+size*2) 16-bit code units. |
| 588 | */ |
| 589 | if (insn->dalvikInsn.opcode == OP_PACKED_SWITCH) { |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 590 | DCHECK_EQ(switchData[0], kPackedSwitchSignature); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 591 | size = switchData[1]; |
| 592 | firstKey = switchData[2] | (switchData[3] << 16); |
| 593 | targetTable = (int *) &switchData[4]; |
| 594 | keyTable = NULL; // Make the compiler happy |
| 595 | /* |
| 596 | * Sparse switch data format: |
| 597 | * ushort ident = 0x0200 magic value |
| 598 | * ushort size number of entries in the table; > 0 |
| 599 | * int keys[size] keys, sorted low-to-high; 32-bit aligned |
| 600 | * int targets[size] branch targets, relative to switch opcode |
| 601 | * |
| 602 | * Total size is (2+size*4) 16-bit code units. |
| 603 | */ |
| 604 | } else { |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 605 | DCHECK_EQ(switchData[0], kSparseSwitchSignature); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 606 | size = switchData[1]; |
| 607 | keyTable = (int *) &switchData[2]; |
| 608 | targetTable = (int *) &switchData[2 + size*2]; |
| 609 | firstKey = 0; // To make the compiler happy |
| 610 | } |
| 611 | |
| 612 | if (curBlock->successorBlockList.blockListType != kNotUsed) { |
| 613 | LOG(FATAL) << "Successor block list already in use: " << |
| 614 | (int)curBlock->successorBlockList.blockListType; |
| 615 | } |
| 616 | curBlock->successorBlockList.blockListType = |
| 617 | (insn->dalvikInsn.opcode == OP_PACKED_SWITCH) ? |
| 618 | kPackedSwitch : kSparseSwitch; |
| 619 | oatInitGrowableList(&curBlock->successorBlockList.blocks, size); |
| 620 | |
| 621 | for (i = 0; i < size; i++) { |
| 622 | BasicBlock *caseBlock = findBlock(cUnit, curOffset + targetTable[i], |
| 623 | /* split */ |
| 624 | true, |
| 625 | /* create */ |
buzbee | 9ab05de | 2012-01-18 15:43:48 -0800 | [diff] [blame] | 626 | true, |
| 627 | /* immedPredBlockP */ |
| 628 | &curBlock); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 629 | SuccessorBlockInfo *successorBlockInfo = |
| 630 | (SuccessorBlockInfo *) oatNew(sizeof(SuccessorBlockInfo), |
| 631 | false); |
| 632 | successorBlockInfo->block = caseBlock; |
| 633 | successorBlockInfo->key = (insn->dalvikInsn.opcode == OP_PACKED_SWITCH)? |
| 634 | firstKey + i : keyTable[i]; |
| 635 | oatInsertGrowableList(&curBlock->successorBlockList.blocks, |
| 636 | (intptr_t) successorBlockInfo); |
| 637 | oatSetBit(caseBlock->predecessors, curBlock->id); |
| 638 | } |
| 639 | |
| 640 | /* Fall-through case */ |
| 641 | BasicBlock* fallthroughBlock = findBlock(cUnit, |
| 642 | curOffset + width, |
| 643 | /* split */ |
| 644 | false, |
| 645 | /* create */ |
buzbee | 9ab05de | 2012-01-18 15:43:48 -0800 | [diff] [blame] | 646 | true, |
| 647 | /* immedPredBlockP */ |
| 648 | NULL); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 649 | curBlock->fallThrough = fallthroughBlock; |
| 650 | oatSetBit(fallthroughBlock->predecessors, curBlock->id); |
| 651 | } |
| 652 | |
| 653 | /* Process instructions with the kInstrCanThrow flag */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 654 | STATIC void processCanThrow(CompilationUnit* cUnit, BasicBlock* curBlock, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 655 | MIR* insn, int curOffset, int width, int flags, |
| 656 | ArenaBitVector* tryBlockAddr, const u2* codePtr, |
| 657 | const u2* codeEnd) |
| 658 | { |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 659 | const DexFile::CodeItem* code_item = cUnit->code_item; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 660 | |
| 661 | /* In try block */ |
| 662 | if (oatIsBitSet(tryBlockAddr, curOffset)) { |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 663 | CatchHandlerIterator iterator(*code_item, curOffset); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 664 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 665 | if (curBlock->successorBlockList.blockListType != kNotUsed) { |
| 666 | LOG(FATAL) << "Successor block list already in use: " << |
| 667 | (int)curBlock->successorBlockList.blockListType; |
| 668 | } |
buzbee | e9a72f6 | 2011-09-04 17:59:07 -0700 | [diff] [blame] | 669 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 670 | curBlock->successorBlockList.blockListType = kCatch; |
| 671 | oatInitGrowableList(&curBlock->successorBlockList.blocks, 2); |
| 672 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 673 | for (;iterator.HasNext(); iterator.Next()) { |
| 674 | BasicBlock *catchBlock = findBlock(cUnit, iterator.GetHandlerAddress(), |
buzbee | e9a72f6 | 2011-09-04 17:59:07 -0700 | [diff] [blame] | 675 | false /* split*/, |
buzbee | 9ab05de | 2012-01-18 15:43:48 -0800 | [diff] [blame] | 676 | false /* creat */, |
| 677 | NULL /* immedPredBlockP */); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 678 | catchBlock->catchEntry = true; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 679 | SuccessorBlockInfo *successorBlockInfo = |
buzbee | e9a72f6 | 2011-09-04 17:59:07 -0700 | [diff] [blame] | 680 | (SuccessorBlockInfo *) oatNew(sizeof(SuccessorBlockInfo), |
| 681 | false); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 682 | successorBlockInfo->block = catchBlock; |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 683 | successorBlockInfo->key = iterator.GetHandlerTypeIndex(); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 684 | oatInsertGrowableList(&curBlock->successorBlockList.blocks, |
| 685 | (intptr_t) successorBlockInfo); |
| 686 | oatSetBit(catchBlock->predecessors, curBlock->id); |
| 687 | } |
| 688 | } else { |
| 689 | BasicBlock *ehBlock = oatNewBB(kExceptionHandling, |
| 690 | cUnit->numBlocks++); |
| 691 | curBlock->taken = ehBlock; |
| 692 | oatInsertGrowableList(&cUnit->blockList, (intptr_t) ehBlock); |
| 693 | ehBlock->startOffset = curOffset; |
| 694 | oatSetBit(ehBlock->predecessors, curBlock->id); |
| 695 | } |
| 696 | |
| 697 | /* |
| 698 | * Force the current block to terminate. |
| 699 | * |
| 700 | * Data may be present before codeEnd, so we need to parse it to know |
| 701 | * whether it is code or data. |
| 702 | */ |
| 703 | if (codePtr < codeEnd) { |
| 704 | /* Create a fallthrough block for real instructions (incl. OP_NOP) */ |
| 705 | if (contentIsInsn(codePtr)) { |
| 706 | BasicBlock *fallthroughBlock = findBlock(cUnit, |
| 707 | curOffset + width, |
| 708 | /* split */ |
| 709 | false, |
| 710 | /* create */ |
buzbee | 9ab05de | 2012-01-18 15:43:48 -0800 | [diff] [blame] | 711 | true, |
| 712 | /* immedPredBlockP */ |
| 713 | NULL); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 714 | /* |
buzbee | 510c605 | 2011-10-27 10:47:20 -0700 | [diff] [blame] | 715 | * OP_THROW is an unconditional branch. NOTE: |
| 716 | * OP_THROW_VERIFICATION_ERROR is also an unconditional |
| 717 | * branch, but we shouldn't treat it as such until we have |
| 718 | * a dead code elimination pass (which won't be important |
| 719 | * until inlining w/ constant propogation is implemented. |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 720 | */ |
buzbee | 510c605 | 2011-10-27 10:47:20 -0700 | [diff] [blame] | 721 | if (insn->dalvikInsn.opcode != OP_THROW) { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 722 | curBlock->fallThrough = fallthroughBlock; |
| 723 | oatSetBit(fallthroughBlock->predecessors, curBlock->id); |
| 724 | } |
| 725 | } |
| 726 | } |
| 727 | } |
| 728 | |
| 729 | /* |
| 730 | * Compile a method. |
| 731 | */ |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 732 | CompiledMethod* oatCompileMethod(const Compiler& compiler, const DexFile::CodeItem* code_item, |
Ian Rogers | a3760aa | 2011-11-14 14:32:37 -0800 | [diff] [blame] | 733 | uint32_t access_flags, uint32_t method_idx, |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 734 | const ClassLoader* class_loader, |
| 735 | const DexFile& dex_file, InstructionSet insnSet) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 736 | { |
Elliott Hughes | 4dd9b4d | 2011-12-12 18:29:24 -0800 | [diff] [blame] | 737 | VLOG(compiler) << "Compiling " << PrettyMethod(method_idx, dex_file) << "..."; |
buzbee | 2a475e7 | 2011-09-07 17:19:17 -0700 | [diff] [blame] | 738 | oatArenaReset(); |
Brian Carlstrom | 94496d3 | 2011-08-22 09:22:47 -0700 | [diff] [blame] | 739 | |
buzbee | c143c55 | 2011-08-20 17:38:58 -0700 | [diff] [blame] | 740 | const u2* codePtr = code_item->insns_; |
Ian Rogers | d81871c | 2011-10-03 13:57:23 -0700 | [diff] [blame] | 741 | const u2* codeEnd = code_item->insns_ + code_item->insns_size_in_code_units_; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 742 | int numBlocks = 0; |
| 743 | unsigned int curOffset = 0; |
| 744 | |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 745 | oatInit(compiler); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 746 | |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 747 | ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 748 | UniquePtr<CompilationUnit> cUnit(new CompilationUnit); |
| 749 | memset(cUnit.get(), 0, sizeof(*cUnit)); |
| 750 | cUnit->compiler = &compiler; |
Ian Rogers | a3760aa | 2011-11-14 14:32:37 -0800 | [diff] [blame] | 751 | cUnit->class_linker = class_linker; |
| 752 | cUnit->dex_file = &dex_file; |
| 753 | cUnit->dex_cache = class_linker->FindDexCache(dex_file); |
| 754 | cUnit->method_idx = method_idx; |
| 755 | cUnit->code_item = code_item; |
| 756 | cUnit->access_flags = access_flags; |
| 757 | cUnit->shorty = dex_file.GetMethodShorty(dex_file.GetMethodId(method_idx)); |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 758 | cUnit->instructionSet = (OatInstructionSetType)insnSet; |
| 759 | cUnit->insns = code_item->insns_; |
Ian Rogers | d81871c | 2011-10-03 13:57:23 -0700 | [diff] [blame] | 760 | cUnit->insnsSize = code_item->insns_size_in_code_units_; |
Ian Rogers | a3760aa | 2011-11-14 14:32:37 -0800 | [diff] [blame] | 761 | cUnit->numIns = code_item->ins_size_; |
| 762 | cUnit->numRegs = code_item->registers_size_ - cUnit->numIns; |
| 763 | cUnit->numOuts = code_item->outs_size_; |
| 764 | /* Adjust this value accordingly once inlining is performed */ |
| 765 | cUnit->numDalvikRegisters = code_item->registers_size_; |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 766 | cUnit->blockMap = std::map<unsigned int, BasicBlock*>(); |
| 767 | cUnit->blockMap.clear(); |
buzbee | ce30293 | 2011-10-04 14:32:18 -0700 | [diff] [blame] | 768 | bool useMatch = compilerMethodMatch.length() != 0; |
| 769 | bool match = useMatch && (compilerFlipMatch ^ |
Ian Rogers | a3760aa | 2011-11-14 14:32:37 -0800 | [diff] [blame] | 770 | (PrettyMethod(method_idx, dex_file).find(compilerMethodMatch) != std::string::npos)); |
buzbee | ce30293 | 2011-10-04 14:32:18 -0700 | [diff] [blame] | 771 | if (!useMatch || match) { |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 772 | cUnit->disableOpt = compilerOptimizerDisableFlags; |
| 773 | cUnit->enableDebug = compilerDebugFlags; |
Elliott Hughes | 4dd9b4d | 2011-12-12 18:29:24 -0800 | [diff] [blame] | 774 | cUnit->printMe = VLOG_IS_ON(compiler) || (cUnit->enableDebug & (1 << kDebugVerbose)); |
buzbee | ce30293 | 2011-10-04 14:32:18 -0700 | [diff] [blame] | 775 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 776 | |
buzbee | cefd187 | 2011-09-09 09:59:52 -0700 | [diff] [blame] | 777 | /* Assume non-throwing leaf */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 778 | cUnit->attrs = (METHOD_IS_LEAF | METHOD_IS_THROW_FREE); |
buzbee | cefd187 | 2011-09-09 09:59:52 -0700 | [diff] [blame] | 779 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 780 | /* Initialize the block list */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 781 | oatInitGrowableList(&cUnit->blockList, 40); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 782 | |
| 783 | /* Initialize the switchTables list */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 784 | oatInitGrowableList(&cUnit->switchTables, 4); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 785 | |
| 786 | /* Intialize the fillArrayData list */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 787 | oatInitGrowableList(&cUnit->fillArrayData, 4); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 788 | |
buzbee | 5ade1d2 | 2011-09-09 14:44:52 -0700 | [diff] [blame] | 789 | /* Intialize the throwLaunchpads list */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 790 | oatInitGrowableList(&cUnit->throwLaunchpads, 4); |
buzbee | 5ade1d2 | 2011-09-09 14:44:52 -0700 | [diff] [blame] | 791 | |
buzbee | c1f4504 | 2011-09-21 16:03:19 -0700 | [diff] [blame] | 792 | /* Intialize the suspendLaunchpads list */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 793 | oatInitGrowableList(&cUnit->suspendLaunchpads, 4); |
buzbee | c1f4504 | 2011-09-21 16:03:19 -0700 | [diff] [blame] | 794 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 795 | /* Allocate the bit-vector to track the beginning of basic blocks */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 796 | ArenaBitVector *tryBlockAddr = oatAllocBitVector(cUnit->insnsSize, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 797 | true /* expandable */); |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 798 | cUnit->tryBlockAddr = tryBlockAddr; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 799 | |
| 800 | /* Create the default entry and exit blocks and enter them to the list */ |
| 801 | BasicBlock *entryBlock = oatNewBB(kEntryBlock, numBlocks++); |
| 802 | BasicBlock *exitBlock = oatNewBB(kExitBlock, numBlocks++); |
| 803 | |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 804 | cUnit->entryBlock = entryBlock; |
| 805 | cUnit->exitBlock = exitBlock; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 806 | |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 807 | oatInsertGrowableList(&cUnit->blockList, (intptr_t) entryBlock); |
| 808 | oatInsertGrowableList(&cUnit->blockList, (intptr_t) exitBlock); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 809 | |
| 810 | /* Current block to record parsed instructions */ |
| 811 | BasicBlock *curBlock = oatNewBB(kDalvikByteCode, numBlocks++); |
| 812 | curBlock->startOffset = 0; |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 813 | oatInsertGrowableList(&cUnit->blockList, (intptr_t) curBlock); |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 814 | /* Add first block to the fast lookup cache */ |
| 815 | cUnit->blockMap.insert(std::make_pair(curBlock->startOffset, curBlock)); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 816 | entryBlock->fallThrough = curBlock; |
| 817 | oatSetBit(curBlock->predecessors, entryBlock->id); |
| 818 | |
| 819 | /* |
| 820 | * Store back the number of blocks since new blocks may be created of |
| 821 | * accessing cUnit. |
| 822 | */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 823 | cUnit->numBlocks = numBlocks; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 824 | |
| 825 | /* Identify code range in try blocks and set up the empty catch blocks */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 826 | processTryCatchBlocks(cUnit.get()); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 827 | |
| 828 | /* Parse all instructions and put them into containing basic blocks */ |
| 829 | while (codePtr < codeEnd) { |
| 830 | MIR *insn = (MIR *) oatNew(sizeof(MIR), true); |
| 831 | insn->offset = curOffset; |
| 832 | int width = parseInsn(codePtr, &insn->dalvikInsn, false); |
| 833 | insn->width = width; |
| 834 | |
| 835 | /* Terminate when the data section is seen */ |
| 836 | if (width == 0) |
| 837 | break; |
| 838 | |
| 839 | oatAppendMIR(curBlock, insn); |
| 840 | |
| 841 | codePtr += width; |
| 842 | int flags = dexGetFlagsFromOpcode(insn->dalvikInsn.opcode); |
| 843 | |
buzbee | 99ba964 | 2012-01-25 14:23:14 -0800 | [diff] [blame^] | 844 | cUnit->usesFP |= (oatDataFlowAttributes[insn->dalvikInsn.opcode] & |
| 845 | DF_USES_FP); |
| 846 | |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 847 | if (flags & kInstrCanBranch) { |
buzbee | e941e2c | 2011-12-05 12:38:17 -0800 | [diff] [blame] | 848 | curBlock = processCanBranch(cUnit.get(), curBlock, insn, curOffset, |
| 849 | width, flags, codePtr, codeEnd); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 850 | } else if (flags & kInstrCanReturn) { |
| 851 | curBlock->fallThrough = exitBlock; |
| 852 | oatSetBit(exitBlock->predecessors, curBlock->id); |
| 853 | /* |
| 854 | * Terminate the current block if there are instructions |
| 855 | * afterwards. |
| 856 | */ |
| 857 | if (codePtr < codeEnd) { |
| 858 | /* |
| 859 | * Create a fallthrough block for real instructions |
| 860 | * (incl. OP_NOP). |
| 861 | */ |
| 862 | if (contentIsInsn(codePtr)) { |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 863 | findBlock(cUnit.get(), curOffset + width, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 864 | /* split */ |
| 865 | false, |
| 866 | /* create */ |
buzbee | 9ab05de | 2012-01-18 15:43:48 -0800 | [diff] [blame] | 867 | true, |
| 868 | /* immedPredBlockP */ |
| 869 | NULL); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 870 | } |
| 871 | } |
| 872 | } else if (flags & kInstrCanThrow) { |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 873 | processCanThrow(cUnit.get(), curBlock, insn, curOffset, width, flags, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 874 | tryBlockAddr, codePtr, codeEnd); |
| 875 | } else if (flags & kInstrCanSwitch) { |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 876 | processCanSwitch(cUnit.get(), curBlock, insn, curOffset, width, flags); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 877 | } |
| 878 | curOffset += width; |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 879 | BasicBlock *nextBlock = findBlock(cUnit.get(), curOffset, |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 880 | /* split */ |
| 881 | false, |
| 882 | /* create */ |
buzbee | 9ab05de | 2012-01-18 15:43:48 -0800 | [diff] [blame] | 883 | false, |
| 884 | /* immedPredBlockP */ |
| 885 | NULL); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 886 | if (nextBlock) { |
| 887 | /* |
| 888 | * The next instruction could be the target of a previously parsed |
| 889 | * forward branch so a block is already created. If the current |
| 890 | * instruction is not an unconditional branch, connect them through |
| 891 | * the fall-through link. |
| 892 | */ |
buzbee | ed3e930 | 2011-09-23 17:34:19 -0700 | [diff] [blame] | 893 | DCHECK(curBlock->fallThrough == NULL || |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 894 | curBlock->fallThrough == nextBlock || |
| 895 | curBlock->fallThrough == exitBlock); |
| 896 | |
| 897 | if ((curBlock->fallThrough == NULL) && |
| 898 | (flags & kInstrCanContinue)) { |
| 899 | curBlock->fallThrough = nextBlock; |
| 900 | oatSetBit(nextBlock->predecessors, curBlock->id); |
| 901 | } |
| 902 | curBlock = nextBlock; |
| 903 | } |
| 904 | } |
| 905 | |
buzbee | 99ba964 | 2012-01-25 14:23:14 -0800 | [diff] [blame^] | 906 | if (!cUnit->usesFP && |
| 907 | !(cUnit->disableOpt & (1 << kSkipLargeMethodOptimization))) { |
| 908 | if ((cUnit->numBlocks > MANY_BLOCKS) || |
| 909 | ((cUnit->numBlocks > MANY_BLOCKS_INITIALIZER) && |
| 910 | PrettyMethod(method_idx, dex_file).find("init>") != |
| 911 | std::string::npos)) { |
| 912 | cUnit->disableDataflow = true; |
| 913 | // Disable optimization which require dataflow/ssa |
| 914 | cUnit->disableOpt |= |
| 915 | (1 << kNullCheckElimination) | |
| 916 | (1 << kPromoteRegs); |
| 917 | if (cUnit->printMe) { |
| 918 | LOG(INFO) << "Compiler: " << PrettyMethod(method_idx, dex_file) |
| 919 | << " too big: " << cUnit->numBlocks; |
| 920 | } |
| 921 | } |
| 922 | } |
| 923 | |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 924 | if (cUnit->printMe) { |
| 925 | oatDumpCompilationUnit(cUnit.get()); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 926 | } |
| 927 | |
buzbee | 5b53710 | 2012-01-17 17:33:47 -0800 | [diff] [blame] | 928 | if (cUnit->enableDebug & (1 << kDebugVerifyDataflow)) { |
| 929 | /* Verify if all blocks are connected as claimed */ |
| 930 | oatDataFlowAnalysisDispatcher(cUnit.get(), verifyPredInfo, kAllNodes, false /* isIterative */); |
| 931 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 932 | |
| 933 | /* Perform SSA transformation for the whole method */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 934 | oatMethodSSATransformation(cUnit.get()); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 935 | |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 936 | /* Perform null check elimination */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 937 | oatMethodNullCheckElimination(cUnit.get()); |
buzbee | 43a3642 | 2011-09-14 14:00:13 -0700 | [diff] [blame] | 938 | |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 939 | oatInitializeRegAlloc(cUnit.get()); // Needs to happen after SSA naming |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 940 | |
| 941 | /* Allocate Registers using simple local allocation scheme */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 942 | oatSimpleRegAlloc(cUnit.get()); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 943 | |
| 944 | /* Convert MIR to LIR, etc. */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 945 | oatMethodMIR2LIR(cUnit.get()); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 946 | |
| 947 | // Debugging only |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 948 | if (cUnit->enableDebug & (1 << kDebugDumpCFG)) { |
| 949 | oatDumpCFG(cUnit.get(), "/sdcard/cfg/"); |
buzbee | ec5adf3 | 2011-09-11 15:25:43 -0700 | [diff] [blame] | 950 | } |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 951 | |
| 952 | /* Method is not empty */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 953 | if (cUnit->firstLIRInsn) { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 954 | |
| 955 | // mark the targets of switch statement case labels |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 956 | oatProcessSwitchTables(cUnit.get()); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 957 | |
| 958 | /* Convert LIR into machine code. */ |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 959 | oatAssembleLIR(cUnit.get()); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 960 | |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 961 | if (cUnit->printMe) { |
| 962 | oatCodegenDump(cUnit.get()); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 963 | } |
| 964 | } |
| 965 | |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 966 | // Combine vmap tables - core regs, then fp regs - into vmapTable |
| 967 | std::vector<uint16_t> vmapTable; |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 968 | for (size_t i = 0 ; i < cUnit->coreVmapTable.size(); i++) { |
| 969 | vmapTable.push_back(cUnit->coreVmapTable[i]); |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 970 | } |
buzbee | c41e5b5 | 2011-09-23 12:46:19 -0700 | [diff] [blame] | 971 | // Add a marker to take place of lr |
Brian Carlstrom | 0dd7dda | 2011-10-25 15:47:53 -0700 | [diff] [blame] | 972 | vmapTable.push_back(INVALID_VREG); |
buzbee | c41e5b5 | 2011-09-23 12:46:19 -0700 | [diff] [blame] | 973 | // Combine vmap tables - core regs, then fp regs |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 974 | for (uint32_t i = 0; i < cUnit->fpVmapTable.size(); i++) { |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 975 | vmapTable.push_back(cUnit->fpVmapTable[i]); |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 976 | } |
Brian Carlstrom | 0dd7dda | 2011-10-25 15:47:53 -0700 | [diff] [blame] | 977 | DCHECK_EQ(vmapTable.size(), |
| 978 | static_cast<uint32_t>(__builtin_popcount(cUnit->coreSpillMask) |
| 979 | + __builtin_popcount(cUnit->fpSpillMask))); |
| 980 | DCHECK_GE(vmapTable.size(), 1U); // should always at least one INVALID_VREG for lr |
| 981 | |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 982 | CompiledMethod* result = new CompiledMethod(kThumb2, cUnit->codeBuffer, |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 983 | cUnit->frameSize, cUnit->coreSpillMask, |
| 984 | cUnit->fpSpillMask, cUnit->mappingTable, |
| 985 | vmapTable); |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 986 | |
Elliott Hughes | 4dd9b4d | 2011-12-12 18:29:24 -0800 | [diff] [blame] | 987 | VLOG(compiler) << "Compiled " << PrettyMethod(method_idx, dex_file) |
| 988 | << " (" << (cUnit->codeBuffer.size() * sizeof(cUnit->codeBuffer[0])) << " bytes)"; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 989 | |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 990 | return result; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 991 | } |
| 992 | |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 993 | void oatInit(const Compiler& compiler) |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 994 | { |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 995 | static bool initialized = false; |
| 996 | if (initialized) |
| 997 | return; |
| 998 | initialized = true; |
Elliott Hughes | 4dd9b4d | 2011-12-12 18:29:24 -0800 | [diff] [blame] | 999 | VLOG(compiler) << "Initializing compiler"; |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1000 | if (!oatArchInit()) { |
| 1001 | LOG(FATAL) << "Failed to initialize oat"; |
| 1002 | } |
| 1003 | if (!oatHeapInit()) { |
| 1004 | LOG(FATAL) << "Failed to initialize oat heap"; |
| 1005 | } |
| 1006 | } |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 1007 | |
| 1008 | } // namespace art |