int fpOffset = VM_Entrypoints.framePointerField.getOffset();
int fpOffset = VM_Entrypoints.framePointerField.getOffsetAsInt();
  private static VM_CodeArray generateReflectiveMethodInvokerInstructions() {    VM_Assembler asm = new VM_Assembler(100);    /* write at most 2 parameters from registers in the stack.  This is     * logically equivalent to ParamaterRegisterUnload in the compiler     */    int gprs;    int fpOffset = VM_Entrypoints.framePointerField.getOffset();    byte T = T0;    gprs = NUM_PARAMETER_GPRS;    int offset = 4 << LG_WORDSIZE;              // we have exactly 4 paramaters    if (gprs > 0) {      gprs--;      asm.emitMOV_RegDisp_Reg(SP, offset, T);       T = T1;      offset -= WORDSIZE;    }    if (gprs > 0)      asm.emitMOV_RegDisp_Reg(SP, offset, T);     /* available registers S0, T0, T1 */    /* push a new frame */    asm.emitPUSH_RegDisp(PR, fpOffset); // link this frame with next    VM_ProcessorLocalState.emitMoveRegToField(asm, fpOffset, SP); // establish base of new frame    asm.emitPUSH_Imm    (INVISIBLE_METHOD_ID);    asm.emitADD_Reg_Imm (SP, STACKFRAME_BODY_OFFSET);        /* write parameters on stack      * move data from memory addressed by Paramaters array, the fourth     * parameter to this, into the stack.     * SP target address     * S0 source address     * T1 length     * T0 scratch     */    VM_ProcessorLocalState.emitMoveFieldToReg(asm, S0, fpOffset);    asm.emitMOV_Reg_RegDisp (S0, S0, PARAMS_FP_OFFSET);// S0 <- Parameters    asm.emitMOV_Reg_RegDisp (T1, S0, VM_ObjectModel.getArrayLengthOffset());    // T1 <- Parameters.length()    asm.emitCMP_Reg_Imm     (T1, 0);                    // length == 0 ?    int parameterLoopLabel = asm.getMachineCodeIndex();    VM_ForwardReference fr1 = asm.forwardJcc(asm.EQ);   // done? --> branch to end    asm.emitMOV_Reg_RegInd (T0, S0);                    // T0 <- Paramaters[i]    asm.emitPUSH_Reg (T0);                              // mem[j++] <- Parameters[i]    asm.emitADD_Reg_Imm (S0, WORDSIZE);                 // i++    asm.emitADD_Reg_Imm (T1, -1);                       // length--    asm.emitJMP_Imm (parameterLoopLabel);    fr1.resolve(asm);                                   // end of the loop        /* write fprs onto fprs registers */    VM_ProcessorLocalState.emitMoveFieldToReg(asm, S0, fpOffset);    asm.emitMOV_Reg_RegDisp (S0, S0, FPRS_FP_OFFSET);   // S0 <- FPRs    asm.emitMOV_Reg_RegDisp (T1, S0, VM_ObjectModel.getArrayLengthOffset());    // T1 <- FPRs.length()    asm.emitSHL_Reg_Imm (T1, LG_WORDSIZE + 1 );         // length in bytes    asm.emitADD_Reg_Reg (S0, T1);                       // S0 <- last FPR + 8    asm.emitCMP_Reg_Imm (T1, 0);                        // length == 0 ?    int fprsLoopLabel = asm.getMachineCodeIndex();    VM_ForwardReference fr2 = asm.forwardJcc(asm.EQ);   // done? --> branch to end    asm.emitSUB_Reg_Imm ( S0, 2 * WORDSIZE);            // i--    asm.emitFLD_Reg_RegInd_Quad (FP0, S0);              // frp[fpr_sp++] <-FPRs[i]    asm.emitSUB_Reg_Imm (T1, 2* WORDSIZE);              // length--    asm.emitJMP_Imm (fprsLoopLabel);    fr2.resolve(asm);                                   // end of the loop    /* write gprs: S0 = Base address of GPRs[], T1 = GPRs.length */    VM_ProcessorLocalState.emitMoveFieldToReg(asm, S0, fpOffset);    asm.emitMOV_Reg_RegDisp (S0, S0, GPRS_FP_OFFSET);   // S0 <- GPRs    asm.emitMOV_Reg_RegDisp (T1, S0, VM_ObjectModel.getArrayLengthOffset());    // T1 <- GPRs.length()    asm.emitCMP_Reg_Imm (T1, 0);                        // length == 0 ?    VM_ForwardReference fr3 = asm.forwardJcc(asm.EQ);   // result 0 --> branch to end    asm.emitMOV_Reg_RegInd (T0, S0);                    // T0 <- GPRs[0]    asm.emitADD_Reg_Imm (S0, WORDSIZE);                 // S0 += WORDSIZE    asm.emitADD_Reg_Imm (T1, -1);                       // T1--    VM_ForwardReference fr4 = asm.forwardJcc(asm.EQ);   // result 0 --> branch to end    asm.emitMOV_Reg_RegInd (T1, S0);                    // T1 <- GPRs[1]    fr3.resolve(asm);    fr4.resolve(asm);    /* branch to method.  On a good day we might even be back */    VM_ProcessorLocalState.emitMoveFieldToReg(asm, S0, fpOffset);    asm.emitMOV_Reg_RegDisp (S0, S0, CODE_FP_OFFSET);   // S0 <- code    asm.emitCALL_Reg (S0);                              // go there    // T0/T1 have returned value    /* and get out */    // NOTE: RVM callee has popped the params, so we can simply    //       add back in the initial SP to FP delta to get SP to be a framepointer again!    asm.emitADD_Reg_Imm (SP, -STACKFRAME_BODY_OFFSET + 4);     asm.emitPOP_RegDisp (PR, fpOffset);    asm.emitRET_Imm(4 << LG_WORDSIZE);                  // again, exactly 4 parameters    return asm.getMachineCodes();  }