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