new OPT_CompilationPlan(method, VM_RuntimeCompiler.optimizationPlan,
new OPT_CompilationPlan(method, (OPT_OptimizationPlanElement[])VM_RuntimeCompiler.optimizationPlan,
  public static VM_CompiledMethod optCompile(OSR_ExecutionState state) {    VM_NormalMethod method = state.getMethod();    if (VM.TraceOnStackReplacement) { VM.sysWriteln("OPT : starts compiling "+method); }    VM_ControllerPlan latestPlan = VM_ControllerMemory.findLatestPlan(method);    OPT_Options _options = null;    if (latestPlan != null) {      _options = (OPT_Options)latestPlan.getCompPlan().options.clone();    } else {      // no previous compilation plan, a long run loop promoted from baseline.      // this only happens when testing, not in real code      _options = new OPT_Options();      _options.setOptLevel(0);    }    // disable OSR points in specialized method    _options.OSR_GUARDED_INLINING = false;    OPT_CompilationPlan compPlan =       new OPT_CompilationPlan(method, VM_RuntimeCompiler.optimizationPlan,                               null, _options);    // it is also necessary to recompile the current method    // without OSR.    /* generate prologue bytes */    byte[] prologue = state.generatePrologue();    int prosize = prologue.length;    method.setForOsrSpecialization(prologue, state.getMaxStackHeight());            int[] oldStartPCs = null;    int[] oldEndPCs = null;    int[] oldHandlerPCs = null;    /* adjust exception table. */    {     // if (VM.TraceOnStackReplacement) { VM.sysWrite("OPT adjust exception table.\n"); }      VM_ExceptionHandlerMap exceptionHandlerMap = method.getExceptionHandlerMap();       if (exceptionHandlerMap != null) {         oldStartPCs = exceptionHandlerMap.getStartPC();        oldEndPCs = exceptionHandlerMap.getEndPC();        oldHandlerPCs = exceptionHandlerMap.getHandlerPC();         int n = oldStartPCs.length;         int[] newStartPCs = new int[n];        System.arraycopy(oldStartPCs, 0, newStartPCs, 0, n);        exceptionHandlerMap.setStartPC(newStartPCs);         int[] newEndPCs = new int[n];        System.arraycopy(oldEndPCs, 0, newEndPCs, 0, n);        exceptionHandlerMap.setEndPC(newEndPCs);         int[] newHandlerPCs = new int[n];        System.arraycopy(oldHandlerPCs, 0, newHandlerPCs, 0, n);        exceptionHandlerMap.setHandlerPC(newHandlerPCs);         for (int i=0; i<n; i++) {          newStartPCs[i] += prosize;          newEndPCs[i] += prosize;          newHandlerPCs[i] += prosize;        }      }    }         VM_CompiledMethod newCompiledMethod =        VM_RuntimeCompiler.recompileWithOptOnStackSpecialization(compPlan);    // restore original bytecode, exception table, and line number table    method.finalizeOsrSpecialization();     {      VM_ExceptionHandlerMap exceptionHandlerMap = method.getExceptionHandlerMap();       if (exceptionHandlerMap != null) {        exceptionHandlerMap.setStartPC(oldStartPCs);        exceptionHandlerMap.setEndPC(oldEndPCs);        exceptionHandlerMap.setHandlerPC(oldHandlerPCs);      }    }    // compilation failed because compilation is in progress,    // reverse back to the baseline    if (newCompiledMethod == null) {      if (VM.TraceOnStackReplacement)         VM.sysWriteln("OPT : fialed, because compilation in progress, "                      +"fall back to baseline");      return baselineCompile(state);    }     // mark the method is a specialized one    newCompiledMethod.setSpecialForOSR();    if (VM.TraceOnStackReplacement) VM.sysWriteln("OPT : done\n");    return newCompiledMethod;  }