blob: bac6a767623a78cbd30f659749cc443184607eeb [file] [log] [blame]
buzbee31a4a6f2012-02-28 15:36:15 -08001/*
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
Ian Rogers57b86d42012-03-27 16:05:41 -070017#include "oat/runtime/oat_support_entrypoints.h"
18
buzbee31a4a6f2012-02-28 15:36:15 -080019namespace art {
20
21/*
22 * This source files contains "gen" codegen routines that should
23 * be applicable to most targets. Only mid-level support utilities
24 * and "op" calls may be used here.
25 */
26
buzbee31a4a6f2012-02-28 15:36:15 -080027/*
28 * If there are any ins passed in registers that have not been promoted
29 * to a callee-save register, flush them to the frame. Perform intial
30 * assignment of promoted arguments.
buzbeead8f15e2012-06-18 14:49:45 -070031 *
32 * argLocs is an array of location records describing the incoming arguments
33 * with one location record per word of argument.
buzbee31a4a6f2012-02-28 15:36:15 -080034 */
buzbeead8f15e2012-06-18 14:49:45 -070035void flushIns(CompilationUnit* cUnit, RegLocation* argLocs, RegLocation rlMethod)
buzbee31a4a6f2012-02-28 15:36:15 -080036{
Bill Buzbeea114add2012-05-03 15:00:40 -070037 /*
38 * Dummy up a RegLocation for the incoming Method*
buzbeef0504cd2012-11-13 16:31:10 -080039 * It will attempt to keep kArg0 live (or copy it to home location
Bill Buzbeea114add2012-05-03 15:00:40 -070040 * if promoted).
41 */
buzbeead8f15e2012-06-18 14:49:45 -070042 RegLocation rlSrc = rlMethod;
Bill Buzbeea114add2012-05-03 15:00:40 -070043 rlSrc.location = kLocPhysReg;
buzbeef0504cd2012-11-13 16:31:10 -080044 rlSrc.lowReg = targetReg(kArg0);
Bill Buzbeea114add2012-05-03 15:00:40 -070045 rlSrc.home = false;
46 oatMarkLive(cUnit, rlSrc.lowReg, rlSrc.sRegLow);
47 storeValue(cUnit, rlMethod, rlSrc);
48 // If Method* has been promoted, explicitly flush
49 if (rlMethod.location == kLocPhysReg) {
buzbeef0504cd2012-11-13 16:31:10 -080050 storeWordDisp(cUnit, targetReg(kSp), 0, targetReg(kArg0));
Bill Buzbeea114add2012-05-03 15:00:40 -070051 }
buzbee9c044ce2012-03-18 13:24:07 -070052
Bill Buzbeea114add2012-05-03 15:00:40 -070053 if (cUnit->numIns == 0)
54 return;
55 const int numArgRegs = 3;
buzbeef0504cd2012-11-13 16:31:10 -080056 static SpecialTargetRegister argRegs[] = {kArg1, kArg2, kArg3};
Bill Buzbeea114add2012-05-03 15:00:40 -070057 int startVReg = cUnit->numDalvikRegisters - cUnit->numIns;
58 /*
59 * Copy incoming arguments to their proper home locations.
60 * NOTE: an older version of dx had an issue in which
61 * it would reuse static method argument registers.
62 * This could result in the same Dalvik virtual register
63 * being promoted to both core and fp regs. To account for this,
64 * we only copy to the corresponding promoted physical register
65 * if it matches the type of the SSA name for the incoming
66 * argument. It is also possible that long and double arguments
67 * end up half-promoted. In those cases, we must flush the promoted
68 * half to memory as well.
69 */
70 for (int i = 0; i < cUnit->numIns; i++) {
71 PromotionMap* vMap = &cUnit->promotionMap[startVReg + i];
72 if (i < numArgRegs) {
73 // If arriving in register
74 bool needFlush = true;
buzbeead8f15e2012-06-18 14:49:45 -070075 RegLocation* tLoc = &argLocs[i];
Bill Buzbeea114add2012-05-03 15:00:40 -070076 if ((vMap->coreLocation == kLocPhysReg) && !tLoc->fp) {
buzbeef0504cd2012-11-13 16:31:10 -080077 opRegCopy(cUnit, vMap->coreReg, targetReg(argRegs[i]));
Bill Buzbeea114add2012-05-03 15:00:40 -070078 needFlush = false;
79 } else if ((vMap->fpLocation == kLocPhysReg) && tLoc->fp) {
buzbeef0504cd2012-11-13 16:31:10 -080080 opRegCopy(cUnit, vMap->fpReg, targetReg(argRegs[i]));
Bill Buzbeea114add2012-05-03 15:00:40 -070081 needFlush = false;
82 } else {
83 needFlush = true;
84 }
buzbee86a4bce2012-03-06 18:15:00 -080085
Bill Buzbeea114add2012-05-03 15:00:40 -070086 // For wide args, force flush if only half is promoted
87 if (tLoc->wide) {
88 PromotionMap* pMap = vMap + (tLoc->highWord ? -1 : +1);
89 needFlush |= (pMap->coreLocation != vMap->coreLocation) ||
90 (pMap->fpLocation != vMap->fpLocation);
91 }
92 if (needFlush) {
buzbeef0504cd2012-11-13 16:31:10 -080093 storeBaseDisp(cUnit, targetReg(kSp), oatSRegOffset(cUnit, startVReg + i),
94 targetReg(argRegs[i]), kWord);
Bill Buzbeea114add2012-05-03 15:00:40 -070095 }
96 } else {
97 // If arriving in frame & promoted
98 if (vMap->coreLocation == kLocPhysReg) {
buzbeef0504cd2012-11-13 16:31:10 -080099 loadWordDisp(cUnit, targetReg(kSp), oatSRegOffset(cUnit, startVReg + i),
Bill Buzbeea114add2012-05-03 15:00:40 -0700100 vMap->coreReg);
101 }
102 if (vMap->fpLocation == kLocPhysReg) {
buzbeef0504cd2012-11-13 16:31:10 -0800103 loadWordDisp(cUnit, targetReg(kSp), oatSRegOffset(cUnit, startVReg + i),
Bill Buzbeea114add2012-05-03 15:00:40 -0700104 vMap->fpReg);
105 }
buzbee31a4a6f2012-02-28 15:36:15 -0800106 }
Bill Buzbeea114add2012-05-03 15:00:40 -0700107 }
buzbee31a4a6f2012-02-28 15:36:15 -0800108}
109
buzbeeeaf09bc2012-11-15 14:51:41 -0800110void scanMethodLiteralPool(CompilationUnit* cUnit, LIR** methodTarget, LIR** codeTarget,
111 const DexFile* dexFile, uint32_t dexMethodIdx)
Ian Rogers3fa13792012-03-18 15:53:45 -0700112{
Bill Buzbeea114add2012-05-03 15:00:40 -0700113 LIR* curTarget = cUnit->methodLiteralList;
114 LIR* nextTarget = curTarget != NULL ? curTarget->next : NULL;
115 while (curTarget != NULL && nextTarget != NULL) {
116 if (curTarget->operands[0] == (int)dexFile &&
117 nextTarget->operands[0] == (int)dexMethodIdx) {
118 *codeTarget = curTarget;
119 *methodTarget = nextTarget;
120 DCHECK((*codeTarget)->next == *methodTarget);
121 DCHECK_EQ((*codeTarget)->operands[0], (int)dexFile);
122 DCHECK_EQ((*methodTarget)->operands[0], (int)dexMethodIdx);
123 break;
Ian Rogers3fa13792012-03-18 15:53:45 -0700124 }
Bill Buzbeea114add2012-05-03 15:00:40 -0700125 curTarget = nextTarget->next;
126 nextTarget = curTarget != NULL ? curTarget->next : NULL;
127 }
Ian Rogers3fa13792012-03-18 15:53:45 -0700128}
129
buzbee31a4a6f2012-02-28 15:36:15 -0800130/*
Elliott Hughesbdf6c3d2012-03-20 13:43:53 -0700131 * Bit of a hack here - in the absence of a real scheduling pass,
buzbee31a4a6f2012-02-28 15:36:15 -0800132 * emit the next instruction in static & direct invoke sequences.
133 */
buzbee3b3dbdd2012-06-13 13:39:34 -0700134int nextSDCallInsn(CompilationUnit* cUnit, CallInfo* info,
Ian Rogers2ed3b952012-03-17 11:49:39 -0700135 int state, uint32_t dexIdx, uint32_t unused,
Brian Carlstromf5822582012-03-19 22:34:31 -0700136 uintptr_t directCode, uintptr_t directMethod,
137 InvokeType type)
buzbee31a4a6f2012-02-28 15:36:15 -0800138{
buzbeeb046e162012-10-30 15:48:42 -0700139 if (cUnit->instructionSet != kThumb2) {
140 // Disable sharpening
141 directCode = 0;
142 directMethod = 0;
143 }
Bill Buzbeea114add2012-05-03 15:00:40 -0700144 if (directCode != 0 && directMethod != 0) {
145 switch (state) {
buzbeef0504cd2012-11-13 16:31:10 -0800146 case 0: // Get the current Method* [sets kArg0]
Bill Buzbeea114add2012-05-03 15:00:40 -0700147 if (directCode != (uintptr_t)-1) {
buzbeef0504cd2012-11-13 16:31:10 -0800148 loadConstant(cUnit, targetReg(kInvokeTgt), directCode);
Bill Buzbeea114add2012-05-03 15:00:40 -0700149 } else {
150 LIR* dataTarget = scanLiteralPool(cUnit->codeLiteralList, dexIdx, 0);
151 if (dataTarget == NULL) {
152 dataTarget = addWordData(cUnit, &cUnit->codeLiteralList, dexIdx);
153 dataTarget->operands[1] = type;
Ian Rogers2ed3b952012-03-17 11:49:39 -0700154 }
buzbeef0504cd2012-11-13 16:31:10 -0800155 LIR* loadPcRel = opPcRelLoad(cUnit, targetReg(kInvokeTgt), dataTarget);
Bill Buzbeea114add2012-05-03 15:00:40 -0700156 oatAppendLIR(cUnit, loadPcRel);
buzbeeb046e162012-10-30 15:48:42 -0700157 DCHECK_EQ(cUnit->instructionSet, kThumb2) << (void*)dataTarget;
Bill Buzbeea114add2012-05-03 15:00:40 -0700158 }
159 if (directMethod != (uintptr_t)-1) {
buzbeef0504cd2012-11-13 16:31:10 -0800160 loadConstant(cUnit, targetReg(kArg0), directMethod);
Bill Buzbeea114add2012-05-03 15:00:40 -0700161 } else {
162 LIR* dataTarget = scanLiteralPool(cUnit->methodLiteralList, dexIdx, 0);
163 if (dataTarget == NULL) {
164 dataTarget = addWordData(cUnit, &cUnit->methodLiteralList, dexIdx);
165 dataTarget->operands[1] = type;
166 }
buzbeef0504cd2012-11-13 16:31:10 -0800167 LIR* loadPcRel = opPcRelLoad(cUnit, targetReg(kArg0), dataTarget);
Bill Buzbeea114add2012-05-03 15:00:40 -0700168 oatAppendLIR(cUnit, loadPcRel);
buzbeeb046e162012-10-30 15:48:42 -0700169 DCHECK_EQ(cUnit->instructionSet, kThumb2) << (void*)dataTarget;
Bill Buzbeea114add2012-05-03 15:00:40 -0700170 }
171 break;
172 default:
173 return -1;
buzbee31a4a6f2012-02-28 15:36:15 -0800174 }
Bill Buzbeea114add2012-05-03 15:00:40 -0700175 } else {
176 switch (state) {
buzbeef0504cd2012-11-13 16:31:10 -0800177 case 0: // Get the current Method* [sets kArg0]
Ian Rogers137e88f2012-10-08 17:46:47 -0700178 // TUNING: we can save a reg copy if Method* has been promoted.
buzbeef0504cd2012-11-13 16:31:10 -0800179 loadCurrMethodDirect(cUnit, targetReg(kArg0));
Bill Buzbeea114add2012-05-03 15:00:40 -0700180 break;
181 case 1: // Get method->dex_cache_resolved_methods_
buzbeef0504cd2012-11-13 16:31:10 -0800182 loadWordDisp(cUnit, targetReg(kArg0),
183 AbstractMethod::DexCacheResolvedMethodsOffset().Int32Value(), targetReg(kArg0));
Bill Buzbeea114add2012-05-03 15:00:40 -0700184 // Set up direct code if known.
185 if (directCode != 0) {
186 if (directCode != (uintptr_t)-1) {
buzbeef0504cd2012-11-13 16:31:10 -0800187 loadConstant(cUnit, targetReg(kInvokeTgt), directCode);
Bill Buzbeea114add2012-05-03 15:00:40 -0700188 } else {
189 LIR* dataTarget = scanLiteralPool(cUnit->codeLiteralList, dexIdx, 0);
190 if (dataTarget == NULL) {
191 dataTarget = addWordData(cUnit, &cUnit->codeLiteralList, dexIdx);
192 dataTarget->operands[1] = type;
193 }
buzbeef0504cd2012-11-13 16:31:10 -0800194 LIR* loadPcRel = opPcRelLoad(cUnit, targetReg(kInvokeTgt), dataTarget);
Bill Buzbeea114add2012-05-03 15:00:40 -0700195 oatAppendLIR(cUnit, loadPcRel);
buzbeeb046e162012-10-30 15:48:42 -0700196 DCHECK_EQ(cUnit->instructionSet, kThumb2) << (void*)dataTarget;
Bill Buzbeea114add2012-05-03 15:00:40 -0700197 }
198 }
199 break;
200 case 2: // Grab target method*
buzbeef0504cd2012-11-13 16:31:10 -0800201 loadWordDisp(cUnit, targetReg(kArg0),
202 Array::DataOffset(sizeof(Object*)).Int32Value() + dexIdx * 4, targetReg(kArg0));
Bill Buzbeea114add2012-05-03 15:00:40 -0700203 break;
Bill Buzbeea114add2012-05-03 15:00:40 -0700204 case 3: // Grab the code from the method*
buzbeeb046e162012-10-30 15:48:42 -0700205 if (cUnit->instructionSet != kX86) {
206 if (directCode == 0) {
buzbeef0504cd2012-11-13 16:31:10 -0800207 loadWordDisp(cUnit, targetReg(kArg0), AbstractMethod::GetCodeOffset().Int32Value(),
208 targetReg(kInvokeTgt));
buzbeeb046e162012-10-30 15:48:42 -0700209 }
210 break;
Bill Buzbeea114add2012-05-03 15:00:40 -0700211 }
buzbeeb046e162012-10-30 15:48:42 -0700212 // Intentional fallthrough for x86
Bill Buzbeea114add2012-05-03 15:00:40 -0700213 default:
214 return -1;
215 }
216 }
217 return state + 1;
buzbee31a4a6f2012-02-28 15:36:15 -0800218}
219
220/*
Elliott Hughesbdf6c3d2012-03-20 13:43:53 -0700221 * Bit of a hack here - in the absence of a real scheduling pass,
buzbee31a4a6f2012-02-28 15:36:15 -0800222 * emit the next instruction in a virtual invoke sequence.
buzbeef0504cd2012-11-13 16:31:10 -0800223 * We can use kLr as a temp prior to target address loading
buzbee31a4a6f2012-02-28 15:36:15 -0800224 * Note also that we'll load the first argument ("this") into
buzbeef0504cd2012-11-13 16:31:10 -0800225 * kArg1 here rather than the standard loadArgRegs.
buzbee31a4a6f2012-02-28 15:36:15 -0800226 */
buzbee3b3dbdd2012-06-13 13:39:34 -0700227int nextVCallInsn(CompilationUnit* cUnit, CallInfo* info,
Ian Rogers2ed3b952012-03-17 11:49:39 -0700228 int state, uint32_t dexIdx, uint32_t methodIdx,
Brian Carlstromf5822582012-03-19 22:34:31 -0700229 uintptr_t unused, uintptr_t unused2, InvokeType unused3)
buzbee31a4a6f2012-02-28 15:36:15 -0800230{
Bill Buzbeea114add2012-05-03 15:00:40 -0700231 /*
232 * This is the fast path in which the target virtual method is
233 * fully resolved at compile time.
234 */
235 switch (state) {
buzbeef0504cd2012-11-13 16:31:10 -0800236 case 0: { // Get "this" [set kArg1]
Ian Rogers137e88f2012-10-08 17:46:47 -0700237 RegLocation rlArg = info->args[0];
buzbeef0504cd2012-11-13 16:31:10 -0800238 loadValueDirectFixed(cUnit, rlArg, targetReg(kArg1));
Bill Buzbeea114add2012-05-03 15:00:40 -0700239 break;
Ian Rogers137e88f2012-10-08 17:46:47 -0700240 }
buzbeef0504cd2012-11-13 16:31:10 -0800241 case 1: // Is "this" null? [use kArg1]
242 genNullCheck(cUnit, info->args[0].sRegLow, targetReg(kArg1), info->optFlags);
243 // get this->klass_ [use kArg1, set kInvokeTgt]
244 loadWordDisp(cUnit, targetReg(kArg1), Object::ClassOffset().Int32Value(),
245 targetReg(kInvokeTgt));
Bill Buzbeea114add2012-05-03 15:00:40 -0700246 break;
buzbeef0504cd2012-11-13 16:31:10 -0800247 case 2: // Get this->klass_->vtable [usr kInvokeTgt, set kInvokeTgt]
248 loadWordDisp(cUnit, targetReg(kInvokeTgt), Class::VTableOffset().Int32Value(),
249 targetReg(kInvokeTgt));
Bill Buzbeea114add2012-05-03 15:00:40 -0700250 break;
buzbeef0504cd2012-11-13 16:31:10 -0800251 case 3: // Get target method [use kInvokeTgt, set kArg0]
252 loadWordDisp(cUnit, targetReg(kInvokeTgt), (methodIdx * 4) +
253 Array::DataOffset(sizeof(Object*)).Int32Value(), targetReg(kArg0));
Bill Buzbeea114add2012-05-03 15:00:40 -0700254 break;
buzbeef0504cd2012-11-13 16:31:10 -0800255 case 4: // Get the compiled code address [uses kArg0, sets kInvokeTgt]
buzbeeb046e162012-10-30 15:48:42 -0700256 if (cUnit->instructionSet != kX86) {
buzbeef0504cd2012-11-13 16:31:10 -0800257 loadWordDisp(cUnit, targetReg(kArg0), AbstractMethod::GetCodeOffset().Int32Value(),
258 targetReg(kInvokeTgt));
buzbeeb046e162012-10-30 15:48:42 -0700259 break;
260 }
261 // Intentional fallthrough for X86
Bill Buzbeea114add2012-05-03 15:00:40 -0700262 default:
263 return -1;
264 }
265 return state + 1;
buzbee31a4a6f2012-02-28 15:36:15 -0800266}
267
Ian Rogers137e88f2012-10-08 17:46:47 -0700268/*
269 * All invoke-interface calls bounce off of art_invoke_interface_trampoline,
270 * which will locate the target and continue on via a tail call.
271 */
272int nextInterfaceCallInsn(CompilationUnit* cUnit, CallInfo* info, int state,
273 uint32_t dexIdx, uint32_t unused, uintptr_t unused2,
274 uintptr_t directMethod, InvokeType unused4)
275{
buzbeeb046e162012-10-30 15:48:42 -0700276 if (cUnit->instructionSet != kThumb2) {
277 // Disable sharpening
278 directMethod = 0;
279 }
280 int trampoline = (cUnit->instructionSet == kX86) ? 0
281 : ENTRYPOINT_OFFSET(pInvokeInterfaceTrampoline);
Ian Rogers137e88f2012-10-08 17:46:47 -0700282
283 if (directMethod != 0) {
284 switch (state) {
buzbeef0504cd2012-11-13 16:31:10 -0800285 case 0: // Load the trampoline target [sets kInvokeTgt].
buzbeeb046e162012-10-30 15:48:42 -0700286 if (cUnit->instructionSet != kX86) {
buzbeef0504cd2012-11-13 16:31:10 -0800287 loadWordDisp(cUnit, targetReg(kSelf), trampoline, targetReg(kInvokeTgt));
buzbeeb046e162012-10-30 15:48:42 -0700288 }
buzbeef0504cd2012-11-13 16:31:10 -0800289 // Get the interface Method* [sets kArg0]
Ian Rogers137e88f2012-10-08 17:46:47 -0700290 if (directMethod != (uintptr_t)-1) {
buzbeef0504cd2012-11-13 16:31:10 -0800291 loadConstant(cUnit, targetReg(kArg0), directMethod);
Ian Rogers137e88f2012-10-08 17:46:47 -0700292 } else {
293 LIR* dataTarget = scanLiteralPool(cUnit->methodLiteralList, dexIdx, 0);
294 if (dataTarget == NULL) {
295 dataTarget = addWordData(cUnit, &cUnit->methodLiteralList, dexIdx);
296 dataTarget->operands[1] = kInterface;
297 }
buzbeef0504cd2012-11-13 16:31:10 -0800298 LIR* loadPcRel = opPcRelLoad(cUnit, targetReg(kArg0), dataTarget);
Ian Rogers137e88f2012-10-08 17:46:47 -0700299 oatAppendLIR(cUnit, loadPcRel);
buzbeeb046e162012-10-30 15:48:42 -0700300 DCHECK_EQ(cUnit->instructionSet, kThumb2) << (void*)dataTarget;
Ian Rogers137e88f2012-10-08 17:46:47 -0700301 }
302 break;
303 default:
304 return -1;
305 }
306 } else {
307 switch (state) {
308 case 0:
buzbeef0504cd2012-11-13 16:31:10 -0800309 // Get the current Method* [sets kArg0] - TUNING: remove copy of method if it is promoted.
310 loadCurrMethodDirect(cUnit, targetReg(kArg0));
311 // Load the trampoline target [sets kInvokeTgt].
buzbeeb046e162012-10-30 15:48:42 -0700312 if (cUnit->instructionSet != kX86) {
buzbeef0504cd2012-11-13 16:31:10 -0800313 loadWordDisp(cUnit, targetReg(kSelf), trampoline, targetReg(kInvokeTgt));
buzbeeb046e162012-10-30 15:48:42 -0700314 }
Ian Rogers137e88f2012-10-08 17:46:47 -0700315 break;
buzbeef0504cd2012-11-13 16:31:10 -0800316 case 1: // Get method->dex_cache_resolved_methods_ [set/use kArg0]
317 loadWordDisp(cUnit, targetReg(kArg0),
Ian Rogers137e88f2012-10-08 17:46:47 -0700318 AbstractMethod::DexCacheResolvedMethodsOffset().Int32Value(),
buzbeef0504cd2012-11-13 16:31:10 -0800319 targetReg(kArg0));
Ian Rogers137e88f2012-10-08 17:46:47 -0700320 break;
buzbeef0504cd2012-11-13 16:31:10 -0800321 case 2: // Grab target method* [set/use kArg0]
322 loadWordDisp(cUnit, targetReg(kArg0),
Ian Rogers137e88f2012-10-08 17:46:47 -0700323 Array::DataOffset(sizeof(Object*)).Int32Value() + dexIdx * 4,
buzbeef0504cd2012-11-13 16:31:10 -0800324 targetReg(kArg0));
Ian Rogers137e88f2012-10-08 17:46:47 -0700325 break;
326 default:
327 return -1;
328 }
329 }
330 return state + 1;
331}
332
buzbee3b3dbdd2012-06-13 13:39:34 -0700333int nextInvokeInsnSP(CompilationUnit* cUnit, CallInfo* info, int trampoline,
buzbee31a4a6f2012-02-28 15:36:15 -0800334 int state, uint32_t dexIdx, uint32_t methodIdx)
335{
Bill Buzbeea114add2012-05-03 15:00:40 -0700336 /*
337 * This handles the case in which the base method is not fully
338 * resolved at compile time, we bail to a runtime helper.
339 */
340 if (state == 0) {
buzbeeb046e162012-10-30 15:48:42 -0700341 if (cUnit->instructionSet != kX86) {
342 // Load trampoline target
buzbeef0504cd2012-11-13 16:31:10 -0800343 loadWordDisp(cUnit, targetReg(kSelf), trampoline, targetReg(kInvokeTgt));
buzbeeb046e162012-10-30 15:48:42 -0700344 }
buzbeef0504cd2012-11-13 16:31:10 -0800345 // Load kArg0 with method index
346 loadConstant(cUnit, targetReg(kArg0), dexIdx);
Bill Buzbeea114add2012-05-03 15:00:40 -0700347 return 1;
348 }
349 return -1;
buzbee31a4a6f2012-02-28 15:36:15 -0800350}
351
buzbee3b3dbdd2012-06-13 13:39:34 -0700352int nextStaticCallInsnSP(CompilationUnit* cUnit, CallInfo* info,
Ian Rogers2ed3b952012-03-17 11:49:39 -0700353 int state, uint32_t dexIdx, uint32_t methodIdx,
Brian Carlstromf5822582012-03-19 22:34:31 -0700354 uintptr_t unused, uintptr_t unused2,
355 InvokeType unused3)
buzbee31a4a6f2012-02-28 15:36:15 -0800356{
Ian Rogers57b86d42012-03-27 16:05:41 -0700357 int trampoline = ENTRYPOINT_OFFSET(pInvokeStaticTrampolineWithAccessCheck);
buzbee15bf9802012-06-12 17:49:27 -0700358 return nextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
buzbee31a4a6f2012-02-28 15:36:15 -0800359}
360
buzbee3b3dbdd2012-06-13 13:39:34 -0700361int nextDirectCallInsnSP(CompilationUnit* cUnit, CallInfo* info, int state,
Ian Rogers2ed3b952012-03-17 11:49:39 -0700362 uint32_t dexIdx, uint32_t methodIdx, uintptr_t unused,
Brian Carlstromf5822582012-03-19 22:34:31 -0700363 uintptr_t unused2, InvokeType unused3)
buzbee31a4a6f2012-02-28 15:36:15 -0800364{
Ian Rogers57b86d42012-03-27 16:05:41 -0700365 int trampoline = ENTRYPOINT_OFFSET(pInvokeDirectTrampolineWithAccessCheck);
buzbee15bf9802012-06-12 17:49:27 -0700366 return nextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
buzbee31a4a6f2012-02-28 15:36:15 -0800367}
368
buzbee3b3dbdd2012-06-13 13:39:34 -0700369int nextSuperCallInsnSP(CompilationUnit* cUnit, CallInfo* info, int state,
Ian Rogers2ed3b952012-03-17 11:49:39 -0700370 uint32_t dexIdx, uint32_t methodIdx, uintptr_t unused,
Brian Carlstromf5822582012-03-19 22:34:31 -0700371 uintptr_t unused2, InvokeType unused3)
buzbee31a4a6f2012-02-28 15:36:15 -0800372{
Ian Rogers57b86d42012-03-27 16:05:41 -0700373 int trampoline = ENTRYPOINT_OFFSET(pInvokeSuperTrampolineWithAccessCheck);
buzbee15bf9802012-06-12 17:49:27 -0700374 return nextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
buzbee31a4a6f2012-02-28 15:36:15 -0800375}
376
buzbee3b3dbdd2012-06-13 13:39:34 -0700377int nextVCallInsnSP(CompilationUnit* cUnit, CallInfo* info, int state,
Ian Rogers2ed3b952012-03-17 11:49:39 -0700378 uint32_t dexIdx, uint32_t methodIdx, uintptr_t unused,
Brian Carlstromf5822582012-03-19 22:34:31 -0700379 uintptr_t unused2, InvokeType unused3)
buzbee31a4a6f2012-02-28 15:36:15 -0800380{
Ian Rogers57b86d42012-03-27 16:05:41 -0700381 int trampoline = ENTRYPOINT_OFFSET(pInvokeVirtualTrampolineWithAccessCheck);
buzbee15bf9802012-06-12 17:49:27 -0700382 return nextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
buzbee31a4a6f2012-02-28 15:36:15 -0800383}
384
buzbee15bf9802012-06-12 17:49:27 -0700385int nextInterfaceCallInsnWithAccessCheck(CompilationUnit* cUnit,
buzbee3b3dbdd2012-06-13 13:39:34 -0700386 CallInfo* info, int state,
buzbee15bf9802012-06-12 17:49:27 -0700387 uint32_t dexIdx, uint32_t unused,
388 uintptr_t unused2, uintptr_t unused3,
389 InvokeType unused4)
buzbee31a4a6f2012-02-28 15:36:15 -0800390{
Ian Rogers57b86d42012-03-27 16:05:41 -0700391 int trampoline = ENTRYPOINT_OFFSET(pInvokeInterfaceTrampolineWithAccessCheck);
buzbee15bf9802012-06-12 17:49:27 -0700392 return nextInvokeInsnSP(cUnit, info, trampoline, state, dexIdx, 0);
buzbee31a4a6f2012-02-28 15:36:15 -0800393}
394
buzbee3b3dbdd2012-06-13 13:39:34 -0700395int loadArgRegs(CompilationUnit* cUnit, CallInfo* info, int callState,
buzbee15bf9802012-06-12 17:49:27 -0700396 NextCallInsn nextCallInsn, uint32_t dexIdx,
Ian Rogers2ed3b952012-03-17 11:49:39 -0700397 uint32_t methodIdx, uintptr_t directCode,
Brian Carlstromf5822582012-03-19 22:34:31 -0700398 uintptr_t directMethod, InvokeType type, bool skipThis)
buzbee31a4a6f2012-02-28 15:36:15 -0800399{
buzbeef0504cd2012-11-13 16:31:10 -0800400 int lastArgReg = targetReg(kArg3);
401 int nextReg = targetReg(kArg1);
Bill Buzbeea114add2012-05-03 15:00:40 -0700402 int nextArg = 0;
403 if (skipThis) {
404 nextReg++;
405 nextArg++;
406 }
buzbee15bf9802012-06-12 17:49:27 -0700407 for (; (nextReg <= lastArgReg) && (nextArg < info->numArgWords); nextReg++) {
408 RegLocation rlArg = info->args[nextArg++];
Bill Buzbeea114add2012-05-03 15:00:40 -0700409 rlArg = oatUpdateRawLoc(cUnit, rlArg);
buzbeef0504cd2012-11-13 16:31:10 -0800410 if (rlArg.wide && (nextReg <= targetReg(kArg2))) {
Bill Buzbeea114add2012-05-03 15:00:40 -0700411 loadValueDirectWideFixed(cUnit, rlArg, nextReg, nextReg + 1);
412 nextReg++;
413 nextArg++;
414 } else {
415 rlArg.wide = false;
416 loadValueDirectFixed(cUnit, rlArg, nextReg);
buzbee31a4a6f2012-02-28 15:36:15 -0800417 }
buzbee15bf9802012-06-12 17:49:27 -0700418 callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
Bill Buzbeea114add2012-05-03 15:00:40 -0700419 directCode, directMethod, type);
420 }
421 return callState;
buzbee31a4a6f2012-02-28 15:36:15 -0800422}
423
424/*
425 * Load up to 5 arguments, the first three of which will be in
buzbeef0504cd2012-11-13 16:31:10 -0800426 * kArg1 .. kArg3. On entry kArg0 contains the current method pointer,
buzbee31a4a6f2012-02-28 15:36:15 -0800427 * and as part of the load sequence, it must be replaced with
428 * the target method pointer. Note, this may also be called
429 * for "range" variants if the number of arguments is 5 or fewer.
430 */
buzbee3b3dbdd2012-06-13 13:39:34 -0700431int genDalvikArgsNoRange(CompilationUnit* cUnit, CallInfo* info,
buzbee15bf9802012-06-12 17:49:27 -0700432 int callState,
buzbee31a4a6f2012-02-28 15:36:15 -0800433 LIR** pcrLabel, NextCallInsn nextCallInsn,
Ian Rogers2ed3b952012-03-17 11:49:39 -0700434 uint32_t dexIdx, uint32_t methodIdx,
435 uintptr_t directCode, uintptr_t directMethod,
Brian Carlstromf5822582012-03-19 22:34:31 -0700436 InvokeType type, bool skipThis)
buzbee31a4a6f2012-02-28 15:36:15 -0800437{
Bill Buzbeea114add2012-05-03 15:00:40 -0700438 RegLocation rlArg;
buzbee31a4a6f2012-02-28 15:36:15 -0800439
Bill Buzbeea114add2012-05-03 15:00:40 -0700440 /* If no arguments, just return */
buzbee15bf9802012-06-12 17:49:27 -0700441 if (info->numArgWords == 0)
buzbee31a4a6f2012-02-28 15:36:15 -0800442 return callState;
Bill Buzbeea114add2012-05-03 15:00:40 -0700443
buzbee15bf9802012-06-12 17:49:27 -0700444 callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
Bill Buzbeea114add2012-05-03 15:00:40 -0700445 directCode, directMethod, type);
446
buzbee15bf9802012-06-12 17:49:27 -0700447 DCHECK_LE(info->numArgWords, 5);
448 if (info->numArgWords > 3) {
449 int32_t nextUse = 3;
Bill Buzbeea114add2012-05-03 15:00:40 -0700450 //Detect special case of wide arg spanning arg3/arg4
buzbee15bf9802012-06-12 17:49:27 -0700451 RegLocation rlUse0 = info->args[0];
452 RegLocation rlUse1 = info->args[1];
453 RegLocation rlUse2 = info->args[2];
Bill Buzbeea114add2012-05-03 15:00:40 -0700454 if (((!rlUse0.wide && !rlUse1.wide) || rlUse0.wide) &&
455 rlUse2.wide) {
456 int reg = -1;
457 // Wide spans, we need the 2nd half of uses[2].
458 rlArg = oatUpdateLocWide(cUnit, rlUse2);
459 if (rlArg.location == kLocPhysReg) {
460 reg = rlArg.highReg;
461 } else {
buzbeef0504cd2012-11-13 16:31:10 -0800462 // kArg2 & rArg3 can safely be used here
463 reg = targetReg(kArg3);
464 loadWordDisp(cUnit, targetReg(kSp), oatSRegOffset(cUnit, rlArg.sRegLow) + 4, reg);
buzbee15bf9802012-06-12 17:49:27 -0700465 callState = nextCallInsn(cUnit, info, callState, dexIdx,
Bill Buzbeea114add2012-05-03 15:00:40 -0700466 methodIdx, directCode, directMethod, type);
467 }
buzbeef0504cd2012-11-13 16:31:10 -0800468 storeBaseDisp(cUnit, targetReg(kSp), (nextUse + 1) * 4, reg, kWord);
469 storeBaseDisp(cUnit, targetReg(kSp), 16 /* (3+1)*4 */, reg, kWord);
buzbee15bf9802012-06-12 17:49:27 -0700470 callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
Bill Buzbeea114add2012-05-03 15:00:40 -0700471 directCode, directMethod, type);
472 nextUse++;
473 }
474 // Loop through the rest
buzbee15bf9802012-06-12 17:49:27 -0700475 while (nextUse < info->numArgWords) {
Bill Buzbeea114add2012-05-03 15:00:40 -0700476 int lowReg;
477 int highReg = -1;
buzbee15bf9802012-06-12 17:49:27 -0700478 rlArg = info->args[nextUse];
Bill Buzbeea114add2012-05-03 15:00:40 -0700479 rlArg = oatUpdateRawLoc(cUnit, rlArg);
480 if (rlArg.location == kLocPhysReg) {
481 lowReg = rlArg.lowReg;
482 highReg = rlArg.highReg;
483 } else {
buzbeef0504cd2012-11-13 16:31:10 -0800484 lowReg = targetReg(kArg2);
Bill Buzbeea114add2012-05-03 15:00:40 -0700485 if (rlArg.wide) {
buzbeef0504cd2012-11-13 16:31:10 -0800486 highReg = targetReg(kArg3);
Bill Buzbeea114add2012-05-03 15:00:40 -0700487 loadValueDirectWideFixed(cUnit, rlArg, lowReg, highReg);
488 } else {
489 loadValueDirectFixed(cUnit, rlArg, lowReg);
490 }
buzbee15bf9802012-06-12 17:49:27 -0700491 callState = nextCallInsn(cUnit, info, callState, dexIdx,
Bill Buzbeea114add2012-05-03 15:00:40 -0700492 methodIdx, directCode, directMethod, type);
493 }
494 int outsOffset = (nextUse + 1) * 4;
495 if (rlArg.wide) {
buzbeef0504cd2012-11-13 16:31:10 -0800496 storeBaseDispWide(cUnit, targetReg(kSp), outsOffset, lowReg, highReg);
Bill Buzbeea114add2012-05-03 15:00:40 -0700497 nextUse += 2;
498 } else {
buzbeef0504cd2012-11-13 16:31:10 -0800499 storeWordDisp(cUnit, targetReg(kSp), outsOffset, lowReg);
Bill Buzbeea114add2012-05-03 15:00:40 -0700500 nextUse++;
501 }
buzbee15bf9802012-06-12 17:49:27 -0700502 callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
Bill Buzbeea114add2012-05-03 15:00:40 -0700503 directCode, directMethod, type);
504 }
505 }
506
buzbee15bf9802012-06-12 17:49:27 -0700507 callState = loadArgRegs(cUnit, info, callState, nextCallInsn,
Bill Buzbeea114add2012-05-03 15:00:40 -0700508 dexIdx, methodIdx, directCode, directMethod,
509 type, skipThis);
510
511 if (pcrLabel) {
buzbeef0504cd2012-11-13 16:31:10 -0800512 *pcrLabel = genNullCheck(cUnit, info->args[0].sRegLow, targetReg(kArg1),
buzbee15bf9802012-06-12 17:49:27 -0700513 info->optFlags);
Bill Buzbeea114add2012-05-03 15:00:40 -0700514 }
515 return callState;
buzbee31a4a6f2012-02-28 15:36:15 -0800516}
517
518/*
519 * May have 0+ arguments (also used for jumbo). Note that
520 * source virtual registers may be in physical registers, so may
521 * need to be flushed to home location before copying. This
522 * applies to arg3 and above (see below).
523 *
524 * Two general strategies:
525 * If < 20 arguments
526 * Pass args 3-18 using vldm/vstm block copy
buzbeef0504cd2012-11-13 16:31:10 -0800527 * Pass arg0, arg1 & arg2 in kArg1-kArg3
buzbee31a4a6f2012-02-28 15:36:15 -0800528 * If 20+ arguments
529 * Pass args arg19+ using memcpy block copy
buzbeef0504cd2012-11-13 16:31:10 -0800530 * Pass arg0, arg1 & arg2 in kArg1-kArg3
buzbee31a4a6f2012-02-28 15:36:15 -0800531 *
532 */
buzbee3b3dbdd2012-06-13 13:39:34 -0700533int genDalvikArgsRange(CompilationUnit* cUnit, CallInfo* info, int callState,
buzbee31a4a6f2012-02-28 15:36:15 -0800534 LIR** pcrLabel, NextCallInsn nextCallInsn,
Ian Rogers2ed3b952012-03-17 11:49:39 -0700535 uint32_t dexIdx, uint32_t methodIdx,
536 uintptr_t directCode, uintptr_t directMethod,
Brian Carlstromf5822582012-03-19 22:34:31 -0700537 InvokeType type, bool skipThis)
buzbee31a4a6f2012-02-28 15:36:15 -0800538{
buzbee31a4a6f2012-02-28 15:36:15 -0800539
Bill Buzbeea114add2012-05-03 15:00:40 -0700540 // If we can treat it as non-range (Jumbo ops will use range form)
buzbee15bf9802012-06-12 17:49:27 -0700541 if (info->numArgWords <= 5)
542 return genDalvikArgsNoRange(cUnit, info, callState, pcrLabel,
Bill Buzbeea114add2012-05-03 15:00:40 -0700543 nextCallInsn, dexIdx, methodIdx,
544 directCode, directMethod, type, skipThis);
545 /*
Bill Buzbeea114add2012-05-03 15:00:40 -0700546 * First load the non-register arguments. Both forms expect all
547 * of the source arguments to be in their home frame location, so
548 * scan the sReg names and flush any that have been promoted to
549 * frame backing storage.
550 */
551 // Scan the rest of the args - if in physReg flush to memory
buzbee15bf9802012-06-12 17:49:27 -0700552 for (int nextArg = 0; nextArg < info->numArgWords;) {
553 RegLocation loc = info->args[nextArg];
Bill Buzbeea114add2012-05-03 15:00:40 -0700554 if (loc.wide) {
555 loc = oatUpdateLocWide(cUnit, loc);
556 if ((nextArg >= 2) && (loc.location == kLocPhysReg)) {
buzbeef0504cd2012-11-13 16:31:10 -0800557 storeBaseDispWide(cUnit, targetReg(kSp), oatSRegOffset(cUnit, loc.sRegLow),
Bill Buzbeea114add2012-05-03 15:00:40 -0700558 loc.lowReg, loc.highReg);
559 }
560 nextArg += 2;
561 } else {
562 loc = oatUpdateLoc(cUnit, loc);
563 if ((nextArg >= 3) && (loc.location == kLocPhysReg)) {
buzbeef0504cd2012-11-13 16:31:10 -0800564 storeBaseDisp(cUnit, targetReg(kSp), oatSRegOffset(cUnit, loc.sRegLow),
Bill Buzbeea114add2012-05-03 15:00:40 -0700565 loc.lowReg, kWord);
566 }
567 nextArg++;
buzbee31a4a6f2012-02-28 15:36:15 -0800568 }
Bill Buzbeea114add2012-05-03 15:00:40 -0700569 }
buzbee31a4a6f2012-02-28 15:36:15 -0800570
buzbee15bf9802012-06-12 17:49:27 -0700571 int startOffset = oatSRegOffset(cUnit, info->args[3].sRegLow);
Bill Buzbeea114add2012-05-03 15:00:40 -0700572 int outsOffset = 4 /* Method* */ + (3 * 4);
buzbeeb046e162012-10-30 15:48:42 -0700573 if (cUnit->instructionSet != kThumb2) {
buzbee31a4a6f2012-02-28 15:36:15 -0800574 // Generate memcpy
buzbeef0504cd2012-11-13 16:31:10 -0800575 opRegRegImm(cUnit, kOpAdd, targetReg(kArg0), targetReg(kSp), outsOffset);
576 opRegRegImm(cUnit, kOpAdd, targetReg(kArg1), targetReg(kSp), startOffset);
577 callRuntimeHelperRegRegImm(cUnit, ENTRYPOINT_OFFSET(pMemcpy), targetReg(kArg0),
578 targetReg(kArg1), (info->numArgWords - 3) * 4, false);
Bill Buzbeea114add2012-05-03 15:00:40 -0700579 } else {
buzbeeb046e162012-10-30 15:48:42 -0700580 if (info->numArgWords >= 20) {
581 // Generate memcpy
buzbeef0504cd2012-11-13 16:31:10 -0800582 opRegRegImm(cUnit, kOpAdd, targetReg(kArg0), targetReg(kSp), outsOffset);
583 opRegRegImm(cUnit, kOpAdd, targetReg(kArg1), targetReg(kSp), startOffset);
584 callRuntimeHelperRegRegImm(cUnit, ENTRYPOINT_OFFSET(pMemcpy), targetReg(kArg0),
585 targetReg(kArg1), (info->numArgWords - 3) * 4, false);
buzbeeb046e162012-10-30 15:48:42 -0700586 } else {
buzbeef0504cd2012-11-13 16:31:10 -0800587 // Use vldm/vstm pair using kArg3 as a temp
buzbeeb046e162012-10-30 15:48:42 -0700588 int regsLeft = std::min(info->numArgWords - 3, 16);
589 callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
590 directCode, directMethod, type);
buzbeef0504cd2012-11-13 16:31:10 -0800591 opRegRegImm(cUnit, kOpAdd, targetReg(kArg3), targetReg(kSp), startOffset);
592 LIR* ld = opVldm(cUnit, targetReg(kArg3), regsLeft);
buzbeeb046e162012-10-30 15:48:42 -0700593 //TUNING: loosen barrier
594 ld->defMask = ENCODE_ALL;
595 setMemRefType(ld, true /* isLoad */, kDalvikReg);
596 callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
597 directCode, directMethod, type);
buzbeef0504cd2012-11-13 16:31:10 -0800598 opRegRegImm(cUnit, kOpAdd, targetReg(kArg3), targetReg(kSp), 4 /* Method* */ + (3 * 4));
buzbeeb046e162012-10-30 15:48:42 -0700599 callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
600 directCode, directMethod, type);
buzbeef0504cd2012-11-13 16:31:10 -0800601 LIR* st = opVstm(cUnit, targetReg(kArg3), regsLeft);
buzbeeb046e162012-10-30 15:48:42 -0700602 setMemRefType(st, false /* isLoad */, kDalvikReg);
603 st->defMask = ENCODE_ALL;
604 callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
605 directCode, directMethod, type);
606 }
Bill Buzbeea114add2012-05-03 15:00:40 -0700607 }
Bill Buzbeea114add2012-05-03 15:00:40 -0700608
buzbee15bf9802012-06-12 17:49:27 -0700609 callState = loadArgRegs(cUnit, info, callState, nextCallInsn,
Bill Buzbeea114add2012-05-03 15:00:40 -0700610 dexIdx, methodIdx, directCode, directMethod,
611 type, skipThis);
612
buzbee15bf9802012-06-12 17:49:27 -0700613 callState = nextCallInsn(cUnit, info, callState, dexIdx, methodIdx,
Bill Buzbeea114add2012-05-03 15:00:40 -0700614 directCode, directMethod, type);
615 if (pcrLabel) {
buzbeef0504cd2012-11-13 16:31:10 -0800616 *pcrLabel = genNullCheck(cUnit, info->args[0].sRegLow, targetReg(kArg1),
buzbee15bf9802012-06-12 17:49:27 -0700617 info->optFlags);
Bill Buzbeea114add2012-05-03 15:00:40 -0700618 }
619 return callState;
buzbee31a4a6f2012-02-28 15:36:15 -0800620}
621
buzbee3b3dbdd2012-06-13 13:39:34 -0700622RegLocation inlineTarget(CompilationUnit* cUnit, CallInfo* info)
buzbeefc9e6fa2012-03-23 15:14:29 -0700623{
Bill Buzbeea114add2012-05-03 15:00:40 -0700624 RegLocation res;
buzbee15bf9802012-06-12 17:49:27 -0700625 if (info->result.location == kLocInvalid) {
Bill Buzbeea114add2012-05-03 15:00:40 -0700626 res = oatGetReturn(cUnit, false);
627 } else {
buzbee15bf9802012-06-12 17:49:27 -0700628 res = info->result;
Bill Buzbeea114add2012-05-03 15:00:40 -0700629 }
630 return res;
buzbeefc9e6fa2012-03-23 15:14:29 -0700631}
632
buzbee3b3dbdd2012-06-13 13:39:34 -0700633RegLocation inlineTargetWide(CompilationUnit* cUnit, CallInfo* info)
buzbeefc9e6fa2012-03-23 15:14:29 -0700634{
Bill Buzbeea114add2012-05-03 15:00:40 -0700635 RegLocation res;
buzbee15bf9802012-06-12 17:49:27 -0700636 if (info->result.location == kLocInvalid) {
Bill Buzbeea114add2012-05-03 15:00:40 -0700637 res = oatGetReturnWide(cUnit, false);
638 } else {
buzbee15bf9802012-06-12 17:49:27 -0700639 res = info->result;
Bill Buzbeea114add2012-05-03 15:00:40 -0700640 }
641 return res;
buzbeefc9e6fa2012-03-23 15:14:29 -0700642}
643
buzbee3b3dbdd2012-06-13 13:39:34 -0700644bool genInlinedCharAt(CompilationUnit* cUnit, CallInfo* info)
buzbeefc9e6fa2012-03-23 15:14:29 -0700645{
buzbeeb046e162012-10-30 15:48:42 -0700646 if (cUnit->instructionSet == kMips) {
647 // TODO - add Mips implementation
648 return false;
649 }
Bill Buzbeea114add2012-05-03 15:00:40 -0700650 // Location of reference to data array
651 int valueOffset = String::ValueOffset().Int32Value();
652 // Location of count
653 int countOffset = String::CountOffset().Int32Value();
654 // Starting offset within data array
655 int offsetOffset = String::OffsetOffset().Int32Value();
656 // Start of char data with array_
657 int dataOffset = Array::DataOffset(sizeof(uint16_t)).Int32Value();
buzbeefc9e6fa2012-03-23 15:14:29 -0700658
buzbee15bf9802012-06-12 17:49:27 -0700659 RegLocation rlObj = info->args[0];
660 RegLocation rlIdx = info->args[1];
Bill Buzbeea114add2012-05-03 15:00:40 -0700661 rlObj = loadValue(cUnit, rlObj, kCoreReg);
662 rlIdx = loadValue(cUnit, rlIdx, kCoreReg);
663 int regMax;
buzbee15bf9802012-06-12 17:49:27 -0700664 genNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, info->optFlags);
665 bool rangeCheck = (!(info->optFlags & MIR_IGNORE_RANGE_CHECK));
jeffhao634ea282012-08-10 13:04:01 -0700666 LIR* launchPad = NULL;
buzbeeb046e162012-10-30 15:48:42 -0700667 int regOff = INVALID_REG;
668 int regPtr = INVALID_REG;
669 if (cUnit->instructionSet != kX86) {
670 regOff = oatAllocTemp(cUnit);
671 regPtr = oatAllocTemp(cUnit);
672 if (rangeCheck) {
673 regMax = oatAllocTemp(cUnit);
674 loadWordDisp(cUnit, rlObj.lowReg, countOffset, regMax);
675 }
676 loadWordDisp(cUnit, rlObj.lowReg, offsetOffset, regOff);
677 loadWordDisp(cUnit, rlObj.lowReg, valueOffset, regPtr);
678 if (rangeCheck) {
679 // Set up a launch pad to allow retry in case of bounds violation */
680 launchPad = rawLIR(cUnit, 0, kPseudoIntrinsicRetry, (uintptr_t)info);
681 oatInsertGrowableList(cUnit, &cUnit->intrinsicLaunchpads,
682 (intptr_t)launchPad);
683 opRegReg(cUnit, kOpCmp, rlIdx.lowReg, regMax);
684 oatFreeTemp(cUnit, regMax);
685 opCondBranch(cUnit, kCondCs, launchPad);
686 }
687 } else {
688 if (rangeCheck) {
689 regMax = oatAllocTemp(cUnit);
690 loadWordDisp(cUnit, rlObj.lowReg, countOffset, regMax);
691 // Set up a launch pad to allow retry in case of bounds violation */
692 launchPad = rawLIR(cUnit, 0, kPseudoIntrinsicRetry, (uintptr_t)info);
693 oatInsertGrowableList(cUnit, &cUnit->intrinsicLaunchpads,
694 (intptr_t)launchPad);
695 opRegReg(cUnit, kOpCmp, rlIdx.lowReg, regMax);
696 oatFreeTemp(cUnit, regMax);
697 opCondBranch(cUnit, kCondCc, launchPad);
698 }
699 regOff = oatAllocTemp(cUnit);
700 regPtr = oatAllocTemp(cUnit);
701 loadWordDisp(cUnit, rlObj.lowReg, offsetOffset, regOff);
702 loadWordDisp(cUnit, rlObj.lowReg, valueOffset, regPtr);
Bill Buzbeea114add2012-05-03 15:00:40 -0700703 }
Bill Buzbeea114add2012-05-03 15:00:40 -0700704 opRegImm(cUnit, kOpAdd, regPtr, dataOffset);
705 opRegReg(cUnit, kOpAdd, regOff, rlIdx.lowReg);
jeffhao634ea282012-08-10 13:04:01 -0700706 oatFreeTemp(cUnit, rlObj.lowReg);
707 oatFreeTemp(cUnit, rlIdx.lowReg);
buzbee15bf9802012-06-12 17:49:27 -0700708 RegLocation rlDest = inlineTarget(cUnit, info);
Bill Buzbeea114add2012-05-03 15:00:40 -0700709 RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
710 loadBaseIndexed(cUnit, regPtr, regOff, rlResult.lowReg, 1, kUnsignedHalf);
711 oatFreeTemp(cUnit, regOff);
712 oatFreeTemp(cUnit, regPtr);
713 storeValue(cUnit, rlDest, rlResult);
714 if (rangeCheck) {
Elliott Hughes60234562012-06-01 12:25:59 -0700715 launchPad->operands[2] = 0; // no resumption
Bill Buzbeea114add2012-05-03 15:00:40 -0700716 }
717 // Record that we've already inlined & null checked
buzbee15bf9802012-06-12 17:49:27 -0700718 info->optFlags |= (MIR_INLINED | MIR_IGNORE_NULL_CHECK);
Bill Buzbeea114add2012-05-03 15:00:40 -0700719 return true;
buzbeefc9e6fa2012-03-23 15:14:29 -0700720}
721
722// Generates an inlined String.isEmpty or String.length.
buzbee3b3dbdd2012-06-13 13:39:34 -0700723bool genInlinedStringIsEmptyOrLength(CompilationUnit* cUnit, CallInfo* info,
buzbee15bf9802012-06-12 17:49:27 -0700724 bool isEmpty)
buzbeefc9e6fa2012-03-23 15:14:29 -0700725{
buzbeeb046e162012-10-30 15:48:42 -0700726 if (cUnit->instructionSet == kMips) {
727 // TODO - add Mips implementation
728 return false;
729 }
Bill Buzbeea114add2012-05-03 15:00:40 -0700730 // dst = src.length();
buzbee15bf9802012-06-12 17:49:27 -0700731 RegLocation rlObj = info->args[0];
Bill Buzbeea114add2012-05-03 15:00:40 -0700732 rlObj = loadValue(cUnit, rlObj, kCoreReg);
buzbee15bf9802012-06-12 17:49:27 -0700733 RegLocation rlDest = inlineTarget(cUnit, info);
Bill Buzbeea114add2012-05-03 15:00:40 -0700734 RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
buzbee15bf9802012-06-12 17:49:27 -0700735 genNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, info->optFlags);
Bill Buzbeea114add2012-05-03 15:00:40 -0700736 loadWordDisp(cUnit, rlObj.lowReg, String::CountOffset().Int32Value(),
737 rlResult.lowReg);
738 if (isEmpty) {
739 // dst = (dst == 0);
buzbeeb046e162012-10-30 15:48:42 -0700740 if (cUnit->instructionSet == kThumb2) {
741 int tReg = oatAllocTemp(cUnit);
742 opRegReg(cUnit, kOpNeg, tReg, rlResult.lowReg);
743 opRegRegReg(cUnit, kOpAdc, rlResult.lowReg, rlResult.lowReg, tReg);
744 } else {
745 DCHECK_EQ(cUnit->instructionSet, kX86);
746 opRegImm(cUnit, kOpSub, rlResult.lowReg, 1);
747 opRegImm(cUnit, kOpLsr, rlResult.lowReg, 31);
748 }
Bill Buzbeea114add2012-05-03 15:00:40 -0700749 }
750 storeValue(cUnit, rlDest, rlResult);
751 return true;
buzbeefc9e6fa2012-03-23 15:14:29 -0700752}
753
buzbee3b3dbdd2012-06-13 13:39:34 -0700754bool genInlinedAbsInt(CompilationUnit *cUnit, CallInfo* info)
buzbeefc9e6fa2012-03-23 15:14:29 -0700755{
buzbeeb046e162012-10-30 15:48:42 -0700756 if (cUnit->instructionSet == kMips) {
757 // TODO - add Mips implementation
758 return false;
759 }
buzbee15bf9802012-06-12 17:49:27 -0700760 RegLocation rlSrc = info->args[0];
Bill Buzbeea114add2012-05-03 15:00:40 -0700761 rlSrc = loadValue(cUnit, rlSrc, kCoreReg);
buzbee15bf9802012-06-12 17:49:27 -0700762 RegLocation rlDest = inlineTarget(cUnit, info);
Bill Buzbeea114add2012-05-03 15:00:40 -0700763 RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
764 int signReg = oatAllocTemp(cUnit);
765 // abs(x) = y<=x>>31, (x+y)^y.
766 opRegRegImm(cUnit, kOpAsr, signReg, rlSrc.lowReg, 31);
767 opRegRegReg(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, signReg);
768 opRegReg(cUnit, kOpXor, rlResult.lowReg, signReg);
769 storeValue(cUnit, rlDest, rlResult);
770 return true;
buzbeefc9e6fa2012-03-23 15:14:29 -0700771}
772
buzbee3b3dbdd2012-06-13 13:39:34 -0700773bool genInlinedAbsLong(CompilationUnit *cUnit, CallInfo* info)
buzbeefc9e6fa2012-03-23 15:14:29 -0700774{
buzbeeb046e162012-10-30 15:48:42 -0700775 if (cUnit->instructionSet == kMips) {
776 // TODO - add Mips implementation
777 return false;
778 }
779 if (cUnit->instructionSet == kThumb2) {
780 RegLocation rlSrc = info->args[0];
781 rlSrc = loadValueWide(cUnit, rlSrc, kCoreReg);
782 RegLocation rlDest = inlineTargetWide(cUnit, info);
783 RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
784 int signReg = oatAllocTemp(cUnit);
785 // abs(x) = y<=x>>31, (x+y)^y.
786 opRegRegImm(cUnit, kOpAsr, signReg, rlSrc.highReg, 31);
787 opRegRegReg(cUnit, kOpAdd, rlResult.lowReg, rlSrc.lowReg, signReg);
788 opRegRegReg(cUnit, kOpAdc, rlResult.highReg, rlSrc.highReg, signReg);
789 opRegReg(cUnit, kOpXor, rlResult.lowReg, signReg);
790 opRegReg(cUnit, kOpXor, rlResult.highReg, signReg);
791 storeValueWide(cUnit, rlDest, rlResult);
792 return true;
793 } else {
794 DCHECK_EQ(cUnit->instructionSet, kX86);
795 // Reuse source registers to avoid running out of temps
796 RegLocation rlSrc = info->args[0];
797 rlSrc = loadValueWide(cUnit, rlSrc, kCoreReg);
798 RegLocation rlDest = inlineTargetWide(cUnit, info);
799 RegLocation rlResult = oatEvalLoc(cUnit, rlDest, kCoreReg, true);
800 opRegCopyWide(cUnit, rlResult.lowReg, rlResult.highReg, rlSrc.lowReg, rlSrc.highReg);
801 oatFreeTemp(cUnit, rlSrc.lowReg);
802 oatFreeTemp(cUnit, rlSrc.highReg);
803 int signReg = oatAllocTemp(cUnit);
804 // abs(x) = y<=x>>31, (x+y)^y.
805 opRegRegImm(cUnit, kOpAsr, signReg, rlResult.highReg, 31);
806 opRegReg(cUnit, kOpAdd, rlResult.lowReg, signReg);
807 opRegReg(cUnit, kOpAdc, rlResult.highReg, signReg);
808 opRegReg(cUnit, kOpXor, rlResult.lowReg, signReg);
809 opRegReg(cUnit, kOpXor, rlResult.highReg, signReg);
810 storeValueWide(cUnit, rlDest, rlResult);
811 return true;
812 }
buzbeefc9e6fa2012-03-23 15:14:29 -0700813}
814
buzbee3b3dbdd2012-06-13 13:39:34 -0700815bool genInlinedFloatCvt(CompilationUnit *cUnit, CallInfo* info)
buzbeefc9e6fa2012-03-23 15:14:29 -0700816{
buzbeeb046e162012-10-30 15:48:42 -0700817 if (cUnit->instructionSet == kMips) {
818 // TODO - add Mips implementation
819 return false;
820 }
buzbee15bf9802012-06-12 17:49:27 -0700821 RegLocation rlSrc = info->args[0];
822 RegLocation rlDest = inlineTarget(cUnit, info);
Bill Buzbeea114add2012-05-03 15:00:40 -0700823 storeValue(cUnit, rlDest, rlSrc);
824 return true;
buzbeefc9e6fa2012-03-23 15:14:29 -0700825}
826
buzbee3b3dbdd2012-06-13 13:39:34 -0700827bool genInlinedDoubleCvt(CompilationUnit *cUnit, CallInfo* info)
buzbeefc9e6fa2012-03-23 15:14:29 -0700828{
buzbeeb046e162012-10-30 15:48:42 -0700829 if (cUnit->instructionSet == kMips) {
830 // TODO - add Mips implementation
831 return false;
832 }
buzbee15bf9802012-06-12 17:49:27 -0700833 RegLocation rlSrc = info->args[0];
834 RegLocation rlDest = inlineTargetWide(cUnit, info);
Bill Buzbeea114add2012-05-03 15:00:40 -0700835 storeValueWide(cUnit, rlDest, rlSrc);
836 return true;
buzbeefc9e6fa2012-03-23 15:14:29 -0700837}
838
839/*
840 * Fast string.indexOf(I) & (II). Tests for simple case of char <= 0xffff,
841 * otherwise bails to standard library code.
842 */
buzbee3b3dbdd2012-06-13 13:39:34 -0700843bool genInlinedIndexOf(CompilationUnit* cUnit, CallInfo* info,
buzbee15bf9802012-06-12 17:49:27 -0700844 bool zeroBased)
buzbeefc9e6fa2012-03-23 15:14:29 -0700845{
buzbeeb046e162012-10-30 15:48:42 -0700846 if (cUnit->instructionSet == kMips) {
847 // TODO - add Mips implementation
848 return false;
849 }
Bill Buzbeea114add2012-05-03 15:00:40 -0700850 oatClobberCalleeSave(cUnit);
851 oatLockCallTemps(cUnit); // Using fixed registers
buzbeef0504cd2012-11-13 16:31:10 -0800852 int regPtr = targetReg(kArg0);
853 int regChar = targetReg(kArg1);
854 int regStart = targetReg(kArg2);
buzbeefc9e6fa2012-03-23 15:14:29 -0700855
buzbee15bf9802012-06-12 17:49:27 -0700856 RegLocation rlObj = info->args[0];
857 RegLocation rlChar = info->args[1];
858 RegLocation rlStart = info->args[2];
Bill Buzbeea114add2012-05-03 15:00:40 -0700859 loadValueDirectFixed(cUnit, rlObj, regPtr);
860 loadValueDirectFixed(cUnit, rlChar, regChar);
861 if (zeroBased) {
862 loadConstant(cUnit, regStart, 0);
863 } else {
864 loadValueDirectFixed(cUnit, rlStart, regStart);
865 }
buzbeeb046e162012-10-30 15:48:42 -0700866 int rTgt = (cUnit->instructionSet != kX86) ? loadHelper(cUnit, ENTRYPOINT_OFFSET(pIndexOf)) : 0;
buzbee15bf9802012-06-12 17:49:27 -0700867 genNullCheck(cUnit, rlObj.sRegLow, regPtr, info->optFlags);
868 LIR* launchPad = rawLIR(cUnit, 0, kPseudoIntrinsicRetry, (uintptr_t)info);
Bill Buzbeea114add2012-05-03 15:00:40 -0700869 oatInsertGrowableList(cUnit, &cUnit->intrinsicLaunchpads,
870 (intptr_t)launchPad);
871 opCmpImmBranch(cUnit, kCondGt, regChar, 0xFFFF, launchPad);
buzbee8320f382012-09-11 16:29:42 -0700872 // NOTE: not a safepoint
buzbeeb046e162012-10-30 15:48:42 -0700873 if (cUnit->instructionSet != kX86) {
874 opReg(cUnit, kOpBlx, rTgt);
875 } else {
876 opThreadMem(cUnit, kOpBlx, ENTRYPOINT_OFFSET(pIndexOf));
877 }
Bill Buzbeea114add2012-05-03 15:00:40 -0700878 LIR* resumeTgt = newLIR0(cUnit, kPseudoTargetLabel);
879 launchPad->operands[2] = (uintptr_t)resumeTgt;
Bill Buzbeea114add2012-05-03 15:00:40 -0700880 // Record that we've already inlined & null checked
buzbee15bf9802012-06-12 17:49:27 -0700881 info->optFlags |= (MIR_INLINED | MIR_IGNORE_NULL_CHECK);
882 RegLocation rlReturn = oatGetReturn(cUnit, false);
883 RegLocation rlDest = inlineTarget(cUnit, info);
884 storeValue(cUnit, rlDest, rlReturn);
Bill Buzbeea114add2012-05-03 15:00:40 -0700885 return true;
buzbeefc9e6fa2012-03-23 15:14:29 -0700886}
887
888/* Fast string.compareTo(Ljava/lang/string;)I. */
buzbee3b3dbdd2012-06-13 13:39:34 -0700889bool genInlinedStringCompareTo(CompilationUnit* cUnit, CallInfo* info)
buzbeefc9e6fa2012-03-23 15:14:29 -0700890{
buzbeeb046e162012-10-30 15:48:42 -0700891 if (cUnit->instructionSet == kMips) {
892 // TODO - add Mips implementation
893 return false;
894 }
Bill Buzbeea114add2012-05-03 15:00:40 -0700895 oatClobberCalleeSave(cUnit);
896 oatLockCallTemps(cUnit); // Using fixed registers
buzbeef0504cd2012-11-13 16:31:10 -0800897 int regThis = targetReg(kArg0);
898 int regCmp = targetReg(kArg1);
buzbeefc9e6fa2012-03-23 15:14:29 -0700899
buzbee15bf9802012-06-12 17:49:27 -0700900 RegLocation rlThis = info->args[0];
901 RegLocation rlCmp = info->args[1];
Bill Buzbeea114add2012-05-03 15:00:40 -0700902 loadValueDirectFixed(cUnit, rlThis, regThis);
903 loadValueDirectFixed(cUnit, rlCmp, regCmp);
buzbeeb046e162012-10-30 15:48:42 -0700904 int rTgt = (cUnit->instructionSet != kX86) ?
905 loadHelper(cUnit, ENTRYPOINT_OFFSET(pStringCompareTo)) : 0;
buzbee15bf9802012-06-12 17:49:27 -0700906 genNullCheck(cUnit, rlThis.sRegLow, regThis, info->optFlags);
Bill Buzbeea114add2012-05-03 15:00:40 -0700907 //TUNING: check if rlCmp.sRegLow is already null checked
buzbee15bf9802012-06-12 17:49:27 -0700908 LIR* launchPad = rawLIR(cUnit, 0, kPseudoIntrinsicRetry, (uintptr_t)info);
Bill Buzbeea114add2012-05-03 15:00:40 -0700909 oatInsertGrowableList(cUnit, &cUnit->intrinsicLaunchpads,
Elliott Hughes60234562012-06-01 12:25:59 -0700910 (intptr_t)launchPad);
Bill Buzbeea114add2012-05-03 15:00:40 -0700911 opCmpImmBranch(cUnit, kCondEq, regCmp, 0, launchPad);
buzbee8320f382012-09-11 16:29:42 -0700912 // NOTE: not a safepoint
buzbeeb046e162012-10-30 15:48:42 -0700913 if (cUnit->instructionSet != kX86) {
914 opReg(cUnit, kOpBlx, rTgt);
915 } else {
916 opThreadMem(cUnit, kOpBlx, ENTRYPOINT_OFFSET(pStringCompareTo));
917 }
Elliott Hughes60234562012-06-01 12:25:59 -0700918 launchPad->operands[2] = 0; // No return possible
Bill Buzbeea114add2012-05-03 15:00:40 -0700919 // Record that we've already inlined & null checked
buzbee15bf9802012-06-12 17:49:27 -0700920 info->optFlags |= (MIR_INLINED | MIR_IGNORE_NULL_CHECK);
921 RegLocation rlReturn = oatGetReturn(cUnit, false);
922 RegLocation rlDest = inlineTarget(cUnit, info);
923 storeValue(cUnit, rlDest, rlReturn);
Bill Buzbeea114add2012-05-03 15:00:40 -0700924 return true;
Ian Rogers0183dd72012-09-17 23:06:51 -0700925}
926
buzbee3b3dbdd2012-06-13 13:39:34 -0700927bool genIntrinsic(CompilationUnit* cUnit, CallInfo* info)
buzbeefc9e6fa2012-03-23 15:14:29 -0700928{
Ian Rogerse13eafa2012-09-07 11:24:27 -0700929 if (info->optFlags & MIR_INLINED) {
buzbeefc9e6fa2012-03-23 15:14:29 -0700930 return false;
Bill Buzbeea114add2012-05-03 15:00:40 -0700931 }
932 /*
933 * TODO: move these to a target-specific structured constant array
934 * and use a generic match function. The list of intrinsics may be
935 * slightly different depending on target.
936 * TODO: Fold this into a matching function that runs during
937 * basic block building. This should be part of the action for
938 * small method inlining and recognition of the special object init
939 * method. By doing this during basic block construction, we can also
940 * take advantage of/generate new useful dataflow info.
941 */
buzbee3b3dbdd2012-06-13 13:39:34 -0700942 std::string tgtMethod(PrettyMethod(info->index, *cUnit->dex_file));
Ian Rogers0183dd72012-09-17 23:06:51 -0700943 if (tgtMethod.find(" java.lang") != std::string::npos) {
944 if (tgtMethod == "long java.lang.Double.doubleToRawLongBits(double)") {
945 return genInlinedDoubleCvt(cUnit, info);
946 }
947 if (tgtMethod == "double java.lang.Double.longBitsToDouble(long)") {
948 return genInlinedDoubleCvt(cUnit, info);
949 }
950 if (tgtMethod == "int java.lang.Float.floatToRawIntBits(float)") {
951 return genInlinedFloatCvt(cUnit, info);
952 }
953 if (tgtMethod == "float java.lang.Float.intBitsToFloat(int)") {
954 return genInlinedFloatCvt(cUnit, info);
955 }
956 if (tgtMethod == "int java.lang.Math.abs(int)" ||
957 tgtMethod == "int java.lang.StrictMath.abs(int)") {
958 return genInlinedAbsInt(cUnit, info);
959 }
960 if (tgtMethod == "long java.lang.Math.abs(long)" ||
961 tgtMethod == "long java.lang.StrictMath.abs(long)") {
962 return genInlinedAbsLong(cUnit, info);
963 }
964 if (tgtMethod == "int java.lang.Math.max(int, int)" ||
965 tgtMethod == "int java.lang.StrictMath.max(int, int)") {
966 return genInlinedMinMaxInt(cUnit, info, false /* isMin */);
967 }
968 if (tgtMethod == "int java.lang.Math.min(int, int)" ||
969 tgtMethod == "int java.lang.StrictMath.min(int, int)") {
970 return genInlinedMinMaxInt(cUnit, info, true /* isMin */);
971 }
972 if (tgtMethod == "double java.lang.Math.sqrt(double)" ||
973 tgtMethod == "double java.lang.StrictMath.sqrt(double)") {
974 return genInlinedSqrt(cUnit, info);
975 }
976 if (tgtMethod == "char java.lang.String.charAt(int)") {
977 return genInlinedCharAt(cUnit, info);
978 }
979 if (tgtMethod == "int java.lang.String.compareTo(java.lang.String)") {
980 return genInlinedStringCompareTo(cUnit, info);
981 }
982 if (tgtMethod == "boolean java.lang.String.isEmpty()") {
983 return genInlinedStringIsEmptyOrLength(cUnit, info, true /* isEmpty */);
984 }
985 if (tgtMethod == "int java.lang.String.indexOf(int, int)") {
986 return genInlinedIndexOf(cUnit, info, false /* base 0 */);
987 }
988 if (tgtMethod == "int java.lang.String.indexOf(int)") {
989 return genInlinedIndexOf(cUnit, info, true /* base 0 */);
990 }
991 if (tgtMethod == "int java.lang.String.length()") {
992 return genInlinedStringIsEmptyOrLength(cUnit, info, false /* isEmpty */);
993 }
994 } else if (tgtMethod.find("boolean sun.misc.Unsafe.compareAndSwap") != std::string::npos) {
995 if (tgtMethod == "boolean sun.misc.Unsafe.compareAndSwapInt(java.lang.Object, long, int, int)") {
996 return genInlinedCas32(cUnit, info, false);
997 }
998 if (tgtMethod == "boolean sun.misc.Unsafe.compareAndSwapObject(java.lang.Object, long, java.lang.Object, java.lang.Object)") {
999 return genInlinedCas32(cUnit, info, true);
1000 }
Ian Rogerse13eafa2012-09-07 11:24:27 -07001001 }
Bill Buzbeea114add2012-05-03 15:00:40 -07001002 return false;
buzbeefc9e6fa2012-03-23 15:14:29 -07001003}
1004
1005
buzbee31a4a6f2012-02-28 15:36:15 -08001006} // namespace art