private final int getMCOffset(int entry) { if (isBigEntry(entry)) { long t = MCInformation[entry+BIG_OFFSET_IDX_ADJ]; return (int)((t & BIG_OFFSET_MASK) >>> BIG_OFFSET_SHIFT); } else { long t = MCInformation[entry]; return (int)((t & OFFSET_MASK) >>> OFFSET_SHIFT); } }   private final int getGCMapIndex(int entry) { if (isBigEntry(entry)) { long t  = MCInformation[entry+BIG_GCI_IDX_ADJ]; int gci = (int)((t & BIG_GCI_MASK) >>> BIG_GCI_SHIFT); if (gci == BIG_INVALID_GCI) return -1; return gci; } else { long t =  MCInformation[entry]; int gci = (int)((t & GCI_MASK) >>> GCI_SHIFT); if (gci == INVALID_GCI) return -1; return gci; } }
  private void generateMCInformation(OPT_GCIRMap irMap) throws VM_PragmaInterruptible {    OPT_CallSiteTree inliningMap = new OPT_CallSiteTree();    int numEntries = 0;        // (1) Count how many entries we are going to have and    //     construct and encode the inlining information for those entries.    for (OPT_GCIRMapEnumerator irMapEnum = irMap.enumerator(); 	 irMapEnum.hasMoreElements(); numEntries++) {      OPT_GCIRMapElement irMapElem = 	(OPT_GCIRMapElement)irMapEnum.nextElement();      OPT_Instruction instr = irMapElem.getInstruction();      if (instr.position == null && instr.bcIndex != INSTRUMENTATION_BCI) {        if (MIR_Call.conforms(instr) && MIR_Call.hasMethod(instr)) {          throw new OPT_OptimizingCompilerException("position required for all call instructions "						    + instr);        }      } else {	inliningMap.addLocation(instr.position);      }    }    if (numEntries == 0) return; // if no entries, then we are done.    inlineEncoding = VM_OptEncodedCallSiteTree.getEncoding(inliningMap);    // (2) Encode the primary machine code mapping information and the GCMaps.    VM_OptGCMap gcMapBuilder = new VM_OptGCMap();    MCInformation = new long[numEntries]; // assume no need for BIG entries    int lastMCInfoEntry = -1;    for (OPT_GCIRMapEnumerator irMapEnum = irMap.enumerator();         irMapEnum.hasMoreElements();) {      OPT_GCIRMapElement irMapElem = 	(OPT_GCIRMapElement)irMapEnum.nextElement();      OPT_Instruction instr = irMapElem.getInstruction();      if (DUMP_MAPS) VM.sysWrite("IR Map for " + instr + "\n\t" + irMapElem);      // retrieve the machine code offset (in bytes) from the instruction,      int mco= instr.getmcOffset();      if (mco < 0) {        System.out.println("Negative machine code MCOffset found:" + mco);        OPT_Instruction i = irMapElem.getInstruction();        System.out.println(i.bcIndex+", "+i+", "+i.getmcOffset()+"\n");	throw new OPT_OptimizingCompilerException("Negative machine code MCOffset found");      }      // create GC map and get GCI      int gci = gcMapBuilder.generateGCMapEntry(irMapElem);      // get bci information      int bci = instr.getBytecodeIndex();      if (bci < 0) {        if (bci == UNKNOWN_BCI && MIR_Call.conforms(instr) && MIR_Call.hasMethod(instr)) {          throw new OPT_OptimizingCompilerException("valid bytecode index required for all calls " + instr);	}        bci = -1;      }      // get index into inline encoding      int iei = -1;      if (instr.position != null) {        iei = inliningMap.find(instr.position).encodedOffset;      }      // set the call info      int cm = 0;      if (MIR_Call.conforms(instr)) {	OPT_MethodOperand mo = MIR_Call.getMethod(instr);	if (mo != null && mo.isGuardedInlineOffBranch()) {	  cm = IS_GUARDED_CALL;	} else {	  cm = IS_UNGUARDED_CALL;	}      }      // Encode this entry into MCInformation      if (bci < INVALID_BCI &&	  iei < INVALID_IEI &&	  gci < INVALID_GCI && 	  mco < (OFFSET_MASK >>> OFFSET_SHIFT)) {	// use a normal entry	if (bci == -1) bci = INVALID_BCI;	if (iei == -1) iei = INVALID_IEI;	if (gci == -1) gci = INVALID_GCI;	if (VM.VerifyAssertions) {	  VM.assert((cm  & (CALL_MASK>>>CALL_SHIFT)) == cm);	  VM.assert((bci & (BCI_MASK>>>BCI_SHIFT)) == bci);	  VM.assert((iei & (IEI_MASK>>>IEI_SHIFT)) == iei);	  VM.assert((gci & (GCI_MASK>>>GCI_SHIFT)) == gci);	  VM.assert((mco & (OFFSET_MASK>>>OFFSET_SHIFT)) == mco);	}	long t = START_OF_ENTRY;	t |= (((long)cm) << CALL_SHIFT);	t |= (((long)bci) << BCI_SHIFT);	t |= (((long)iei) << IEI_SHIFT);	t |= (((long)gci) << GCI_SHIFT);	t |= (((long)mco) << OFFSET_SHIFT);	MCInformation[++lastMCInfoEntry] = t;      } else {	// use a big entry (assume this is very rare, so only make room for one)	long[] tmp = new long[MCInformation.length+1];	System.arraycopy(MCInformation, 0, tmp, 0, MCInformation.length);	MCInformation = tmp;	if (bci == -1) bci = BIG_INVALID_BCI;	if (iei == -1) iei = BIG_INVALID_IEI;	if (gci == -1) gci = BIG_INVALID_GCI;	if (VM.VerifyAssertions) {	  VM.assert(BIG_CALL_IDX_ADJ == 0 &&		    BIG_BCI_IDX_ADJ == 0 &&		    BIG_OFFSET_IDX_ADJ == 0);	  VM.assert(BIG_GCI_IDX_ADJ == 1 &&		    BIG_IEI_IDX_ADJ == 1);	  VM.assert((cm  & (BIG_CALL_MASK>>>BIG_CALL_SHIFT)) == cm);	  VM.assert((bci & (BIG_BCI_MASK>>>BIG_BCI_SHIFT)) == bci);	  VM.assert((iei & (BIG_IEI_MASK>>>BIG_IEI_SHIFT)) == iei);	  VM.assert((gci & (BIG_GCI_MASK>>>BIG_GCI_SHIFT)) == gci);	  VM.assert((mco & (BIG_OFFSET_MASK>>>BIG_OFFSET_SHIFT)) == mco);	}	// long 1	long t = START_OF_BIG_ENTRY;	t |= (((long)cm) << BIG_CALL_SHIFT);	t |= (((long)bci) << BIG_BCI_SHIFT);	t |= (((long)mco) << BIG_OFFSET_SHIFT);	MCInformation[++lastMCInfoEntry] = t;	// long 2 	t = (((long)gci) << BIG_GCI_SHIFT);	t |= (((long)iei) << BIG_IEI_SHIFT);	MCInformation[++lastMCInfoEntry] = t;      }      }    gcMaps = gcMapBuilder.finish();  }  ////////////////////////////////////////////  //  Accessors  //  NB: The accessors take an entry number, which is defined to  //      be the index of word I of the MCInformation entry  ////////////////////////////////////////////  /**   * Returns the MCOffset for the entry passed   * @param  entry the index of the start of the entry   * @return       the MCOffset for this entry   */  private final int getMCOffset(int entry) {    if (isBigEntry(entry)) {      long t = MCInformation[entry+BIG_OFFSET_IDX_ADJ];      return (int)((t & BIG_OFFSET_MASK) >>> BIG_OFFSET_SHIFT);    } else {      long t = MCInformation[entry];      return (int)((t & OFFSET_MASK) >>> OFFSET_SHIFT);    }  }  /**   * Returns the GC map index for the entry passed   * @param   entry the index of the start of the entry   * @return        the GC map entry index for this entry (or -1 if none)   */  private final int getGCMapIndex(int entry) {    if (isBigEntry(entry)) {      long t  = MCInformation[entry+BIG_GCI_IDX_ADJ];      int gci = (int)((t & BIG_GCI_MASK) >>> BIG_GCI_SHIFT);      if (gci == BIG_INVALID_GCI) return -1;      return gci;    } else {      long t =  MCInformation[entry];      int gci = (int)((t & GCI_MASK) >>> GCI_SHIFT);      if (gci == INVALID_GCI) return -1;      return gci;    }  }