Пример #1
0
  /**
   * recompile an execution state
   *
   * @param state a list of execution states
   * @param invalidate Is this an invalidation?
   * @return the compiled method for the root state
   */
  public static CompiledMethod recompileState(ExecutionState state, boolean invalidate) {

    // compile from callee to caller
    CompiledMethod newCM = null;
    do {
      if (!invalidate) {
        newCM = optCompile(state);
      } else {
        newCM = baselineCompile(state);
      }

      if (VM.TraceOnStackReplacement) {
        VM.sysWriteln(
            "new CMID 0x"
                + Integer.toHexString(newCM.getId())
                + "("
                + newCM.getId()
                + ") for "
                + newCM.getMethod());
      }

      if (state.callerState == null) break;
      state = state.callerState;
      // set callee_cmid of the caller
      state.callee_cmid = newCM.getId();

    } while (true);

    return newCM;
  }