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        String compilerAdviceFileName = Controller.options.COMPILER_ADVICE_FILE_INPUT;
040        if (compilerAdviceFileName != null) {
041          VM.sysWrite("Compiler advice file name ");
042          VM.sysWriteln(compilerAdviceFileName);
043          List<CompilerAdviceAttribute> compilerAdviceInfoList =
044              CompilerAdviceInfoReader.readCompilerAdviceFile(compilerAdviceFileName);
045          // register these sites so that when a compilation is done,
046          // these sites use compiler advice
047          CompilerAdviceAttribute.registerCompilerAdvice(compilerAdviceInfoList);
048        }
049        String dynamicCallFileName = Controller.options.DYNAMIC_CALL_FILE_INPUT;
050        if (dynamicCallFileName != null) {
051          VM.sysWrite("Dynamic call file name ");
052          VM.sysWriteln(dynamicCallFileName);
053          //List dynamicCallInfoList =
054          DynamicCallFileInfoReader.readDynamicCallFile(dynamicCallFileName, false);
055          // register these sites so that when a compilation is done,
056          // these sites use compiler advice
057        }
058      }
059    }
060    
061    
062    
063