buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [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 | namespace art { |
| 18 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 19 | void setMemRefType(LIR* lir, bool isLoad, int memType) |
| 20 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 21 | u8 *maskPtr; |
| 22 | u8 mask = ENCODE_MEM;; |
| 23 | DCHECK(EncodingMap[lir->opcode].flags & (IS_LOAD | IS_STORE)); |
| 24 | if (isLoad) { |
| 25 | maskPtr = &lir->useMask; |
| 26 | } else { |
| 27 | maskPtr = &lir->defMask; |
| 28 | } |
| 29 | /* Clear out the memref flags */ |
| 30 | *maskPtr &= ~mask; |
| 31 | /* ..and then add back the one we need */ |
| 32 | switch (memType) { |
| 33 | case kLiteral: |
| 34 | DCHECK(isLoad); |
| 35 | *maskPtr |= ENCODE_LITERAL; |
| 36 | break; |
| 37 | case kDalvikReg: |
| 38 | *maskPtr |= ENCODE_DALVIK_REG; |
| 39 | break; |
| 40 | case kHeapRef: |
| 41 | *maskPtr |= ENCODE_HEAP_REF; |
| 42 | break; |
| 43 | case kMustNotAlias: |
| 44 | /* Currently only loads can be marked as kMustNotAlias */ |
| 45 | DCHECK(!(EncodingMap[lir->opcode].flags & IS_STORE)); |
| 46 | *maskPtr |= ENCODE_MUST_NOT_ALIAS; |
| 47 | break; |
| 48 | default: |
| 49 | LOG(FATAL) << "Oat: invalid memref kind - " << memType; |
| 50 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | /* |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 54 | * Mark load/store instructions that access Dalvik registers through the stack. |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 55 | */ |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 56 | void annotateDalvikRegAccess(LIR* lir, int regId, bool isLoad, bool is64bit) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 57 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 58 | setMemRefType(lir, isLoad, kDalvikReg); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 59 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 60 | /* |
| 61 | * Store the Dalvik register id in aliasInfo. Mark the MSB if it is a 64-bit |
| 62 | * access. |
| 63 | */ |
| 64 | lir->aliasInfo = regId; |
| 65 | if (is64bit) { |
| 66 | lir->aliasInfo |= 0x80000000; |
| 67 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | /* |
| 71 | * Decode the register id. |
| 72 | */ |
| 73 | inline u8 getRegMaskCommon(int reg) |
| 74 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 75 | u8 seed; |
| 76 | int shift; |
| 77 | int regId = reg & 0x1f; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 78 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 79 | /* |
| 80 | * Each double register is equal to a pair of single-precision FP registers |
| 81 | */ |
| 82 | seed = DOUBLEREG(reg) ? 3 : 1; |
| 83 | /* FP register starts at bit position 16 */ |
| 84 | shift = FPREG(reg) ? kFPReg0 : 0; |
| 85 | /* Expand the double register id into single offset */ |
| 86 | shift += regId; |
| 87 | return (seed << shift); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | /* |
| 91 | * Mark the corresponding bit(s). |
| 92 | */ |
| 93 | inline void setupRegMask(u8* mask, int reg) |
| 94 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 95 | *mask |= getRegMaskCommon(reg); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | /* |
| 99 | * Set up the proper fields in the resource mask |
| 100 | */ |
| 101 | void setupResourceMasks(LIR* lir) |
| 102 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 103 | int opcode = lir->opcode; |
| 104 | int flags; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 105 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 106 | if (opcode <= 0) { |
| 107 | lir->useMask = lir->defMask = 0; |
| 108 | return; |
| 109 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 110 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 111 | flags = EncodingMap[lir->opcode].flags; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 112 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 113 | if (flags & NEEDS_FIXUP) { |
| 114 | lir->flags.pcRelFixup = true; |
| 115 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 116 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 117 | /* Get the starting size of the instruction's template */ |
| 118 | lir->flags.size = oatGetInsnSize(lir); |
buzbee | e88dfbf | 2012-03-05 11:19:57 -0800 | [diff] [blame] | 119 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 120 | /* Set up the mask for resources that are updated */ |
| 121 | if (flags & (IS_LOAD | IS_STORE)) { |
| 122 | /* Default to heap - will catch specialized classes later */ |
| 123 | setMemRefType(lir, flags & IS_LOAD, kHeapRef); |
| 124 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 125 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 126 | /* |
| 127 | * Conservatively assume the branch here will call out a function that in |
| 128 | * turn will trash everything. |
| 129 | */ |
| 130 | if (flags & IS_BRANCH) { |
| 131 | lir->defMask = lir->useMask = ENCODE_ALL; |
| 132 | return; |
| 133 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 134 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 135 | if (flags & REG_DEF0) { |
| 136 | setupRegMask(&lir->defMask, lir->operands[0]); |
| 137 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 138 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 139 | if (flags & REG_DEF1) { |
| 140 | setupRegMask(&lir->defMask, lir->operands[1]); |
| 141 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 142 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 143 | if (flags & REG_DEF_SP) { |
| 144 | lir->defMask |= ENCODE_REG_SP; |
| 145 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 146 | |
buzbee | a7678db | 2012-03-05 15:35:46 -0800 | [diff] [blame] | 147 | #if !defined(TARGET_X86) |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 148 | if (flags & REG_DEF_LR) { |
| 149 | lir->defMask |= ENCODE_REG_LR; |
| 150 | } |
buzbee | a7678db | 2012-03-05 15:35:46 -0800 | [diff] [blame] | 151 | #endif |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 152 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 153 | if (flags & REG_DEF_LIST0) { |
| 154 | lir->defMask |= ENCODE_REG_LIST(lir->operands[0]); |
| 155 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 156 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 157 | if (flags & REG_DEF_LIST1) { |
| 158 | lir->defMask |= ENCODE_REG_LIST(lir->operands[1]); |
| 159 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 160 | |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 161 | #if defined(TARGET_ARM) |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 162 | if (flags & REG_DEF_FPCS_LIST0) { |
| 163 | lir->defMask |= ENCODE_REG_FPCS_LIST(lir->operands[0]); |
| 164 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 165 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 166 | if (flags & REG_DEF_FPCS_LIST2) { |
| 167 | for (int i = 0; i < lir->operands[2]; i++) { |
| 168 | setupRegMask(&lir->defMask, lir->operands[1] + i); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 169 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 170 | } |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 171 | #endif |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 172 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 173 | if (flags & SETS_CCODES) { |
| 174 | lir->defMask |= ENCODE_CCODE; |
| 175 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 176 | |
| 177 | #if defined(TARGET_ARM) |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 178 | /* Conservatively treat the IT block */ |
| 179 | if (flags & IS_IT) { |
| 180 | lir->defMask = ENCODE_ALL; |
| 181 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 182 | #endif |
| 183 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 184 | if (flags & (REG_USE0 | REG_USE1 | REG_USE2 | REG_USE3)) { |
| 185 | int i; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 186 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 187 | for (i = 0; i < 4; i++) { |
| 188 | if (flags & (1 << (kRegUse0 + i))) { |
| 189 | setupRegMask(&lir->useMask, lir->operands[i]); |
| 190 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 191 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 192 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 193 | |
buzbee | a7678db | 2012-03-05 15:35:46 -0800 | [diff] [blame] | 194 | #if defined(TARGET_ARM) |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 195 | if (flags & REG_USE_PC) { |
| 196 | lir->useMask |= ENCODE_REG_PC; |
| 197 | } |
buzbee | a7678db | 2012-03-05 15:35:46 -0800 | [diff] [blame] | 198 | #endif |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 199 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 200 | if (flags & REG_USE_SP) { |
| 201 | lir->useMask |= ENCODE_REG_SP; |
| 202 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 203 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 204 | if (flags & REG_USE_LIST0) { |
| 205 | lir->useMask |= ENCODE_REG_LIST(lir->operands[0]); |
| 206 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 207 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 208 | if (flags & REG_USE_LIST1) { |
| 209 | lir->useMask |= ENCODE_REG_LIST(lir->operands[1]); |
| 210 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 211 | |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 212 | #if defined(TARGET_ARM) |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 213 | if (flags & REG_USE_FPCS_LIST0) { |
| 214 | lir->useMask |= ENCODE_REG_FPCS_LIST(lir->operands[0]); |
| 215 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 216 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 217 | if (flags & REG_USE_FPCS_LIST2) { |
| 218 | for (int i = 0; i < lir->operands[2]; i++) { |
| 219 | setupRegMask(&lir->useMask, lir->operands[1] + i); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 220 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 221 | } |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 222 | #endif |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 223 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 224 | if (flags & USES_CCODES) { |
| 225 | lir->useMask |= ENCODE_CCODE; |
| 226 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 227 | |
| 228 | #if defined(TARGET_ARM) |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 229 | /* Fixup for kThumbPush/lr and kThumbPop/pc */ |
| 230 | if (opcode == kThumbPush || opcode == kThumbPop) { |
| 231 | u8 r8Mask = getRegMaskCommon(r8); |
| 232 | if ((opcode == kThumbPush) && (lir->useMask & r8Mask)) { |
| 233 | lir->useMask &= ~r8Mask; |
| 234 | lir->useMask |= ENCODE_REG_LR; |
| 235 | } else if ((opcode == kThumbPop) && (lir->defMask & r8Mask)) { |
| 236 | lir->defMask &= ~r8Mask; |
| 237 | lir->defMask |= ENCODE_REG_PC; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 238 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 239 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 240 | #endif |
| 241 | } |
| 242 | |
| 243 | /* |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 244 | * Debugging macros |
| 245 | */ |
| 246 | #define DUMP_RESOURCE_MASK(X) |
| 247 | #define DUMP_SSA_REP(X) |
| 248 | |
| 249 | /* Pretty-print a LIR instruction */ |
| 250 | void oatDumpLIRInsn(CompilationUnit* cUnit, LIR* arg, unsigned char* baseAddr) |
| 251 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 252 | LIR* lir = (LIR*) arg; |
| 253 | int offset = lir->offset; |
| 254 | int dest = lir->operands[0]; |
| 255 | const bool dumpNop = (cUnit->enableDebug & (1 << kDebugShowNops)); |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 256 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 257 | /* Handle pseudo-ops individually, and all regular insns as a group */ |
| 258 | switch (lir->opcode) { |
| 259 | case kPseudoMethodEntry: |
| 260 | LOG(INFO) << "-------- method entry " |
| 261 | << PrettyMethod(cUnit->method_idx, *cUnit->dex_file); |
| 262 | break; |
| 263 | case kPseudoMethodExit: |
| 264 | LOG(INFO) << "-------- Method_Exit"; |
| 265 | break; |
| 266 | case kPseudoBarrier: |
| 267 | LOG(INFO) << "-------- BARRIER"; |
| 268 | break; |
| 269 | case kPseudoExtended: |
| 270 | LOG(INFO) << "-------- " << (char* ) dest; |
| 271 | break; |
| 272 | case kPseudoSSARep: |
| 273 | DUMP_SSA_REP(LOG(INFO) << "-------- kMirOpPhi: " << (char* ) dest); |
| 274 | break; |
| 275 | case kPseudoEntryBlock: |
| 276 | LOG(INFO) << "-------- entry offset: 0x" << std::hex << dest; |
| 277 | break; |
| 278 | case kPseudoDalvikByteCodeBoundary: |
| 279 | LOG(INFO) << "-------- dalvik offset: 0x" << std::hex |
| 280 | << lir->dalvikOffset << " @ " << (char* )lir->operands[0]; |
| 281 | break; |
| 282 | case kPseudoExitBlock: |
| 283 | LOG(INFO) << "-------- exit offset: 0x" << std::hex << dest; |
| 284 | break; |
| 285 | case kPseudoPseudoAlign4: |
| 286 | LOG(INFO) << (intptr_t)baseAddr + offset << " (0x" << std::hex |
| 287 | << offset << "): .align4"; |
| 288 | break; |
| 289 | case kPseudoEHBlockLabel: |
| 290 | LOG(INFO) << "Exception_Handling:"; |
| 291 | break; |
| 292 | case kPseudoTargetLabel: |
| 293 | case kPseudoNormalBlockLabel: |
| 294 | LOG(INFO) << "L" << (void*)lir << ":"; |
| 295 | break; |
| 296 | case kPseudoThrowTarget: |
| 297 | LOG(INFO) << "LT" << (void*)lir << ":"; |
| 298 | break; |
| 299 | case kPseudoIntrinsicRetry: |
| 300 | LOG(INFO) << "IR" << (void*)lir << ":"; |
| 301 | break; |
| 302 | case kPseudoSuspendTarget: |
| 303 | LOG(INFO) << "LS" << (void*)lir << ":"; |
| 304 | break; |
| 305 | case kPseudoCaseLabel: |
| 306 | LOG(INFO) << "LC" << (void*)lir << ": Case target 0x" |
| 307 | << std::hex << lir->operands[0] << "|" << std::dec << |
| 308 | lir->operands[0]; |
| 309 | break; |
| 310 | default: |
| 311 | if (lir->flags.isNop && !dumpNop) { |
| 312 | break; |
| 313 | } else { |
| 314 | std::string op_name(buildInsnString(EncodingMap[lir->opcode].name, |
| 315 | lir, baseAddr)); |
| 316 | std::string op_operands(buildInsnString(EncodingMap[lir->opcode].fmt |
| 317 | , lir, baseAddr)); |
| 318 | LOG(INFO) << StringPrintf("%05x: %-9s%s%s", |
| 319 | (unsigned int)(baseAddr + offset), |
| 320 | op_name.c_str(), op_operands.c_str(), |
| 321 | lir->flags.isNop ? "(nop)" : ""); |
| 322 | } |
| 323 | break; |
| 324 | } |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 325 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 326 | if (lir->useMask && (!lir->flags.isNop || dumpNop)) { |
| 327 | DUMP_RESOURCE_MASK(oatDumpResourceMask((LIR* ) lir, lir->useMask, "use")); |
| 328 | } |
| 329 | if (lir->defMask && (!lir->flags.isNop || dumpNop)) { |
| 330 | DUMP_RESOURCE_MASK(oatDumpResourceMask((LIR* ) lir, lir->defMask, "def")); |
| 331 | } |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 332 | } |
| 333 | |
| 334 | void oatDumpPromotionMap(CompilationUnit *cUnit) |
| 335 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 336 | int numRegs = cUnit->numDalvikRegisters + cUnit->numCompilerTemps + 1; |
| 337 | for (int i = 0; i < numRegs; i++) { |
| 338 | PromotionMap vRegMap = cUnit->promotionMap[i]; |
| 339 | std::string buf; |
| 340 | if (vRegMap.fpLocation == kLocPhysReg) { |
| 341 | StringAppendF(&buf, " : s%d", vRegMap.fpReg & FP_REG_MASK); |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 342 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 343 | |
| 344 | std::string buf3; |
| 345 | if (i < cUnit->numDalvikRegisters) { |
| 346 | StringAppendF(&buf3, "%02d", i); |
| 347 | } else if (i == cUnit->methodSReg) { |
| 348 | buf3 = "Method*"; |
| 349 | } else { |
| 350 | StringAppendF(&buf3, "ct%d", i - cUnit->numDalvikRegisters); |
| 351 | } |
| 352 | |
| 353 | LOG(INFO) << StringPrintf("V[%s] -> %s%d%s", buf3.c_str(), |
| 354 | vRegMap.coreLocation == kLocPhysReg ? |
| 355 | "r" : "SP+", vRegMap.coreLocation == kLocPhysReg ? |
| 356 | vRegMap.coreReg : oatSRegOffset(cUnit, i), |
| 357 | buf.c_str()); |
| 358 | } |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 359 | } |
| 360 | |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 361 | /* Dump instructions and constant pool contents */ |
| 362 | void oatCodegenDump(CompilationUnit* cUnit) |
| 363 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 364 | LOG(INFO) << "Dumping LIR insns for " |
| 365 | << PrettyMethod(cUnit->method_idx, *cUnit->dex_file); |
| 366 | LIR* lirInsn; |
| 367 | LIR* thisLIR; |
| 368 | int insnsSize = cUnit->insnsSize; |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 369 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 370 | LOG(INFO) << "Regs (excluding ins) : " << cUnit->numRegs; |
| 371 | LOG(INFO) << "Ins : " << cUnit->numIns; |
| 372 | LOG(INFO) << "Outs : " << cUnit->numOuts; |
| 373 | LOG(INFO) << "CoreSpills : " << cUnit->numCoreSpills; |
| 374 | LOG(INFO) << "FPSpills : " << cUnit->numFPSpills; |
| 375 | LOG(INFO) << "CompilerTemps : " << cUnit->numCompilerTemps; |
| 376 | LOG(INFO) << "Frame size : " << cUnit->frameSize; |
| 377 | LOG(INFO) << "code size is " << cUnit->totalSize << |
| 378 | " bytes, Dalvik size is " << insnsSize * 2; |
| 379 | LOG(INFO) << "expansion factor: " |
| 380 | << (float)cUnit->totalSize / (float)(insnsSize * 2); |
| 381 | oatDumpPromotionMap(cUnit); |
| 382 | for (lirInsn = cUnit->firstLIRInsn; lirInsn; lirInsn = lirInsn->next) { |
| 383 | oatDumpLIRInsn(cUnit, lirInsn, 0); |
| 384 | } |
| 385 | for (lirInsn = cUnit->classPointerList; lirInsn; lirInsn = lirInsn->next) { |
| 386 | thisLIR = (LIR*) lirInsn; |
| 387 | LOG(INFO) << StringPrintf("%x (%04x): .class (%s)", |
| 388 | thisLIR->offset, thisLIR->offset, |
| 389 | ((CallsiteInfo *) |
| 390 | thisLIR->operands[0])->classDescriptor); |
| 391 | } |
| 392 | for (lirInsn = cUnit->literalList; lirInsn; lirInsn = lirInsn->next) { |
| 393 | thisLIR = (LIR*) lirInsn; |
| 394 | LOG(INFO) << StringPrintf("%x (%04x): .word (%#x)", |
| 395 | thisLIR->offset, thisLIR->offset, |
| 396 | thisLIR->operands[0]); |
| 397 | } |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 398 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 399 | const DexFile::MethodId& method_id = |
| 400 | cUnit->dex_file->GetMethodId(cUnit->method_idx); |
| 401 | std::string signature(cUnit->dex_file->GetMethodSignature(method_id)); |
| 402 | std::string name(cUnit->dex_file->GetMethodName(method_id)); |
| 403 | std::string descriptor(cUnit->dex_file->GetMethodDeclaringClassDescriptor(method_id)); |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 404 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 405 | // Dump mapping table |
| 406 | if (cUnit->mappingTable.size() > 0) { |
| 407 | std::string |
| 408 | line(StringPrintf("\n MappingTable %s%s_%s_mappingTable[%zu] = {", |
| 409 | descriptor.c_str(), name.c_str(), signature.c_str(), |
| 410 | cUnit->mappingTable.size())); |
| 411 | std::replace(line.begin(), line.end(), ';', '_'); |
| 412 | LOG(INFO) << line; |
| 413 | for (uint32_t i = 0; i < cUnit->mappingTable.size(); i+=2) { |
| 414 | line = StringPrintf(" {0x%05x, 0x%04x},", |
| 415 | cUnit->mappingTable[i], cUnit->mappingTable[i+1]); |
| 416 | LOG(INFO) << line; |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 417 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 418 | LOG(INFO) <<" };\n\n"; |
| 419 | } |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 420 | } |
| 421 | |
buzbee | a2ebdd7 | 2012-03-04 14:57:06 -0800 | [diff] [blame] | 422 | |
| 423 | LIR* rawLIR(CompilationUnit* cUnit, int dalvikOffset, int opcode, int op0, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 424 | int op1, int op2, int op3, int op4, LIR* target) |
buzbee | a2ebdd7 | 2012-03-04 14:57:06 -0800 | [diff] [blame] | 425 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 426 | LIR* insn = (LIR* ) oatNew(cUnit, sizeof(LIR), true, kAllocLIR); |
| 427 | insn->dalvikOffset = dalvikOffset; |
| 428 | insn->opcode = opcode; |
| 429 | insn->operands[0] = op0; |
| 430 | insn->operands[1] = op1; |
| 431 | insn->operands[2] = op2; |
| 432 | insn->operands[3] = op3; |
| 433 | insn->operands[4] = op4; |
| 434 | insn->target = target; |
| 435 | oatSetupResourceMasks(insn); |
| 436 | if (opcode == kPseudoTargetLabel) { |
| 437 | // Always make labels scheduling barriers |
| 438 | insn->defMask = ENCODE_ALL; |
| 439 | } |
| 440 | return insn; |
buzbee | a2ebdd7 | 2012-03-04 14:57:06 -0800 | [diff] [blame] | 441 | } |
| 442 | |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 443 | /* |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 444 | * The following are building blocks to construct low-level IRs with 0 - 4 |
| 445 | * operands. |
| 446 | */ |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 447 | LIR* newLIR0(CompilationUnit* cUnit, int opcode) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 448 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 449 | DCHECK(isPseudoOpcode(opcode) || (EncodingMap[opcode].flags & NO_OPERAND)) |
| 450 | << EncodingMap[opcode].name << " " << (int)opcode << " " |
| 451 | << PrettyMethod(cUnit->method_idx, *cUnit->dex_file) << " " |
| 452 | << cUnit->currentDalvikOffset; |
| 453 | LIR* insn = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode); |
| 454 | oatAppendLIR(cUnit, (LIR*) insn); |
| 455 | return insn; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 456 | } |
| 457 | |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 458 | LIR* newLIR1(CompilationUnit* cUnit, int opcode, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 459 | int dest) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 460 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 461 | DCHECK(isPseudoOpcode(opcode) || (EncodingMap[opcode].flags & IS_UNARY_OP)) |
| 462 | << EncodingMap[opcode].name << " " << (int)opcode << " " |
| 463 | << PrettyMethod(cUnit->method_idx, *cUnit->dex_file) << " " |
| 464 | << cUnit->currentDalvikOffset; |
| 465 | LIR* insn = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest); |
| 466 | oatAppendLIR(cUnit, (LIR*) insn); |
| 467 | return insn; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 468 | } |
| 469 | |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 470 | LIR* newLIR2(CompilationUnit* cUnit, int opcode, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 471 | int dest, int src1) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 472 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 473 | DCHECK(isPseudoOpcode(opcode) || (EncodingMap[opcode].flags & IS_BINARY_OP)) |
| 474 | << EncodingMap[opcode].name << " " << (int)opcode << " " |
| 475 | << PrettyMethod(cUnit->method_idx, *cUnit->dex_file) << " " |
| 476 | << cUnit->currentDalvikOffset; |
| 477 | LIR* insn = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest, src1); |
| 478 | oatAppendLIR(cUnit, (LIR*) insn); |
| 479 | return insn; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 480 | } |
| 481 | |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 482 | LIR* newLIR3(CompilationUnit* cUnit, int opcode, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 483 | int dest, int src1, int src2) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 484 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 485 | DCHECK(isPseudoOpcode(opcode) || (EncodingMap[opcode].flags & IS_TERTIARY_OP)) |
| 486 | << EncodingMap[opcode].name << " " << (int)opcode << " " |
| 487 | << PrettyMethod(cUnit->method_idx, *cUnit->dex_file) << " " |
| 488 | << cUnit->currentDalvikOffset; |
| 489 | LIR* insn = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest, src1, |
| 490 | src2); |
| 491 | oatAppendLIR(cUnit, (LIR*) insn); |
| 492 | return insn; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 493 | } |
| 494 | |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 495 | LIR* newLIR4(CompilationUnit* cUnit, int opcode, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 496 | int dest, int src1, int src2, int info) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 497 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 498 | DCHECK(isPseudoOpcode(opcode) || (EncodingMap[opcode].flags & IS_QUAD_OP)) |
| 499 | << EncodingMap[opcode].name << " " << (int)opcode << " " |
| 500 | << PrettyMethod(cUnit->method_idx, *cUnit->dex_file) << " " |
| 501 | << cUnit->currentDalvikOffset; |
| 502 | LIR* insn = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest, src1, |
| 503 | src2, info); |
| 504 | oatAppendLIR(cUnit, (LIR*) insn); |
| 505 | return insn; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 506 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 507 | |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 508 | LIR* newLIR5(CompilationUnit* cUnit, int opcode, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 509 | int dest, int src1, int src2, int info1, int info2) |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 510 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 511 | DCHECK(isPseudoOpcode(opcode) || (EncodingMap[opcode].flags & IS_QUIN_OP)) |
| 512 | << EncodingMap[opcode].name << " " << (int)opcode << " " |
| 513 | << PrettyMethod(cUnit->method_idx, *cUnit->dex_file) << " " |
| 514 | << cUnit->currentDalvikOffset; |
| 515 | LIR* insn = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, dest, src1, |
| 516 | src2, info1, info2); |
| 517 | oatAppendLIR(cUnit, (LIR*) insn); |
| 518 | return insn; |
Ian Rogers | b5d09b2 | 2012-03-06 22:14:17 -0800 | [diff] [blame] | 519 | } |
| 520 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 521 | /* |
| 522 | * Search the existing constants in the literal pool for an exact or close match |
| 523 | * within specified delta (greater or equal to 0). |
| 524 | */ |
| 525 | LIR* scanLiteralPool(LIR* dataTarget, int value, unsigned int delta) |
| 526 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 527 | while (dataTarget) { |
| 528 | if (((unsigned) (value - ((LIR* ) dataTarget)->operands[0])) <= delta) |
| 529 | return (LIR* ) dataTarget; |
| 530 | dataTarget = dataTarget->next; |
| 531 | } |
| 532 | return NULL; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 533 | } |
| 534 | |
| 535 | /* Search the existing constants in the literal pool for an exact wide match */ |
| 536 | LIR* scanLiteralPoolWide(LIR* dataTarget, int valLo, int valHi) |
| 537 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 538 | bool loMatch = false; |
| 539 | LIR* loTarget = NULL; |
| 540 | while (dataTarget) { |
| 541 | if (loMatch && (((LIR*)dataTarget)->operands[0] == valHi)) { |
| 542 | return (LIR*)loTarget; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 543 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 544 | loMatch = false; |
| 545 | if (((LIR*)dataTarget)->operands[0] == valLo) { |
| 546 | loMatch = true; |
| 547 | loTarget = dataTarget; |
| 548 | } |
| 549 | dataTarget = dataTarget->next; |
| 550 | } |
| 551 | return NULL; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 552 | } |
| 553 | |
| 554 | /* |
| 555 | * The following are building blocks to insert constants into the pool or |
| 556 | * instruction streams. |
| 557 | */ |
| 558 | |
buzbee | 5de3494 | 2012-03-01 14:51:57 -0800 | [diff] [blame] | 559 | /* Add a 32-bit constant either in the constant pool */ |
Ian Rogers | 3fa1379 | 2012-03-18 15:53:45 -0700 | [diff] [blame] | 560 | LIR* addWordData(CompilationUnit* cUnit, LIR* *constantListP, int value) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 561 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 562 | /* Add the constant to the literal pool */ |
| 563 | if (constantListP) { |
| 564 | LIR* newValue = (LIR* ) oatNew(cUnit, sizeof(LIR), true, kAllocData); |
| 565 | newValue->operands[0] = value; |
| 566 | newValue->next = *constantListP; |
| 567 | *constantListP = (LIR*) newValue; |
| 568 | return newValue; |
| 569 | } |
| 570 | return NULL; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | /* Add a 64-bit constant to the constant pool or mixed with code */ |
| 574 | LIR* addWideData(CompilationUnit* cUnit, LIR* *constantListP, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 575 | int valLo, int valHi) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 576 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 577 | //FIXME: hard-coded little endian, need BE variant |
| 578 | // Insert high word into list first |
| 579 | addWordData(cUnit, constantListP, valHi); |
| 580 | return addWordData(cUnit, constantListP, valLo); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 581 | } |
| 582 | |
Ian Rogers | ab058bb | 2012-03-11 22:19:38 -0700 | [diff] [blame] | 583 | void pushWord(std::vector<uint8_t>&buf, int data) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 584 | buf.push_back( data & 0xff); |
| 585 | buf.push_back( (data >> 8) & 0xff); |
| 586 | buf.push_back( (data >> 16) & 0xff); |
| 587 | buf.push_back( (data >> 24) & 0xff); |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 588 | } |
| 589 | |
Ian Rogers | ab058bb | 2012-03-11 22:19:38 -0700 | [diff] [blame] | 590 | void alignBuffer(std::vector<uint8_t>&buf, size_t offset) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 591 | while (buf.size() < offset) { |
| 592 | buf.push_back(0); |
| 593 | } |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 594 | } |
| 595 | |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 596 | bool IsDirect(int invokeType) { |
| 597 | InvokeType type = static_cast<InvokeType>(invokeType); |
| 598 | return type == kStatic || type == kDirect; |
| 599 | } |
| 600 | |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 601 | /* Write the literal pool to the output stream */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 602 | void installLiteralPools(CompilationUnit* cUnit) |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 603 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 604 | alignBuffer(cUnit->codeBuffer, cUnit->dataOffset); |
| 605 | LIR* dataLIR = cUnit->literalList; |
| 606 | while (dataLIR != NULL) { |
| 607 | pushWord(cUnit->codeBuffer, dataLIR->operands[0]); |
| 608 | dataLIR = NEXT_LIR(dataLIR); |
| 609 | } |
| 610 | // Push code and method literals, record offsets for the compiler to patch. |
| 611 | dataLIR = cUnit->codeLiteralList; |
| 612 | if (dataLIR != NULL) { |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 613 | while (dataLIR != NULL) { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 614 | uint32_t target = dataLIR->operands[0]; |
| 615 | cUnit->compiler->AddCodePatch(cUnit->dex_cache, cUnit->dex_file, |
| 616 | cUnit->method_idx, |
| 617 | cUnit->access_flags, |
| 618 | target, |
| 619 | IsDirect(dataLIR->operands[1]), |
| 620 | cUnit->codeBuffer.size()); |
| 621 | const DexFile::MethodId& id = cUnit->dex_file->GetMethodId(target); |
| 622 | // unique based on target to ensure code deduplication works |
| 623 | uint32_t unique_patch_value = reinterpret_cast<uint32_t>(&id); |
| 624 | pushWord(cUnit->codeBuffer, unique_patch_value); |
| 625 | dataLIR = NEXT_LIR(dataLIR); |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 626 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 627 | dataLIR = cUnit->methodLiteralList; |
| 628 | while (dataLIR != NULL) { |
| 629 | uint32_t target = dataLIR->operands[0]; |
| 630 | cUnit->compiler->AddMethodPatch(cUnit->dex_cache, cUnit->dex_file, |
| 631 | cUnit->method_idx, |
| 632 | cUnit->access_flags, |
| 633 | target, |
| 634 | IsDirect(dataLIR->operands[1]), |
| 635 | cUnit->codeBuffer.size()); |
| 636 | const DexFile::MethodId& id = cUnit->dex_file->GetMethodId(target); |
| 637 | // unique based on target to ensure code deduplication works |
| 638 | uint32_t unique_patch_value = reinterpret_cast<uint32_t>(&id); |
| 639 | pushWord(cUnit->codeBuffer, unique_patch_value); |
| 640 | dataLIR = NEXT_LIR(dataLIR); |
Ian Rogers | 3fa1379 | 2012-03-18 15:53:45 -0700 | [diff] [blame] | 641 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 642 | } |
Ian Rogers | 3fa1379 | 2012-03-18 15:53:45 -0700 | [diff] [blame] | 643 | |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 644 | } |
| 645 | |
| 646 | /* Write the switch tables to the output stream */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 647 | void installSwitchTables(CompilationUnit* cUnit) |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 648 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 649 | GrowableListIterator iterator; |
| 650 | oatGrowableListIteratorInit(&cUnit->switchTables, &iterator); |
| 651 | while (true) { |
| 652 | SwitchTable* tabRec = (SwitchTable *) oatGrowableListIteratorNext( |
| 653 | &iterator); |
| 654 | if (tabRec == NULL) break; |
| 655 | alignBuffer(cUnit->codeBuffer, tabRec->offset); |
| 656 | /* |
| 657 | * For Arm, our reference point is the address of the bx |
| 658 | * instruction that does the launch, so we have to subtract |
| 659 | * the auto pc-advance. For other targets the reference point |
| 660 | * is a label, so we can use the offset as-is. |
| 661 | */ |
buzbee | c5159d5 | 2012-03-03 11:48:39 -0800 | [diff] [blame] | 662 | #if defined(TARGET_ARM) |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 663 | int bxOffset = tabRec->anchor->offset + 4; |
Ian Rogers | 7caad77 | 2012-03-30 01:07:54 -0700 | [diff] [blame] | 664 | #elif defined(TARGET_X86) |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 665 | int bxOffset = 0; |
buzbee | c5159d5 | 2012-03-03 11:48:39 -0800 | [diff] [blame] | 666 | #else |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 667 | int bxOffset = tabRec->anchor->offset; |
buzbee | c5159d5 | 2012-03-03 11:48:39 -0800 | [diff] [blame] | 668 | #endif |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 669 | if (cUnit->printMe) { |
| 670 | LOG(INFO) << "Switch table for offset 0x" << std::hex << bxOffset; |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 671 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 672 | if (tabRec->table[0] == Instruction::kSparseSwitchSignature) { |
| 673 | int* keys = (int*)&(tabRec->table[2]); |
| 674 | for (int elems = 0; elems < tabRec->table[1]; elems++) { |
| 675 | int disp = tabRec->targets[elems]->offset - bxOffset; |
| 676 | if (cUnit->printMe) { |
| 677 | LOG(INFO) << " Case[" << elems << "] key: 0x" |
| 678 | << std::hex << keys[elems] << ", disp: 0x" |
| 679 | << std::hex << disp; |
| 680 | } |
| 681 | pushWord(cUnit->codeBuffer, keys[elems]); |
| 682 | pushWord(cUnit->codeBuffer, |
| 683 | tabRec->targets[elems]->offset - bxOffset); |
| 684 | } |
| 685 | } else { |
| 686 | DCHECK_EQ(static_cast<int>(tabRec->table[0]), |
| 687 | static_cast<int>(Instruction::kPackedSwitchSignature)); |
| 688 | for (int elems = 0; elems < tabRec->table[1]; elems++) { |
| 689 | int disp = tabRec->targets[elems]->offset - bxOffset; |
| 690 | if (cUnit->printMe) { |
| 691 | LOG(INFO) << " Case[" << elems << "] disp: 0x" |
| 692 | << std::hex << disp; |
| 693 | } |
| 694 | pushWord(cUnit->codeBuffer, tabRec->targets[elems]->offset - bxOffset); |
| 695 | } |
| 696 | } |
| 697 | } |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 698 | } |
| 699 | |
| 700 | /* Write the fill array dta to the output stream */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 701 | void installFillArrayData(CompilationUnit* cUnit) |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 702 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 703 | GrowableListIterator iterator; |
| 704 | oatGrowableListIteratorInit(&cUnit->fillArrayData, &iterator); |
| 705 | while (true) { |
| 706 | FillArrayData *tabRec = (FillArrayData *) oatGrowableListIteratorNext( |
| 707 | &iterator); |
| 708 | if (tabRec == NULL) break; |
| 709 | alignBuffer(cUnit->codeBuffer, tabRec->offset); |
| 710 | for (int i = 0; i < (tabRec->size + 1) / 2; i++) { |
| 711 | cUnit->codeBuffer.push_back( tabRec->table[i] & 0xFF); |
| 712 | cUnit->codeBuffer.push_back( (tabRec->table[i] >> 8) & 0xFF); |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 713 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 714 | } |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 715 | } |
| 716 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 717 | int assignLiteralOffsetCommon(LIR* lir, int offset) |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 718 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 719 | for (;lir != NULL; lir = lir->next) { |
| 720 | lir->offset = offset; |
| 721 | offset += 4; |
| 722 | } |
| 723 | return offset; |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 724 | } |
| 725 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 726 | void createMappingTable(CompilationUnit* cUnit) |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 727 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 728 | LIR* tgtLIR; |
| 729 | int currentDalvikOffset = -1; |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 730 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 731 | for (tgtLIR = (LIR *) cUnit->firstLIRInsn; |
| 732 | tgtLIR; |
| 733 | tgtLIR = NEXT_LIR(tgtLIR)) { |
| 734 | if ((tgtLIR->opcode >= 0) && !tgtLIR->flags.isNop && |
| 735 | (currentDalvikOffset != tgtLIR->dalvikOffset)) { |
| 736 | // Changed - need to emit a record |
| 737 | cUnit->mappingTable.push_back(tgtLIR->offset); |
| 738 | cUnit->mappingTable.push_back(tgtLIR->dalvikOffset); |
| 739 | currentDalvikOffset = tgtLIR->dalvikOffset; |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 740 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 741 | } |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 742 | } |
| 743 | |
| 744 | /* Determine the offset of each literal field */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 745 | int assignLiteralOffset(CompilationUnit* cUnit, int offset) |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 746 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 747 | offset = assignLiteralOffsetCommon(cUnit->literalList, offset); |
| 748 | offset = assignLiteralOffsetCommon(cUnit->codeLiteralList, offset); |
| 749 | offset = assignLiteralOffsetCommon(cUnit->methodLiteralList, offset); |
| 750 | return offset; |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 751 | } |
| 752 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 753 | int assignSwitchTablesOffset(CompilationUnit* cUnit, int offset) |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 754 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 755 | GrowableListIterator iterator; |
| 756 | oatGrowableListIteratorInit(&cUnit->switchTables, &iterator); |
| 757 | while (true) { |
| 758 | SwitchTable *tabRec = (SwitchTable *) oatGrowableListIteratorNext( |
| 759 | &iterator); |
| 760 | if (tabRec == NULL) break; |
| 761 | tabRec->offset = offset; |
| 762 | if (tabRec->table[0] == Instruction::kSparseSwitchSignature) { |
| 763 | offset += tabRec->table[1] * (sizeof(int) * 2); |
| 764 | } else { |
| 765 | DCHECK_EQ(static_cast<int>(tabRec->table[0]), |
| 766 | static_cast<int>(Instruction::kPackedSwitchSignature)); |
| 767 | offset += tabRec->table[1] * sizeof(int); |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 768 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 769 | } |
| 770 | return offset; |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 771 | } |
| 772 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 773 | int assignFillArrayDataOffset(CompilationUnit* cUnit, int offset) |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 774 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 775 | GrowableListIterator iterator; |
| 776 | oatGrowableListIteratorInit(&cUnit->fillArrayData, &iterator); |
| 777 | while (true) { |
| 778 | FillArrayData *tabRec = (FillArrayData *) oatGrowableListIteratorNext( |
| 779 | &iterator); |
| 780 | if (tabRec == NULL) break; |
| 781 | tabRec->offset = offset; |
| 782 | offset += tabRec->size; |
| 783 | // word align |
| 784 | offset = (offset + 3) & ~3; |
| 785 | } |
| 786 | return offset; |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 787 | } |
| 788 | |
| 789 | /* |
| 790 | * Walk the compilation unit and assign offsets to instructions |
| 791 | * and literals and compute the total size of the compiled unit. |
| 792 | */ |
| 793 | void oatAssignOffsets(CompilationUnit* cUnit) |
| 794 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 795 | int offset = oatAssignInsnOffsets(cUnit); |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 796 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 797 | /* Const values have to be word aligned */ |
| 798 | offset = (offset + 3) & ~3; |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 799 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 800 | /* Set up offsets for literals */ |
| 801 | cUnit->dataOffset = offset; |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 802 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 803 | offset = assignLiteralOffset(cUnit, offset); |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 804 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 805 | offset = assignSwitchTablesOffset(cUnit, offset); |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 806 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 807 | offset = assignFillArrayDataOffset(cUnit, offset); |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 808 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 809 | cUnit->totalSize = offset; |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 810 | } |
| 811 | |
| 812 | /* |
| 813 | * Go over each instruction in the list and calculate the offset from the top |
| 814 | * before sending them off to the assembler. If out-of-range branch distance is |
| 815 | * seen rearrange the instructions a bit to correct it. |
| 816 | */ |
| 817 | void oatAssembleLIR(CompilationUnit* cUnit) |
| 818 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 819 | oatAssignOffsets(cUnit); |
| 820 | /* |
| 821 | * Assemble here. Note that we generate code with optimistic assumptions |
| 822 | * and if found now to work, we'll have to redo the sequence and retry. |
| 823 | */ |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 824 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 825 | while (true) { |
| 826 | AssemblerStatus res = oatAssembleInstructions(cUnit, 0); |
| 827 | if (res == kSuccess) { |
| 828 | break; |
| 829 | } else { |
| 830 | cUnit->assemblerRetries++; |
| 831 | if (cUnit->assemblerRetries > MAX_ASSEMBLER_RETRIES) { |
| 832 | oatCodegenDump(cUnit); |
| 833 | LOG(FATAL) << "Assembler error - too many retries"; |
| 834 | } |
| 835 | // Redo offsets and try again |
| 836 | oatAssignOffsets(cUnit); |
| 837 | cUnit->codeBuffer.clear(); |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 838 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 839 | } |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 840 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 841 | // Install literals |
| 842 | installLiteralPools(cUnit); |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 843 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 844 | // Install switch tables |
| 845 | installSwitchTables(cUnit); |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 846 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 847 | // Install fill array data |
| 848 | installFillArrayData(cUnit); |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 849 | |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 850 | /* |
| 851 | * Create the mapping table |
| 852 | */ |
| 853 | createMappingTable(cUnit); |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 854 | } |
| 855 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 856 | /* |
| 857 | * Insert a kPseudoCaseLabel at the beginning of the Dalvik |
| 858 | * offset vaddr. This label will be used to fix up the case |
| 859 | * branch table during the assembly phase. Be sure to set |
| 860 | * all resource flags on this to prevent code motion across |
| 861 | * target boundaries. KeyVal is just there for debugging. |
| 862 | */ |
| 863 | LIR* insertCaseLabel(CompilationUnit* cUnit, int vaddr, int keyVal) |
| 864 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 865 | SafeMap<unsigned int, LIR*>::iterator it; |
| 866 | it = cUnit->boundaryMap.find(vaddr); |
| 867 | if (it == cUnit->boundaryMap.end()) { |
| 868 | LOG(FATAL) << "Error: didn't find vaddr 0x" << std::hex << vaddr; |
| 869 | } |
| 870 | LIR* newLabel = (LIR*)oatNew(cUnit, sizeof(LIR), true, kAllocLIR); |
| 871 | newLabel->dalvikOffset = vaddr; |
| 872 | newLabel->opcode = kPseudoCaseLabel; |
| 873 | newLabel->operands[0] = keyVal; |
| 874 | oatInsertLIRAfter(it->second, (LIR*)newLabel); |
| 875 | return newLabel; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 876 | } |
| 877 | |
| 878 | void markPackedCaseLabels(CompilationUnit* cUnit, SwitchTable *tabRec) |
| 879 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 880 | const u2* table = tabRec->table; |
| 881 | int baseVaddr = tabRec->vaddr; |
| 882 | int *targets = (int*)&table[4]; |
| 883 | int entries = table[1]; |
| 884 | int lowKey = s4FromSwitchData(&table[2]); |
| 885 | for (int i = 0; i < entries; i++) { |
| 886 | tabRec->targets[i] = insertCaseLabel(cUnit, baseVaddr + targets[i], |
| 887 | i + lowKey); |
| 888 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 889 | } |
| 890 | |
| 891 | void markSparseCaseLabels(CompilationUnit* cUnit, SwitchTable *tabRec) |
| 892 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 893 | const u2* table = tabRec->table; |
| 894 | int baseVaddr = tabRec->vaddr; |
| 895 | int entries = table[1]; |
| 896 | int* keys = (int*)&table[2]; |
| 897 | int* targets = &keys[entries]; |
| 898 | for (int i = 0; i < entries; i++) { |
| 899 | tabRec->targets[i] = insertCaseLabel(cUnit, baseVaddr + targets[i], |
| 900 | keys[i]); |
| 901 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 902 | } |
| 903 | |
| 904 | void oatProcessSwitchTables(CompilationUnit* cUnit) |
| 905 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 906 | GrowableListIterator iterator; |
| 907 | oatGrowableListIteratorInit(&cUnit->switchTables, &iterator); |
| 908 | while (true) { |
| 909 | SwitchTable *tabRec = |
| 910 | (SwitchTable *) oatGrowableListIteratorNext(&iterator); |
| 911 | if (tabRec == NULL) break; |
| 912 | if (tabRec->table[0] == Instruction::kPackedSwitchSignature) { |
| 913 | markPackedCaseLabels(cUnit, tabRec); |
| 914 | } else if (tabRec->table[0] == Instruction::kSparseSwitchSignature) { |
| 915 | markSparseCaseLabels(cUnit, tabRec); |
| 916 | } else { |
| 917 | LOG(FATAL) << "Invalid switch table"; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 918 | } |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 919 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 920 | } |
| 921 | |
| 922 | //FIXME: Do we have endian issues here? |
| 923 | |
| 924 | void dumpSparseSwitchTable(const u2* table) |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 925 | /* |
| 926 | * Sparse switch data format: |
| 927 | * ushort ident = 0x0200 magic value |
| 928 | * ushort size number of entries in the table; > 0 |
| 929 | * int keys[size] keys, sorted low-to-high; 32-bit aligned |
| 930 | * int targets[size] branch targets, relative to switch opcode |
| 931 | * |
| 932 | * Total size is (2+size*4) 16-bit code units. |
| 933 | */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 934 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 935 | u2 ident = table[0]; |
| 936 | int entries = table[1]; |
| 937 | int* keys = (int*)&table[2]; |
| 938 | int* targets = &keys[entries]; |
| 939 | LOG(INFO) << "Sparse switch table - ident:0x" << std::hex << ident |
| 940 | << ", entries: " << std::dec << entries; |
| 941 | for (int i = 0; i < entries; i++) { |
| 942 | LOG(INFO) << " Key[" << keys[i] << "] -> 0x" << std::hex << targets[i]; |
| 943 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 944 | } |
| 945 | |
| 946 | void dumpPackedSwitchTable(const u2* table) |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 947 | /* |
| 948 | * Packed switch data format: |
| 949 | * ushort ident = 0x0100 magic value |
| 950 | * ushort size number of entries in the table |
| 951 | * int first_key first (and lowest) switch case value |
| 952 | * int targets[size] branch targets, relative to switch opcode |
| 953 | * |
| 954 | * Total size is (4+size*2) 16-bit code units. |
| 955 | */ |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 956 | { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 957 | u2 ident = table[0]; |
| 958 | int* targets = (int*)&table[4]; |
| 959 | int entries = table[1]; |
| 960 | int lowKey = s4FromSwitchData(&table[2]); |
| 961 | LOG(INFO) << "Packed switch table - ident:0x" << std::hex << ident |
| 962 | << ", entries: " << std::dec << entries << ", lowKey: " << lowKey; |
| 963 | for (int i = 0; i < entries; i++) { |
| 964 | LOG(INFO) << " Key[" << (i + lowKey) << "] -> 0x" << std::hex |
| 965 | << targets[i]; |
| 966 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 967 | } |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 968 | |
| 969 | |
| 970 | } // namespace art |