asm.emitMOV_RegIdx_Reg_Word(T1, S0, asm.BYTE, NO_SLOT, T0);
asm.emitMOV_RegIdx_Reg_Word(T1, S0, VM_Assembler.BYTE, NO_SLOT, T0);
  private final boolean genMagic (VM_MethodReference m) {    VM_Atom methodName = m.getName();    if (m.getType() == VM_TypeReference.Address) {      // Address magic      VM_TypeReference[] types = m.getParameterTypes();      // Loads all take the form:      // ..., Address, [Offset] -> ..., Value      if (methodName == VM_MagicNames.loadAddress ||          methodName == VM_MagicNames.prepareAddress ||          methodName == VM_MagicNames.prepareObjectReference ||          methodName == VM_MagicNames.loadWord ||          methodName == VM_MagicNames.loadObjectReference ||          methodName == VM_MagicNames.prepareWord ||          methodName == VM_MagicNames.loadInt ||          methodName == VM_MagicNames.prepareInt ||          methodName == VM_MagicNames.loadFloat) {        if (types.length == 0) {          // No offset          asm.emitPOP_Reg(T0);                      // address          asm.emitPUSH_RegInd(T0);                  // pushes [T0+0]        } else {          // Load at offset          asm.emitPOP_Reg (S0);                  // offset          asm.emitPOP_Reg (T0);                  // object ref          asm.emitPUSH_RegIdx(T0, S0, asm.BYTE, NO_SLOT); // pushes [T0+S0]        }        return true;      }      if (methodName == VM_MagicNames.loadByte) {        if (types.length == 0) {          // No offset          asm.emitPOP_Reg (T0);                  // base           asm.emitMOVZX_Reg_RegInd_Byte(T0, T0) ;          asm.emitPUSH_Reg (T0);        } else {          // Load at offset          asm.emitPOP_Reg (S0);                  // offset          asm.emitPOP_Reg (T0);                  // base           asm.emitMOVZX_Reg_RegIdx_Byte(T0, T0, S0, asm.BYTE, NO_SLOT); // load and zero extend byte [T0+S0]          asm.emitPUSH_Reg (T0);        }        return true;      }      if (methodName == VM_MagicNames.loadShort ||          methodName == VM_MagicNames.loadChar) {        if (types.length == 0) {          // No offset          asm.emitPOP_Reg (T0);                  // base           asm.emitMOVZX_Reg_RegInd_Word(T0, T0);          asm.emitPUSH_Reg (T0);        } else {          // Load at offset          asm.emitPOP_Reg (S0);                  // offset          asm.emitPOP_Reg (T0);                  // base           asm.emitMOVZX_Reg_RegIdx_Word(T0, T0, S0, asm.BYTE, NO_SLOT); // load and zero extend word [T0+S0]          asm.emitPUSH_Reg (T0);        }        return true;      }      if (methodName == VM_MagicNames.loadLong ||          methodName == VM_MagicNames.loadDouble) {              if (types.length == 0) {          // No offset          throw new RuntimeException("Magic not implemented");        } else {          // Load at offset          asm.emitPOP_Reg (S0);                  // offset          asm.emitPOP_Reg (T0);                  // base           asm.emitPUSH_RegIdx(T0, S0, asm.BYTE, ONE_SLOT); // pushes [T0+S0+4]          asm.emitPUSH_RegIdx(T0, S0, asm.BYTE, NO_SLOT); // pushes [T0+S0]        }        return true;      }      // Stores all take the form:      // ..., Address, [Offset], Value -> ...      if (methodName == VM_MagicNames.store) {        // Always at least one parameter to a store.         // First parameter is the type to be stored.        VM_TypeReference storeType = types[0];        if (storeType == VM_TypeReference.Int ||            storeType == VM_TypeReference.Address ||            storeType == VM_TypeReference.ObjectReference ||            storeType == VM_TypeReference.Word ||            storeType == VM_TypeReference.Float) {                  if (types.length == 1) {            // No offset            asm.emitPOP_Reg(T0);                   // value            asm.emitPOP_Reg(S0);                   // address            asm.emitMOV_RegInd_Reg(S0,T0);         // [S0+0] <- T0          } else {            // Store at offset            asm.emitPOP_Reg(S0);                   // offset            asm.emitPOP_Reg(T0);                   // value            asm.emitPOP_Reg(T1);                   // address             asm.emitMOV_RegIdx_Reg(T1, S0,                                 asm.BYTE, NO_SLOT, T0); // [T1+S0] <- T0          }          return true;        }        if (storeType == VM_TypeReference.Byte) {          if (types.length == 1) {            // No offset             asm.emitPOP_Reg(T0);                   // value            asm.emitPOP_Reg(T1);                   // base             asm.emitMOV_RegInd_Reg_Byte(T1, T0);          } else {            // Store at offset            asm.emitPOP_Reg(S0);                   // offset            asm.emitPOP_Reg(T0);                   // value            asm.emitPOP_Reg(T1);                   // base             asm.emitMOV_RegIdx_Reg_Byte(T1, S0,                                  asm.BYTE, NO_SLOT, T0); // [T1+S0] <- (byte) T0               }          return true;        }        if (storeType == VM_TypeReference.Short ||            storeType == VM_TypeReference.Char) {           if (types.length == 1) {            // No offset             asm.emitPOP_Reg(T0);                   // value            asm.emitPOP_Reg(T1);                   // base             asm.emitMOV_RegInd_Reg_Word(T1, T0);          } else {            // Store at offset            asm.emitPOP_Reg(S0);                   // offset                asm.emitPOP_Reg(T0);                   // value            asm.emitPOP_Reg(T1);                   // base                  asm.emitMOV_RegIdx_Reg_Word(T1, S0,                                  asm.BYTE, NO_SLOT, T0); // [T1+S0] <- (word) T0               }          return true;        }        if (storeType == VM_TypeReference.Double ||            storeType == VM_TypeReference.Long) {           if (types.length == 1) {            // No offset             throw new RuntimeException("Magic not implemented");          } else {            // Store at offset            asm.emitMOV_Reg_RegDisp(T0, SP, ONE_SLOT);          // value high            asm.emitMOV_Reg_RegInd (S0, SP);     // offset            asm.emitMOV_Reg_RegDisp(T1, SP, THREE_SLOTS);     // base             asm.emitMOV_RegIdx_Reg (T1, S0, asm.BYTE, NO_SLOT, T0); // [T1+S0] <- T0            asm.emitMOV_Reg_RegDisp(T0, SP, TWO_SLOTS);     // value low            asm.emitMOV_RegIdx_Reg (T1, S0, asm.BYTE, ONE_SLOT, T0); // [T1+S0+4] <- T0            asm.emitADD_Reg_Imm    (SP, WORDSIZE * 4); // pop stack locations          }          return true;        }      } else if (methodName == VM_MagicNames.attempt) {        // All attempts are similar 32 bit values.        if (types.length == 3) {          // Offset passed          asm.emitPOP_Reg (S0);        // S0 = offset        }        asm.emitPOP_Reg (T1);          // newVal        asm.emitPOP_Reg (EAX);         // oldVal (EAX is implicit arg to LCMPX        if (types.length == 3) {          asm.emitADD_Reg_RegInd(S0, SP);  // S0 += base        } else {          // No offset          asm.emitMOV_Reg_RegInd(S0, SP);  // S0 = base        }                asm.emitLockNextInstruction();        asm.emitCMPXCHG_RegInd_Reg (S0, T1);   // atomic compare-and-exchange        asm.emitMOV_RegInd_Imm (SP, 0);        // 'push' false (overwriting base)        VM_ForwardReference fr = asm.forwardJcc(asm.NE); // skip if compare fails        asm.emitMOV_RegInd_Imm (SP, 1);        // 'push' true (overwriting base)        fr.resolve(asm);        return true;      }    }    if (methodName == VM_MagicNames.attemptInt ||        methodName == VM_MagicNames.attemptObject ||        methodName == VM_MagicNames.attemptAddress ||        methodName == VM_MagicNames.attemptWord) {      // attempt gets called with four arguments: base, offset, oldVal, newVal      // returns ([base+offset] == oldVal)      // if ([base+offset] == oldVal) [base+offset] := newVal      // (operation on memory is atomic)      asm.emitPOP_Reg (T1);            // newVal      asm.emitPOP_Reg (EAX);           // oldVal (EAX is implicit arg to LCMPXCNG      asm.emitPOP_Reg (S0);            // S0 = offset      asm.emitADD_Reg_RegInd(S0, SP);  // S0 += base      asm.emitLockNextInstruction();      asm.emitCMPXCHG_RegInd_Reg (S0, T1);   // atomic compare-and-exchange      asm.emitMOV_RegInd_Imm (SP, 0);        // 'push' false (overwriting base)      VM_ForwardReference fr = asm.forwardJcc(asm.NE); // skip if compare fails      asm.emitMOV_RegInd_Imm (SP, 1);        // 'push' true (overwriting base)      fr.resolve(asm);      return true;    }        if (methodName == VM_MagicNames.invokeMain) {      // invokeMain gets "called" with two arguments:      //   String[] mainArgs       // the arguments to the main method      //   INSTRUCTION[] mainCode  // the code for the main method      asm.emitPOP_Reg (S0);            //       genParameterRegisterLoad(1); // pass 1 parameter word           asm.emitCALL_Reg(S0);            // branches to mainCode with mainArgs on the stack      return true;    }        if (methodName == VM_MagicNames.saveThreadState) {      Offset offset = VM_Entrypoints.saveThreadStateInstructionsField.getOffset();      genParameterRegisterLoad(1); // pass 1 parameter word      asm.emitCALL_RegDisp(JTOC, offset);      return true;    }    if (methodName == VM_MagicNames.threadSwitch) {      Offset offset = VM_Entrypoints.threadSwitchInstructionsField.getOffset();      genParameterRegisterLoad(2); // pass 2 parameter words      asm.emitCALL_RegDisp(JTOC, offset);      return true;    }                      if (methodName == VM_MagicNames.restoreHardwareExceptionState) {      Offset offset = VM_Entrypoints.restoreHardwareExceptionStateInstructionsField.getOffset();      genParameterRegisterLoad(1); // pass 1 parameter word      asm.emitCALL_RegDisp(JTOC, offset);      return true;    }    if (methodName == VM_MagicNames.invokeClassInitializer) {      asm.emitPOP_Reg (S0);      asm.emitCALL_Reg(S0); // call address just popped      return true;    }        if (m.getType() == VM_TypeReference.SysCall) {      VM_TypeReference[] args = m.getParameterTypes();      VM_TypeReference rtype = m.getReturnType();      Offset offsetToJavaArg = THREE_SLOTS; // the three regs saved in (2)      int paramBytes = 0;            // (1) save three RVM nonvolatile/special registers      //     we don't have to save EBP: the callee will      //     treat it as a framepointer and save/restore      //     it for us.      asm.emitPUSH_Reg(EBX);      asm.emitPUSH_Reg(ESI);          asm.emitPUSH_Reg(EDI);      // (2) Push args to target function (reversed)      for (int i=args.length-1; i>=0; i--) {        VM_TypeReference arg = args[i];        if (arg.isLongType() || arg.isDoubleType()) {          asm.emitPUSH_RegDisp(SP, offsetToJavaArg.add(4));          asm.emitPUSH_RegDisp(SP, offsetToJavaArg.add(4));          offsetToJavaArg = offsetToJavaArg.add(16);          paramBytes += 8;        } else {          asm.emitPUSH_RegDisp(SP, offsetToJavaArg);          offsetToJavaArg = offsetToJavaArg.add(8);          paramBytes += 4;        }      }         // (3) invoke target function      VM_Field ip = VM_Entrypoints.getSysCallField(m.getName().toString());      asm.emitMOV_Reg_RegDisp(S0, JTOC, VM_Entrypoints.the_boot_recordField.getOffset());      asm.emitCALL_RegDisp(S0, ip.getOffset());            // (4) pop space for arguments      asm.emitADD_Reg_Imm(SP, paramBytes);      // (5) restore RVM registers      asm.emitPOP_Reg(EDI);      asm.emitPOP_Reg(ESI);      asm.emitPOP_Reg(EBX);      // (6) pop expression stack      asm.emitADD_Reg_Imm(SP, paramBytes);      // (7) push return value      if (rtype.isLongType()) {        asm.emitPUSH_Reg(T1);        asm.emitPUSH_Reg(T0);      } else if (rtype.isDoubleType()) {        asm.emitSUB_Reg_Imm(SP, 8);        asm.emitFSTP_RegInd_Reg_Quad(SP, FP0);      } else if (rtype.isFloatType()) {        asm.emitSUB_Reg_Imm(SP, 4);        asm.emitFSTP_RegInd_Reg(SP, FP0);      } else if (!rtype.isVoidType()) {        asm.emitPUSH_Reg(T0);      }            return true;    }           if (methodName == VM_MagicNames.getFramePointer) {      asm.emitLEA_Reg_RegDisp(S0, SP, fp2spOffset(NO_SLOT));      asm.emitPUSH_Reg       (S0);      return true;    }        if (methodName == VM_MagicNames.getCallerFramePointer) {      asm.emitPOP_Reg(T0);                                       // Callee FP      asm.emitPUSH_RegDisp(T0, Offset.fromIntSignExtend(STACKFRAME_FRAME_POINTER_OFFSET)); // Caller FP      return true;    }    if (methodName == VM_MagicNames.setCallerFramePointer) {      asm.emitPOP_Reg(T0);  // value      asm.emitPOP_Reg(S0);  // fp      asm.emitMOV_RegDisp_Reg(S0, Offset.fromIntSignExtend(STACKFRAME_FRAME_POINTER_OFFSET), T0); // [S0+SFPO] <- T0      return true;    }    if (methodName == VM_MagicNames.getCompiledMethodID) {      asm.emitPOP_Reg(T0);                                   // Callee FP      asm.emitPUSH_RegDisp(T0, Offset.fromIntSignExtend(STACKFRAME_METHOD_ID_OFFSET)); // Callee CMID      return true;    }    if (methodName == VM_MagicNames.setCompiledMethodID) {      asm.emitPOP_Reg(T0);  // value      asm.emitPOP_Reg(S0);  // fp      asm.emitMOV_RegDisp_Reg(S0, Offset.fromIntSignExtend(STACKFRAME_METHOD_ID_OFFSET), T0); // [S0+SMIO] <- T0      return true;    }    if (methodName == VM_MagicNames.getReturnAddressLocation) {      asm.emitPOP_Reg(T0);                                        // Callee FP      asm.emitADD_Reg_Imm(T0, STACKFRAME_RETURN_ADDRESS_OFFSET);  // location containing callee return address      asm.emitPUSH_Reg(T0);                                       // Callee return address      return true;    }        if (methodName == VM_MagicNames.getTocPointer ||        methodName == VM_MagicNames.getJTOC ) {      asm.emitPUSH_Reg(JTOC);      return true;    }        // get the processor register (PR)    if (methodName == VM_MagicNames.getProcessorRegister) {      asm.emitPUSH_Reg(PR);      return true;    }      // set the processor register (PR)    if (methodName == VM_MagicNames.setProcessorRegister) {      asm.emitPOP_Reg(PR);      return true;    }        // Get the value in ESI     if (methodName == VM_MagicNames.getESIAsProcessor) {      asm.emitPUSH_Reg(ESI);      return true;    }      // Set the value in ESI    if (methodName == VM_MagicNames.setESIAsProcessor) {      asm.emitPOP_Reg(ESI);      return true;    }      if (methodName == VM_MagicNames.getIntAtOffset ||        methodName == VM_MagicNames.getWordAtOffset ||         methodName == VM_MagicNames.getObjectAtOffset ||        methodName == VM_MagicNames.getObjectArrayAtOffset ||        methodName == VM_MagicNames.prepareInt ||        methodName == VM_MagicNames.prepareObject ||        methodName == VM_MagicNames.prepareAddress ||        methodName == VM_MagicNames.prepareWord) {      asm.emitPOP_Reg (T0);                  // object ref      asm.emitPOP_Reg (S0);                  // offset      asm.emitPUSH_RegIdx(T0, S0, asm.BYTE, NO_SLOT); // pushes [T0+S0]      return true;    }        if (methodName == VM_MagicNames.getByteAtOffset) {      asm.emitPOP_Reg (T0);                  // object ref      asm.emitPOP_Reg (S0);                  // offset      asm.emitMOVZX_Reg_RegIdx_Byte(T0, T0, S0, asm.BYTE, NO_SLOT); // load and zero extend byte [T0+S0]      asm.emitPUSH_Reg (T0);      return true;    }    if (methodName == VM_MagicNames.getCharAtOffset) {      asm.emitPOP_Reg (T0);                  // object ref      asm.emitPOP_Reg (S0);                  // offset      asm.emitMOVZX_Reg_RegIdx_Word(T0, T0, S0, asm.BYTE, NO_SLOT); // load and zero extend char [T0+S0]      asm.emitPUSH_Reg (T0);      return true;    }        if (methodName == VM_MagicNames.setIntAtOffset ||        methodName == VM_MagicNames.setWordAtOffset ||         methodName == VM_MagicNames.setObjectAtOffset ) {      if (m.getParameterTypes().length == 4) {         // discard locationMetadata parameter        asm.emitPOP_Reg(T0); // locationMetadata, not needed by baseline compiler.      }      asm.emitPOP_Reg(T0);                   // value      asm.emitPOP_Reg(S0);                   // offset      asm.emitPOP_Reg(T1);                   // obj ref      asm.emitMOV_RegIdx_Reg(T1, S0, asm.BYTE, NO_SLOT, T0); // [T1+S0] <- T0      return true;    }        if (methodName == VM_MagicNames.setByteAtOffset) {      asm.emitPOP_Reg(T0);                   // value      asm.emitPOP_Reg(S0);                   // offset      asm.emitPOP_Reg(T1);                   // obj ref      asm.emitMOV_RegIdx_Reg_Byte(T1, S0, asm.BYTE, NO_SLOT, T0); // [T1+S0] <- (byte) T0      return true;    }        if (methodName == VM_MagicNames.setCharAtOffset) {      asm.emitPOP_Reg(T0);                   // value      asm.emitPOP_Reg(S0);                   // offset      asm.emitPOP_Reg(T1);                   // obj ref      asm.emitMOV_RegIdx_Reg_Word(T1, S0, asm.BYTE, NO_SLOT, T0); // [T1+S0] <- (char) T0      return true;    }        if (methodName == VM_MagicNames.getLongAtOffset ||        methodName == VM_MagicNames.getDoubleAtOffset) {      asm.emitPOP_Reg (T0);                  // object ref      asm.emitPOP_Reg (S0);                  // offset      asm.emitPUSH_RegIdx(T0, S0, asm.BYTE, ONE_SLOT); // pushes [T0+S0+4]      asm.emitPUSH_RegIdx(T0, S0, asm.BYTE, NO_SLOT); // pushes [T0+S0]      return true;    }        if (methodName == VM_MagicNames.setLongAtOffset ||        methodName == VM_MagicNames.setDoubleAtOffset) {      asm.emitMOV_Reg_RegInd (T0, SP);          // value high      asm.emitMOV_Reg_RegDisp(S0, SP, TWO_SLOTS );     // offset      asm.emitMOV_Reg_RegDisp(T1, SP, THREE_SLOTS);     // obj ref      asm.emitMOV_RegIdx_Reg (T1, S0, asm.BYTE, NO_SLOT, T0); // [T1+S0] <- T0      asm.emitMOV_Reg_RegDisp(T0, SP, ONE_SLOT );     // value low      asm.emitMOV_RegIdx_Reg (T1, S0, asm.BYTE, ONE_SLOT, T0); // [T1+S0+4] <- T0      asm.emitADD_Reg_Imm    (SP, WORDSIZE * 4); // pop stack locations      return true;    }    if (methodName == VM_MagicNames.addressArrayCreate) {      // no resolution problem possible.      emit_resolved_newarray(m.getType().resolve().asArray());      return true;    }    if (methodName == VM_MagicNames.addressArrayLength) {      emit_arraylength();  // argument order already correct      return true;    }    if (methodName == VM_MagicNames.addressArrayGet) {      if (m.getType() == VM_TypeReference.CodeArray) {        emit_baload();      } else {        if (VM.BuildFor32Addr) {          emit_iaload();           } else if (VM.BuildFor64Addr) {          emit_laload();        } else {          VM._assert(NOT_REACHED);        }      }      return true;    }    if (methodName == VM_MagicNames.addressArraySet) {      if (m.getType() == VM_TypeReference.CodeArray) {        emit_bastore();      } else {        if (VM.BuildFor32Addr) {          emit_iastore();          } else if (VM.BuildFor64Addr) {          VM._assert(false);  // not implemented        } else {          VM._assert(NOT_REACHED);        }      }      return true;    }    if (methodName == VM_MagicNames.getMemoryInt ||        methodName == VM_MagicNames.getMemoryWord ||        methodName == VM_MagicNames.getMemoryAddress) {      asm.emitPOP_Reg(T0);      // address      asm.emitPUSH_RegInd(T0); // pushes [T0+0]      return true;    }    if (methodName == VM_MagicNames.setMemoryInt ||        methodName == VM_MagicNames.setMemoryWord ||        methodName == VM_MagicNames.setMemoryAddress) {      if (m.getParameterTypes().length == 3) {        // discard locationMetadata parameter        asm.emitPOP_Reg(T0); // locationMetadata, not needed by baseline compiler.      }      asm.emitPOP_Reg(T0);  // value      asm.emitPOP_Reg(S0);  // address      asm.emitMOV_RegInd_Reg(S0,T0); // [S0+0] <- T0      return true;    }        if (methodName == VM_MagicNames.objectAsAddress         ||        methodName == VM_MagicNames.addressAsByteArray      ||        methodName == VM_MagicNames.addressAsIntArray       ||        methodName == VM_MagicNames.addressAsObject         ||        methodName == VM_MagicNames.addressAsObjectArray    ||        methodName == VM_MagicNames.addressAsType           ||        methodName == VM_MagicNames.objectAsType            ||        methodName == VM_MagicNames.objectAsShortArray      ||        methodName == VM_MagicNames.objectAsByteArray       ||        methodName == VM_MagicNames.objectAsIntArray       ||        methodName == VM_MagicNames.addressAsThread         ||        methodName == VM_MagicNames.objectAsThread          ||        methodName == VM_MagicNames.objectAsProcessor       ||        methodName == VM_MagicNames.threadAsCollectorThread ||        methodName == VM_MagicNames.addressAsRegisters      ||        methodName == VM_MagicNames.addressAsStack          ||        methodName == VM_MagicNames.floatAsIntBits          ||        methodName == VM_MagicNames.intBitsAsFloat          ||        methodName == VM_MagicNames.doubleAsLongBits        ||        methodName == VM_MagicNames.longBitsAsDouble)      {        // no-op (a type change, not a representation change)        return true;      }        // code for      VM_Type VM_Magic.getObjectType(Object object)    if (methodName == VM_MagicNames.getObjectType) {      asm.emitPOP_Reg (T0);                               // object ref      VM_ObjectModel.baselineEmitLoadTIB(asm,S0,T0);      asm.emitPUSH_RegDisp(S0, Offset.fromIntZeroExtend(TIB_TYPE_INDEX<<LG_WORDSIZE)); // push VM_Type slot of TIB      return true;    }        if (methodName == VM_MagicNames.getArrayLength) {      asm.emitPOP_Reg(T0);                      // object ref      asm.emitPUSH_RegDisp(T0, VM_ObjectModel.getArrayLengthOffset());       return true;    }        if (methodName == VM_MagicNames.sync) {  // nothing required on IA32      return true;    }        if (methodName == VM_MagicNames.isync) { // nothing required on IA32      return true;    }        // baseline compiled invocation only: all paramaters on the stack    // hi mem    //      Code    //      GPRs    //      FPRs    //      Spills    // low-mem    if (methodName == VM_MagicNames.invokeMethodReturningVoid) {      Offset offset = VM_Entrypoints.reflectiveMethodInvokerInstructionsField.getOffset();      genParameterRegisterLoad(4); // pass 4 parameter words      asm.emitCALL_RegDisp(JTOC, offset);      return true;    }                     if (methodName == VM_MagicNames.invokeMethodReturningInt) {      Offset offset = VM_Entrypoints.reflectiveMethodInvokerInstructionsField.getOffset();      genParameterRegisterLoad(4); // pass 4 parameter words      asm.emitCALL_RegDisp(JTOC, offset);      asm.emitPUSH_Reg(T0);      return true;    }                     if (methodName == VM_MagicNames.invokeMethodReturningLong) {      Offset offset = VM_Entrypoints.reflectiveMethodInvokerInstructionsField.getOffset();      genParameterRegisterLoad(4); // pass 4 parameter words      asm.emitCALL_RegDisp(JTOC, offset);      asm.emitPUSH_Reg(T0); // high half      asm.emitPUSH_Reg(T1); // low half      return true;    }                     if (methodName == VM_MagicNames.invokeMethodReturningFloat) {      Offset offset = VM_Entrypoints.reflectiveMethodInvokerInstructionsField.getOffset();      genParameterRegisterLoad(4); // pass 4 parameter words      asm.emitCALL_RegDisp(JTOC, offset);      asm.emitSUB_Reg_Imm  (SP, 4);      asm.emitFSTP_RegInd_Reg(SP, FP0);      return true;    }                     if (methodName == VM_MagicNames.invokeMethodReturningDouble) {      Offset offset = VM_Entrypoints.reflectiveMethodInvokerInstructionsField.getOffset();      genParameterRegisterLoad(4); // pass 4 parameter words      asm.emitCALL_RegDisp(JTOC, offset);      asm.emitSUB_Reg_Imm  (SP, 8);      asm.emitFSTP_RegInd_Reg_Quad(SP, FP0);      return true;    }                     if (methodName == VM_MagicNames.invokeMethodReturningObject) {      Offset offset = VM_Entrypoints.reflectiveMethodInvokerInstructionsField.getOffset();      genParameterRegisterLoad(4); // pass 4 parameter words      asm.emitCALL_RegDisp(JTOC, offset);      asm.emitPUSH_Reg(T0);      return true;    }                     // baseline invocation    // one paramater, on the stack  -- actual code    if (methodName == VM_MagicNames.dynamicBridgeTo) {      if (VM.VerifyAssertions) VM._assert(klass.isDynamicBridge());      // save the branch address for later      asm.emitPOP_Reg (S0);             // S0<-code address      asm.emitADD_Reg_Imm(SP, fp2spOffset(NO_SLOT).toInt() - 4); // just popped 4 bytes above.      // restore FPU state      asm.emitFRSTOR_RegDisp(SP, FPU_SAVE_OFFSET);      // restore GPRs      asm.emitMOV_Reg_RegDisp (T0,  SP, T0_SAVE_OFFSET);       asm.emitMOV_Reg_RegDisp (T1,  SP, T1_SAVE_OFFSET);       asm.emitMOV_Reg_RegDisp (EBX, SP, EBX_SAVE_OFFSET);       asm.emitMOV_Reg_RegDisp (JTOC,  SP, JTOC_SAVE_OFFSET);       // pop frame      asm.emitPOP_RegDisp (PR, VM_Entrypoints.framePointerField.getOffset()); // FP<-previous FP       // branch      asm.emitJMP_Reg (S0);      return true;    }                                                      if (methodName == VM_MagicNames.returnToNewStack) {      // SP gets frame pointer for new stack      asm.emitPOP_Reg (SP);           // restore nonvolatile registers      asm.emitMOV_Reg_RegDisp (JTOC, SP, JTOC_SAVE_OFFSET);      asm.emitMOV_Reg_RegDisp (EBX, SP, EBX_SAVE_OFFSET);      // discard current stack frame      asm.emitPOP_RegDisp (PR, VM_Entrypoints.framePointerField.getOffset());      // return to caller- pop parameters from stack      asm.emitRET_Imm(parameterWords << LG_WORDSIZE);          return true;    }    if (methodName == VM_MagicNames.roundToZero) {      // Store the FPU Control Word to a JTOC slot      asm.emitFNSTCW_RegDisp(JTOC, VM_Entrypoints.FPUControlWordField.getOffset());      // Set the bits in the status word that control round to zero.      // Note that we use a 32-bit OR, even though we only care about the      // low-order 16 bits      asm.emitOR_RegDisp_Imm(JTOC,VM_Entrypoints.FPUControlWordField.getOffset(), 0x00000c00);      // Now store the result back into the FPU Control Word      asm.emitFLDCW_RegDisp(JTOC,VM_Entrypoints.FPUControlWordField.getOffset());      return true;    }    if (methodName == VM_MagicNames.clearFloatingPointState) {      // Clear the hardware floating-point state      asm.emitFNINIT();      return true;    }        if (methodName == VM_MagicNames.getTimeBase) {      asm.emitRDTSC();       // read timestamp counter instruction      asm.emitPUSH_Reg(EDX); // upper 32 bits      asm.emitPUSH_Reg(EAX); // lower 32 bits      return true;    }    if (methodName == VM_MagicNames.wordFromInt ||        methodName == VM_MagicNames.wordFromObject ||        methodName == VM_MagicNames.wordFromIntZeroExtend ||        methodName == VM_MagicNames.wordFromIntSignExtend ||        methodName == VM_MagicNames.wordToInt ||        methodName == VM_MagicNames.wordToAddress ||        methodName == VM_MagicNames.wordToOffset ||        methodName == VM_MagicNames.wordToObject ||        methodName == VM_MagicNames.wordToObjectReference ||        methodName == VM_MagicNames.wordToExtent ||        methodName == VM_MagicNames.wordToWord) {        if (VM.BuildFor32Addr) return true;     // no-op for 32-bit        if (VM.VerifyAssertions) VM._assert(false);    }    if (methodName == VM_MagicNames.wordToLong) {      if (VM.BuildFor32Addr) {        asm.emitPOP_Reg(T0);        asm.emitPUSH_Imm(0); // upper 32 bits        asm.emitPUSH_Reg(T0); // lower 32 bits        return true;      } // else fill unused stackslot       if (VM.VerifyAssertions) VM._assert(false);    }    if (methodName == VM_MagicNames.wordAnd) {        asm.emitPOP_Reg(T0);        asm.emitAND_RegInd_Reg(SP, T0);        return true;    }    if (methodName == VM_MagicNames.wordOr) {        asm.emitPOP_Reg(T0);        asm.emitOR_RegInd_Reg(SP, T0);        return true;    }    if (methodName == VM_MagicNames.wordXor) {        asm.emitPOP_Reg(T0);        asm.emitXOR_RegInd_Reg(SP, T0);        return true;    }    if (methodName == VM_MagicNames.wordNot) {        asm.emitNOT_RegInd (SP);        return true;    }    if (methodName == VM_MagicNames.wordAdd) {        asm.emitPOP_Reg(T0);        asm.emitADD_RegInd_Reg(SP, T0);        return true;    }    if (methodName == VM_MagicNames.wordSub ||        methodName == VM_MagicNames.wordDiff) {        asm.emitPOP_Reg(T0);        asm.emitSUB_RegInd_Reg(SP, T0);        return true;    }    if (methodName == VM_MagicNames.wordZero ||        methodName == VM_MagicNames.wordNull) {        asm.emitPUSH_Imm(0);        return true;    }    if (methodName == VM_MagicNames.wordOne) {        asm.emitPUSH_Imm(1);        return true;    }    if (methodName == VM_MagicNames.wordMax) {        asm.emitPUSH_Imm(-1);        return true;    }    if (methodName == VM_MagicNames.wordLT) {        generateAddrComparison(asm.LLT);        return true;    }    if (methodName == VM_MagicNames.wordLE) {        generateAddrComparison(asm.LLE);        return true;    }    if (methodName == VM_MagicNames.wordGT) {        generateAddrComparison(asm.LGT);        return true;    }    if (methodName == VM_MagicNames.wordGE) {        generateAddrComparison(asm.LGE);        return true;    }    if (methodName == VM_MagicNames.wordsLT) {        generateAddrComparison(asm.LT);        return true;    }    if (methodName == VM_MagicNames.wordsLE) {        generateAddrComparison(asm.LE);        return true;    }    if (methodName == VM_MagicNames.wordsGT) {        generateAddrComparison(asm.GT);        return true;    }    if (methodName == VM_MagicNames.wordsGE) {        generateAddrComparison(asm.GE);        return true;    }    if (methodName == VM_MagicNames.wordEQ) {        generateAddrComparison(asm.EQ);        return true;    }    if (methodName == VM_MagicNames.wordNE) {        generateAddrComparison(asm.NE);        return true;    }    if (methodName == VM_MagicNames.wordIsZero) {        asm.emitPUSH_Imm(0);        generateAddrComparison(asm.EQ);        return true;    }    if (methodName == VM_MagicNames.wordIsNull) {        asm.emitPUSH_Imm(0);        generateAddrComparison(asm.EQ);        return true;    }    if (methodName == VM_MagicNames.wordIsMax) {        asm.emitPUSH_Imm(-1);        generateAddrComparison(asm.EQ);        return true;    }    if (methodName == VM_MagicNames.wordLsh) {        if (VM.BuildFor32Addr) {          asm.emitPOP_Reg(ECX);          asm.emitSHL_RegInd_Reg(SP, ECX);           }        else          VM._assert(false);          return true;    }    if (methodName == VM_MagicNames.wordRshl) {      if (VM.BuildFor32Addr) {        asm.emitPOP_Reg (ECX);        asm.emitSHR_RegInd_Reg (SP, ECX);        }      else        VM._assert(false);        return true;    }    if (methodName == VM_MagicNames.wordRsha) {      if (VM.BuildFor32Addr) {        asm.emitPOP_Reg (ECX);        asm.emitSAR_RegInd_Reg (SP, ECX);        }      else        VM._assert(false);        return true;    }    return false;      }