Home | History | Annotate | Download | only in mips
      1     /*
      2      * Unwind a frame from the Dalvik stack for compiled OP_RETURN_XXX.
      3      * If the stored value in returnAddr
      4      * is non-zero, the caller is compiled by the JIT thus return to the
      5      * address in the code cache following the invoke instruction. Otherwise
      6      * return to the special dvmJitToInterpNoChain entry point.
      7      */
      8 #if defined(TEMPLATE_INLINE_PROFILING)
      9     # preserve a0-a2 and ra
     10     SCRATCH_STORE(a0, 0)
     11     SCRATCH_STORE(a1, 4)
     12     SCRATCH_STORE(a2, 8)
     13     SCRATCH_STORE(ra, 12)
     14 
     15     # a0=rSELF
     16     move    a0, rSELF
     17     la      t9, dvmFastMethodTraceExit
     18     JALR(t9)
     19     lw      gp, STACK_OFFSET_GP(sp)
     20 
     21     # restore a0-a2 and ra
     22     SCRATCH_LOAD(ra, 12)
     23     SCRATCH_LOAD(a2, 8)
     24     SCRATCH_LOAD(a1, 4)
     25     SCRATCH_LOAD(a0, 0)
     26 #endif
     27     SAVEAREA_FROM_FP(a0, rFP)           # a0<- saveArea (old)
     28     lw      t0, offStackSaveArea_prevFrame(a0)     # t0<- saveArea->prevFrame
     29     lbu     t1, offThread_breakFlags(rSELF)        # t1<- breakFlags
     30     lw      rPC, offStackSaveArea_savedPc(a0)      # rPC<- saveArea->savedPc
     31 #if !defined(WITH_SELF_VERIFICATION)
     32     lw      t2,  offStackSaveArea_returnAddr(a0)   # t2<- chaining cell ret
     33 #else
     34     move    t2, zero                               # disable chaining
     35 #endif
     36     lw      a2, offStackSaveArea_method - sizeofStackSaveArea(t0)
     37                                                    # a2<- method we're returning to
     38 #if !defined(WITH_SELF_VERIFICATION)
     39     beq     a2, zero, 1f                           # bail to interpreter
     40 #else
     41     bne     a2, zero, 2f
     42     JALR(ra)                                       # punt to interpreter and compare state
     43     # DOUG: assume this does not return ???
     44 2:
     45 #endif
     46     la      t4, .LdvmJitToInterpNoChainNoProfile   # defined in footer.S
     47     lw      a1, (t4)
     48     move    rFP, t0                                # publish new FP
     49     beq     a2, zero, 4f
     50     lw      t0, offMethod_clazz(a2)                # t0<- method->clazz
     51 4:
     52 
     53     sw      a2, offThread_method(rSELF)            # self->method = newSave->method
     54     lw      a0, offClassObject_pDvmDex(t0)         # a0<- method->clazz->pDvmDex
     55     sw      rFP, offThread_curFrame(rSELF)         # self->curFrame = fp
     56     add     rPC, rPC, 3*2                          # publish new rPC
     57     sw      a0, offThread_methodClassDex(rSELF)
     58     movn    t2, zero, t1                           # check the breadFlags and
     59                                                    # clear the chaining cell address
     60     sw      t2, offThread_inJitCodeCache(rSELF)    # in code cache or not
     61     beq     t2, zero, 3f                           # chaining cell exists?
     62     JALR(t2)                                       # jump to the chaining cell
     63     # DOUG: assume this does not return ???
     64 3:
     65 #if defined(WITH_JIT_TUNING)
     66     li      a0, kCallsiteInterpreted
     67 #endif
     68     j       a1                                     # callsite is interpreted
     69 1:
     70     sw      zero, offThread_inJitCodeCache(rSELF)  # reset inJitCodeCache
     71     SAVE_PC_TO_SELF()                              # SAVE_PC_FP_TO_SELF()
     72     SAVE_FP_TO_SELF()
     73     la      t4, .LdvmMterpStdBail                  # defined in footer.S
     74     lw      a2, (t4)
     75     move    a0, rSELF                              # Expecting rSELF in a0
     76     JALR(a2)                                       # exit the interpreter
     77     # DOUG: assume this does not return ???
     78