annotate src/share/vm/ci/ciReplay.hpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 4ca6dc0799b6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6972
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
1 /*
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
4 *
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
7 * published by the Free Software Foundation.
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
8 *
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
13 * accompanied this code).
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
14 *
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
18 *
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
21 * questions.
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
22 *
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
23 */
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
24
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
25 #ifndef SHARE_VM_CI_CIREPLAY_HPP
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
26 #define SHARE_VM_CI_CIREPLAY_HPP
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
27
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
28 #include "ci/ciMethod.hpp"
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
29
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
30 // ciReplay
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
31
18041
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
32 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
33 // Replay compilation of a java method by using an information in replay file.
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
34 // Replay inlining decisions during compilation by using an information in inline file.
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
35 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
36 // NOTE: these replay functions only exist in debug version of VM.
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
37 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
38 // Replay compilation.
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
39 // -------------------
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
40 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
41 // Replay data file replay.txt can be created by Serviceability Agent
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
42 // from a core file, see agent/doc/cireplay.html
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
43 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
44 // $ java -cp <jdk>/lib/sa-jdi.jar sun.jvm.hotspot.CLHSDB
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
45 // hsdb> attach <jdk>/bin/java ./core
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
46 // hsdb> threads
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
47 // t@10 Service Thread
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
48 // t@9 C2 CompilerThread0
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
49 // t@8 Signal Dispatcher
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
50 // t@7 Finalizer
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
51 // t@6 Reference Handler
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
52 // t@2 main
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
53 // hsdb> dumpreplaydata t@9 > replay.txt
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
54 // hsdb> quit
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
55 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
56 // (Note: SA could be also used to extract app.jar and boot.jar files
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
57 // from core file to replay compilation if only core file is available)
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
58 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
59 // Replay data file replay_pid%p.log is also created when VM crashes
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
60 // in Compiler thread during compilation. It is controlled by
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
61 // DumpReplayDataOnError flag which is ON by default.
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
62 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
63 // Replay file replay_pid%p_compid%d.log can be created
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
64 // for the specified java method during normal execution using
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
65 // CompileCommand option DumpReplay:
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
66 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
67 // -XX:CompileCommand=option,Benchmark::test,DumpReplay
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
68 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
69 // In this case the file name has additional compilation id "_compid%d"
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
70 // because the method could be compiled several times.
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
71 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
72 // To replay compilation the replay file should be specified:
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
73 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
74 // -XX:+ReplayCompiles -XX:ReplayDataFile=replay_pid2133.log
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
75 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
76 // VM thread reads data from the file immediately after VM initialization
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
77 // and puts the compilation task on compile queue. After that it goes into
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
78 // wait state (BackgroundCompilation flag is set to false) since there is no
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
79 // a program to execute. VM exits when the compilation is finished.
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
80 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
81 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
82 // Replay inlining.
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
83 // ----------------
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
84 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
85 // Replay inlining file inline_pid%p_compid%d.log is created for
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
86 // a specific java method during normal execution of a java program
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
87 // using CompileCommand option DumpInline:
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
88 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
89 // -XX:CompileCommand=option,Benchmark::test,DumpInline
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
90 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
91 // To replay inlining the replay file and the method should be specified:
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
92 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
93 // -XX:CompileCommand=option,Benchmark::test,ReplayInline -XX:InlineDataFile=inline_pid3244_compid6.log
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
94 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
95 // The difference from replay compilation is that replay inlining
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
96 // is performed during normal java program execution.
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
97 //
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
98
6972
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
99 class ciReplay {
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
100 CI_PACKAGE_ACCESS
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
101
7185
90273fc0a981 8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents: 6972
diff changeset
102 #ifndef PRODUCT
6972
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
103 private:
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
104 static int replay_impl(TRAPS);
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
105
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
106 public:
18041
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
107 // Replay specified compilation and exit VM.
6972
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
108 static void replay(TRAPS);
18041
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
109 // Load inlining decisions from file and use them
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
110 // during compilation of specified method.
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
111 static void* load_inline_data(ciMethod* method, int entry_bci, int comp_level);
6972
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
112
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
113 // These are used by the CI to fill in the cached data from the
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
114 // replay file when replaying compiles.
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
115 static void initialize(ciMethodData* method);
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
116 static void initialize(ciMethod* method);
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
117
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
118 static bool is_loaded(Method* method);
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
119 static bool is_loaded(Klass* klass);
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
120
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
121 static bool should_not_inline(ciMethod* method);
18041
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
122 static bool should_inline(void* data, ciMethod* method, int bci, int inline_depth);
52b4284cb496 Merge with jdk8u20-b26
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 14909
diff changeset
123 static bool should_not_inline(void* data, ciMethod* method, int bci, int inline_depth);
6972
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
124
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
125 #endif
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
126 };
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
127
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents:
diff changeset
128 #endif // SHARE_VM_CI_CIREPLAY_HPP