asm.emitL     (JTOC, -4, PROCESSOR_REGISTER);
asm.emitL     (PROCESSOR_REGISTER, 0, PROCESSOR_REGISTER);  asm.emitL     (JTOC, -JNI_JTOC_OFFSET, PROCESSOR_REGISTER);
  private static INSTRUCTION[] generateInvokeNativeFunctionInstructions() {    VM_Assembler asm = new VM_Assembler(0);    int lockoutLockOffset = VM_Entrypoints.lockoutProcessorField.getOffset();    //    // store the return address to the Java to C glue prolog, which is now in LR    // into transition frame. If GC occurs, the JNIGCMapIterator will cause    // this ip address to be relocated if the generated glue code is moved.    //    asm.emitL     (SP, 0, FP);    asm.emitMFLR  (T0);    asm.emitST    (T0, -JNI_PROLOG_RETURN_ADDRESS_OFFSET, SP);  // save return address in stack frame    //    // Load required JNI function ptr into first parameter reg (GPR3/T0)    // This pointer is in the JNIEnvAddress field of JNIEnvironment    //    asm.emitL (T0, VM_Entrypoints.JNIEnvAddressField.getOffset(), S0);    //    // change the vpstatus of the VP to "in Native"    //    asm.emitL     (PROCESSOR_REGISTER, VM_Entrypoints.JNIEnvSavedPRField.getOffset(), S0);     asm.emitL     (SP, VM_Entrypoints.vpStatusAddressField.getOffset(), PROCESSOR_REGISTER); // SP gets addr vpStatus word    asm.emitCAL   (S0,  VM_Processor.IN_NATIVE, 0 );              // S0  <- new status value    asm.emitST    (S0,  0, SP);                                   // change state to native    // set word following JNI function ptr to addr of current processors vpStatus word    asm.emitST    (SP,  4, T0);    //    asm.emitMTLR  (TI);                                // move native code address to link reg    //    // goto the native code    //    asm.emitBLRL  ();                                       // call native method    //    // save the return value in R3-R4 in the glue frame spill area since they may be overwritten    // in the call to becomeRVMThreadOffset    asm.emitST    (T0, AIX_FRAME_HEADER_SIZE, FP);    asm.emitST    (T1, AIX_FRAME_HEADER_SIZE+4, FP);    //    // try to return to Java state, by testing state word of process    //    int label1    = asm.getMachineCodeIndex();                            // inst index of the following load    asm.emitL     (PROCESSOR_REGISTER, 0, FP);                            // get previous frame    asm.emitL     (JTOC, -4, PROCESSOR_REGISTER);                         // load JTOC reg    asm.emitL     (PROCESSOR_REGISTER, - JNI_PR_OFFSET, PROCESSOR_REGISTER); //load processor register      asm.emitL     (T3, VM_Entrypoints.vpStatusAddressField.getOffset(), PROCESSOR_REGISTER); // T3 gets addr of vpStatus word    asm.emitLWARX (S0, 0, T3);                                            // get status for processor    asm.emitCMPI  (S0, VM_Processor.BLOCKED_IN_NATIVE);                   // are we blocked in native code?    VM_ForwardReference fr = asm.emitForwardBC(NE);    //    // if blocked in native, call C routine to do pthread_yield    //    asm.emitL     (T2, VM_Entrypoints.the_boot_recordField.getOffset(), JTOC);       // T2 gets boot record address    asm.emitL     (JTOC, VM_Entrypoints.sysTOCField.getOffset(), T2);                // load TOC for syscalls from bootrecord    asm.emitL     (T1,   VM_Entrypoints.sysVirtualProcessorYieldIPField.getOffset(), T2);  // load addr of function    asm.emitMTLR  (T1);    asm.emitBLRL  ();                                          // call sysVirtualProcessorYield in sys.C    asm.emitB     (label1); // retest the blocked in native    //    //  br to here -not blocked in native    //    fr.resolve(asm);    asm.emitCAL   (S0,  VM_Processor.IN_JAVA, 0 );           // S0  <- new state value    asm.emitSTWCXr(S0,  0, T3);                              // attempt to change state to java    asm.emitBC    (NE, label1);                              // br if failure -retry lwarx    //    // return to caller    //    asm.emitL     (T3, 0 , FP);                                // get previous frame    asm.emitL     (S0, -JNI_PROLOG_RETURN_ADDRESS_OFFSET, T3); // get return address from stack frame    asm.emitMTLR  (S0);    asm.emitBLR   ();    //    return asm.makeMachineCode().getInstructions();  }  // generateInvokeNativeFunctionInstructions