1a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham /* 2a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham * For polymorphic callsites - setup the Dalvik frame and load Dalvik PC 3a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham * into rPC then jump to dvmJitToInterpNoChain to dispatch the 4a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham * runtime-resolved callee. 5a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham */ 6a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham # a0 = methodToCall, a1 = returnCell, rPC = dalvikCallsite 7a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham lh t7, offMethod_registersSize(a0) # t7<- methodToCall->regsSize 8a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham lh a2, offMethod_outsSize(a0) # a2<- methodToCall->outsSize 9a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham lw t9, offThread_interpStackEnd(rSELF) # t9<- interpStackEnd 10a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham lbu t8, offThread_breakFlags(rSELF) # t8<- breakFlags 11a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham move a3, a1 # a3<- returnCell 12a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham SAVEAREA_FROM_FP(a1, rFP) # a1<- stack save area 13a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham sll t6, t7, 2 # multiply regsSize by 4 (4 bytes per reg) 14a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham sub a1, a1, t6 # a1<- newFp(old savearea-regsSize) 15a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham SAVEAREA_FROM_FP(t0, a1) # t0<- stack save area 16a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham sll t6, a2, 2 # multiply outsSize by 4 (4 bytes per reg) 17a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham sub t0, t0, t6 # t0<- bottom (newsave-outsSize) 18a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham bgeu t0, t9, 1f # bottom < interpStackEnd? 19a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham RETURN # return to raise stack overflow excep. 20a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham 21a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham1: 22a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham # a1 = newFP, a0 = methodToCall, a3 = returnCell, rPC = dalvikCallsite 23a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham lw t9, offMethod_clazz(a0) # t9<- methodToCall->clazz 24a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham lw t0, offMethod_accessFlags(a0) # t0<- methodToCall->accessFlags 25a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham sw rPC, (offStackSaveArea_currentPc - sizeofStackSaveArea)(rFP) 26a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham sw rPC, (offStackSaveArea_savedPc - sizeofStackSaveArea)(a1) 27a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham lw rPC, offMethod_insns(a0) # rPC<- methodToCall->insns 28a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham 29a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham # set up newSaveArea 30a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham sw rFP, (offStackSaveArea_prevFrame - sizeofStackSaveArea)(a1) 31a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham sw a3, (offStackSaveArea_returnAddr - sizeofStackSaveArea)(a1) 32a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham sw a0, (offStackSaveArea_method - sizeofStackSaveArea)(a1) 33a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham beqz t8, 2f # breakFlags != 0 34a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham RETURN # bail to the interpreter 35a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham 36a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham2: 37a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham and t6, t0, ACC_NATIVE 38a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham beqz t6, 3f 39a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham#if !defined(WITH_SELF_VERIFICATION) 40a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham j .LinvokeNative 41a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham#else 42a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham RETURN # bail to the interpreter 43a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham#endif 44a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham 45a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham3: 46a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham # continue executing the next instruction through the interpreter 47a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham la t0, .LdvmJitToInterpTraceSelectNoChain # defined in footer.S 48a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham lw rTEMP, (t0) 49a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham lw a3, offClassObject_pDvmDex(t9) # a3<- method->clazz->pDvmDex 50a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham 51a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham # Update "thread" values for the new method 52a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham sw a0, offThread_method(rSELF) # self->method = methodToCall 53a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham sw a3, offThread_methodClassDex(rSELF) # self->methodClassDex = ... 54a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham move rFP, a1 # fp = newFp 55a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham sw rFP, offThread_curFrame(rSELF) # self->curFrame = newFp 56a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham#if defined(TEMPLATE_INLINE_PROFILING) 57b1cafe0ffcf7b6df198fd25fb956c2c1c45a0a9bChris Dearman # preserve rTEMP,a1-a3 58b1cafe0ffcf7b6df198fd25fb956c2c1c45a0a9bChris Dearman SCRATCH_STORE(rTEMP, 0) 59a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham SCRATCH_STORE(a1, 4) 60a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham SCRATCH_STORE(a2, 8) 61a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham SCRATCH_STORE(a3, 12) 62a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham 63a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham # a0=methodToCall, a1=rSELF 64a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham move a1, rSELF 65a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham la t9, dvmFastMethodTraceEnter 66a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham JALR(t9) 67a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham lw gp, STACK_OFFSET_GP(sp) 68a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham 69b1cafe0ffcf7b6df198fd25fb956c2c1c45a0a9bChris Dearman # restore rTEMP,a1-a3 70a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham SCRATCH_LOAD(a3, 12) 71a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham SCRATCH_LOAD(a2, 8) 72a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham SCRATCH_LOAD(a1, 4) 73b1cafe0ffcf7b6df198fd25fb956c2c1c45a0a9bChris Dearman SCRATCH_LOAD(rTEMP, 0) 74a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham#endif 75a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham 76a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham # Start executing the callee 77a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham#if defined(WITH_JIT_TUNING) 78a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham li a0, kInlineCacheMiss 79a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham#endif 80a8b91c52fd8a90b784835dfe1f8898035266c4ddRaghu Gandham jr rTEMP # dvmJitToInterpTraceSelectNoChain 81