bytecodeIndex = baseCompiledMethod.findBytecodeIndexForInstruction (MCOffset>>>VM.LG_INSTRUCTION_WIDTH);
bytecodeIndex = baseCompiledMethod.findBytecodeIndexForInstruction(MCOffset);
  void thresholdReached() {    if (DEBUG) VM.sysWriteln("DCG_Organizer.thresholdReached()");        for (int i=0; i<bufferSize; i=i+3) {      int calleeCMID = buffer[i+0];      VM_CompiledMethod compiledMethod   = VM_CompiledMethods.getCompiledMethod(calleeCMID);      if (compiledMethod == null) continue;      VM_Method callee = compiledMethod.getMethod();      if (callee.isRuntimeServiceMethod()) {        if (DEBUG) VM.sysWrite("Skipping sample with runtime service callee");        continue;      }      int callerCMID = buffer[i+1];      compiledMethod   = VM_CompiledMethods.getCompiledMethod(callerCMID);      if (compiledMethod == null) continue;      VM_Method stackFrameCaller = compiledMethod.getMethod();             int MCOffset = buffer[i+2];      int bytecodeIndex = -1;      VM_Method caller = null;      switch (compiledMethod.getCompilerType()) {      case VM_CompiledMethod.TRAP:      case VM_CompiledMethod.JNI:        if (DEBUG) VM.sysWrite("Skipping sample with TRAP/JNI caller");        continue;      case VM_CompiledMethod.BASELINE:        {          VM_BaselineCompiledMethod baseCompiledMethod =             (VM_BaselineCompiledMethod)compiledMethod;          // note: the following call expects the offset in INSTRUCTIONS!          bytecodeIndex = baseCompiledMethod.findBytecodeIndexForInstruction            (MCOffset>>>VM.LG_INSTRUCTION_WIDTH);          caller = stackFrameCaller;        }        break;        //-#if RVM_WITH_QUICK_COMPILER      case VM_CompiledMethod.QUICK:        {          VM_QuickCompiledMethod quickCompiledMethod =             (VM_QuickCompiledMethod)compiledMethod;          // note: the following call expects the offset in INSTRUCTIONS!          bytecodeIndex = quickCompiledMethod.findBytecodeIndexForInstruction            (MCOffset>>>VM.LG_INSTRUCTION_WIDTH);          caller = stackFrameCaller;        }        break;        //-#endif      case VM_CompiledMethod.OPT:        {          VM_OptCompiledMethod optCompiledMethod = (VM_OptCompiledMethod)compiledMethod;          VM_OptMachineCodeMap mc_map = optCompiledMethod.getMCMap();          try {            bytecodeIndex = mc_map.getBytecodeIndexForMCOffset(MCOffset);            if (bytecodeIndex == -1) {              // this can happen we we sample a call               // to a runtimeSerivce routine.               // We aren't setup to inline such methods anyways,               // so skip the sample.              if (DEBUG) {                  VM.sysWrite("  *** SKIP SAMPLE ", stackFrameCaller.toString());                  VM.sysWrite("@",compiledMethod.toString());                  VM.sysWrite(" at MC offset ", MCOffset);                  VM.sysWrite(" calling ", callee.toString());                  VM.sysWriteln(" due to invalid bytecodeIndex");              }              continue; // skip sample.            }          } catch (java.lang.ArrayIndexOutOfBoundsException e) {              VM.sysWrite("  ***ERROR: getBytecodeIndexForMCOffset(", MCOffset);              VM.sysWrite(") ArrayIndexOutOfBounds!\n");              e.printStackTrace();              if (VM.ErrorsFatal) VM.sysFail("Exception in AI organizer.");              caller = stackFrameCaller;              continue;  // skip sample          } catch (OPT_OptimizingCompilerException e) {            VM.sysWrite("***Error: SKIP SAMPLE: can't find bytecode index in OPT compiled "+                        stackFrameCaller+"@"+compiledMethod+" at MC offset ",MCOffset);            VM.sysWrite("!\n");            if (VM.ErrorsFatal) VM.sysFail("Exception in AI organizer.");            continue;  // skip sample          }                    try {            caller = mc_map.getMethodForMCOffset(MCOffset);          } catch (java.lang.ArrayIndexOutOfBoundsException e) {            VM.sysWrite("  ***ERROR: getMethodForMCOffset(",MCOffset);                 VM.sysWrite(") ArrayIndexOutOfBounds!\n");            e.printStackTrace();            if (VM.ErrorsFatal) VM.sysFail("Exception in AI organizer.");            caller = stackFrameCaller;            continue;          } catch (OPT_OptimizingCompilerException e) {            VM.sysWrite("***Error: SKIP SAMPLE: can't find caller in OPT compiled "+                        stackFrameCaller+"@"+compiledMethod+" at MC offset ",MCOffset);            VM.sysWrite("!\n");            if (VM.ErrorsFatal) VM.sysFail("Exception in AI organizer.");            continue;  // skip sample          }          if (caller == null) {            VM.sysWrite("  ***ERROR: getMethodForMCOffset(",MCOffset);            VM.sysWrite(") returned null!\n");            caller = stackFrameCaller;            continue;  // skip sample          }        }        break;      }      // increment the call graph edge, adding it if needed      VM_Controller.dcg.incrementEdge(caller, bytecodeIndex, callee);    }  }