Program: 149914
Project: 149914
Buggy source:
/** 
 * Generate inline code sequence for specified method.
 * @param methodToBeCalled method whose name indicates semantics of code to be generated
 * @return true if there was magic defined for the method
 */
private boolean generateInlineCode(VM_MethodReference methodToBeCalled){
  VM_Atom methodName=methodToBeCalled.getName();
  if (methodToBeCalled.isSysCall()) {
    VM_TypeReference[] args=methodToBeCalled.getParameterTypes();
    int paramWords=methodToBeCalled.getParameterWords();
    int gp=FIRST_OS_PARAMETER_GPR;
    int fp=FIRST_OS_PARAMETER_FPR;
    int stackIndex=paramWords - 1;
    int paramBytes=((VM.BuildFor64Addr ? args.length : paramWords) - 1) * BYTES_IN_STACKSLOT;
    int callee_param_index=-BYTES_IN_STACKSLOT - paramBytes;
    for (int i=1; i < args.length; i++) {
      VM_TypeReference t=args[i];
      if (t.isLongType()) {
        stackIndex-=2;
        callee_param_index+=BYTES_IN_LONG;
        if (VM.BuildFor64Addr) {
          if (gp <= LAST_OS_PARAMETER_GPR) {
            peekLong(gp,gp,stackIndex);
            gp++;
          }
 else {
            peekLong(S0,S0,stackIndex);
            asm.emitSTD(S0,callee_param_index - BYTES_IN_LONG,FP);
          }
        }
 else {
          if (VM.BuildForLinux) {
            gp+=(gp + 1) & 0x01;
          }
          if (gp <= LAST_OS_PARAMETER_GPR) {
            peekInt(gp++,stackIndex);
          }
          if (gp <= LAST_OS_PARAMETER_GPR) {
            peekInt(gp++,stackIndex + 1);
          }
 else {
            peekLong(S0,S1,stackIndex);
            asm.emitSTW(S0,callee_param_index - BYTES_IN_LONG,FP);
            asm.emitSTW(S1,callee_param_index - BYTES_IN_INT,FP);
          }
        }
      }
 else       if (t.isFloatType()) {
        stackIndex-=1;
        callee_param_index+=BYTES_IN_STACKSLOT;
        if (fp <= LAST_OS_PARAMETER_FPR) {
          peekFloat(fp++,stackIndex);
        }
 else {
          peekFloat(FIRST_SCRATCH_FPR,stackIndex);
          asm.emitSTFS(FIRST_SCRATCH_FPR,callee_param_index - BYTES_IN_FLOAT,FP);
        }
      }
 else       if (t.isDoubleType()) {
        stackIndex-=2;
        callee_param_index+=BYTES_IN_DOUBLE;
        if (fp <= LAST_OS_PARAMETER_FPR) {
          peekDouble(fp++,stackIndex);
        }
 else {
          peekDouble(FIRST_SCRATCH_FPR,stackIndex);
          asm.emitSTFD(FIRST_SCRATCH_FPR,callee_param_index - BYTES_IN_DOUBLE,FP);
        }
      }
 else       if (t.isIntLikeType()) {
        stackIndex-=1;
        callee_param_index+=BYTES_IN_STACKSLOT;
        if (gp <= LAST_OS_PARAMETER_GPR) {
          peekInt(gp++,stackIndex);
        }
 else {
          peekInt(S0,stackIndex);
          asm.emitSTAddr(S0,callee_param_index - BYTES_IN_ADDRESS,FP);
        }
      }
 else {
        stackIndex-=1;
        callee_param_index+=BYTES_IN_STACKSLOT;
        if (gp <= LAST_OS_PARAMETER_GPR) {
          peekAddr(gp++,stackIndex);
        }
 else {
          peekAddr(S0,stackIndex);
          asm.emitSTAddr(S0,callee_param_index - BYTES_IN_ADDRESS,FP);
        }
      }
    }
    if (VM.VerifyAssertions) {
      VM._assert(stackIndex == 0);
    }
    peekAddr(S0,paramWords - 1);
    generateSysCall(paramBytes);
    discardSlots(paramWords);
    VM_TypeReference rtype=methodToBeCalled.getReturnType();
    if (rtype.isIntLikeType()) {
      pushInt(T0);
    }
 else     if (rtype.isWordType() || rtype.isReferenceType()) {
      pushAddr(T0);
    }
 else     if (rtype.isDoubleType()) {
      pushDouble(FIRST_OS_PARAMETER_FPR);
    }
 else     if (rtype.isFloatType()) {
      pushFloat(FIRST_OS_PARAMETER_FPR);
    }
 else     if (rtype.isLongType()) {
      pushLong(T0,VM.BuildFor64Addr ? T0 : T1);
    }
    return true;
  }
  if (methodToBeCalled.getType() == VM_TypeReference.Address) {
    VM_TypeReference[] types=methodToBeCalled.getParameterTypes();
    if (methodName == VM_MagicNames.loadAddress || methodName == VM_MagicNames.loadObjectReference || methodName == VM_MagicNames.loadWord) {
      if (types.length == 0) {
        popAddr(T0);
        asm.emitLAddr(T0,0,T0);
        pushAddr(T0);
      }
 else {
        popInt(T1);
        popAddr(T0);
        asm.emitLAddrX(T0,T1,T0);
        pushAddr(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.loadChar) {
      if (types.length == 0) {
        popAddr(T0);
        asm.emitLHZ(T0,0,T0);
        pushInt(T0);
      }
 else {
        popInt(T1);
        popAddr(T0);
        asm.emitLHZX(T0,T1,T0);
        pushInt(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.loadShort) {
      if (types.length == 0) {
        popAddr(T0);
        asm.emitLHA(T0,0,T0);
        pushInt(T0);
      }
 else {
        popInt(T1);
        popAddr(T0);
        asm.emitLHAX(T0,T1,T0);
        pushInt(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.loadByte) {
      if (types.length == 0) {
        popAddr(T0);
        asm.emitLBZ(T0,0,T0);
        pushInt(T0);
      }
 else {
        popInt(T1);
        popAddr(T0);
        asm.emitLBZX(T0,T1,T0);
        pushInt(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.loadInt || methodName == VM_MagicNames.loadFloat) {
      if (types.length == 0) {
        popAddr(T0);
        asm.emitLInt(T0,0,T0);
        pushInt(T0);
      }
 else {
        popInt(T1);
        popAddr(T0);
        asm.emitLIntX(T0,T1,T0);
        pushInt(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.loadDouble || methodName == VM_MagicNames.loadLong) {
      if (types.length == 0) {
        popAddr(T1);
        asm.emitLFD(F0,0,T1);
        pushDouble(F0);
      }
 else {
        popInt(T2);
        popAddr(T1);
        asm.emitLFDX(F0,T1,T2);
        pushDouble(F0);
      }
      return true;
    }
    if ((methodName == VM_MagicNames.prepareInt) || (VM.BuildFor32Addr && (methodName == VM_MagicNames.prepareWord)) || (VM.BuildFor32Addr && (methodName == VM_MagicNames.prepareObjectReference))|| (VM.BuildFor32Addr && (methodName == VM_MagicNames.prepareAddress))) {
      if (types.length == 0) {
        popAddr(T0);
        asm.emitLWARX(T0,0,T0);
        pushInt(T0);
      }
 else {
        popInt(T1);
        popAddr(T0);
        asm.emitLWARX(T0,T1,T0);
        pushInt(T0);
      }
      return true;
    }
    if ((methodName == VM_MagicNames.prepareLong) || (VM.BuildFor64Addr && (methodName == VM_MagicNames.prepareWord)) || (VM.BuildFor64Addr && (methodName == VM_MagicNames.prepareObjectReference))|| (VM.BuildFor64Addr && (methodName == VM_MagicNames.prepareAddress))) {
      if (types.length == 0) {
        popAddr(T0);
        asm.emitLDARX(T0,0,T0);
        pushAddr(T0);
      }
 else {
        popInt(T1);
        popAddr(T0);
        if (VM.BuildFor64Addr) {
          asm.emitLDARX(T0,T1,T0);
        }
 else {
        }
        pushAddr(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.attempt && ((types[0] == VM_TypeReference.Int) || (VM.BuildFor32Addr && (types[0] == VM_TypeReference.Address)) || (VM.BuildFor32Addr && (types[0] == VM_TypeReference.Word)))) {
      if (types.length == 2) {
        popInt(T2);
        discardSlot();
        popAddr(T0);
        asm.emitSTWCXr(T2,0,T0);
        asm.emitLVAL(T0,0);
        VM_ForwardReference fr=asm.emitForwardBC(NE);
        asm.emitLVAL(T0,1);
        fr.resolve(asm);
        pushInt(T0);
      }
 else {
        popInt(T1);
        popInt(T2);
        discardSlot();
        popAddr(T0);
        asm.emitSTWCXr(T2,T1,T0);
        asm.emitLVAL(T0,0);
        VM_ForwardReference fr=asm.emitForwardBC(NE);
        asm.emitLVAL(T0,1);
        fr.resolve(asm);
        pushInt(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.attempt && ((types[0] == VM_TypeReference.Long) || (VM.BuildFor64Addr && (types[0] == VM_TypeReference.Address)) || (VM.BuildFor64Addr && (types[0] == VM_TypeReference.Word)))) {
      if (types.length == 2) {
        popAddr(T2);
        discardSlot();
        popAddr(T0);
        asm.emitSTDCXr(T2,0,T0);
        asm.emitLVAL(T0,0);
        VM_ForwardReference fr=asm.emitForwardBC(NE);
        asm.emitLVAL(T0,1);
        fr.resolve(asm);
        pushInt(T0);
      }
 else {
        popInt(T1);
        popAddr(T2);
        discardSlot();
        popAddr(T0);
        if (VM.BuildFor64Addr) {
          asm.emitSTDCXr(T2,T1,T0);
        }
 else {
        }
        asm.emitLVAL(T0,0);
        VM_ForwardReference fr=asm.emitForwardBC(NE);
        asm.emitLVAL(T0,1);
        fr.resolve(asm);
        pushInt(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.store) {
      if (types[0] == VM_TypeReference.Word || types[0] == VM_TypeReference.ObjectReference || types[0] == VM_TypeReference.Address) {
        if (types.length == 1) {
          popAddr(T1);
          popAddr(T0);
          asm.emitSTAddrX(T1,0,T0);
        }
 else {
          popInt(T1);
          popAddr(T2);
          popAddr(T0);
          asm.emitSTAddrX(T2,T1,T0);
        }
        return true;
      }
      if (types[0] == VM_TypeReference.Byte) {
        if (types.length == 1) {
          popInt(T1);
          popAddr(T0);
          asm.emitSTBX(T1,0,T0);
        }
 else {
          popInt(T1);
          popInt(T2);
          popAddr(T0);
          asm.emitSTBX(T2,T1,T0);
        }
        return true;
      }
      if (types[0] == VM_TypeReference.Int || types[0] == VM_TypeReference.Float) {
        if (types.length == 1) {
          popInt(T1);
          popAddr(T0);
          asm.emitSTWX(T1,0,T0);
        }
 else {
          popInt(T1);
          popInt(T2);
          popAddr(T0);
          asm.emitSTWX(T2,T1,T0);
        }
        return true;
      }
      if (types[0] == VM_TypeReference.Short || types[0] == VM_TypeReference.Char) {
        if (types.length == 1) {
          popInt(T1);
          popAddr(T0);
          asm.emitSTHX(T1,0,T0);
        }
 else {
          popInt(T1);
          popInt(T2);
          popAddr(T0);
          asm.emitSTHX(T2,T1,T0);
        }
        return true;
      }
      if (types[0] == VM_TypeReference.Double || types[0] == VM_TypeReference.Long) {
        if (types.length == 1) {
          popLong(T2,T1);
          popAddr(T0);
          if (VM.BuildFor32Addr) {
            asm.emitSTWX(T2,0,T0);
            asm.emitSTWX(T1,BYTES_IN_INT,T0);
          }
 else {
            asm.emitSTDX(T1,0,T0);
          }
        }
 else {
          popInt(T1);
          popLong(T3,T2);
          popAddr(T0);
          if (VM.BuildFor32Addr) {
            asm.emitSTWX(T3,T1,T0);
            asm.emitADDI(T1,BYTES_IN_INT,T1);
            asm.emitSTWX(T2,T1,T0);
          }
 else {
            asm.emitSTDX(T2,T1,T0);
          }
        }
        return true;
      }
    }
  }
  if (methodName == VM_MagicNames.getFramePointer) {
    pushAddr(FP);
  }
 else   if (methodName == VM_MagicNames.getCallerFramePointer) {
    popAddr(T0);
    asm.emitLAddr(T1,STACKFRAME_FRAME_POINTER_OFFSET,T0);
    pushAddr(T1);
  }
 else   if (methodName == VM_MagicNames.setCallerFramePointer) {
    popAddr(T1);
    popAddr(T0);
    asm.emitSTAddr(T1,STACKFRAME_FRAME_POINTER_OFFSET,T0);
  }
 else   if (methodName == VM_MagicNames.getCompiledMethodID) {
    popAddr(T0);
    asm.emitLInt(T1,STACKFRAME_METHOD_ID_OFFSET,T0);
    pushInt(T1);
  }
 else   if (methodName == VM_MagicNames.setCompiledMethodID) {
    popInt(T1);
    popAddr(T0);
    asm.emitSTW(T1,STACKFRAME_METHOD_ID_OFFSET,T0);
  }
 else   if (methodName == VM_MagicNames.getNextInstructionAddress) {
    popAddr(T0);
    asm.emitLAddr(T1,STACKFRAME_NEXT_INSTRUCTION_OFFSET,T0);
    pushAddr(T1);
  }
 else   if (methodName == VM_MagicNames.getReturnAddressLocation) {
    popAddr(T0);
    asm.emitLAddr(T1,STACKFRAME_FRAME_POINTER_OFFSET,T0);
    asm.emitADDI(T2,STACKFRAME_NEXT_INSTRUCTION_OFFSET,T1);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.getTocPointer || methodName == VM_MagicNames.getJTOC) {
    pushAddr(JTOC);
  }
 else   if (methodName == VM_MagicNames.getProcessorRegister) {
    pushAddr(PROCESSOR_REGISTER);
  }
 else   if (methodName == VM_MagicNames.setProcessorRegister) {
    popAddr(PROCESSOR_REGISTER);
  }
 else   if (methodName == VM_MagicNames.getTimeBase) {
    if (VM.BuildFor64Addr) {
      asm.emitMFTB(T1);
    }
 else {
      int label=asm.getMachineCodeIndex();
      asm.emitMFTBU(T0);
      asm.emitMFTB(T1);
      asm.emitMFTBU(T2);
      asm.emitCMP(T0,T2);
      asm.emitBC(NE,label);
    }
    pushLong(T0,T1);
  }
 else   if (methodName == VM_MagicNames.invokeClassInitializer) {
    popAddr(T0);
    asm.emitMTCTR(T0);
    asm.emitBCCTRL();
  }
 else   if (methodName == VM_MagicNames.invokeMethodReturningVoid) {
    generateMethodInvocation();
  }
 else   if (methodName == VM_MagicNames.invokeMethodReturningInt) {
    generateMethodInvocation();
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.invokeMethodReturningLong) {
    generateMethodInvocation();
    pushLong(T0,VM.BuildFor64Addr ? T0 : T1);
  }
 else   if (methodName == VM_MagicNames.invokeMethodReturningFloat) {
    generateMethodInvocation();
    pushFloat(F0);
  }
 else   if (methodName == VM_MagicNames.invokeMethodReturningDouble) {
    generateMethodInvocation();
    pushDouble(F0);
  }
 else   if (methodName == VM_MagicNames.invokeMethodReturningObject) {
    generateMethodInvocation();
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.addressArrayCreate) {
    VM_Array type=methodToBeCalled.getType().resolve().asArray();
    emit_resolved_newarray(type);
  }
 else   if (methodName == VM_MagicNames.addressArrayLength) {
    emit_arraylength();
  }
 else   if (methodName == VM_MagicNames.addressArrayGet) {
    if (VM.BuildFor32Addr || methodToBeCalled.getType() == VM_TypeReference.CodeArray) {
      emit_iaload();
    }
 else {
      genBoundsCheck();
      asm.emitSLDI(T1,T1,LOG_BYTES_IN_ADDRESS);
      asm.emitLAddrX(T2,T0,T1);
      pushAddr(T2);
    }
  }
 else   if (methodName == VM_MagicNames.addressArraySet) {
    if (VM.BuildFor32Addr || methodToBeCalled.getType() == VM_TypeReference.CodeArray) {
      emit_iastore();
    }
 else {
      popAddr(T2);
      genBoundsCheck();
      asm.emitSLDI(T1,T1,LOG_BYTES_IN_ADDRESS);
      asm.emitSTAddrX(T2,T0,T1);
    }
  }
 else   if (methodName == VM_MagicNames.getIntAtOffset) {
    popInt(T1);
    popAddr(T0);
    asm.emitLIntX(T0,T1,T0);
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.getObjectAtOffset || methodName == VM_MagicNames.getWordAtOffset || methodName == VM_MagicNames.getObjectArrayAtOffset) {
    popInt(T1);
    popAddr(T0);
    asm.emitLAddrX(T0,T1,T0);
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.getUnsignedByteAtOffset) {
    popInt(T1);
    popAddr(T0);
    asm.emitLBZX(T0,T1,T0);
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.getByteAtOffset) {
    popInt(T1);
    popAddr(T0);
    asm.emitLBZX(T0,T1,T0);
    asm.emitEXTSB(T0,T0);
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.getCharAtOffset) {
    popInt(T1);
    popAddr(T0);
    asm.emitLHZX(T0,T1,T0);
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.getShortAtOffset) {
    popInt(T1);
    popAddr(T0);
    asm.emitLHAX(T0,T1,T0);
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.setIntAtOffset) {
    popInt(T2);
    popInt(T1);
    popAddr(T0);
    asm.emitSTWX(T2,T1,T0);
  }
 else   if (methodName == VM_MagicNames.setObjectAtOffset || methodName == VM_MagicNames.setWordAtOffset) {
    if (methodToBeCalled.getParameterTypes().length == 4) {
      discardSlot();
    }
    popAddr(T2);
    popInt(T1);
    popAddr(T0);
    asm.emitSTAddrX(T2,T1,T0);
  }
 else   if (methodName == VM_MagicNames.setByteAtOffset) {
    popInt(T2);
    popInt(T1);
    popAddr(T0);
    asm.emitSTBX(T2,T1,T0);
  }
 else   if (methodName == VM_MagicNames.setCharAtOffset) {
    popInt(T2);
    popInt(T1);
    popAddr(T0);
    asm.emitSTHX(T2,T1,T0);
  }
 else   if (methodName == VM_MagicNames.getLongAtOffset || methodName == VM_MagicNames.getDoubleAtOffset) {
    popInt(T2);
    popAddr(T1);
    asm.emitLFDX(F0,T1,T2);
    pushDouble(F0);
  }
 else   if ((methodName == VM_MagicNames.setLongAtOffset) || (methodName == VM_MagicNames.setDoubleAtOffset)) {
    popLong(T3,T2);
    popInt(T1);
    popAddr(T0);
    if (VM.BuildFor32Addr) {
      asm.emitSTWX(T3,T1,T0);
      asm.emitADDI(T1,BYTES_IN_INT,T1);
      asm.emitSTWX(T2,T1,T0);
    }
 else {
      asm.emitSTDX(T2,T1,T0);
    }
  }
 else   if (methodName == VM_MagicNames.getMemoryInt) {
    popAddr(T0);
    asm.emitLInt(T0,0,T0);
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.getMemoryWord || methodName == VM_MagicNames.getMemoryAddress) {
    popAddr(T0);
    asm.emitLAddr(T0,0,T0);
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.setMemoryInt) {
    popInt(T1);
    popAddr(T0);
    asm.emitSTW(T1,0,T0);
  }
 else   if (methodName == VM_MagicNames.setMemoryWord) {
    if (methodToBeCalled.getParameterTypes().length == 3) {
      discardSlot();
    }
    popAddr(T1);
    popAddr(T0);
    asm.emitSTAddr(T1,0,T0);
  }
 else   if ((methodName == VM_MagicNames.prepareInt) || (VM.BuildFor32Addr && (methodName == VM_MagicNames.prepareObject)) || (VM.BuildFor32Addr && (methodName == VM_MagicNames.prepareAddress))|| (VM.BuildFor32Addr && (methodName == VM_MagicNames.prepareWord))) {
    popInt(T1);
    popAddr(T0);
    asm.emitLWARX(T0,T1,T0);
    pushInt(T0);
  }
 else   if ((methodName == VM_MagicNames.prepareLong) || (VM.BuildFor64Addr && (methodName == VM_MagicNames.prepareObject)) || (VM.BuildFor64Addr && (methodName == VM_MagicNames.prepareAddress))|| (VM.BuildFor64Addr && (methodName == VM_MagicNames.prepareWord))) {
    popInt(T1);
    popAddr(T0);
    if (VM.BuildFor64Addr) {
      asm.emitLDARX(T0,T1,T0);
    }
 else {
    }
    pushAddr(T0);
  }
 else   if ((methodName == VM_MagicNames.attemptInt) || (VM.BuildFor32Addr && (methodName == VM_MagicNames.attemptObject)) || (VM.BuildFor32Addr && (methodName == VM_MagicNames.attemptObjectReference))|| (VM.BuildFor32Addr && (methodName == VM_MagicNames.attemptAddress))|| (VM.BuildFor32Addr && (methodName == VM_MagicNames.attemptWord))) {
    popInt(T2);
    discardSlot();
    popInt(T1);
    popAddr(T0);
    asm.emitSTWCXr(T2,T1,T0);
    asm.emitLVAL(T0,0);
    VM_ForwardReference fr=asm.emitForwardBC(NE);
    asm.emitLVAL(T0,1);
    fr.resolve(asm);
    pushInt(T0);
  }
 else   if ((methodName == VM_MagicNames.attemptLong) || (VM.BuildFor64Addr && (methodName == VM_MagicNames.attemptObject)) || (VM.BuildFor64Addr && (methodName == VM_MagicNames.attemptObjectReference))|| (VM.BuildFor64Addr && (methodName == VM_MagicNames.attemptAddress))|| (VM.BuildFor64Addr && (methodName == VM_MagicNames.attemptWord))) {
    popAddr(T2);
    discardSlot();
    popInt(T1);
    popAddr(T0);
    if (VM.BuildFor64Addr) {
      asm.emitSTDCXr(T2,T1,T0);
    }
 else {
    }
    asm.emitLVAL(T0,0);
    VM_ForwardReference fr=asm.emitForwardBC(NE);
    asm.emitLVAL(T0,1);
    fr.resolve(asm);
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.saveThreadState) {
    peekAddr(T0,0);
    asm.emitLAddrToc(S0,VM_Entrypoints.saveThreadStateInstructionsField.getOffset());
    asm.emitMTCTR(S0);
    asm.emitBCCTRL();
    discardSlot();
  }
 else   if (methodName == VM_MagicNames.threadSwitch) {
    peekAddr(T1,0);
    peekAddr(T0,1);
    asm.emitLAddrToc(S0,VM_Entrypoints.threadSwitchInstructionsField.getOffset());
    asm.emitMTCTR(S0);
    asm.emitBCCTRL();
    discardSlots(2);
  }
 else   if (methodName == VM_MagicNames.restoreHardwareExceptionState) {
    peekAddr(T0,0);
    asm.emitLAddrToc(S0,VM_Entrypoints.restoreHardwareExceptionStateInstructionsField.getOffset());
    asm.emitMTLR(S0);
    asm.emitBCLR();
  }
 else   if (methodName == VM_MagicNames.returnToNewStack) {
    peekAddr(FP,0);
    asm.emitLAddr(S0,STACKFRAME_NEXT_INSTRUCTION_OFFSET,FP);
    asm.emitMTLR(S0);
    asm.emitBCLR();
  }
 else   if (methodName == VM_MagicNames.dynamicBridgeTo) {
    if (VM.VerifyAssertions)     VM._assert(klass.hasDynamicBridgeAnnotation());
    peekAddr(T0,0);
    asm.emitMTCTR(T0);
    int offset=frameSize;
    for (int i=LAST_NONVOLATILE_FPR; i >= FIRST_VOLATILE_FPR; --i) {
      asm.emitLFD(i,offset-=BYTES_IN_DOUBLE,FP);
    }
    for (int i=LAST_NONVOLATILE_GPR; i >= FIRST_NONVOLATILE_GPR; --i) {
      asm.emitLAddr(i,offset-=BYTES_IN_ADDRESS,FP);
    }
    offset-=(FIRST_NONVOLATILE_GPR - LAST_VOLATILE_GPR - 1) * BYTES_IN_ADDRESS;
    for (int i=LAST_VOLATILE_GPR; i >= FIRST_VOLATILE_GPR; --i) {
      asm.emitLAddr(i,offset-=BYTES_IN_ADDRESS,FP);
    }
    asm.emitLAddr(FP,0,FP);
    asm.emitLAddr(S0,STACKFRAME_NEXT_INSTRUCTION_OFFSET,FP);
    asm.emitMTLR(S0);
    asm.emitBCCTR();
  }
 else   if (methodName == VM_MagicNames.objectAsAddress || methodName == VM_MagicNames.addressAsByteArray || methodName == VM_MagicNames.addressAsObject || methodName == VM_MagicNames.addressAsObjectArray || methodName == VM_MagicNames.objectAsType || methodName == VM_MagicNames.objectAsShortArray || methodName == VM_MagicNames.objectAsIntArray || methodName == VM_MagicNames.objectAsProcessor || methodName == VM_MagicNames.threadAsCollectorThread || methodName == VM_MagicNames.floatAsIntBits || methodName == VM_MagicNames.intBitsAsFloat || methodName == VM_MagicNames.doubleAsLongBits || methodName == VM_MagicNames.longBitsAsDouble) {
  }
 else   if (methodName == VM_MagicNames.getObjectType) {
    popAddr(T0);
    VM_ObjectModel.baselineEmitLoadTIB(asm,T0,T0);
    asm.emitLAddr(T0,TIB_TYPE_INDEX << LOG_BYTES_IN_ADDRESS,T0);
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.getArrayLength) {
    popAddr(T0);
    asm.emitLIntOffset(T0,T0,VM_ObjectModel.getArrayLengthOffset());
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.sync) {
    asm.emitSYNC();
  }
 else   if (methodName == VM_MagicNames.isync) {
    asm.emitISYNC();
  }
 else   if (methodName == VM_MagicNames.dcbst) {
    popAddr(T0);
    asm.emitDCBST(0,T0);
  }
 else   if (methodName == VM_MagicNames.dcbt) {
    popAddr(T0);
    asm.emitDCBT(0,T0);
  }
 else   if (methodName == VM_MagicNames.dcbtst) {
    popAddr(T0);
    asm.emitDCBTST(0,T0);
  }
 else   if (methodName == VM_MagicNames.dcbz) {
    popAddr(T0);
    asm.emitDCBZ(0,T0);
  }
 else   if (methodName == VM_MagicNames.dcbzl) {
    popAddr(T0);
    asm.emitDCBZL(0,T0);
  }
 else   if (methodName == VM_MagicNames.icbi) {
    popAddr(T0);
    asm.emitICBI(0,T0);
  }
 else   if (methodName == VM_MagicNames.wordToInt || methodName == VM_MagicNames.wordToAddress || methodName == VM_MagicNames.wordToOffset || methodName == VM_MagicNames.wordToObject || methodName == VM_MagicNames.wordFromObject || methodName == VM_MagicNames.wordToObjectReference || methodName == VM_MagicNames.wordToExtent || methodName == VM_MagicNames.wordToWord || methodName == VM_MagicNames.codeArrayToAddress) {
  }
 else   if (methodName == VM_MagicNames.wordToLong) {
    asm.emitLVAL(T0,0);
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.wordFromInt || methodName == VM_MagicNames.wordFromIntSignExtend) {
    if (VM.BuildFor64Addr) {
      popInt(T0);
      pushAddr(T0);
    }
  }
 else   if (methodName == VM_MagicNames.wordFromIntZeroExtend) {
    if (VM.BuildFor64Addr) {
      asm.emitLWZ(T0,spTopOffset + BYTES_IN_STACKSLOT - BYTES_IN_INT,FP);
      pokeAddr(T0,0);
    }
  }
 else   if (methodName == VM_MagicNames.wordFromLong) {
    discardSlot();
  }
 else   if (methodName == VM_MagicNames.wordPlus) {
    if (VM.BuildFor64Addr && (methodToBeCalled.getParameterTypes()[0] == VM_TypeReference.Int)) {
      popInt(T0);
    }
 else {
      popAddr(T0);
    }
    popAddr(T1);
    asm.emitADD(T2,T1,T0);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordMinus || methodName == VM_MagicNames.wordDiff) {
    if (VM.BuildFor64Addr && (methodToBeCalled.getParameterTypes()[0] == VM_TypeReference.Int)) {
      popInt(T0);
    }
 else {
      popAddr(T0);
    }
    popAddr(T1);
    asm.emitSUBFC(T2,T0,T1);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordEQ) {
    generateAddrComparison(false,EQ);
  }
 else   if (methodName == VM_MagicNames.wordNE) {
    generateAddrComparison(false,NE);
  }
 else   if (methodName == VM_MagicNames.wordLT) {
    generateAddrComparison(false,LT);
  }
 else   if (methodName == VM_MagicNames.wordLE) {
    generateAddrComparison(false,LE);
  }
 else   if (methodName == VM_MagicNames.wordGT) {
    generateAddrComparison(false,GT);
  }
 else   if (methodName == VM_MagicNames.wordGE) {
    generateAddrComparison(false,GE);
  }
 else   if (methodName == VM_MagicNames.wordsLT) {
    generateAddrComparison(true,LT);
  }
 else   if (methodName == VM_MagicNames.wordsLE) {
    generateAddrComparison(true,LE);
  }
 else   if (methodName == VM_MagicNames.wordsGT) {
    generateAddrComparison(true,GT);
  }
 else   if (methodName == VM_MagicNames.wordsGE) {
    generateAddrComparison(true,GE);
  }
 else   if (methodName == VM_MagicNames.wordIsZero || methodName == VM_MagicNames.wordIsNull) {
    asm.emitLVAL(T0,0);
    pushAddr(T0);
    generateAddrComparison(false,EQ);
  }
 else   if (methodName == VM_MagicNames.wordIsMax) {
    asm.emitLVAL(T0,-1);
    pushAddr(T0);
    generateAddrComparison(false,EQ);
  }
 else   if (methodName == VM_MagicNames.wordZero || methodName == VM_MagicNames.wordNull) {
    asm.emitLVAL(T0,0);
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.wordOne) {
    asm.emitLVAL(T0,1);
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.wordMax) {
    asm.emitLVAL(T0,-1);
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.wordAnd) {
    popAddr(T0);
    popAddr(T1);
    asm.emitAND(T2,T1,T0);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordOr) {
    popAddr(T0);
    popAddr(T1);
    asm.emitOR(T2,T1,T0);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordNot) {
    popAddr(T0);
    asm.emitLVAL(T1,-1);
    asm.emitXOR(T2,T1,T0);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordXor) {
    popAddr(T0);
    popAddr(T1);
    asm.emitXOR(T2,T1,T0);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordLsh) {
    popInt(T0);
    popAddr(T1);
    asm.emitSLAddr(T2,T1,T0);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordRshl) {
    popInt(T0);
    popAddr(T1);
    asm.emitSRAddr(T2,T1,T0);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordRsha) {
    popInt(T0);
    popAddr(T1);
    asm.emitSRA_Addr(T2,T1,T0);
    pushAddr(T2);
  }
 else {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Generate inline code sequence for specified method.
 * @param methodToBeCalled method whose name indicates semantics of code to be generated
 * @return true if there was magic defined for the method
 */
private boolean generateInlineCode(VM_MethodReference methodToBeCalled){
  VM_Atom methodName=methodToBeCalled.getName();
  if (methodToBeCalled.isSysCall()) {
    VM_TypeReference[] args=methodToBeCalled.getParameterTypes();
    int paramWords=methodToBeCalled.getParameterWords();
    int gp=FIRST_OS_PARAMETER_GPR;
    int fp=FIRST_OS_PARAMETER_FPR;
    int stackIndex=paramWords - 1;
    int paramBytes=((VM.BuildFor64Addr ? args.length : paramWords) - 1) * BYTES_IN_STACKSLOT;
    int callee_param_index=-BYTES_IN_STACKSLOT - paramBytes;
    for (int i=1; i < args.length; i++) {
      VM_TypeReference t=args[i];
      if (t.isLongType()) {
        stackIndex-=2;
        callee_param_index+=BYTES_IN_LONG;
        if (VM.BuildFor64Addr) {
          if (gp <= LAST_OS_PARAMETER_GPR) {
            peekLong(gp,gp,stackIndex);
            gp++;
          }
 else {
            peekLong(S0,S0,stackIndex);
            asm.emitSTD(S0,callee_param_index - BYTES_IN_LONG,FP);
          }
        }
 else {
          if (VM.BuildForLinux) {
            gp+=(gp + 1) & 0x01;
          }
          if (gp <= LAST_OS_PARAMETER_GPR) {
            peekInt(gp++,stackIndex);
          }
          if (gp <= LAST_OS_PARAMETER_GPR) {
            peekInt(gp++,stackIndex + 1);
          }
 else {
            peekLong(S0,S1,stackIndex);
            asm.emitSTW(S0,callee_param_index - BYTES_IN_LONG,FP);
            asm.emitSTW(S1,callee_param_index - BYTES_IN_INT,FP);
          }
        }
      }
 else       if (t.isFloatType()) {
        stackIndex-=1;
        callee_param_index+=BYTES_IN_STACKSLOT;
        if (fp <= LAST_OS_PARAMETER_FPR) {
          peekFloat(fp++,stackIndex);
        }
 else {
          peekFloat(FIRST_SCRATCH_FPR,stackIndex);
          asm.emitSTFS(FIRST_SCRATCH_FPR,callee_param_index - BYTES_IN_FLOAT,FP);
        }
      }
 else       if (t.isDoubleType()) {
        stackIndex-=2;
        callee_param_index+=BYTES_IN_DOUBLE;
        if (fp <= LAST_OS_PARAMETER_FPR) {
          peekDouble(fp++,stackIndex);
        }
 else {
          peekDouble(FIRST_SCRATCH_FPR,stackIndex);
          asm.emitSTFD(FIRST_SCRATCH_FPR,callee_param_index - BYTES_IN_DOUBLE,FP);
        }
      }
 else       if (t.isIntLikeType()) {
        stackIndex-=1;
        callee_param_index+=BYTES_IN_STACKSLOT;
        if (gp <= LAST_OS_PARAMETER_GPR) {
          peekInt(gp++,stackIndex);
        }
 else {
          peekInt(S0,stackIndex);
          asm.emitSTAddr(S0,callee_param_index - BYTES_IN_ADDRESS,FP);
        }
      }
 else {
        stackIndex-=1;
        callee_param_index+=BYTES_IN_STACKSLOT;
        if (gp <= LAST_OS_PARAMETER_GPR) {
          peekAddr(gp++,stackIndex);
        }
 else {
          peekAddr(S0,stackIndex);
          asm.emitSTAddr(S0,callee_param_index - BYTES_IN_ADDRESS,FP);
        }
      }
    }
    if (VM.VerifyAssertions) {
      VM._assert(stackIndex == 0);
    }
    peekAddr(S0,paramWords - 1);
    generateSysCall(paramBytes);
    discardSlots(paramWords);
    VM_TypeReference rtype=methodToBeCalled.getReturnType();
    if (rtype.isIntLikeType()) {
      pushInt(T0);
    }
 else     if (rtype.isWordType() || rtype.isReferenceType()) {
      pushAddr(T0);
    }
 else     if (rtype.isDoubleType()) {
      pushDouble(FIRST_OS_PARAMETER_FPR);
    }
 else     if (rtype.isFloatType()) {
      pushFloat(FIRST_OS_PARAMETER_FPR);
    }
 else     if (rtype.isLongType()) {
      pushLong(T0,VM.BuildFor64Addr ? T0 : T1);
    }
    return true;
  }
  if (methodToBeCalled.getType() == VM_TypeReference.Address) {
    VM_TypeReference[] types=methodToBeCalled.getParameterTypes();
    if (methodName == VM_MagicNames.loadAddress || methodName == VM_MagicNames.loadObjectReference || methodName == VM_MagicNames.loadWord) {
      if (types.length == 0) {
        popAddr(T0);
        asm.emitLAddr(T0,0,T0);
        pushAddr(T0);
      }
 else {
        popInt(T1);
        popAddr(T0);
        asm.emitLAddrX(T0,T1,T0);
        pushAddr(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.loadChar) {
      if (types.length == 0) {
        popAddr(T0);
        asm.emitLHZ(T0,0,T0);
        pushInt(T0);
      }
 else {
        popInt(T1);
        popAddr(T0);
        asm.emitLHZX(T0,T1,T0);
        pushInt(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.loadShort) {
      if (types.length == 0) {
        popAddr(T0);
        asm.emitLHA(T0,0,T0);
        pushInt(T0);
      }
 else {
        popInt(T1);
        popAddr(T0);
        asm.emitLHAX(T0,T1,T0);
        pushInt(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.loadByte) {
      if (types.length == 0) {
        popAddr(T0);
        asm.emitLBZ(T0,0,T0);
        pushInt(T0);
      }
 else {
        popInt(T1);
        popAddr(T0);
        asm.emitLBZX(T0,T1,T0);
        pushInt(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.loadInt || methodName == VM_MagicNames.loadFloat) {
      if (types.length == 0) {
        popAddr(T0);
        asm.emitLInt(T0,0,T0);
        pushInt(T0);
      }
 else {
        popInt(T1);
        popAddr(T0);
        asm.emitLIntX(T0,T1,T0);
        pushInt(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.loadDouble || methodName == VM_MagicNames.loadLong) {
      if (types.length == 0) {
        popAddr(T1);
        asm.emitLFD(F0,0,T1);
        pushDouble(F0);
      }
 else {
        popInt(T2);
        popAddr(T1);
        asm.emitLFDX(F0,T1,T2);
        pushDouble(F0);
      }
      return true;
    }
    if ((methodName == VM_MagicNames.prepareInt) || (VM.BuildFor32Addr && (methodName == VM_MagicNames.prepareWord)) || (VM.BuildFor32Addr && (methodName == VM_MagicNames.prepareObjectReference))|| (VM.BuildFor32Addr && (methodName == VM_MagicNames.prepareAddress))) {
      if (types.length == 0) {
        popAddr(T0);
        asm.emitLWARX(T0,0,T0);
        pushInt(T0);
      }
 else {
        popInt(T1);
        popAddr(T0);
        asm.emitLWARX(T0,T1,T0);
        pushInt(T0);
      }
      return true;
    }
    if ((methodName == VM_MagicNames.prepareLong) || (VM.BuildFor64Addr && (methodName == VM_MagicNames.prepareWord)) || (VM.BuildFor64Addr && (methodName == VM_MagicNames.prepareObjectReference))|| (VM.BuildFor64Addr && (methodName == VM_MagicNames.prepareAddress))) {
      if (types.length == 0) {
        popAddr(T0);
        asm.emitLDARX(T0,0,T0);
        pushAddr(T0);
      }
 else {
        popInt(T1);
        popAddr(T0);
        if (VM.BuildFor64Addr) {
          asm.emitLDARX(T0,T1,T0);
        }
 else {
        }
        pushAddr(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.attempt && ((types[0] == VM_TypeReference.Int) || (VM.BuildFor32Addr && (types[0] == VM_TypeReference.Address)) || (VM.BuildFor32Addr && (types[0] == VM_TypeReference.Word)))) {
      if (types.length == 2) {
        popInt(T2);
        discardSlot();
        popAddr(T0);
        asm.emitSTWCXr(T2,0,T0);
        asm.emitLVAL(T0,0);
        VM_ForwardReference fr=asm.emitForwardBC(NE);
        asm.emitLVAL(T0,1);
        fr.resolve(asm);
        pushInt(T0);
      }
 else {
        popInt(T1);
        popInt(T2);
        discardSlot();
        popAddr(T0);
        asm.emitSTWCXr(T2,T1,T0);
        asm.emitLVAL(T0,0);
        VM_ForwardReference fr=asm.emitForwardBC(NE);
        asm.emitLVAL(T0,1);
        fr.resolve(asm);
        pushInt(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.attempt && ((types[0] == VM_TypeReference.Long) || (VM.BuildFor64Addr && (types[0] == VM_TypeReference.Address)) || (VM.BuildFor64Addr && (types[0] == VM_TypeReference.Word)))) {
      if (types.length == 2) {
        popAddr(T2);
        discardSlot();
        popAddr(T0);
        asm.emitSTDCXr(T2,0,T0);
        asm.emitLVAL(T0,0);
        VM_ForwardReference fr=asm.emitForwardBC(NE);
        asm.emitLVAL(T0,1);
        fr.resolve(asm);
        pushInt(T0);
      }
 else {
        popInt(T1);
        popAddr(T2);
        discardSlot();
        popAddr(T0);
        if (VM.BuildFor64Addr) {
          asm.emitSTDCXr(T2,T1,T0);
        }
 else {
        }
        asm.emitLVAL(T0,0);
        VM_ForwardReference fr=asm.emitForwardBC(NE);
        asm.emitLVAL(T0,1);
        fr.resolve(asm);
        pushInt(T0);
      }
      return true;
    }
    if (methodName == VM_MagicNames.store) {
      if (types[0] == VM_TypeReference.Word || types[0] == VM_TypeReference.ObjectReference || types[0] == VM_TypeReference.Address) {
        if (types.length == 1) {
          popAddr(T1);
          popAddr(T0);
          asm.emitSTAddrX(T1,0,T0);
        }
 else {
          popInt(T1);
          popAddr(T2);
          popAddr(T0);
          asm.emitSTAddrX(T2,T1,T0);
        }
        return true;
      }
      if (types[0] == VM_TypeReference.Byte) {
        if (types.length == 1) {
          popInt(T1);
          popAddr(T0);
          asm.emitSTBX(T1,0,T0);
        }
 else {
          popInt(T1);
          popInt(T2);
          popAddr(T0);
          asm.emitSTBX(T2,T1,T0);
        }
        return true;
      }
      if (types[0] == VM_TypeReference.Int || types[0] == VM_TypeReference.Float) {
        if (types.length == 1) {
          popInt(T1);
          popAddr(T0);
          asm.emitSTWX(T1,0,T0);
        }
 else {
          popInt(T1);
          popInt(T2);
          popAddr(T0);
          asm.emitSTWX(T2,T1,T0);
        }
        return true;
      }
      if (types[0] == VM_TypeReference.Short || types[0] == VM_TypeReference.Char) {
        if (types.length == 1) {
          popInt(T1);
          popAddr(T0);
          asm.emitSTHX(T1,0,T0);
        }
 else {
          popInt(T1);
          popInt(T2);
          popAddr(T0);
          asm.emitSTHX(T2,T1,T0);
        }
        return true;
      }
      if (types[0] == VM_TypeReference.Double || types[0] == VM_TypeReference.Long) {
        if (types.length == 1) {
          popLong(T2,T1);
          popAddr(T0);
          if (VM.BuildFor32Addr) {
            asm.emitSTW(T2,0,T0);
            asm.emitSTW(T1,BYTES_IN_INT,T0);
          }
 else {
            asm.emitSTD(T1,0,T0);
          }
        }
 else {
          popInt(T1);
          popLong(T3,T2);
          popAddr(T0);
          if (VM.BuildFor32Addr) {
            asm.emitSTWX(T3,T1,T0);
            asm.emitADDI(T1,BYTES_IN_INT,T1);
            asm.emitSTWX(T2,T1,T0);
          }
 else {
            asm.emitSTDX(T2,T1,T0);
          }
        }
        return true;
      }
    }
  }
  if (methodName == VM_MagicNames.getFramePointer) {
    pushAddr(FP);
  }
 else   if (methodName == VM_MagicNames.getCallerFramePointer) {
    popAddr(T0);
    asm.emitLAddr(T1,STACKFRAME_FRAME_POINTER_OFFSET,T0);
    pushAddr(T1);
  }
 else   if (methodName == VM_MagicNames.setCallerFramePointer) {
    popAddr(T1);
    popAddr(T0);
    asm.emitSTAddr(T1,STACKFRAME_FRAME_POINTER_OFFSET,T0);
  }
 else   if (methodName == VM_MagicNames.getCompiledMethodID) {
    popAddr(T0);
    asm.emitLInt(T1,STACKFRAME_METHOD_ID_OFFSET,T0);
    pushInt(T1);
  }
 else   if (methodName == VM_MagicNames.setCompiledMethodID) {
    popInt(T1);
    popAddr(T0);
    asm.emitSTW(T1,STACKFRAME_METHOD_ID_OFFSET,T0);
  }
 else   if (methodName == VM_MagicNames.getNextInstructionAddress) {
    popAddr(T0);
    asm.emitLAddr(T1,STACKFRAME_NEXT_INSTRUCTION_OFFSET,T0);
    pushAddr(T1);
  }
 else   if (methodName == VM_MagicNames.getReturnAddressLocation) {
    popAddr(T0);
    asm.emitLAddr(T1,STACKFRAME_FRAME_POINTER_OFFSET,T0);
    asm.emitADDI(T2,STACKFRAME_NEXT_INSTRUCTION_OFFSET,T1);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.getTocPointer || methodName == VM_MagicNames.getJTOC) {
    pushAddr(JTOC);
  }
 else   if (methodName == VM_MagicNames.getProcessorRegister) {
    pushAddr(PROCESSOR_REGISTER);
  }
 else   if (methodName == VM_MagicNames.setProcessorRegister) {
    popAddr(PROCESSOR_REGISTER);
  }
 else   if (methodName == VM_MagicNames.getTimeBase) {
    if (VM.BuildFor64Addr) {
      asm.emitMFTB(T1);
    }
 else {
      int label=asm.getMachineCodeIndex();
      asm.emitMFTBU(T0);
      asm.emitMFTB(T1);
      asm.emitMFTBU(T2);
      asm.emitCMP(T0,T2);
      asm.emitBC(NE,label);
    }
    pushLong(T0,T1);
  }
 else   if (methodName == VM_MagicNames.invokeClassInitializer) {
    popAddr(T0);
    asm.emitMTCTR(T0);
    asm.emitBCCTRL();
  }
 else   if (methodName == VM_MagicNames.invokeMethodReturningVoid) {
    generateMethodInvocation();
  }
 else   if (methodName == VM_MagicNames.invokeMethodReturningInt) {
    generateMethodInvocation();
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.invokeMethodReturningLong) {
    generateMethodInvocation();
    pushLong(T0,VM.BuildFor64Addr ? T0 : T1);
  }
 else   if (methodName == VM_MagicNames.invokeMethodReturningFloat) {
    generateMethodInvocation();
    pushFloat(F0);
  }
 else   if (methodName == VM_MagicNames.invokeMethodReturningDouble) {
    generateMethodInvocation();
    pushDouble(F0);
  }
 else   if (methodName == VM_MagicNames.invokeMethodReturningObject) {
    generateMethodInvocation();
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.addressArrayCreate) {
    VM_Array type=methodToBeCalled.getType().resolve().asArray();
    emit_resolved_newarray(type);
  }
 else   if (methodName == VM_MagicNames.addressArrayLength) {
    emit_arraylength();
  }
 else   if (methodName == VM_MagicNames.addressArrayGet) {
    if (VM.BuildFor32Addr || methodToBeCalled.getType() == VM_TypeReference.CodeArray) {
      emit_iaload();
    }
 else {
      genBoundsCheck();
      asm.emitSLDI(T1,T1,LOG_BYTES_IN_ADDRESS);
      asm.emitLAddrX(T2,T0,T1);
      pushAddr(T2);
    }
  }
 else   if (methodName == VM_MagicNames.addressArraySet) {
    if (VM.BuildFor32Addr || methodToBeCalled.getType() == VM_TypeReference.CodeArray) {
      emit_iastore();
    }
 else {
      popAddr(T2);
      genBoundsCheck();
      asm.emitSLDI(T1,T1,LOG_BYTES_IN_ADDRESS);
      asm.emitSTAddrX(T2,T0,T1);
    }
  }
 else   if (methodName == VM_MagicNames.getIntAtOffset) {
    popInt(T1);
    popAddr(T0);
    asm.emitLIntX(T0,T1,T0);
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.getObjectAtOffset || methodName == VM_MagicNames.getWordAtOffset || methodName == VM_MagicNames.getObjectArrayAtOffset) {
    popInt(T1);
    popAddr(T0);
    asm.emitLAddrX(T0,T1,T0);
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.getUnsignedByteAtOffset) {
    popInt(T1);
    popAddr(T0);
    asm.emitLBZX(T0,T1,T0);
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.getByteAtOffset) {
    popInt(T1);
    popAddr(T0);
    asm.emitLBZX(T0,T1,T0);
    asm.emitEXTSB(T0,T0);
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.getCharAtOffset) {
    popInt(T1);
    popAddr(T0);
    asm.emitLHZX(T0,T1,T0);
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.getShortAtOffset) {
    popInt(T1);
    popAddr(T0);
    asm.emitLHAX(T0,T1,T0);
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.setIntAtOffset) {
    popInt(T2);
    popInt(T1);
    popAddr(T0);
    asm.emitSTWX(T2,T1,T0);
  }
 else   if (methodName == VM_MagicNames.setObjectAtOffset || methodName == VM_MagicNames.setWordAtOffset) {
    if (methodToBeCalled.getParameterTypes().length == 4) {
      discardSlot();
    }
    popAddr(T2);
    popInt(T1);
    popAddr(T0);
    asm.emitSTAddrX(T2,T1,T0);
  }
 else   if (methodName == VM_MagicNames.setByteAtOffset) {
    popInt(T2);
    popInt(T1);
    popAddr(T0);
    asm.emitSTBX(T2,T1,T0);
  }
 else   if (methodName == VM_MagicNames.setCharAtOffset) {
    popInt(T2);
    popInt(T1);
    popAddr(T0);
    asm.emitSTHX(T2,T1,T0);
  }
 else   if (methodName == VM_MagicNames.getLongAtOffset || methodName == VM_MagicNames.getDoubleAtOffset) {
    popInt(T2);
    popAddr(T1);
    asm.emitLFDX(F0,T1,T2);
    pushDouble(F0);
  }
 else   if ((methodName == VM_MagicNames.setLongAtOffset) || (methodName == VM_MagicNames.setDoubleAtOffset)) {
    popLong(T3,T2);
    popInt(T1);
    popAddr(T0);
    if (VM.BuildFor32Addr) {
      asm.emitSTWX(T3,T1,T0);
      asm.emitADDI(T1,BYTES_IN_INT,T1);
      asm.emitSTWX(T2,T1,T0);
    }
 else {
      asm.emitSTDX(T2,T1,T0);
    }
  }
 else   if (methodName == VM_MagicNames.getMemoryInt) {
    popAddr(T0);
    asm.emitLInt(T0,0,T0);
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.getMemoryWord || methodName == VM_MagicNames.getMemoryAddress) {
    popAddr(T0);
    asm.emitLAddr(T0,0,T0);
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.setMemoryInt) {
    popInt(T1);
    popAddr(T0);
    asm.emitSTW(T1,0,T0);
  }
 else   if (methodName == VM_MagicNames.setMemoryWord) {
    if (methodToBeCalled.getParameterTypes().length == 3) {
      discardSlot();
    }
    popAddr(T1);
    popAddr(T0);
    asm.emitSTAddr(T1,0,T0);
  }
 else   if ((methodName == VM_MagicNames.prepareInt) || (VM.BuildFor32Addr && (methodName == VM_MagicNames.prepareObject)) || (VM.BuildFor32Addr && (methodName == VM_MagicNames.prepareAddress))|| (VM.BuildFor32Addr && (methodName == VM_MagicNames.prepareWord))) {
    popInt(T1);
    popAddr(T0);
    asm.emitLWARX(T0,T1,T0);
    pushInt(T0);
  }
 else   if ((methodName == VM_MagicNames.prepareLong) || (VM.BuildFor64Addr && (methodName == VM_MagicNames.prepareObject)) || (VM.BuildFor64Addr && (methodName == VM_MagicNames.prepareAddress))|| (VM.BuildFor64Addr && (methodName == VM_MagicNames.prepareWord))) {
    popInt(T1);
    popAddr(T0);
    if (VM.BuildFor64Addr) {
      asm.emitLDARX(T0,T1,T0);
    }
 else {
    }
    pushAddr(T0);
  }
 else   if ((methodName == VM_MagicNames.attemptInt) || (VM.BuildFor32Addr && (methodName == VM_MagicNames.attemptObject)) || (VM.BuildFor32Addr && (methodName == VM_MagicNames.attemptObjectReference))|| (VM.BuildFor32Addr && (methodName == VM_MagicNames.attemptAddress))|| (VM.BuildFor32Addr && (methodName == VM_MagicNames.attemptWord))) {
    popInt(T2);
    discardSlot();
    popInt(T1);
    popAddr(T0);
    asm.emitSTWCXr(T2,T1,T0);
    asm.emitLVAL(T0,0);
    VM_ForwardReference fr=asm.emitForwardBC(NE);
    asm.emitLVAL(T0,1);
    fr.resolve(asm);
    pushInt(T0);
  }
 else   if ((methodName == VM_MagicNames.attemptLong) || (VM.BuildFor64Addr && (methodName == VM_MagicNames.attemptObject)) || (VM.BuildFor64Addr && (methodName == VM_MagicNames.attemptObjectReference))|| (VM.BuildFor64Addr && (methodName == VM_MagicNames.attemptAddress))|| (VM.BuildFor64Addr && (methodName == VM_MagicNames.attemptWord))) {
    popAddr(T2);
    discardSlot();
    popInt(T1);
    popAddr(T0);
    if (VM.BuildFor64Addr) {
      asm.emitSTDCXr(T2,T1,T0);
    }
 else {
    }
    asm.emitLVAL(T0,0);
    VM_ForwardReference fr=asm.emitForwardBC(NE);
    asm.emitLVAL(T0,1);
    fr.resolve(asm);
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.saveThreadState) {
    peekAddr(T0,0);
    asm.emitLAddrToc(S0,VM_Entrypoints.saveThreadStateInstructionsField.getOffset());
    asm.emitMTCTR(S0);
    asm.emitBCCTRL();
    discardSlot();
  }
 else   if (methodName == VM_MagicNames.threadSwitch) {
    peekAddr(T1,0);
    peekAddr(T0,1);
    asm.emitLAddrToc(S0,VM_Entrypoints.threadSwitchInstructionsField.getOffset());
    asm.emitMTCTR(S0);
    asm.emitBCCTRL();
    discardSlots(2);
  }
 else   if (methodName == VM_MagicNames.restoreHardwareExceptionState) {
    peekAddr(T0,0);
    asm.emitLAddrToc(S0,VM_Entrypoints.restoreHardwareExceptionStateInstructionsField.getOffset());
    asm.emitMTLR(S0);
    asm.emitBCLR();
  }
 else   if (methodName == VM_MagicNames.returnToNewStack) {
    peekAddr(FP,0);
    asm.emitLAddr(S0,STACKFRAME_NEXT_INSTRUCTION_OFFSET,FP);
    asm.emitMTLR(S0);
    asm.emitBCLR();
  }
 else   if (methodName == VM_MagicNames.dynamicBridgeTo) {
    if (VM.VerifyAssertions)     VM._assert(klass.hasDynamicBridgeAnnotation());
    peekAddr(T0,0);
    asm.emitMTCTR(T0);
    int offset=frameSize;
    for (int i=LAST_NONVOLATILE_FPR; i >= FIRST_VOLATILE_FPR; --i) {
      asm.emitLFD(i,offset-=BYTES_IN_DOUBLE,FP);
    }
    for (int i=LAST_NONVOLATILE_GPR; i >= FIRST_NONVOLATILE_GPR; --i) {
      asm.emitLAddr(i,offset-=BYTES_IN_ADDRESS,FP);
    }
    offset-=(FIRST_NONVOLATILE_GPR - LAST_VOLATILE_GPR - 1) * BYTES_IN_ADDRESS;
    for (int i=LAST_VOLATILE_GPR; i >= FIRST_VOLATILE_GPR; --i) {
      asm.emitLAddr(i,offset-=BYTES_IN_ADDRESS,FP);
    }
    asm.emitLAddr(FP,0,FP);
    asm.emitLAddr(S0,STACKFRAME_NEXT_INSTRUCTION_OFFSET,FP);
    asm.emitMTLR(S0);
    asm.emitBCCTR();
  }
 else   if (methodName == VM_MagicNames.objectAsAddress || methodName == VM_MagicNames.addressAsByteArray || methodName == VM_MagicNames.addressAsObject || methodName == VM_MagicNames.addressAsObjectArray || methodName == VM_MagicNames.objectAsType || methodName == VM_MagicNames.objectAsShortArray || methodName == VM_MagicNames.objectAsIntArray || methodName == VM_MagicNames.objectAsProcessor || methodName == VM_MagicNames.threadAsCollectorThread || methodName == VM_MagicNames.floatAsIntBits || methodName == VM_MagicNames.intBitsAsFloat || methodName == VM_MagicNames.doubleAsLongBits || methodName == VM_MagicNames.longBitsAsDouble) {
  }
 else   if (methodName == VM_MagicNames.getObjectType) {
    popAddr(T0);
    VM_ObjectModel.baselineEmitLoadTIB(asm,T0,T0);
    asm.emitLAddr(T0,TIB_TYPE_INDEX << LOG_BYTES_IN_ADDRESS,T0);
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.getArrayLength) {
    popAddr(T0);
    asm.emitLIntOffset(T0,T0,VM_ObjectModel.getArrayLengthOffset());
    pushInt(T0);
  }
 else   if (methodName == VM_MagicNames.sync) {
    asm.emitSYNC();
  }
 else   if (methodName == VM_MagicNames.isync) {
    asm.emitISYNC();
  }
 else   if (methodName == VM_MagicNames.dcbst) {
    popAddr(T0);
    asm.emitDCBST(0,T0);
  }
 else   if (methodName == VM_MagicNames.dcbt) {
    popAddr(T0);
    asm.emitDCBT(0,T0);
  }
 else   if (methodName == VM_MagicNames.dcbtst) {
    popAddr(T0);
    asm.emitDCBTST(0,T0);
  }
 else   if (methodName == VM_MagicNames.dcbz) {
    popAddr(T0);
    asm.emitDCBZ(0,T0);
  }
 else   if (methodName == VM_MagicNames.dcbzl) {
    popAddr(T0);
    asm.emitDCBZL(0,T0);
  }
 else   if (methodName == VM_MagicNames.icbi) {
    popAddr(T0);
    asm.emitICBI(0,T0);
  }
 else   if (methodName == VM_MagicNames.wordToInt || methodName == VM_MagicNames.wordToAddress || methodName == VM_MagicNames.wordToOffset || methodName == VM_MagicNames.wordToObject || methodName == VM_MagicNames.wordFromObject || methodName == VM_MagicNames.wordToObjectReference || methodName == VM_MagicNames.wordToExtent || methodName == VM_MagicNames.wordToWord || methodName == VM_MagicNames.codeArrayToAddress) {
  }
 else   if (methodName == VM_MagicNames.wordToLong) {
    asm.emitLVAL(T0,0);
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.wordFromInt || methodName == VM_MagicNames.wordFromIntSignExtend) {
    if (VM.BuildFor64Addr) {
      popInt(T0);
      pushAddr(T0);
    }
  }
 else   if (methodName == VM_MagicNames.wordFromIntZeroExtend) {
    if (VM.BuildFor64Addr) {
      asm.emitLWZ(T0,spTopOffset + BYTES_IN_STACKSLOT - BYTES_IN_INT,FP);
      pokeAddr(T0,0);
    }
  }
 else   if (methodName == VM_MagicNames.wordFromLong) {
    discardSlot();
  }
 else   if (methodName == VM_MagicNames.wordPlus) {
    if (VM.BuildFor64Addr && (methodToBeCalled.getParameterTypes()[0] == VM_TypeReference.Int)) {
      popInt(T0);
    }
 else {
      popAddr(T0);
    }
    popAddr(T1);
    asm.emitADD(T2,T1,T0);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordMinus || methodName == VM_MagicNames.wordDiff) {
    if (VM.BuildFor64Addr && (methodToBeCalled.getParameterTypes()[0] == VM_TypeReference.Int)) {
      popInt(T0);
    }
 else {
      popAddr(T0);
    }
    popAddr(T1);
    asm.emitSUBFC(T2,T0,T1);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordEQ) {
    generateAddrComparison(false,EQ);
  }
 else   if (methodName == VM_MagicNames.wordNE) {
    generateAddrComparison(false,NE);
  }
 else   if (methodName == VM_MagicNames.wordLT) {
    generateAddrComparison(false,LT);
  }
 else   if (methodName == VM_MagicNames.wordLE) {
    generateAddrComparison(false,LE);
  }
 else   if (methodName == VM_MagicNames.wordGT) {
    generateAddrComparison(false,GT);
  }
 else   if (methodName == VM_MagicNames.wordGE) {
    generateAddrComparison(false,GE);
  }
 else   if (methodName == VM_MagicNames.wordsLT) {
    generateAddrComparison(true,LT);
  }
 else   if (methodName == VM_MagicNames.wordsLE) {
    generateAddrComparison(true,LE);
  }
 else   if (methodName == VM_MagicNames.wordsGT) {
    generateAddrComparison(true,GT);
  }
 else   if (methodName == VM_MagicNames.wordsGE) {
    generateAddrComparison(true,GE);
  }
 else   if (methodName == VM_MagicNames.wordIsZero || methodName == VM_MagicNames.wordIsNull) {
    asm.emitLVAL(T0,0);
    pushAddr(T0);
    generateAddrComparison(false,EQ);
  }
 else   if (methodName == VM_MagicNames.wordIsMax) {
    asm.emitLVAL(T0,-1);
    pushAddr(T0);
    generateAddrComparison(false,EQ);
  }
 else   if (methodName == VM_MagicNames.wordZero || methodName == VM_MagicNames.wordNull) {
    asm.emitLVAL(T0,0);
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.wordOne) {
    asm.emitLVAL(T0,1);
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.wordMax) {
    asm.emitLVAL(T0,-1);
    pushAddr(T0);
  }
 else   if (methodName == VM_MagicNames.wordAnd) {
    popAddr(T0);
    popAddr(T1);
    asm.emitAND(T2,T1,T0);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordOr) {
    popAddr(T0);
    popAddr(T1);
    asm.emitOR(T2,T1,T0);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordNot) {
    popAddr(T0);
    asm.emitLVAL(T1,-1);
    asm.emitXOR(T2,T1,T0);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordXor) {
    popAddr(T0);
    popAddr(T1);
    asm.emitXOR(T2,T1,T0);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordLsh) {
    popInt(T0);
    popAddr(T1);
    asm.emitSLAddr(T2,T1,T0);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordRshl) {
    popInt(T0);
    popAddr(T1);
    asm.emitSRAddr(T2,T1,T0);
    pushAddr(T2);
  }
 else   if (methodName == VM_MagicNames.wordRsha) {
    popInt(T0);
    popAddr(T1);
    asm.emitSRA_Addr(T2,T1,T0);
    pushAddr(T2);
  }
 else {
    return false;
  }
  return true;
}