/**
   * Initialize boot image compiler.
   *
   * @param args command line arguments to the bootimage compiler
   */
  protected void initCompiler(String[] args) {
    try {
      BaselineCompiler.initOptions();
      VM.sysWrite("BootImageCompiler: init (opt compiler)\n");

      // Writing a boot image is a little bit special.  We're not really
      // concerned about compile time, but we do care a lot about the quality
      // and stability of the generated code.  Set the options accordingly.
      OptimizingCompiler.setBootOptions(masterOptions);

      // Allow further customization by the user.
      for (int i = 0, n = args.length; i < n; i++) {
        String arg = args[i];
        if (!masterOptions.processAsOption("-X:bc:", arg)) {
          if (arg.startsWith("exclude=")) {
            excludePattern = arg.substring(8);
          } else {
            VM.sysWrite("BootImageCompiler: Unrecognized argument " + arg + "; ignoring\n");
          }
        }
      }
      EdgeCounts.loadCountsFromFileIfAvailable(masterOptions.PROFILE_EDGE_COUNT_INPUT_FILE);
      OptimizingCompiler.init(masterOptions);
    } catch (OptimizingCompilerException e) {
      String msg = "BootImageCompiler: Compiler failed during initialization: " + e + "\n";
      if (e.isFatal) {
        // An unexpected error when building the opt boot image should be fatal
        e.printStackTrace();
        System.exit(VM.EXIT_STATUS_OPT_COMPILER_FAILED);
      } else {
        VM.sysWrite(msg);
      }
    }
  }
 private CompiledMethod baselineCompile(NormalMethod method) {
   Callbacks.notifyMethodCompile(method, CompiledMethod.BASELINE);
   CompiledMethod cm = BaselineCompiler.compile(method);
   /* We can't accurately measure compilation time on Host JVM, so just approximate with DNA */
   cm.setCompilationTime((float) CompilerDNA.estimateCompileTime(CompilerDNA.BASELINE, method));
   return cm;
 }