aoqi@0: /* aoqi@0: * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: #ifndef SHARE_VM_CI_CIREPLAY_HPP aoqi@0: #define SHARE_VM_CI_CIREPLAY_HPP aoqi@0: aoqi@0: #include "ci/ciMethod.hpp" aoqi@0: aoqi@0: // ciReplay aoqi@0: aoqi@0: // aoqi@0: // Replay compilation of a java method by using an information in replay file. aoqi@0: // Replay inlining decisions during compilation by using an information in inline file. aoqi@0: // aoqi@0: // NOTE: these replay functions only exist in debug version of VM. aoqi@0: // aoqi@0: // Replay compilation. aoqi@0: // ------------------- aoqi@0: // aoqi@0: // Replay data file replay.txt can be created by Serviceability Agent aoqi@0: // from a core file, see agent/doc/cireplay.html aoqi@0: // aoqi@0: // $ java -cp /lib/sa-jdi.jar sun.jvm.hotspot.CLHSDB aoqi@0: // hsdb> attach /bin/java ./core aoqi@0: // hsdb> threads aoqi@0: // t@10 Service Thread aoqi@0: // t@9 C2 CompilerThread0 aoqi@0: // t@8 Signal Dispatcher aoqi@0: // t@7 Finalizer aoqi@0: // t@6 Reference Handler aoqi@0: // t@2 main aoqi@0: // hsdb> dumpreplaydata t@9 > replay.txt aoqi@0: // hsdb> quit aoqi@0: // aoqi@0: // (Note: SA could be also used to extract app.jar and boot.jar files aoqi@0: // from core file to replay compilation if only core file is available) aoqi@0: // aoqi@0: // Replay data file replay_pid%p.log is also created when VM crashes aoqi@0: // in Compiler thread during compilation. It is controlled by aoqi@0: // DumpReplayDataOnError flag which is ON by default. aoqi@0: // aoqi@0: // Replay file replay_pid%p_compid%d.log can be created aoqi@0: // for the specified java method during normal execution using aoqi@0: // CompileCommand option DumpReplay: aoqi@0: // aoqi@0: // -XX:CompileCommand=option,Benchmark::test,DumpReplay aoqi@0: // aoqi@0: // In this case the file name has additional compilation id "_compid%d" aoqi@0: // because the method could be compiled several times. aoqi@0: // aoqi@0: // To replay compilation the replay file should be specified: aoqi@0: // aoqi@0: // -XX:+ReplayCompiles -XX:ReplayDataFile=replay_pid2133.log aoqi@0: // aoqi@0: // VM thread reads data from the file immediately after VM initialization aoqi@0: // and puts the compilation task on compile queue. After that it goes into aoqi@0: // wait state (BackgroundCompilation flag is set to false) since there is no aoqi@0: // a program to execute. VM exits when the compilation is finished. aoqi@0: // aoqi@0: // aoqi@0: // Replay inlining. aoqi@0: // ---------------- aoqi@0: // aoqi@0: // Replay inlining file inline_pid%p_compid%d.log is created for aoqi@0: // a specific java method during normal execution of a java program aoqi@0: // using CompileCommand option DumpInline: aoqi@0: // aoqi@0: // -XX:CompileCommand=option,Benchmark::test,DumpInline aoqi@0: // aoqi@0: // To replay inlining the replay file and the method should be specified: aoqi@0: // aoqi@0: // -XX:CompileCommand=option,Benchmark::test,ReplayInline -XX:InlineDataFile=inline_pid3244_compid6.log aoqi@0: // aoqi@0: // The difference from replay compilation is that replay inlining aoqi@0: // is performed during normal java program execution. aoqi@0: // aoqi@0: aoqi@0: class ciReplay { aoqi@0: CI_PACKAGE_ACCESS aoqi@0: aoqi@0: #ifndef PRODUCT aoqi@0: private: aoqi@0: static int replay_impl(TRAPS); aoqi@0: aoqi@0: public: aoqi@0: // Replay specified compilation and exit VM. aoqi@0: static void replay(TRAPS); aoqi@0: // Load inlining decisions from file and use them aoqi@0: // during compilation of specified method. aoqi@0: static void* load_inline_data(ciMethod* method, int entry_bci, int comp_level); aoqi@0: aoqi@0: // These are used by the CI to fill in the cached data from the aoqi@0: // replay file when replaying compiles. aoqi@0: static void initialize(ciMethodData* method); aoqi@0: static void initialize(ciMethod* method); aoqi@0: aoqi@0: static bool is_loaded(Method* method); aoqi@0: static bool is_loaded(Klass* klass); aoqi@0: aoqi@0: static bool should_not_inline(ciMethod* method); aoqi@0: static bool should_inline(void* data, ciMethod* method, int bci, int inline_depth); aoqi@0: static bool should_not_inline(void* data, ciMethod* method, int bci, int inline_depth); aoqi@0: aoqi@0: #endif aoqi@0: }; aoqi@0: aoqi@0: #endif // SHARE_VM_CI_CIREPLAY_HPP