001/*
002 *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 *  This file is licensed to You under the Eclipse Public License (EPL);
005 *  You may not use this file except in compliance with the License. You
006 *  may obtain a copy of the License at
007 *
008 *      http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 *  See the COPYRIGHT.txt file distributed with this work for information
011 *  regarding copyright ownership.
012 */
013package org.jikesrvm.adaptive.util;
014
015import java.util.List;
016import org.jikesrvm.VM;
017import org.jikesrvm.adaptive.controller.Controller;
018
019/**
020 * Utilities for providing compiler advice.  Advice files provided
021 * at run time allow compilers to be specified for particular methods
022 * <p>
023 * <i>Run time</i> advice is given by identifying an advice file
024 * through a command line option:
025 * <code>-X:aos:cafi=path-to-advice-file</code>.
026 *
027 *
028 * @see CompilerAdviceAttribute
029 * @see CompilerAdviceInfoReader
030 * @see org.jikesrvm.compilers.common.RuntimeCompiler
031 */
032public class CompilerAdvice {
033
034  /**
035   *  Read a list of compiler advice annotations from a file
036   */
037  public static void postBoot() {
038    CompilerAdviceAttribute.postBoot();
039  }
040  public static void readCompilerAdvice() {
041    String compilerAdviceFileName = Controller.options.COMPILER_ADVICE_FILE_INPUT;
042    if (compilerAdviceFileName != null) {
043      if (Controller.options.BULK_COMPILATION_VERBOSITY >= 1) {
044        VM.sysWrite("Loading compiler advice file: ", compilerAdviceFileName, " ");
045      }
046      List<CompilerAdviceAttribute> compilerAdviceInfoList =
047          CompilerAdviceInfoReader.readCompilerAdviceFile(compilerAdviceFileName);
048      if (Controller.options.BULK_COMPILATION_VERBOSITY >= 1) {
049        VM.sysWriteln();
050      }
051      // register these sites so that when a compilation is done,
052      // these sites use compiler advice
053      CompilerAdviceAttribute.registerCompilerAdvice(compilerAdviceInfoList);
054    }
055    String dynamicCallFileName = Controller.options.DYNAMIC_CALL_FILE_INPUT;
056    if (dynamicCallFileName != null) {
057      if (Controller.options.BULK_COMPILATION_VERBOSITY >= 1) {
058        VM.sysWrite("Loading dynamic call file: ", dynamicCallFileName, " ");
059      }
060      //List dynamicCallInfoList =
061      DynamicCallFileInfoReader.readDynamicCallFile(dynamicCallFileName, false);
062      if (Controller.options.BULK_COMPILATION_VERBOSITY >= 1) {
063        VM.sysWriteln();
064      }
065     // register these sites so that when a compilation is done,
066      // these sites use compiler advice
067    }
068  }
069}
070
071
072
073