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     */
013    package org.jikesrvm.adaptive.util;
014    
015    import java.util.List;
016    import org.jikesrvm.VM;
017    import 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     */
032    public 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) { VM.sysWrite("Loading compiler advice file: ", compilerAdviceFileName, " "); }
044          List<CompilerAdviceAttribute> compilerAdviceInfoList =
045              CompilerAdviceInfoReader.readCompilerAdviceFile(compilerAdviceFileName);
046          if (Controller.options.BULK_COMPILATION_VERBOSITY >= 1) { VM.sysWriteln(); }
047          // register these sites so that when a compilation is done,
048          // these sites use compiler advice
049          CompilerAdviceAttribute.registerCompilerAdvice(compilerAdviceInfoList);
050        }
051        String dynamicCallFileName = Controller.options.DYNAMIC_CALL_FILE_INPUT;
052        if (dynamicCallFileName != null) {
053          if (Controller.options.BULK_COMPILATION_VERBOSITY >= 1) { VM.sysWrite("Loading dynamic call file: ", dynamicCallFileName, " "); }
054          //List dynamicCallInfoList =
055          DynamicCallFileInfoReader.readDynamicCallFile(dynamicCallFileName, false);
056          if (Controller.options.BULK_COMPILATION_VERBOSITY >= 1) { VM.sysWriteln(); }
057         // register these sites so that when a compilation is done,
058          // these sites use compiler advice
059        }
060      }
061    }
062    
063    
064    
065