buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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 | |
| 19 | /* |
| 20 | * This source files contains "gen" codegen routines that should |
| 21 | * be applicable to most targets. Only mid-level support utilities |
| 22 | * and "op" calls may be used here. |
| 23 | */ |
| 24 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 25 | typedef int (*NextCallInsn)(CompilationUnit*, MIR*, int, uint32_t dexIdx, |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 26 | uint32_t methodIdx, uintptr_t directCode, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 27 | uintptr_t directMethod, InvokeType type); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 28 | /* |
| 29 | * If there are any ins passed in registers that have not been promoted |
| 30 | * to a callee-save register, flush them to the frame. Perform intial |
| 31 | * assignment of promoted arguments. |
| 32 | */ |
| 33 | void flushIns(CompilationUnit* cUnit) |
| 34 | { |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 35 | /* |
| 36 | * Dummy up a RegLocation for the incoming Method* |
| 37 | * It will attempt to keep rARG0 live (or copy it to home location |
| 38 | * if promoted). |
| 39 | */ |
| 40 | RegLocation rlSrc = cUnit->regLocation[cUnit->methodSReg]; |
| 41 | RegLocation rlMethod = cUnit->regLocation[cUnit->methodSReg]; |
| 42 | rlSrc.location = kLocPhysReg; |
| 43 | rlSrc.lowReg = rARG0; |
| 44 | rlSrc.home = false; |
| 45 | oatMarkLive(cUnit, rlSrc.lowReg, rlSrc.sRegLow); |
| 46 | storeValue(cUnit, rlMethod, rlSrc); |
| 47 | // If Method* has been promoted, explicitly flush |
| 48 | if (rlMethod.location == kLocPhysReg) { |
| 49 | storeWordDisp(cUnit, rSP, 0, rARG0); |
| 50 | } |
| 51 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 52 | if (cUnit->numIns == 0) |
| 53 | return; |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 54 | #if !defined(TARGET_X86) |
Ian Rogers | b3ab25b | 2012-03-19 01:12:01 -0700 | [diff] [blame] | 55 | const int numArgRegs = 3; |
| 56 | static int argRegs[] = {rARG1, rARG2, rARG3}; |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 57 | #else |
Ian Rogers | b3ab25b | 2012-03-19 01:12:01 -0700 | [diff] [blame] | 58 | const int numArgRegs = 2; |
| 59 | static int argRegs[] = {rARG1, rARG2}; |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 60 | #endif |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 61 | int startVReg = cUnit->numDalvikRegisters - cUnit->numIns; |
| 62 | /* |
buzbee | 86a4bce | 2012-03-06 18:15:00 -0800 | [diff] [blame] | 63 | * Copy incoming arguments to their proper home locations. |
| 64 | * NOTE: an older version of dx had an issue in which |
| 65 | * it would reuse static method argument registers. |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 66 | * This could result in the same Dalvik virtual register |
buzbee | 86a4bce | 2012-03-06 18:15:00 -0800 | [diff] [blame] | 67 | * being promoted to both core and fp regs. To account for this, |
| 68 | * we only copy to the corresponding promoted physical register |
| 69 | * if it matches the type of the SSA name for the incoming |
| 70 | * argument. It is also possible that long and double arguments |
| 71 | * end up half-promoted. In those cases, we must flush the promoted |
| 72 | * half to memory as well. |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 73 | */ |
| 74 | for (int i = 0; i < cUnit->numIns; i++) { |
buzbee | 86a4bce | 2012-03-06 18:15:00 -0800 | [diff] [blame] | 75 | PromotionMap* vMap = &cUnit->promotionMap[startVReg + i]; |
Ian Rogers | b3ab25b | 2012-03-19 01:12:01 -0700 | [diff] [blame] | 76 | if (i < numArgRegs) { |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 77 | // If arriving in register |
buzbee | 86a4bce | 2012-03-06 18:15:00 -0800 | [diff] [blame] | 78 | bool needFlush = true; |
| 79 | RegLocation* tLoc = &cUnit->regLocation[startVReg + i]; |
| 80 | if ((vMap->coreLocation == kLocPhysReg) && !tLoc->fp) { |
Ian Rogers | b3ab25b | 2012-03-19 01:12:01 -0700 | [diff] [blame] | 81 | opRegCopy(cUnit, vMap->coreReg, argRegs[i]); |
buzbee | 86a4bce | 2012-03-06 18:15:00 -0800 | [diff] [blame] | 82 | needFlush = false; |
| 83 | } else if ((vMap->fpLocation == kLocPhysReg) && tLoc->fp) { |
Ian Rogers | b3ab25b | 2012-03-19 01:12:01 -0700 | [diff] [blame] | 84 | opRegCopy(cUnit, vMap->fpReg, argRegs[i]); |
buzbee | 86a4bce | 2012-03-06 18:15:00 -0800 | [diff] [blame] | 85 | needFlush = false; |
| 86 | } else { |
| 87 | needFlush = true; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 88 | } |
buzbee | 86a4bce | 2012-03-06 18:15:00 -0800 | [diff] [blame] | 89 | |
| 90 | // For wide args, force flush if only half is promoted |
| 91 | if (tLoc->wide) { |
| 92 | PromotionMap* pMap = vMap + (tLoc->highWord ? -1 : +1); |
| 93 | needFlush |= (pMap->coreLocation != vMap->coreLocation) || |
| 94 | (pMap->fpLocation != vMap->fpLocation); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 95 | } |
buzbee | 86a4bce | 2012-03-06 18:15:00 -0800 | [diff] [blame] | 96 | if (needFlush) { |
| 97 | storeBaseDisp(cUnit, rSP, oatSRegOffset(cUnit, startVReg + i), |
Ian Rogers | b3ab25b | 2012-03-19 01:12:01 -0700 | [diff] [blame] | 98 | argRegs[i], kWord); |
buzbee | 86a4bce | 2012-03-06 18:15:00 -0800 | [diff] [blame] | 99 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 100 | } else { |
| 101 | // If arriving in frame & promoted |
buzbee | 86a4bce | 2012-03-06 18:15:00 -0800 | [diff] [blame] | 102 | if (vMap->coreLocation == kLocPhysReg) { |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 103 | loadWordDisp(cUnit, rSP, oatSRegOffset(cUnit, startVReg + i), |
buzbee | 86a4bce | 2012-03-06 18:15:00 -0800 | [diff] [blame] | 104 | vMap->coreReg); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 105 | } |
buzbee | 86a4bce | 2012-03-06 18:15:00 -0800 | [diff] [blame] | 106 | if (vMap->fpLocation == kLocPhysReg) { |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 107 | loadWordDisp(cUnit, rSP, oatSRegOffset(cUnit, startVReg + i), |
buzbee | 86a4bce | 2012-03-06 18:15:00 -0800 | [diff] [blame] | 108 | vMap->fpReg); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 109 | } |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | |
Ian Rogers | 3fa1379 | 2012-03-18 15:53:45 -0700 | [diff] [blame] | 114 | void scanMethodLiteralPool(CompilationUnit* cUnit, LIR** methodTarget, LIR** codeTarget, const DexFile* dexFile, uint32_t dexMethodIdx) |
| 115 | { |
| 116 | LIR* curTarget = cUnit->methodLiteralList; |
| 117 | LIR* nextTarget = curTarget != NULL ? curTarget->next : NULL; |
| 118 | while (curTarget != NULL && nextTarget != NULL) { |
| 119 | if (curTarget->operands[0] == (int)dexFile && |
| 120 | nextTarget->operands[0] == (int)dexMethodIdx) { |
| 121 | *codeTarget = curTarget; |
| 122 | *methodTarget = nextTarget; |
| 123 | DCHECK((*codeTarget)->next == *methodTarget); |
| 124 | DCHECK_EQ((*codeTarget)->operands[0], (int)dexFile); |
| 125 | DCHECK_EQ((*methodTarget)->operands[0], (int)dexMethodIdx); |
| 126 | break; |
| 127 | } |
| 128 | curTarget = nextTarget->next; |
| 129 | nextTarget = curTarget != NULL ? curTarget->next : NULL; |
| 130 | } |
| 131 | } |
| 132 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 133 | /* |
Elliott Hughes | bdf6c3d | 2012-03-20 13:43:53 -0700 | [diff] [blame] | 134 | * Bit of a hack here - in the absence of a real scheduling pass, |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 135 | * emit the next instruction in static & direct invoke sequences. |
| 136 | */ |
| 137 | int nextSDCallInsn(CompilationUnit* cUnit, MIR* mir, |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 138 | int state, uint32_t dexIdx, uint32_t unused, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 139 | uintptr_t directCode, uintptr_t directMethod, |
| 140 | InvokeType type) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 141 | { |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 142 | #if !defined(TARGET_ARM) |
| 143 | directCode = 0; |
| 144 | directMethod = 0; |
| 145 | #endif |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 146 | if (directCode != 0 && directMethod != 0) { |
| 147 | switch(state) { |
| 148 | case 0: // Get the current Method* [sets rARG0] |
Ian Rogers | 3fa1379 | 2012-03-18 15:53:45 -0700 | [diff] [blame] | 149 | if (directCode != (uintptr_t)-1) { |
| 150 | loadConstant(cUnit, rINVOKE_TGT, directCode); |
| 151 | } else { |
| 152 | LIR* dataTarget = scanLiteralPool(cUnit->codeLiteralList, dexIdx, 0); |
| 153 | if (dataTarget == NULL) { |
| 154 | dataTarget = addWordData(cUnit, &cUnit->codeLiteralList, dexIdx); |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 155 | dataTarget->operands[1] = type; |
Ian Rogers | 3fa1379 | 2012-03-18 15:53:45 -0700 | [diff] [blame] | 156 | } |
| 157 | #if defined(TARGET_ARM) |
| 158 | LIR* loadPcRel = rawLIR(cUnit, cUnit->currentDalvikOffset, |
| 159 | kThumb2LdrPcRel12, rINVOKE_TGT, 0, 0, 0, 0, dataTarget); |
| 160 | oatAppendLIR(cUnit, loadPcRel); |
| 161 | #else |
| 162 | UNIMPLEMENTED(FATAL) << (void*)dataTarget; |
| 163 | #endif |
| 164 | } |
| 165 | if (directMethod != (uintptr_t)-1) { |
| 166 | loadConstant(cUnit, rARG0, directMethod); |
| 167 | } else { |
| 168 | LIR* dataTarget = scanLiteralPool(cUnit->methodLiteralList, dexIdx, 0); |
| 169 | if (dataTarget == NULL) { |
| 170 | dataTarget = addWordData(cUnit, &cUnit->methodLiteralList, dexIdx); |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 171 | dataTarget->operands[1] = type; |
Ian Rogers | 3fa1379 | 2012-03-18 15:53:45 -0700 | [diff] [blame] | 172 | } |
| 173 | #if defined(TARGET_ARM) |
| 174 | LIR* loadPcRel = rawLIR(cUnit, cUnit->currentDalvikOffset, |
| 175 | kThumb2LdrPcRel12, rARG0, 0, 0, 0, 0, dataTarget); |
| 176 | oatAppendLIR(cUnit, loadPcRel); |
| 177 | #else |
| 178 | UNIMPLEMENTED(FATAL) << (void*)dataTarget; |
| 179 | #endif |
| 180 | } |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 181 | break; |
| 182 | default: |
| 183 | return -1; |
| 184 | } |
| 185 | } else { |
| 186 | switch(state) { |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 187 | case 0: // Get the current Method* [sets rARG0] |
buzbee | 9c044ce | 2012-03-18 13:24:07 -0700 | [diff] [blame] | 188 | // TUNING: we can save a reg copy if Method* has been promoted |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 189 | loadCurrMethodDirect(cUnit, rARG0); |
| 190 | break; |
| 191 | case 1: // Get method->dex_cache_resolved_methods_ |
| 192 | loadWordDisp(cUnit, rARG0, |
| 193 | Method::DexCacheResolvedMethodsOffset().Int32Value(), |
| 194 | rARG0); |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 195 | // Set up direct code if known. |
| 196 | if (directCode != 0) { |
Ian Rogers | 3fa1379 | 2012-03-18 15:53:45 -0700 | [diff] [blame] | 197 | if (directCode != (uintptr_t)-1) { |
| 198 | loadConstant(cUnit, rINVOKE_TGT, directCode); |
| 199 | } else { |
| 200 | LIR* dataTarget = scanLiteralPool(cUnit->codeLiteralList, dexIdx, 0); |
| 201 | if (dataTarget == NULL) { |
| 202 | dataTarget = addWordData(cUnit, &cUnit->codeLiteralList, dexIdx); |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 203 | dataTarget->operands[1] = type; |
Ian Rogers | 3fa1379 | 2012-03-18 15:53:45 -0700 | [diff] [blame] | 204 | } |
| 205 | #if defined(TARGET_ARM) |
| 206 | LIR* loadPcRel = rawLIR(cUnit, cUnit->currentDalvikOffset, |
| 207 | kThumb2LdrPcRel12, rINVOKE_TGT, 0, 0, 0, 0, dataTarget); |
| 208 | oatAppendLIR(cUnit, loadPcRel); |
| 209 | #else |
| 210 | UNIMPLEMENTED(FATAL) << (void*)dataTarget; |
| 211 | #endif |
| 212 | } |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 213 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 214 | break; |
| 215 | case 2: // Grab target method* |
| 216 | loadWordDisp(cUnit, rARG0, |
| 217 | Array::DataOffset(sizeof(Object*)).Int32Value() + dexIdx * 4, |
| 218 | rARG0); |
| 219 | break; |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 220 | #if !defined(TARGET_X86) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 221 | case 3: // Grab the code from the method* |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 222 | if (directCode == 0) { |
| 223 | loadWordDisp(cUnit, rARG0, Method::GetCodeOffset().Int32Value(), |
| 224 | rINVOKE_TGT); |
| 225 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 226 | break; |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 227 | #endif |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 228 | default: |
| 229 | return -1; |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 230 | } |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 231 | } |
| 232 | return state + 1; |
| 233 | } |
| 234 | |
| 235 | /* |
Elliott Hughes | bdf6c3d | 2012-03-20 13:43:53 -0700 | [diff] [blame] | 236 | * Bit of a hack here - in the absence of a real scheduling pass, |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 237 | * emit the next instruction in a virtual invoke sequence. |
| 238 | * We can use rLR as a temp prior to target address loading |
| 239 | * Note also that we'll load the first argument ("this") into |
| 240 | * rARG1 here rather than the standard loadArgRegs. |
| 241 | */ |
| 242 | int nextVCallInsn(CompilationUnit* cUnit, MIR* mir, |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 243 | int state, uint32_t dexIdx, uint32_t methodIdx, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 244 | uintptr_t unused, uintptr_t unused2, InvokeType unused3) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 245 | { |
| 246 | RegLocation rlArg; |
| 247 | /* |
| 248 | * This is the fast path in which the target virtual method is |
| 249 | * fully resolved at compile time. |
| 250 | */ |
| 251 | switch(state) { |
| 252 | case 0: // Get "this" [set rARG1] |
| 253 | rlArg = oatGetSrc(cUnit, mir, 0); |
| 254 | loadValueDirectFixed(cUnit, rlArg, rARG1); |
| 255 | break; |
| 256 | case 1: // Is "this" null? [use rARG1] |
| 257 | genNullCheck(cUnit, oatSSASrc(mir,0), rARG1, mir); |
buzbee | 0398c42 | 2012-03-02 15:22:47 -0800 | [diff] [blame] | 258 | // get this->klass_ [use rARG1, set rINVOKE_TGT] |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 259 | loadWordDisp(cUnit, rARG1, Object::ClassOffset().Int32Value(), |
buzbee | 0398c42 | 2012-03-02 15:22:47 -0800 | [diff] [blame] | 260 | rINVOKE_TGT); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 261 | break; |
buzbee | 0398c42 | 2012-03-02 15:22:47 -0800 | [diff] [blame] | 262 | case 2: // Get this->klass_->vtable [usr rINVOKE_TGT, set rINVOKE_TGT] |
| 263 | loadWordDisp(cUnit, rINVOKE_TGT, Class::VTableOffset().Int32Value(), |
| 264 | rINVOKE_TGT); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 265 | break; |
buzbee | 0398c42 | 2012-03-02 15:22:47 -0800 | [diff] [blame] | 266 | case 3: // Get target method [use rINVOKE_TGT, set rARG0] |
| 267 | loadWordDisp(cUnit, rINVOKE_TGT, (methodIdx * 4) + |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 268 | Array::DataOffset(sizeof(Object*)).Int32Value(), |
| 269 | rARG0); |
| 270 | break; |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 271 | #if !defined(TARGET_X86) |
buzbee | 0398c42 | 2012-03-02 15:22:47 -0800 | [diff] [blame] | 272 | case 4: // Get the compiled code address [uses rARG0, sets rINVOKE_TGT] |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 273 | loadWordDisp(cUnit, rARG0, Method::GetCodeOffset().Int32Value(), |
buzbee | 0398c42 | 2012-03-02 15:22:47 -0800 | [diff] [blame] | 274 | rINVOKE_TGT); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 275 | break; |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 276 | #endif |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 277 | default: |
| 278 | return -1; |
| 279 | } |
| 280 | return state + 1; |
| 281 | } |
| 282 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 283 | int nextInvokeInsnSP(CompilationUnit* cUnit, MIR* mir, int trampoline, |
| 284 | int state, uint32_t dexIdx, uint32_t methodIdx) |
| 285 | { |
| 286 | /* |
| 287 | * This handles the case in which the base method is not fully |
| 288 | * resolved at compile time, we bail to a runtime helper. |
| 289 | */ |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 290 | #if !defined(TARGET_X86) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 291 | if (state == 0) { |
| 292 | // Load trampoline target |
buzbee | 0398c42 | 2012-03-02 15:22:47 -0800 | [diff] [blame] | 293 | loadWordDisp(cUnit, rSELF, trampoline, rINVOKE_TGT); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 294 | // Load rARG0 with method index |
| 295 | loadConstant(cUnit, rARG0, dexIdx); |
| 296 | return 1; |
| 297 | } |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 298 | #endif |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 299 | return -1; |
| 300 | } |
| 301 | |
| 302 | int nextStaticCallInsnSP(CompilationUnit* cUnit, MIR* mir, |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 303 | int state, uint32_t dexIdx, uint32_t methodIdx, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 304 | uintptr_t unused, uintptr_t unused2, |
| 305 | InvokeType unused3) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 306 | { |
| 307 | int trampoline = OFFSETOF_MEMBER(Thread, pInvokeStaticTrampolineWithAccessCheck); |
| 308 | return nextInvokeInsnSP(cUnit, mir, trampoline, state, dexIdx, 0); |
| 309 | } |
| 310 | |
| 311 | int nextDirectCallInsnSP(CompilationUnit* cUnit, MIR* mir, int state, |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 312 | uint32_t dexIdx, uint32_t methodIdx, uintptr_t unused, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 313 | uintptr_t unused2, InvokeType unused3) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 314 | { |
| 315 | int trampoline = OFFSETOF_MEMBER(Thread, pInvokeDirectTrampolineWithAccessCheck); |
| 316 | return nextInvokeInsnSP(cUnit, mir, trampoline, state, dexIdx, 0); |
| 317 | } |
| 318 | |
| 319 | int nextSuperCallInsnSP(CompilationUnit* cUnit, MIR* mir, int state, |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 320 | uint32_t dexIdx, uint32_t methodIdx, uintptr_t unused, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 321 | uintptr_t unused2, InvokeType unused3) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 322 | { |
| 323 | int trampoline = OFFSETOF_MEMBER(Thread, pInvokeSuperTrampolineWithAccessCheck); |
| 324 | return nextInvokeInsnSP(cUnit, mir, trampoline, state, dexIdx, 0); |
| 325 | } |
| 326 | |
| 327 | int nextVCallInsnSP(CompilationUnit* cUnit, MIR* mir, int state, |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 328 | uint32_t dexIdx, uint32_t methodIdx, uintptr_t unused, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 329 | uintptr_t unused2, InvokeType unused3) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 330 | { |
| 331 | int trampoline = OFFSETOF_MEMBER(Thread, pInvokeVirtualTrampolineWithAccessCheck); |
| 332 | return nextInvokeInsnSP(cUnit, mir, trampoline, state, dexIdx, 0); |
| 333 | } |
| 334 | |
| 335 | /* |
| 336 | * All invoke-interface calls bounce off of art_invoke_interface_trampoline, |
| 337 | * which will locate the target and continue on via a tail call. |
| 338 | */ |
| 339 | int nextInterfaceCallInsn(CompilationUnit* cUnit, MIR* mir, int state, |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 340 | uint32_t dexIdx, uint32_t unused, uintptr_t unused2, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 341 | uintptr_t unused3, InvokeType unused4) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 342 | { |
| 343 | int trampoline = OFFSETOF_MEMBER(Thread, pInvokeInterfaceTrampoline); |
| 344 | return nextInvokeInsnSP(cUnit, mir, trampoline, state, dexIdx, 0); |
| 345 | } |
| 346 | |
| 347 | int nextInterfaceCallInsnWithAccessCheck(CompilationUnit* cUnit, MIR* mir, |
| 348 | int state, uint32_t dexIdx, |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 349 | uint32_t unused, uintptr_t unused2, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 350 | uintptr_t unused3, InvokeType unused4) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 351 | { |
| 352 | int trampoline = OFFSETOF_MEMBER(Thread, pInvokeInterfaceTrampolineWithAccessCheck); |
| 353 | return nextInvokeInsnSP(cUnit, mir, trampoline, state, dexIdx, 0); |
| 354 | } |
| 355 | |
| 356 | int loadArgRegs(CompilationUnit* cUnit, MIR* mir, DecodedInstruction* dInsn, |
| 357 | int callState, NextCallInsn nextCallInsn, uint32_t dexIdx, |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 358 | uint32_t methodIdx, uintptr_t directCode, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 359 | uintptr_t directMethod, InvokeType type, bool skipThis) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 360 | { |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 361 | #if !defined(TARGET_X86) |
| 362 | int lastArgReg = rARG3; |
| 363 | #else |
| 364 | int lastArgReg = rARG2; |
| 365 | #endif |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 366 | int nextReg = rARG1; |
| 367 | int nextArg = 0; |
| 368 | if (skipThis) { |
| 369 | nextReg++; |
| 370 | nextArg++; |
| 371 | } |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 372 | for (; (nextReg <= lastArgReg) && (nextArg < mir->ssaRep->numUses); nextReg++) { |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 373 | RegLocation rlArg = oatGetRawSrc(cUnit, mir, nextArg++); |
| 374 | rlArg = oatUpdateRawLoc(cUnit, rlArg); |
| 375 | if (rlArg.wide && (nextReg <= rARG2)) { |
| 376 | loadValueDirectWideFixed(cUnit, rlArg, nextReg, nextReg + 1); |
| 377 | nextReg++; |
| 378 | nextArg++; |
| 379 | } else { |
| 380 | rlArg.wide = false; |
| 381 | loadValueDirectFixed(cUnit, rlArg, nextReg); |
| 382 | } |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 383 | callState = nextCallInsn(cUnit, mir, callState, dexIdx, methodIdx, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 384 | directCode, directMethod, type); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 385 | } |
| 386 | return callState; |
| 387 | } |
| 388 | |
| 389 | /* |
| 390 | * Load up to 5 arguments, the first three of which will be in |
| 391 | * rARG1 .. rARG3. On entry rARG0 contains the current method pointer, |
| 392 | * and as part of the load sequence, it must be replaced with |
| 393 | * the target method pointer. Note, this may also be called |
| 394 | * for "range" variants if the number of arguments is 5 or fewer. |
| 395 | */ |
| 396 | int genDalvikArgsNoRange(CompilationUnit* cUnit, MIR* mir, |
| 397 | DecodedInstruction* dInsn, int callState, |
| 398 | LIR** pcrLabel, NextCallInsn nextCallInsn, |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 399 | uint32_t dexIdx, uint32_t methodIdx, |
| 400 | uintptr_t directCode, uintptr_t directMethod, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 401 | InvokeType type, bool skipThis) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 402 | { |
| 403 | RegLocation rlArg; |
| 404 | |
| 405 | /* If no arguments, just return */ |
| 406 | if (dInsn->vA == 0) |
| 407 | return callState; |
| 408 | |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 409 | callState = nextCallInsn(cUnit, mir, callState, dexIdx, methodIdx, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 410 | directCode, directMethod, type); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 411 | |
| 412 | DCHECK_LE(dInsn->vA, 5U); |
| 413 | if (dInsn->vA > 3) { |
| 414 | uint32_t nextUse = 3; |
| 415 | //Detect special case of wide arg spanning arg3/arg4 |
| 416 | RegLocation rlUse0 = oatGetRawSrc(cUnit, mir, 0); |
| 417 | RegLocation rlUse1 = oatGetRawSrc(cUnit, mir, 1); |
| 418 | RegLocation rlUse2 = oatGetRawSrc(cUnit, mir, 2); |
| 419 | if (((!rlUse0.wide && !rlUse1.wide) || rlUse0.wide) && |
| 420 | rlUse2.wide) { |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 421 | int reg = -1; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 422 | // Wide spans, we need the 2nd half of uses[2]. |
| 423 | rlArg = oatUpdateLocWide(cUnit, rlUse2); |
| 424 | if (rlArg.location == kLocPhysReg) { |
| 425 | reg = rlArg.highReg; |
| 426 | } else { |
| 427 | // rARG2 & rARG3 can safely be used here |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 428 | #if defined(TARGET_X86) |
| 429 | UNIMPLEMENTED(FATAL); |
| 430 | #else |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 431 | reg = rARG3; |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 432 | #endif |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 433 | loadWordDisp(cUnit, rSP, |
| 434 | oatSRegOffset(cUnit, rlArg.sRegLow) + 4, reg); |
| 435 | callState = nextCallInsn(cUnit, mir, callState, dexIdx, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 436 | methodIdx, directCode, directMethod, |
| 437 | type); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 438 | } |
| 439 | storeBaseDisp(cUnit, rSP, (nextUse + 1) * 4, reg, kWord); |
| 440 | storeBaseDisp(cUnit, rSP, 16 /* (3+1)*4 */, reg, kWord); |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 441 | callState = nextCallInsn(cUnit, mir, callState, dexIdx, methodIdx, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 442 | directCode, directMethod, type); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 443 | nextUse++; |
| 444 | } |
| 445 | // Loop through the rest |
| 446 | while (nextUse < dInsn->vA) { |
| 447 | int lowReg; |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 448 | int highReg = -1; |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 449 | rlArg = oatGetRawSrc(cUnit, mir, nextUse); |
| 450 | rlArg = oatUpdateRawLoc(cUnit, rlArg); |
| 451 | if (rlArg.location == kLocPhysReg) { |
| 452 | lowReg = rlArg.lowReg; |
| 453 | highReg = rlArg.highReg; |
| 454 | } else { |
| 455 | lowReg = rARG2; |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 456 | #if defined(TARGET_X86) |
| 457 | UNIMPLEMENTED(FATAL); |
| 458 | #else |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 459 | highReg = rARG3; |
Ian Rogers | 6cbb2bd | 2012-03-16 13:45:30 -0700 | [diff] [blame] | 460 | #endif |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 461 | if (rlArg.wide) { |
| 462 | loadValueDirectWideFixed(cUnit, rlArg, lowReg, highReg); |
| 463 | } else { |
| 464 | loadValueDirectFixed(cUnit, rlArg, lowReg); |
| 465 | } |
| 466 | callState = nextCallInsn(cUnit, mir, callState, dexIdx, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 467 | methodIdx, directCode, directMethod, |
| 468 | type); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 469 | } |
| 470 | int outsOffset = (nextUse + 1) * 4; |
| 471 | if (rlArg.wide) { |
| 472 | storeBaseDispWide(cUnit, rSP, outsOffset, lowReg, highReg); |
| 473 | nextUse += 2; |
| 474 | } else { |
| 475 | storeWordDisp(cUnit, rSP, outsOffset, lowReg); |
| 476 | nextUse++; |
| 477 | } |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 478 | callState = nextCallInsn(cUnit, mir, callState, dexIdx, methodIdx, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 479 | directCode, directMethod, type); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 480 | } |
| 481 | } |
| 482 | |
| 483 | callState = loadArgRegs(cUnit, mir, dInsn, callState, nextCallInsn, |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 484 | dexIdx, methodIdx, directCode, directMethod, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 485 | type, skipThis); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 486 | |
| 487 | if (pcrLabel) { |
| 488 | *pcrLabel = genNullCheck(cUnit, oatSSASrc(mir,0), rARG1, mir); |
| 489 | } |
| 490 | return callState; |
| 491 | } |
| 492 | |
| 493 | /* |
| 494 | * May have 0+ arguments (also used for jumbo). Note that |
| 495 | * source virtual registers may be in physical registers, so may |
| 496 | * need to be flushed to home location before copying. This |
| 497 | * applies to arg3 and above (see below). |
| 498 | * |
| 499 | * Two general strategies: |
| 500 | * If < 20 arguments |
| 501 | * Pass args 3-18 using vldm/vstm block copy |
| 502 | * Pass arg0, arg1 & arg2 in rARG1-rARG3 |
| 503 | * If 20+ arguments |
| 504 | * Pass args arg19+ using memcpy block copy |
| 505 | * Pass arg0, arg1 & arg2 in rARG1-rARG3 |
| 506 | * |
| 507 | */ |
| 508 | int genDalvikArgsRange(CompilationUnit* cUnit, MIR* mir, |
| 509 | DecodedInstruction* dInsn, int callState, |
| 510 | LIR** pcrLabel, NextCallInsn nextCallInsn, |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 511 | uint32_t dexIdx, uint32_t methodIdx, |
| 512 | uintptr_t directCode, uintptr_t directMethod, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 513 | InvokeType type, bool skipThis) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 514 | { |
| 515 | int firstArg = dInsn->vC; |
| 516 | int numArgs = dInsn->vA; |
| 517 | |
| 518 | // If we can treat it as non-range (Jumbo ops will use range form) |
| 519 | if (numArgs <= 5) |
| 520 | return genDalvikArgsNoRange(cUnit, mir, dInsn, callState, pcrLabel, |
| 521 | nextCallInsn, dexIdx, methodIdx, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 522 | directCode, directMethod, type, skipThis); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 523 | /* |
| 524 | * Make sure range list doesn't span the break between in normal |
| 525 | * Dalvik vRegs and the ins. |
| 526 | */ |
| 527 | int highestArg = oatGetSrc(cUnit, mir, numArgs-1).sRegLow; |
| 528 | int boundaryReg = cUnit->numDalvikRegisters - cUnit->numIns; |
| 529 | if ((firstArg < boundaryReg) && (highestArg >= boundaryReg)) { |
| 530 | LOG(FATAL) << "Argument list spanned locals & args"; |
| 531 | } |
| 532 | |
| 533 | /* |
| 534 | * First load the non-register arguments. Both forms expect all |
| 535 | * of the source arguments to be in their home frame location, so |
| 536 | * scan the sReg names and flush any that have been promoted to |
| 537 | * frame backing storage. |
| 538 | */ |
| 539 | // Scan the rest of the args - if in physReg flush to memory |
| 540 | for (int nextArg = 0; nextArg < numArgs;) { |
| 541 | RegLocation loc = oatGetRawSrc(cUnit, mir, nextArg); |
| 542 | if (loc.wide) { |
| 543 | loc = oatUpdateLocWide(cUnit, loc); |
| 544 | if ((nextArg >= 2) && (loc.location == kLocPhysReg)) { |
| 545 | storeBaseDispWide(cUnit, rSP, |
| 546 | oatSRegOffset(cUnit, loc.sRegLow), |
| 547 | loc.lowReg, loc.highReg); |
| 548 | } |
| 549 | nextArg += 2; |
| 550 | } else { |
| 551 | loc = oatUpdateLoc(cUnit, loc); |
| 552 | if ((nextArg >= 3) && (loc.location == kLocPhysReg)) { |
| 553 | storeBaseDisp(cUnit, rSP, oatSRegOffset(cUnit, loc.sRegLow), |
| 554 | loc.lowReg, kWord); |
| 555 | } |
| 556 | nextArg++; |
| 557 | } |
| 558 | } |
| 559 | |
| 560 | int startOffset = oatSRegOffset(cUnit, |
| 561 | cUnit->regLocation[mir->ssaRep->uses[3]].sRegLow); |
| 562 | int outsOffset = 4 /* Method* */ + (3 * 4); |
Ian Rogers | ab2b55d | 2012-03-18 00:06:11 -0700 | [diff] [blame] | 563 | #if defined(TARGET_MIPS) || defined(TARGET_X86) |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 564 | // Generate memcpy |
| 565 | opRegRegImm(cUnit, kOpAdd, rARG0, rSP, outsOffset); |
| 566 | opRegRegImm(cUnit, kOpAdd, rARG1, rSP, startOffset); |
Ian Rogers | ab2b55d | 2012-03-18 00:06:11 -0700 | [diff] [blame] | 567 | callRuntimeHelperRegRegImm(cUnit, OFFSETOF_MEMBER(Thread, pMemcpy), |
| 568 | rARG0, rARG1, (numArgs - 3) * 4); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 569 | #else |
| 570 | if (numArgs >= 20) { |
| 571 | // Generate memcpy |
| 572 | opRegRegImm(cUnit, kOpAdd, rARG0, rSP, outsOffset); |
| 573 | opRegRegImm(cUnit, kOpAdd, rARG1, rSP, startOffset); |
Ian Rogers | ab2b55d | 2012-03-18 00:06:11 -0700 | [diff] [blame] | 574 | callRuntimeHelperRegRegImm(cUnit, OFFSETOF_MEMBER(Thread, pMemcpy), |
| 575 | rARG0, rARG1, (numArgs - 3) * 4); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 576 | } else { |
| 577 | // Use vldm/vstm pair using rARG3 as a temp |
| 578 | int regsLeft = std::min(numArgs - 3, 16); |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 579 | callState = nextCallInsn(cUnit, mir, callState, dexIdx, methodIdx, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 580 | directCode, directMethod, type); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 581 | opRegRegImm(cUnit, kOpAdd, rARG3, rSP, startOffset); |
| 582 | LIR* ld = newLIR3(cUnit, kThumb2Vldms, rARG3, fr0, regsLeft); |
| 583 | //TUNING: loosen barrier |
| 584 | ld->defMask = ENCODE_ALL; |
| 585 | setMemRefType(ld, true /* isLoad */, kDalvikReg); |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 586 | callState = nextCallInsn(cUnit, mir, callState, dexIdx, methodIdx, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 587 | directCode, directMethod, type); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 588 | opRegRegImm(cUnit, kOpAdd, rARG3, rSP, 4 /* Method* */ + (3 * 4)); |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 589 | callState = nextCallInsn(cUnit, mir, callState, dexIdx, methodIdx, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 590 | directCode, directMethod, type); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 591 | LIR* st = newLIR3(cUnit, kThumb2Vstms, rARG3, fr0, regsLeft); |
| 592 | setMemRefType(st, false /* isLoad */, kDalvikReg); |
| 593 | st->defMask = ENCODE_ALL; |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 594 | callState = nextCallInsn(cUnit, mir, callState, dexIdx, methodIdx, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 595 | directCode, directMethod, type); |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 596 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 597 | } |
| 598 | #endif |
| 599 | |
| 600 | callState = loadArgRegs(cUnit, mir, dInsn, callState, nextCallInsn, |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 601 | dexIdx, methodIdx, directCode, directMethod, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 602 | type, skipThis); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 603 | |
Ian Rogers | 2ed3b95 | 2012-03-17 11:49:39 -0700 | [diff] [blame] | 604 | callState = nextCallInsn(cUnit, mir, callState, dexIdx, methodIdx, |
Brian Carlstrom | f582258 | 2012-03-19 22:34:31 -0700 | [diff] [blame] | 605 | directCode, directMethod, type); |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 606 | if (pcrLabel) { |
| 607 | *pcrLabel = genNullCheck(cUnit, oatSSASrc(mir,0), rARG1, mir); |
| 608 | } |
| 609 | return callState; |
| 610 | } |
| 611 | |
buzbee | 31a4a6f | 2012-02-28 15:36:15 -0800 | [diff] [blame] | 612 | } // namespace art |