src/share/vm/ci/ciReplay.hpp

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/ci/ciReplay.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,128 @@
     1.4 +/*
     1.5 + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#ifndef SHARE_VM_CI_CIREPLAY_HPP
    1.29 +#define SHARE_VM_CI_CIREPLAY_HPP
    1.30 +
    1.31 +#include "ci/ciMethod.hpp"
    1.32 +
    1.33 +// ciReplay
    1.34 +
    1.35 +//
    1.36 +// Replay compilation of a java method by using an information in replay file.
    1.37 +// Replay inlining decisions during compilation by using an information in inline file.
    1.38 +//
    1.39 +// NOTE: these replay functions only exist in debug version of VM.
    1.40 +//
    1.41 +// Replay compilation.
    1.42 +// -------------------
    1.43 +//
    1.44 +// Replay data file replay.txt can be created by Serviceability Agent
    1.45 +// from a core file, see agent/doc/cireplay.html
    1.46 +//
    1.47 +// $ java -cp <jdk>/lib/sa-jdi.jar sun.jvm.hotspot.CLHSDB
    1.48 +// hsdb> attach <jdk>/bin/java ./core
    1.49 +// hsdb> threads
    1.50 +// t@10 Service Thread
    1.51 +// t@9 C2 CompilerThread0
    1.52 +// t@8 Signal Dispatcher
    1.53 +// t@7 Finalizer
    1.54 +// t@6 Reference Handler
    1.55 +// t@2 main
    1.56 +// hsdb> dumpreplaydata t@9 > replay.txt
    1.57 +// hsdb> quit
    1.58 +//
    1.59 +// (Note: SA could be also used to extract app.jar and boot.jar files
    1.60 +//  from core file to replay compilation if only core file is available)
    1.61 +//
    1.62 +// Replay data file replay_pid%p.log is also created when VM crashes
    1.63 +// in Compiler thread during compilation. It is controlled by
    1.64 +// DumpReplayDataOnError flag which is ON by default.
    1.65 +//
    1.66 +// Replay file replay_pid%p_compid%d.log can be created
    1.67 +// for the specified java method during normal execution using
    1.68 +// CompileCommand option DumpReplay:
    1.69 +//
    1.70 +// -XX:CompileCommand=option,Benchmark::test,DumpReplay
    1.71 +//
    1.72 +// In this case the file name has additional compilation id "_compid%d"
    1.73 +// because the method could be compiled several times.
    1.74 +//
    1.75 +// To replay compilation the replay file should be specified:
    1.76 +//
    1.77 +// -XX:+ReplayCompiles -XX:ReplayDataFile=replay_pid2133.log
    1.78 +//
    1.79 +// VM thread reads data from the file immediately after VM initialization
    1.80 +// and puts the compilation task on compile queue. After that it goes into
    1.81 +// wait state (BackgroundCompilation flag is set to false) since there is no
    1.82 +// a program to execute. VM exits when the compilation is finished.
    1.83 +//
    1.84 +//
    1.85 +// Replay inlining.
    1.86 +// ----------------
    1.87 +//
    1.88 +// Replay inlining file inline_pid%p_compid%d.log is created for
    1.89 +// a specific java method during normal execution of a java program
    1.90 +// using CompileCommand option DumpInline:
    1.91 +//
    1.92 +// -XX:CompileCommand=option,Benchmark::test,DumpInline
    1.93 +//
    1.94 +// To replay inlining the replay file and the method should be specified:
    1.95 +//
    1.96 +// -XX:CompileCommand=option,Benchmark::test,ReplayInline -XX:InlineDataFile=inline_pid3244_compid6.log
    1.97 +//
    1.98 +// The difference from replay compilation is that replay inlining
    1.99 +// is performed during normal java program execution.
   1.100 +//
   1.101 +
   1.102 +class ciReplay {
   1.103 +  CI_PACKAGE_ACCESS
   1.104 +
   1.105 +#ifndef PRODUCT
   1.106 + private:
   1.107 +  static int replay_impl(TRAPS);
   1.108 +
   1.109 + public:
   1.110 +  // Replay specified compilation and exit VM.
   1.111 +  static void replay(TRAPS);
   1.112 +  // Load inlining decisions from file and use them
   1.113 +  // during compilation of specified method.
   1.114 +  static void* load_inline_data(ciMethod* method, int entry_bci, int comp_level);
   1.115 +
   1.116 +  // These are used by the CI to fill in the cached data from the
   1.117 +  // replay file when replaying compiles.
   1.118 +  static void initialize(ciMethodData* method);
   1.119 +  static void initialize(ciMethod* method);
   1.120 +
   1.121 +  static bool is_loaded(Method* method);
   1.122 +  static bool is_loaded(Klass* klass);
   1.123 +
   1.124 +  static bool should_not_inline(ciMethod* method);
   1.125 +  static bool should_inline(void* data, ciMethod* method, int bci, int inline_depth);
   1.126 +  static bool should_not_inline(void* data, ciMethod* method, int bci, int inline_depth);
   1.127 +
   1.128 +#endif
   1.129 +};
   1.130 +
   1.131 +#endif // SHARE_VM_CI_CIREPLAY_HPP

mercurial