author | coleenp |
Thu, 19 Jun 2014 11:16:10 -0400 | |
changeset 25325 | e3af4e02b0d5 |
parent 24476 | 912595db2e75 |
child 27680 | 8ecc0871c18e |
permissions | -rw-r--r-- |
25325 | 1 |
/* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
3 |
* |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
4 |
* 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
|
5 |
* 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
|
6 |
* published by the Free Software Foundation. |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
7 |
* |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
8 |
* 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
|
9 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
10 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
11 |
* 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
|
12 |
* accompanied this code). |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
13 |
* |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
14 |
* 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
|
15 |
* 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
|
16 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
17 |
* |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
18 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
19 |
* 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
|
20 |
* questions. |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
21 |
* |
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 |
#include "precompiled.hpp" |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
25 |
#include "ci/ciMethodData.hpp" |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
26 |
#include "ci/ciReplay.hpp" |
22243 | 27 |
#include "ci/ciSymbol.hpp" |
28 |
#include "ci/ciKlass.hpp" |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
29 |
#include "ci/ciUtilities.hpp" |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
30 |
#include "compiler/compileBroker.hpp" |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
31 |
#include "memory/allocation.inline.hpp" |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
32 |
#include "memory/oopFactory.hpp" |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
33 |
#include "memory/resourceArea.hpp" |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
34 |
#include "utilities/copy.hpp" |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
14588
diff
changeset
|
35 |
#include "utilities/macros.hpp" |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
36 |
|
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14477
diff
changeset
|
37 |
#ifndef PRODUCT |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
38 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
39 |
// ciReplay |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
40 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
41 |
typedef struct _ciMethodDataRecord { |
22243 | 42 |
const char* _klass_name; |
43 |
const char* _method_name; |
|
44 |
const char* _signature; |
|
45 |
||
46 |
int _state; |
|
47 |
int _current_mileage; |
|
48 |
||
49 |
intptr_t* _data; |
|
50 |
char* _orig_data; |
|
24476
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
51 |
Klass** _classes; |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
52 |
Method** _methods; |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
53 |
int* _classes_offsets; |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
54 |
int* _methods_offsets; |
22243 | 55 |
int _data_length; |
56 |
int _orig_data_length; |
|
24476
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
57 |
int _classes_length; |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
58 |
int _methods_length; |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
59 |
} ciMethodDataRecord; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
60 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
61 |
typedef struct _ciMethodRecord { |
22243 | 62 |
const char* _klass_name; |
63 |
const char* _method_name; |
|
64 |
const char* _signature; |
|
65 |
||
66 |
int _instructions_size; |
|
67 |
int _interpreter_invocation_count; |
|
68 |
int _interpreter_throwout_count; |
|
69 |
int _invocation_counter; |
|
70 |
int _backedge_counter; |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
71 |
} ciMethodRecord; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
72 |
|
22243 | 73 |
typedef struct _ciInlineRecord { |
74 |
const char* _klass_name; |
|
75 |
const char* _method_name; |
|
76 |
const char* _signature; |
|
77 |
||
78 |
int _inline_depth; |
|
79 |
int _inline_bci; |
|
80 |
} ciInlineRecord; |
|
81 |
||
82 |
class CompileReplay; |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
83 |
static CompileReplay* replay_state; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
84 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
85 |
class CompileReplay : public StackObj { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
86 |
private: |
22243 | 87 |
FILE* _stream; |
88 |
Thread* _thread; |
|
89 |
Handle _protection_domain; |
|
90 |
Handle _loader; |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
91 |
|
22243 | 92 |
GrowableArray<ciMethodRecord*> _ci_method_records; |
93 |
GrowableArray<ciMethodDataRecord*> _ci_method_data_records; |
|
94 |
||
95 |
// Use pointer because we may need to return inline records |
|
96 |
// without destroying them. |
|
97 |
GrowableArray<ciInlineRecord*>* _ci_inline_records; |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
98 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
99 |
const char* _error_message; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
100 |
|
22243 | 101 |
char* _bufptr; |
102 |
char* _buffer; |
|
103 |
int _buffer_length; |
|
104 |
int _buffer_pos; |
|
105 |
||
106 |
// "compile" data |
|
107 |
ciKlass* _iklass; |
|
108 |
Method* _imethod; |
|
109 |
int _entry_bci; |
|
110 |
int _comp_level; |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
111 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
112 |
public: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
113 |
CompileReplay(const char* filename, TRAPS) { |
22243 | 114 |
_thread = THREAD; |
115 |
_loader = Handle(_thread, SystemDictionary::java_system_loader()); |
|
116 |
_protection_domain = Handle(); |
|
117 |
||
118 |
_stream = fopen(filename, "rt"); |
|
119 |
if (_stream == NULL) { |
|
17121
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
17000
diff
changeset
|
120 |
fprintf(stderr, "ERROR: Can't open replay file %s\n", filename); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
121 |
} |
22243 | 122 |
|
123 |
_ci_inline_records = NULL; |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
124 |
_error_message = NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
125 |
|
22243 | 126 |
_buffer_length = 32; |
127 |
_buffer = NEW_RESOURCE_ARRAY(char, _buffer_length); |
|
128 |
_bufptr = _buffer; |
|
129 |
_buffer_pos = 0; |
|
130 |
||
131 |
_imethod = NULL; |
|
132 |
_iklass = NULL; |
|
133 |
_entry_bci = 0; |
|
134 |
_comp_level = 0; |
|
135 |
||
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
136 |
test(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
137 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
138 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
139 |
~CompileReplay() { |
22243 | 140 |
if (_stream != NULL) fclose(_stream); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
141 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
142 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
143 |
void test() { |
22243 | 144 |
strcpy(_buffer, "1 2 foo 4 bar 0x9 \"this is it\""); |
145 |
_bufptr = _buffer; |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
146 |
assert(parse_int("test") == 1, "what"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
147 |
assert(parse_int("test") == 2, "what"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
148 |
assert(strcmp(parse_string(), "foo") == 0, "what"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
149 |
assert(parse_int("test") == 4, "what"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
150 |
assert(strcmp(parse_string(), "bar") == 0, "what"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
151 |
assert(parse_intptr_t("test") == 9, "what"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
152 |
assert(strcmp(parse_quoted_string(), "this is it") == 0, "what"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
153 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
154 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
155 |
bool had_error() { |
22243 | 156 |
return _error_message != NULL || _thread->has_pending_exception(); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
157 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
158 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
159 |
bool can_replay() { |
22243 | 160 |
return !(_stream == NULL || had_error()); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
161 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
162 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
163 |
void report_error(const char* msg) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
164 |
_error_message = msg; |
22243 | 165 |
// Restore the _buffer contents for error reporting |
166 |
for (int i = 0; i < _buffer_pos; i++) { |
|
167 |
if (_buffer[i] == '\0') _buffer[i] = ' '; |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
168 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
169 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
170 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
171 |
int parse_int(const char* label) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
172 |
if (had_error()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
173 |
return 0; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
174 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
175 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
176 |
int v = 0; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
177 |
int read; |
22243 | 178 |
if (sscanf(_bufptr, "%i%n", &v, &read) != 1) { |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
179 |
report_error(label); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
180 |
} else { |
22243 | 181 |
_bufptr += read; |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
182 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
183 |
return v; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
184 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
185 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
186 |
intptr_t parse_intptr_t(const char* label) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
187 |
if (had_error()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
188 |
return 0; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
189 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
190 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
191 |
intptr_t v = 0; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
192 |
int read; |
22243 | 193 |
if (sscanf(_bufptr, INTPTR_FORMAT "%n", &v, &read) != 1) { |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
194 |
report_error(label); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
195 |
} else { |
22243 | 196 |
_bufptr += read; |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
197 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
198 |
return v; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
199 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
200 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
201 |
void skip_ws() { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
202 |
// Skip any leading whitespace |
22243 | 203 |
while (*_bufptr == ' ' || *_bufptr == '\t') { |
204 |
_bufptr++; |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
205 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
206 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
207 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
208 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
209 |
char* scan_and_terminate(char delim) { |
22243 | 210 |
char* str = _bufptr; |
211 |
while (*_bufptr != delim && *_bufptr != '\0') { |
|
212 |
_bufptr++; |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
213 |
} |
22243 | 214 |
if (*_bufptr != '\0') { |
215 |
*_bufptr++ = '\0'; |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
216 |
} |
22243 | 217 |
if (_bufptr == str) { |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
218 |
// nothing here |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
219 |
return NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
220 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
221 |
return str; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
222 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
223 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
224 |
char* parse_string() { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
225 |
if (had_error()) return NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
226 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
227 |
skip_ws(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
228 |
return scan_and_terminate(' '); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
229 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
230 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
231 |
char* parse_quoted_string() { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
232 |
if (had_error()) return NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
233 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
234 |
skip_ws(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
235 |
|
22243 | 236 |
if (*_bufptr == '"') { |
237 |
_bufptr++; |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
238 |
return scan_and_terminate('"'); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
239 |
} else { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
240 |
return scan_and_terminate(' '); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
241 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
242 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
243 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
244 |
const char* parse_escaped_string() { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
245 |
char* result = parse_quoted_string(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
246 |
if (result != NULL) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
247 |
unescape_string(result); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
248 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
249 |
return result; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
250 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
251 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
252 |
// Look for the tag 'tag' followed by an |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
253 |
bool parse_tag_and_count(const char* tag, int& length) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
254 |
const char* t = parse_string(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
255 |
if (t == NULL) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
256 |
return false; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
257 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
258 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
259 |
if (strcmp(tag, t) != 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
260 |
report_error(tag); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
261 |
return false; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
262 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
263 |
length = parse_int("parse_tag_and_count"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
264 |
return !had_error(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
265 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
266 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
267 |
// Parse a sequence of raw data encoded as bytes and return the |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
268 |
// resulting data. |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
269 |
char* parse_data(const char* tag, int& length) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
270 |
if (!parse_tag_and_count(tag, length)) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
271 |
return NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
272 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
273 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
274 |
char * result = NEW_RESOURCE_ARRAY(char, length); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
275 |
for (int i = 0; i < length; i++) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
276 |
int val = parse_int("data"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
277 |
result[i] = val; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
278 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
279 |
return result; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
280 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
281 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
282 |
// Parse a standard chunk of data emitted as: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
283 |
// 'tag' <length> # # ... |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
284 |
// Where each # is an intptr_t item |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
285 |
intptr_t* parse_intptr_data(const char* tag, int& length) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
286 |
if (!parse_tag_and_count(tag, length)) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
287 |
return NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
288 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
289 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
290 |
intptr_t* result = NEW_RESOURCE_ARRAY(intptr_t, length); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
291 |
for (int i = 0; i < length; i++) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
292 |
skip_ws(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
293 |
intptr_t val = parse_intptr_t("data"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
294 |
result[i] = val; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
295 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
296 |
return result; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
297 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
298 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
299 |
// Parse a possibly quoted version of a symbol into a symbolOop |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
300 |
Symbol* parse_symbol(TRAPS) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
301 |
const char* str = parse_escaped_string(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
302 |
if (str != NULL) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
303 |
Symbol* sym = SymbolTable::lookup(str, (int)strlen(str), CHECK_NULL); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
304 |
return sym; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
305 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
306 |
return NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
307 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
308 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
309 |
// Parse a valid klass name and look it up |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
310 |
Klass* parse_klass(TRAPS) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
311 |
const char* str = parse_escaped_string(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
312 |
Symbol* klass_name = SymbolTable::lookup(str, (int)strlen(str), CHECK_NULL); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
313 |
if (klass_name != NULL) { |
22243 | 314 |
Klass* k = NULL; |
315 |
if (_iklass != NULL) { |
|
316 |
k = (Klass*)_iklass->find_klass(ciSymbol::make(klass_name->as_C_string()))->constant_encoding(); |
|
317 |
} else { |
|
318 |
k = SystemDictionary::resolve_or_fail(klass_name, _loader, _protection_domain, true, THREAD); |
|
319 |
} |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
320 |
if (HAS_PENDING_EXCEPTION) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
321 |
oop throwable = PENDING_EXCEPTION; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
322 |
java_lang_Throwable::print(throwable, tty); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
323 |
tty->cr(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
324 |
report_error(str); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
325 |
return NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
326 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
327 |
return k; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
328 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
329 |
return NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
330 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
331 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
332 |
// Lookup a klass |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
333 |
Klass* resolve_klass(const char* klass, TRAPS) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
334 |
Symbol* klass_name = SymbolTable::lookup(klass, (int)strlen(klass), CHECK_NULL); |
22243 | 335 |
return SystemDictionary::resolve_or_fail(klass_name, _loader, _protection_domain, true, CHECK_NULL); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
336 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
337 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
338 |
// Parse the standard tuple of <klass> <name> <signature> |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
339 |
Method* parse_method(TRAPS) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
340 |
InstanceKlass* k = (InstanceKlass*)parse_klass(CHECK_NULL); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
341 |
Symbol* method_name = parse_symbol(CHECK_NULL); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
342 |
Symbol* method_signature = parse_symbol(CHECK_NULL); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
343 |
Method* m = k->find_method(method_name, method_signature); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
344 |
if (m == NULL) { |
18984
a0fce9081603
8012263: ciReplay: gracefully exit & report meaningful error when replay data parsing fails
minqi
parents:
17376
diff
changeset
|
345 |
report_error("Can't find method"); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
346 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
347 |
return m; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
348 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
349 |
|
22243 | 350 |
int get_line(int c) { |
351 |
while(c != EOF) { |
|
352 |
if (_buffer_pos + 1 >= _buffer_length) { |
|
353 |
int new_length = _buffer_length * 2; |
|
354 |
// Next call will throw error in case of OOM. |
|
355 |
_buffer = REALLOC_RESOURCE_ARRAY(char, _buffer, _buffer_length, new_length); |
|
356 |
_buffer_length = new_length; |
|
357 |
} |
|
358 |
if (c == '\n') { |
|
359 |
c = getc(_stream); // get next char |
|
360 |
break; |
|
361 |
} else if (c == '\r') { |
|
362 |
// skip LF |
|
363 |
} else { |
|
364 |
_buffer[_buffer_pos++] = c; |
|
365 |
} |
|
366 |
c = getc(_stream); |
|
367 |
} |
|
368 |
// null terminate it, reset the pointer |
|
369 |
_buffer[_buffer_pos] = '\0'; // NL or EOF |
|
370 |
_buffer_pos = 0; |
|
371 |
_bufptr = _buffer; |
|
372 |
return c; |
|
373 |
} |
|
374 |
||
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
375 |
// Process each line of the replay file executing each command until |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
376 |
// the file ends. |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
377 |
void process(TRAPS) { |
22243 | 378 |
int line_no = 1; |
379 |
int c = getc(_stream); |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
380 |
while(c != EOF) { |
22243 | 381 |
c = get_line(c); |
24324
e18584aa83e2
8041959: Skip replay parsing errors with ReplayIgnoreInitErrors
kvn
parents:
22243
diff
changeset
|
382 |
process_command(THREAD); |
22243 | 383 |
if (had_error()) { |
384 |
tty->print_cr("Error while parsing line %d: %s\n", line_no, _error_message); |
|
24324
e18584aa83e2
8041959: Skip replay parsing errors with ReplayIgnoreInitErrors
kvn
parents:
22243
diff
changeset
|
385 |
if (ReplayIgnoreInitErrors) { |
e18584aa83e2
8041959: Skip replay parsing errors with ReplayIgnoreInitErrors
kvn
parents:
22243
diff
changeset
|
386 |
CLEAR_PENDING_EXCEPTION; |
e18584aa83e2
8041959: Skip replay parsing errors with ReplayIgnoreInitErrors
kvn
parents:
22243
diff
changeset
|
387 |
_error_message = NULL; |
e18584aa83e2
8041959: Skip replay parsing errors with ReplayIgnoreInitErrors
kvn
parents:
22243
diff
changeset
|
388 |
} else { |
e18584aa83e2
8041959: Skip replay parsing errors with ReplayIgnoreInitErrors
kvn
parents:
22243
diff
changeset
|
389 |
return; |
e18584aa83e2
8041959: Skip replay parsing errors with ReplayIgnoreInitErrors
kvn
parents:
22243
diff
changeset
|
390 |
} |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
391 |
} |
22243 | 392 |
line_no++; |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
393 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
394 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
395 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
396 |
void process_command(TRAPS) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
397 |
char* cmd = parse_string(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
398 |
if (cmd == NULL) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
399 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
400 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
401 |
if (strcmp("#", cmd) == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
402 |
// ignore |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
403 |
} else if (strcmp("compile", cmd) == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
404 |
process_compile(CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
405 |
} else if (strcmp("ciMethod", cmd) == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
406 |
process_ciMethod(CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
407 |
} else if (strcmp("ciMethodData", cmd) == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
408 |
process_ciMethodData(CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
409 |
} else if (strcmp("staticfield", cmd) == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
410 |
process_staticfield(CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
411 |
} else if (strcmp("ciInstanceKlass", cmd) == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
412 |
process_ciInstanceKlass(CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
413 |
} else if (strcmp("instanceKlass", cmd) == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
414 |
process_instanceKlass(CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
415 |
#if INCLUDE_JVMTI |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
416 |
} else if (strcmp("JvmtiExport", cmd) == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
417 |
process_JvmtiExport(CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
418 |
#endif // INCLUDE_JVMTI |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
419 |
} else { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
420 |
report_error("unknown command"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
421 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
422 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
423 |
|
17123
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
424 |
// validation of comp_level |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
425 |
bool is_valid_comp_level(int comp_level) { |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
426 |
const int msg_len = 256; |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
427 |
char* msg = NULL; |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
428 |
if (!is_compile(comp_level)) { |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
429 |
msg = NEW_RESOURCE_ARRAY(char, msg_len); |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
430 |
jio_snprintf(msg, msg_len, "%d isn't compilation level", comp_level); |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
431 |
} else if (!TieredCompilation && (comp_level != CompLevel_highest_tier)) { |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
432 |
msg = NEW_RESOURCE_ARRAY(char, msg_len); |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
433 |
switch (comp_level) { |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
434 |
case CompLevel_simple: |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
435 |
jio_snprintf(msg, msg_len, "compilation level %d requires Client VM or TieredCompilation", comp_level); |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
436 |
break; |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
437 |
case CompLevel_full_optimization: |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
438 |
jio_snprintf(msg, msg_len, "compilation level %d requires Server VM", comp_level); |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
439 |
break; |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
440 |
default: |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
441 |
jio_snprintf(msg, msg_len, "compilation level %d requires TieredCompilation", comp_level); |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
442 |
} |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
443 |
} |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
444 |
if (msg != NULL) { |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
445 |
report_error(msg); |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
446 |
return false; |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
447 |
} |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
448 |
return true; |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
449 |
} |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
450 |
|
22243 | 451 |
// compile <klass> <name> <signature> <entry_bci> <comp_level> inline <count> <depth> <bci> <klass> <name> <signature> ... |
452 |
void* process_inline(ciMethod* imethod, Method* m, int entry_bci, int comp_level, TRAPS) { |
|
453 |
_imethod = m; |
|
454 |
_iklass = imethod->holder(); |
|
455 |
_entry_bci = entry_bci; |
|
456 |
_comp_level = comp_level; |
|
457 |
int line_no = 1; |
|
458 |
int c = getc(_stream); |
|
459 |
while(c != EOF) { |
|
460 |
c = get_line(c); |
|
461 |
// Expecting only lines with "compile" command in inline replay file. |
|
462 |
char* cmd = parse_string(); |
|
463 |
if (cmd == NULL || strcmp("compile", cmd) != 0) { |
|
464 |
return NULL; |
|
465 |
} |
|
466 |
process_compile(CHECK_NULL); |
|
467 |
if (had_error()) { |
|
468 |
tty->print_cr("Error while parsing line %d: %s\n", line_no, _error_message); |
|
469 |
tty->print_cr("%s", _buffer); |
|
470 |
return NULL; |
|
471 |
} |
|
472 |
if (_ci_inline_records != NULL && _ci_inline_records->length() > 0) { |
|
473 |
// Found inlining record for the requested method. |
|
474 |
return _ci_inline_records; |
|
475 |
} |
|
476 |
line_no++; |
|
477 |
} |
|
478 |
return NULL; |
|
479 |
} |
|
480 |
||
481 |
// compile <klass> <name> <signature> <entry_bci> <comp_level> inline <count> <depth> <bci> <klass> <name> <signature> ... |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
482 |
void process_compile(TRAPS) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
483 |
Method* method = parse_method(CHECK); |
18984
a0fce9081603
8012263: ciReplay: gracefully exit & report meaningful error when replay data parsing fails
minqi
parents:
17376
diff
changeset
|
484 |
if (had_error()) return; |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
485 |
int entry_bci = parse_int("entry_bci"); |
17123
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
486 |
const char* comp_level_label = "comp_level"; |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
487 |
int comp_level = parse_int(comp_level_label); |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
488 |
// old version w/o comp_level |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
489 |
if (had_error() && (error_message() == comp_level_label)) { |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
490 |
comp_level = CompLevel_full_optimization; |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
491 |
} |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
492 |
if (!is_valid_comp_level(comp_level)) { |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
493 |
return; |
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
494 |
} |
22243 | 495 |
if (_imethod != NULL) { |
496 |
// Replay Inlining |
|
497 |
if (entry_bci != _entry_bci || comp_level != _comp_level) { |
|
498 |
return; |
|
499 |
} |
|
500 |
const char* iklass_name = _imethod->method_holder()->name()->as_utf8(); |
|
501 |
const char* imethod_name = _imethod->name()->as_utf8(); |
|
502 |
const char* isignature = _imethod->signature()->as_utf8(); |
|
503 |
const char* klass_name = method->method_holder()->name()->as_utf8(); |
|
504 |
const char* method_name = method->name()->as_utf8(); |
|
505 |
const char* signature = method->signature()->as_utf8(); |
|
506 |
if (strcmp(iklass_name, klass_name) != 0 || |
|
507 |
strcmp(imethod_name, method_name) != 0 || |
|
508 |
strcmp(isignature, signature) != 0) { |
|
509 |
return; |
|
510 |
} |
|
511 |
} |
|
512 |
int inline_count = 0; |
|
513 |
if (parse_tag_and_count("inline", inline_count)) { |
|
514 |
// Record inlining data |
|
515 |
_ci_inline_records = new GrowableArray<ciInlineRecord*>(); |
|
516 |
for (int i = 0; i < inline_count; i++) { |
|
517 |
int depth = parse_int("inline_depth"); |
|
518 |
int bci = parse_int("inline_bci"); |
|
519 |
if (had_error()) { |
|
520 |
break; |
|
521 |
} |
|
522 |
Method* inl_method = parse_method(CHECK); |
|
523 |
if (had_error()) { |
|
524 |
break; |
|
525 |
} |
|
526 |
new_ciInlineRecord(inl_method, bci, depth); |
|
527 |
} |
|
528 |
} |
|
529 |
if (_imethod != NULL) { |
|
530 |
return; // Replay Inlining |
|
531 |
} |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
532 |
Klass* k = method->method_holder(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
533 |
((InstanceKlass*)k)->initialize(THREAD); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
534 |
if (HAS_PENDING_EXCEPTION) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
535 |
oop throwable = PENDING_EXCEPTION; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
536 |
java_lang_Throwable::print(throwable, tty); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
537 |
tty->cr(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
538 |
if (ReplayIgnoreInitErrors) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
539 |
CLEAR_PENDING_EXCEPTION; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
540 |
((InstanceKlass*)k)->set_init_state(InstanceKlass::fully_initialized); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
541 |
} else { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
542 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
543 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
544 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
545 |
// Make sure the existence of a prior compile doesn't stop this one |
17123
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
546 |
nmethod* nm = (entry_bci != InvocationEntryBci) ? method->lookup_osr_nmethod_for(entry_bci, comp_level, true) : method->code(); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
547 |
if (nm != NULL) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
548 |
nm->make_not_entrant(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
549 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
550 |
replay_state = this; |
17123
a8e62eed2e3e
8011675: adding compilation level to replay data
iignatyev
parents:
17121
diff
changeset
|
551 |
CompileBroker::compile_method(method, entry_bci, comp_level, |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
552 |
methodHandle(), 0, "replay", THREAD); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
553 |
replay_state = NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
554 |
reset(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
555 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
556 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
557 |
// ciMethod <klass> <name> <signature> <invocation_counter> <backedge_counter> <interpreter_invocation_count> <interpreter_throwout_count> <instructions_size> |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
558 |
// |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
559 |
// |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
560 |
void process_ciMethod(TRAPS) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
561 |
Method* method = parse_method(CHECK); |
18984
a0fce9081603
8012263: ciReplay: gracefully exit & report meaningful error when replay data parsing fails
minqi
parents:
17376
diff
changeset
|
562 |
if (had_error()) return; |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
563 |
ciMethodRecord* rec = new_ciMethod(method); |
22243 | 564 |
rec->_invocation_counter = parse_int("invocation_counter"); |
565 |
rec->_backedge_counter = parse_int("backedge_counter"); |
|
566 |
rec->_interpreter_invocation_count = parse_int("interpreter_invocation_count"); |
|
567 |
rec->_interpreter_throwout_count = parse_int("interpreter_throwout_count"); |
|
568 |
rec->_instructions_size = parse_int("instructions_size"); |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
569 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
570 |
|
24476
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
571 |
// ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length> # ... methods <length> |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
572 |
void process_ciMethodData(TRAPS) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
573 |
Method* method = parse_method(CHECK); |
18984
a0fce9081603
8012263: ciReplay: gracefully exit & report meaningful error when replay data parsing fails
minqi
parents:
17376
diff
changeset
|
574 |
if (had_error()) return; |
24324
e18584aa83e2
8041959: Skip replay parsing errors with ReplayIgnoreInitErrors
kvn
parents:
22243
diff
changeset
|
575 |
/* just copied from Method, to build interpret data*/ |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
576 |
if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
577 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
578 |
} |
24324
e18584aa83e2
8041959: Skip replay parsing errors with ReplayIgnoreInitErrors
kvn
parents:
22243
diff
changeset
|
579 |
// To be properly initialized, some profiling in the MDO needs the |
e18584aa83e2
8041959: Skip replay parsing errors with ReplayIgnoreInitErrors
kvn
parents:
22243
diff
changeset
|
580 |
// method to be rewritten (number of arguments at a call for |
e18584aa83e2
8041959: Skip replay parsing errors with ReplayIgnoreInitErrors
kvn
parents:
22243
diff
changeset
|
581 |
// instance) |
e18584aa83e2
8041959: Skip replay parsing errors with ReplayIgnoreInitErrors
kvn
parents:
22243
diff
changeset
|
582 |
method->method_holder()->link_class(CHECK); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
583 |
// methodOopDesc::build_interpreter_method_data(method, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
584 |
{ |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
585 |
// Grab a lock here to prevent multiple |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
586 |
// MethodData*s from being created. |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
587 |
MutexLocker ml(MethodData_lock, THREAD); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
588 |
if (method->method_data() == NULL) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
589 |
ClassLoaderData* loader_data = method->method_holder()->class_loader_data(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
590 |
MethodData* method_data = MethodData::allocate(loader_data, method, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
591 |
method->set_method_data(method_data); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
592 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
593 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
594 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
595 |
// collect and record all the needed information for later |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
596 |
ciMethodDataRecord* rec = new_ciMethodData(method); |
22243 | 597 |
rec->_state = parse_int("state"); |
598 |
rec->_current_mileage = parse_int("current_mileage"); |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
599 |
|
22243 | 600 |
rec->_orig_data = parse_data("orig", rec->_orig_data_length); |
601 |
if (rec->_orig_data == NULL) { |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
602 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
603 |
} |
22243 | 604 |
rec->_data = parse_intptr_data("data", rec->_data_length); |
605 |
if (rec->_data == NULL) { |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
606 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
607 |
} |
24476
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
608 |
if (!parse_tag_and_count("oops", rec->_classes_length)) { |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
609 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
610 |
} |
24476
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
611 |
rec->_classes = NEW_RESOURCE_ARRAY(Klass*, rec->_classes_length); |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
612 |
rec->_classes_offsets = NEW_RESOURCE_ARRAY(int, rec->_classes_length); |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
613 |
for (int i = 0; i < rec->_classes_length; i++) { |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
614 |
int offset = parse_int("offset"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
615 |
if (had_error()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
616 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
617 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
618 |
Klass* k = parse_klass(CHECK); |
24476
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
619 |
rec->_classes_offsets[i] = offset; |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
620 |
rec->_classes[i] = k; |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
621 |
} |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
622 |
|
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
623 |
if (!parse_tag_and_count("methods", rec->_methods_length)) { |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
624 |
return; |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
625 |
} |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
626 |
rec->_methods = NEW_RESOURCE_ARRAY(Method*, rec->_methods_length); |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
627 |
rec->_methods_offsets = NEW_RESOURCE_ARRAY(int, rec->_methods_length); |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
628 |
for (int i = 0; i < rec->_methods_length; i++) { |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
629 |
int offset = parse_int("offset"); |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
630 |
if (had_error()) { |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
631 |
return; |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
632 |
} |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
633 |
Method* m = parse_method(CHECK); |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
634 |
rec->_methods_offsets[i] = offset; |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
635 |
rec->_methods[i] = m; |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
636 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
637 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
638 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
639 |
// instanceKlass <name> |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
640 |
// |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
641 |
// Loads and initializes the klass 'name'. This can be used to |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
642 |
// create particular class loading environments |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
643 |
void process_instanceKlass(TRAPS) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
644 |
// just load the referenced class |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
645 |
Klass* k = parse_klass(CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
646 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
647 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
648 |
// ciInstanceKlass <name> <is_linked> <is_initialized> <length> tag # # # ... |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
649 |
// |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
650 |
// Load the klass 'name' and link or initialize it. Verify that the |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
651 |
// constant pool is the same length as 'length' and make sure the |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
652 |
// constant pool tags are in the same state. |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
653 |
void process_ciInstanceKlass(TRAPS) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
654 |
InstanceKlass* k = (InstanceKlass *)parse_klass(CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
655 |
int is_linked = parse_int("is_linked"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
656 |
int is_initialized = parse_int("is_initialized"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
657 |
int length = parse_int("length"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
658 |
if (is_initialized) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
659 |
k->initialize(THREAD); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
660 |
if (HAS_PENDING_EXCEPTION) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
661 |
oop throwable = PENDING_EXCEPTION; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
662 |
java_lang_Throwable::print(throwable, tty); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
663 |
tty->cr(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
664 |
if (ReplayIgnoreInitErrors) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
665 |
CLEAR_PENDING_EXCEPTION; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
666 |
k->set_init_state(InstanceKlass::fully_initialized); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
667 |
} else { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
668 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
669 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
670 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
671 |
} else if (is_linked) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
672 |
k->link_class(CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
673 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
674 |
ConstantPool* cp = k->constants(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
675 |
if (length != cp->length()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
676 |
report_error("constant pool length mismatch: wrong class files?"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
677 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
678 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
679 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
680 |
int parsed_two_word = 0; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
681 |
for (int i = 1; i < length; i++) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
682 |
int tag = parse_int("tag"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
683 |
if (had_error()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
684 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
685 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
686 |
switch (cp->tag_at(i).value()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
687 |
case JVM_CONSTANT_UnresolvedClass: { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
688 |
if (tag == JVM_CONSTANT_Class) { |
25325 | 689 |
tty->print_cr("Resolving klass %s at %d", cp->klass_name_at(i)->as_utf8(), i); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
690 |
Klass* k = cp->klass_at(i, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
691 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
692 |
break; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
693 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
694 |
case JVM_CONSTANT_Long: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
695 |
case JVM_CONSTANT_Double: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
696 |
parsed_two_word = i + 1; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
697 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
698 |
case JVM_CONSTANT_ClassIndex: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
699 |
case JVM_CONSTANT_StringIndex: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
700 |
case JVM_CONSTANT_String: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
701 |
case JVM_CONSTANT_UnresolvedClassInError: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
702 |
case JVM_CONSTANT_Fieldref: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
703 |
case JVM_CONSTANT_Methodref: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
704 |
case JVM_CONSTANT_InterfaceMethodref: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
705 |
case JVM_CONSTANT_NameAndType: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
706 |
case JVM_CONSTANT_Utf8: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
707 |
case JVM_CONSTANT_Integer: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
708 |
case JVM_CONSTANT_Float: |
22243 | 709 |
case JVM_CONSTANT_MethodHandle: |
710 |
case JVM_CONSTANT_MethodType: |
|
711 |
case JVM_CONSTANT_InvokeDynamic: |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
712 |
if (tag != cp->tag_at(i).value()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
713 |
report_error("tag mismatch: wrong class files?"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
714 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
715 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
716 |
break; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
717 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
718 |
case JVM_CONSTANT_Class: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
719 |
if (tag == JVM_CONSTANT_Class) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
720 |
} else if (tag == JVM_CONSTANT_UnresolvedClass) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
721 |
tty->print_cr("Warning: entry was unresolved in the replay data"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
722 |
} else { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
723 |
report_error("Unexpected tag"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
724 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
725 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
726 |
break; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
727 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
728 |
case 0: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
729 |
if (parsed_two_word == i) continue; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
730 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
731 |
default: |
17121
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
17000
diff
changeset
|
732 |
fatal(err_msg_res("Unexpected tag: %d", cp->tag_at(i).value())); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
733 |
break; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
734 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
735 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
736 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
737 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
738 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
739 |
// Initialize a class and fill in the value for a static field. |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
740 |
// This is useful when the compile was dependent on the value of |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
741 |
// static fields but it's impossible to properly rerun the static |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
742 |
// initiailizer. |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
743 |
void process_staticfield(TRAPS) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
744 |
InstanceKlass* k = (InstanceKlass *)parse_klass(CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
745 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
746 |
if (ReplaySuppressInitializers == 0 || |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
747 |
ReplaySuppressInitializers == 2 && k->class_loader() == NULL) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
748 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
749 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
750 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
751 |
assert(k->is_initialized(), "must be"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
752 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
753 |
const char* field_name = parse_escaped_string();; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
754 |
const char* field_signature = parse_string(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
755 |
fieldDescriptor fd; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
756 |
Symbol* name = SymbolTable::lookup(field_name, (int)strlen(field_name), CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
757 |
Symbol* sig = SymbolTable::lookup(field_signature, (int)strlen(field_signature), CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
758 |
if (!k->find_local_field(name, sig, &fd) || |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
759 |
!fd.is_static() || |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
760 |
fd.has_initial_value()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
761 |
report_error(field_name); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
762 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
763 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
764 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
765 |
oop java_mirror = k->java_mirror(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
766 |
if (field_signature[0] == '[') { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
767 |
int length = parse_int("array length"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
768 |
oop value = NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
769 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
770 |
if (field_signature[1] == '[') { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
771 |
// multi dimensional array |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
772 |
ArrayKlass* kelem = (ArrayKlass *)parse_klass(CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
773 |
int rank = 0; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
774 |
while (field_signature[rank] == '[') { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
775 |
rank++; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
776 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
777 |
int* dims = NEW_RESOURCE_ARRAY(int, rank); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
778 |
dims[0] = length; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
779 |
for (int i = 1; i < rank; i++) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
780 |
dims[i] = 1; // These aren't relevant to the compiler |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
781 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
782 |
value = kelem->multi_allocate(rank, dims, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
783 |
} else { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
784 |
if (strcmp(field_signature, "[B") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
785 |
value = oopFactory::new_byteArray(length, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
786 |
} else if (strcmp(field_signature, "[Z") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
787 |
value = oopFactory::new_boolArray(length, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
788 |
} else if (strcmp(field_signature, "[C") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
789 |
value = oopFactory::new_charArray(length, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
790 |
} else if (strcmp(field_signature, "[S") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
791 |
value = oopFactory::new_shortArray(length, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
792 |
} else if (strcmp(field_signature, "[F") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
793 |
value = oopFactory::new_singleArray(length, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
794 |
} else if (strcmp(field_signature, "[D") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
795 |
value = oopFactory::new_doubleArray(length, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
796 |
} else if (strcmp(field_signature, "[I") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
797 |
value = oopFactory::new_intArray(length, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
798 |
} else if (strcmp(field_signature, "[J") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
799 |
value = oopFactory::new_longArray(length, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
800 |
} else if (field_signature[0] == '[' && field_signature[1] == 'L') { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
801 |
KlassHandle kelem = resolve_klass(field_signature + 1, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
802 |
value = oopFactory::new_objArray(kelem(), length, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
803 |
} else { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
804 |
report_error("unhandled array staticfield"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
805 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
806 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
807 |
java_mirror->obj_field_put(fd.offset(), value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
808 |
} else { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
809 |
const char* string_value = parse_escaped_string(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
810 |
if (strcmp(field_signature, "I") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
811 |
int value = atoi(string_value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
812 |
java_mirror->int_field_put(fd.offset(), value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
813 |
} else if (strcmp(field_signature, "B") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
814 |
int value = atoi(string_value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
815 |
java_mirror->byte_field_put(fd.offset(), value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
816 |
} else if (strcmp(field_signature, "C") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
817 |
int value = atoi(string_value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
818 |
java_mirror->char_field_put(fd.offset(), value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
819 |
} else if (strcmp(field_signature, "S") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
820 |
int value = atoi(string_value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
821 |
java_mirror->short_field_put(fd.offset(), value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
822 |
} else if (strcmp(field_signature, "Z") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
823 |
int value = atol(string_value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
824 |
java_mirror->bool_field_put(fd.offset(), value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
825 |
} else if (strcmp(field_signature, "J") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
826 |
jlong value; |
15228
e92acc84ade3
7102489: RFE: cleanup jlong typedef on __APPLE__and _LLP64 systems.
hseigel
parents:
14588
diff
changeset
|
827 |
if (sscanf(string_value, JLONG_FORMAT, &value) != 1) { |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
828 |
fprintf(stderr, "Error parsing long: %s\n", string_value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
829 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
830 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
831 |
java_mirror->long_field_put(fd.offset(), value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
832 |
} else if (strcmp(field_signature, "F") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
833 |
float value = atof(string_value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
834 |
java_mirror->float_field_put(fd.offset(), value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
835 |
} else if (strcmp(field_signature, "D") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
836 |
double value = atof(string_value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
837 |
java_mirror->double_field_put(fd.offset(), value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
838 |
} else if (strcmp(field_signature, "Ljava/lang/String;") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
839 |
Handle value = java_lang_String::create_from_str(string_value, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
840 |
java_mirror->obj_field_put(fd.offset(), value()); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
841 |
} else if (field_signature[0] == 'L') { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
842 |
Symbol* klass_name = SymbolTable::lookup(field_signature, (int)strlen(field_signature), CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
843 |
KlassHandle kelem = resolve_klass(field_signature, CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
844 |
oop value = ((InstanceKlass*)kelem())->allocate_instance(CHECK); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
845 |
java_mirror->obj_field_put(fd.offset(), value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
846 |
} else { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
847 |
report_error("unhandled staticfield"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
848 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
849 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
850 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
851 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
852 |
#if INCLUDE_JVMTI |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
853 |
void process_JvmtiExport(TRAPS) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
854 |
const char* field = parse_string(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
855 |
bool value = parse_int("JvmtiExport flag") != 0; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
856 |
if (strcmp(field, "can_access_local_variables") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
857 |
JvmtiExport::set_can_access_local_variables(value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
858 |
} else if (strcmp(field, "can_hotswap_or_post_breakpoint") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
859 |
JvmtiExport::set_can_hotswap_or_post_breakpoint(value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
860 |
} else if (strcmp(field, "can_post_on_exceptions") == 0) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
861 |
JvmtiExport::set_can_post_on_exceptions(value); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
862 |
} else { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
863 |
report_error("Unrecognized JvmtiExport directive"); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
864 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
865 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
866 |
#endif // INCLUDE_JVMTI |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
867 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
868 |
// Create and initialize a record for a ciMethod |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
869 |
ciMethodRecord* new_ciMethod(Method* method) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
870 |
ciMethodRecord* rec = NEW_RESOURCE_OBJ(ciMethodRecord); |
22243 | 871 |
rec->_klass_name = method->method_holder()->name()->as_utf8(); |
872 |
rec->_method_name = method->name()->as_utf8(); |
|
873 |
rec->_signature = method->signature()->as_utf8(); |
|
874 |
_ci_method_records.append(rec); |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
875 |
return rec; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
876 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
877 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
878 |
// Lookup data for a ciMethod |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
879 |
ciMethodRecord* find_ciMethodRecord(Method* method) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
880 |
const char* klass_name = method->method_holder()->name()->as_utf8(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
881 |
const char* method_name = method->name()->as_utf8(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
882 |
const char* signature = method->signature()->as_utf8(); |
22243 | 883 |
for (int i = 0; i < _ci_method_records.length(); i++) { |
884 |
ciMethodRecord* rec = _ci_method_records.at(i); |
|
885 |
if (strcmp(rec->_klass_name, klass_name) == 0 && |
|
886 |
strcmp(rec->_method_name, method_name) == 0 && |
|
887 |
strcmp(rec->_signature, signature) == 0) { |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
888 |
return rec; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
889 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
890 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
891 |
return NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
892 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
893 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
894 |
// Create and initialize a record for a ciMethodData |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
895 |
ciMethodDataRecord* new_ciMethodData(Method* method) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
896 |
ciMethodDataRecord* rec = NEW_RESOURCE_OBJ(ciMethodDataRecord); |
22243 | 897 |
rec->_klass_name = method->method_holder()->name()->as_utf8(); |
898 |
rec->_method_name = method->name()->as_utf8(); |
|
899 |
rec->_signature = method->signature()->as_utf8(); |
|
900 |
_ci_method_data_records.append(rec); |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
901 |
return rec; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
902 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
903 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
904 |
// Lookup data for a ciMethodData |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
905 |
ciMethodDataRecord* find_ciMethodDataRecord(Method* method) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
906 |
const char* klass_name = method->method_holder()->name()->as_utf8(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
907 |
const char* method_name = method->name()->as_utf8(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
908 |
const char* signature = method->signature()->as_utf8(); |
22243 | 909 |
for (int i = 0; i < _ci_method_data_records.length(); i++) { |
910 |
ciMethodDataRecord* rec = _ci_method_data_records.at(i); |
|
911 |
if (strcmp(rec->_klass_name, klass_name) == 0 && |
|
912 |
strcmp(rec->_method_name, method_name) == 0 && |
|
913 |
strcmp(rec->_signature, signature) == 0) { |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
914 |
return rec; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
915 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
916 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
917 |
return NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
918 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
919 |
|
22243 | 920 |
// Create and initialize a record for a ciInlineRecord |
921 |
ciInlineRecord* new_ciInlineRecord(Method* method, int bci, int depth) { |
|
922 |
ciInlineRecord* rec = NEW_RESOURCE_OBJ(ciInlineRecord); |
|
923 |
rec->_klass_name = method->method_holder()->name()->as_utf8(); |
|
924 |
rec->_method_name = method->name()->as_utf8(); |
|
925 |
rec->_signature = method->signature()->as_utf8(); |
|
926 |
rec->_inline_bci = bci; |
|
927 |
rec->_inline_depth = depth; |
|
928 |
_ci_inline_records->append(rec); |
|
929 |
return rec; |
|
930 |
} |
|
931 |
||
932 |
// Lookup inlining data for a ciMethod |
|
933 |
ciInlineRecord* find_ciInlineRecord(Method* method, int bci, int depth) { |
|
934 |
if (_ci_inline_records != NULL) { |
|
935 |
return find_ciInlineRecord(_ci_inline_records, method, bci, depth); |
|
936 |
} |
|
937 |
return NULL; |
|
938 |
} |
|
939 |
||
940 |
static ciInlineRecord* find_ciInlineRecord(GrowableArray<ciInlineRecord*>* records, |
|
941 |
Method* method, int bci, int depth) { |
|
942 |
if (records != NULL) { |
|
943 |
const char* klass_name = method->method_holder()->name()->as_utf8(); |
|
944 |
const char* method_name = method->name()->as_utf8(); |
|
945 |
const char* signature = method->signature()->as_utf8(); |
|
946 |
for (int i = 0; i < records->length(); i++) { |
|
947 |
ciInlineRecord* rec = records->at(i); |
|
948 |
if ((rec->_inline_bci == bci) && |
|
949 |
(rec->_inline_depth == depth) && |
|
950 |
(strcmp(rec->_klass_name, klass_name) == 0) && |
|
951 |
(strcmp(rec->_method_name, method_name) == 0) && |
|
952 |
(strcmp(rec->_signature, signature) == 0)) { |
|
953 |
return rec; |
|
954 |
} |
|
955 |
} |
|
956 |
} |
|
957 |
return NULL; |
|
958 |
} |
|
959 |
||
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
960 |
const char* error_message() { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
961 |
return _error_message; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
962 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
963 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
964 |
void reset() { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
965 |
_error_message = NULL; |
22243 | 966 |
_ci_method_records.clear(); |
967 |
_ci_method_data_records.clear(); |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
968 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
969 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
970 |
// Take an ascii string contain \u#### escapes and convert it to utf8 |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
971 |
// in place. |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
972 |
static void unescape_string(char* value) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
973 |
char* from = value; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
974 |
char* to = value; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
975 |
while (*from != '\0') { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
976 |
if (*from != '\\') { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
977 |
*from++ = *to++; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
978 |
} else { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
979 |
switch (from[1]) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
980 |
case 'u': { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
981 |
from += 2; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
982 |
jchar value=0; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
983 |
for (int i=0; i<4; i++) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
984 |
char c = *from++; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
985 |
switch (c) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
986 |
case '0': case '1': case '2': case '3': case '4': |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
987 |
case '5': case '6': case '7': case '8': case '9': |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
988 |
value = (value << 4) + c - '0'; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
989 |
break; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
990 |
case 'a': case 'b': case 'c': |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
991 |
case 'd': case 'e': case 'f': |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
992 |
value = (value << 4) + 10 + c - 'a'; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
993 |
break; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
994 |
case 'A': case 'B': case 'C': |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
995 |
case 'D': case 'E': case 'F': |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
996 |
value = (value << 4) + 10 + c - 'A'; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
997 |
break; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
998 |
default: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
999 |
ShouldNotReachHere(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1000 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1001 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1002 |
UNICODE::convert_to_utf8(&value, 1, to); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1003 |
to++; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1004 |
break; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1005 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1006 |
case 't': *to++ = '\t'; from += 2; break; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1007 |
case 'n': *to++ = '\n'; from += 2; break; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1008 |
case 'r': *to++ = '\r'; from += 2; break; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1009 |
case 'f': *to++ = '\f'; from += 2; break; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1010 |
default: |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1011 |
ShouldNotReachHere(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1012 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1013 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1014 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1015 |
*from = *to; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1016 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1017 |
}; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1018 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1019 |
void ciReplay::replay(TRAPS) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1020 |
int exit_code = replay_impl(THREAD); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1021 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1022 |
Threads::destroy_vm(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1023 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1024 |
vm_exit(exit_code); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1025 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1026 |
|
22243 | 1027 |
void* ciReplay::load_inline_data(ciMethod* method, int entry_bci, int comp_level) { |
1028 |
if (FLAG_IS_DEFAULT(InlineDataFile)) { |
|
1029 |
tty->print_cr("ERROR: no inline replay data file specified (use -XX:InlineDataFile=inline_pid12345.txt)."); |
|
1030 |
return NULL; |
|
1031 |
} |
|
1032 |
||
1033 |
VM_ENTRY_MARK; |
|
1034 |
// Load and parse the replay data |
|
1035 |
CompileReplay rp(InlineDataFile, THREAD); |
|
1036 |
if (!rp.can_replay()) { |
|
1037 |
tty->print_cr("ciReplay: !rp.can_replay()"); |
|
1038 |
return NULL; |
|
1039 |
} |
|
1040 |
void* data = rp.process_inline(method, method->get_Method(), entry_bci, comp_level, THREAD); |
|
1041 |
if (HAS_PENDING_EXCEPTION) { |
|
1042 |
oop throwable = PENDING_EXCEPTION; |
|
1043 |
CLEAR_PENDING_EXCEPTION; |
|
1044 |
java_lang_Throwable::print(throwable, tty); |
|
1045 |
tty->cr(); |
|
1046 |
java_lang_Throwable::print_stack_trace(throwable, tty); |
|
1047 |
tty->cr(); |
|
1048 |
return NULL; |
|
1049 |
} |
|
1050 |
||
1051 |
if (rp.had_error()) { |
|
1052 |
tty->print_cr("ciReplay: Failed on %s", rp.error_message()); |
|
1053 |
return NULL; |
|
1054 |
} |
|
1055 |
return data; |
|
1056 |
} |
|
1057 |
||
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1058 |
int ciReplay::replay_impl(TRAPS) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1059 |
HandleMark hm; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1060 |
ResourceMark rm; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1061 |
// Make sure we don't run with background compilation |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1062 |
BackgroundCompilation = false; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1063 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1064 |
if (ReplaySuppressInitializers > 2) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1065 |
// ReplaySuppressInitializers > 2 means that we want to allow |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1066 |
// normal VM bootstrap but once we get into the replay itself |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1067 |
// don't allow any intializers to be run. |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1068 |
ReplaySuppressInitializers = 1; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1069 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1070 |
|
17121
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
17000
diff
changeset
|
1071 |
if (FLAG_IS_DEFAULT(ReplayDataFile)) { |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
17000
diff
changeset
|
1072 |
tty->print_cr("ERROR: no compiler replay data file specified (use -XX:ReplayDataFile=replay_pid12345.txt)."); |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
17000
diff
changeset
|
1073 |
return 1; |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
17000
diff
changeset
|
1074 |
} |
e40a97c700d9
8012260: ciReplay: Include PID into the name of replay data file
vlivanov
parents:
17000
diff
changeset
|
1075 |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1076 |
// Load and parse the replay data |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1077 |
CompileReplay rp(ReplayDataFile, THREAD); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1078 |
int exit_code = 0; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1079 |
if (rp.can_replay()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1080 |
rp.process(THREAD); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1081 |
} else { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1082 |
exit_code = 1; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1083 |
return exit_code; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1084 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1085 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1086 |
if (HAS_PENDING_EXCEPTION) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1087 |
oop throwable = PENDING_EXCEPTION; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1088 |
CLEAR_PENDING_EXCEPTION; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1089 |
java_lang_Throwable::print(throwable, tty); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1090 |
tty->cr(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1091 |
java_lang_Throwable::print_stack_trace(throwable, tty); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1092 |
tty->cr(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1093 |
exit_code = 2; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1094 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1095 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1096 |
if (rp.had_error()) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1097 |
tty->print_cr("Failed on %s", rp.error_message()); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1098 |
exit_code = 1; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1099 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1100 |
return exit_code; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1101 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1102 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1103 |
void ciReplay::initialize(ciMethodData* m) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1104 |
if (replay_state == NULL) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1105 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1106 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1107 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1108 |
ASSERT_IN_VM; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1109 |
ResourceMark rm; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1110 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1111 |
Method* method = m->get_MethodData()->method(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1112 |
ciMethodDataRecord* rec = replay_state->find_ciMethodDataRecord(method); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1113 |
if (rec == NULL) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1114 |
// This indicates some mismatch with the original environment and |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1115 |
// the replay environment though it's not always enough to |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1116 |
// interfere with reproducing a bug |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1117 |
tty->print_cr("Warning: requesting ciMethodData record for method with no data: "); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1118 |
method->print_name(tty); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1119 |
tty->cr(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1120 |
} else { |
22243 | 1121 |
m->_state = rec->_state; |
1122 |
m->_current_mileage = rec->_current_mileage; |
|
1123 |
if (rec->_data_length != 0) { |
|
24476
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
1124 |
assert(m->_data_size + m->_extra_data_size == rec->_data_length * (int)sizeof(rec->_data[0]) || |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
1125 |
m->_data_size == rec->_data_length * (int)sizeof(rec->_data[0]), "must agree"); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1126 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1127 |
// Write the correct ciObjects back into the profile data |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1128 |
ciEnv* env = ciEnv::current(); |
24476
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
1129 |
for (int i = 0; i < rec->_classes_length; i++) { |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
1130 |
Klass *k = rec->_classes[i]; |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
1131 |
// In case this class pointer is is tagged, preserve the tag |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
1132 |
// bits |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
1133 |
rec->_data[rec->_classes_offsets[i]] = |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
1134 |
ciTypeEntries::with_status(env->get_metadata(k)->as_klass(), rec->_data[rec->_classes_offsets[i]]); |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
1135 |
} |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
1136 |
for (int i = 0; i < rec->_methods_length; i++) { |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
1137 |
Method *m = rec->_methods[i]; |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
1138 |
*(ciMetadata**)(rec->_data + rec->_methods_offsets[i]) = |
912595db2e75
8026694: New type profiling points break compilation replay
roland
parents:
24324
diff
changeset
|
1139 |
env->get_metadata(m); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1140 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1141 |
// Copy the updated profile data into place as intptr_ts |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1142 |
#ifdef _LP64 |
22243 | 1143 |
Copy::conjoint_jlongs_atomic((jlong *)rec->_data, (jlong *)m->_data, rec->_data_length); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1144 |
#else |
22243 | 1145 |
Copy::conjoint_jints_atomic((jint *)rec->_data, (jint *)m->_data, rec->_data_length); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1146 |
#endif |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1147 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1148 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1149 |
// copy in the original header |
22243 | 1150 |
Copy::conjoint_jbytes(rec->_orig_data, (char*)&m->_orig, rec->_orig_data_length); |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1151 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1152 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1153 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1154 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1155 |
bool ciReplay::should_not_inline(ciMethod* method) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1156 |
if (replay_state == NULL) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1157 |
return false; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1158 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1159 |
VM_ENTRY_MARK; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1160 |
// ciMethod without a record shouldn't be inlined. |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1161 |
return replay_state->find_ciMethodRecord(method->get_Method()) == NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1162 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1163 |
|
22243 | 1164 |
bool ciReplay::should_inline(void* data, ciMethod* method, int bci, int inline_depth) { |
1165 |
if (data != NULL) { |
|
1166 |
GrowableArray<ciInlineRecord*>* records = (GrowableArray<ciInlineRecord*>*)data; |
|
1167 |
VM_ENTRY_MARK; |
|
1168 |
// Inline record are ordered by bci and depth. |
|
1169 |
return CompileReplay::find_ciInlineRecord(records, method->get_Method(), bci, inline_depth) != NULL; |
|
1170 |
} else if (replay_state != NULL) { |
|
1171 |
VM_ENTRY_MARK; |
|
1172 |
// Inline record are ordered by bci and depth. |
|
1173 |
return replay_state->find_ciInlineRecord(method->get_Method(), bci, inline_depth) != NULL; |
|
1174 |
} |
|
1175 |
return false; |
|
1176 |
} |
|
1177 |
||
1178 |
bool ciReplay::should_not_inline(void* data, ciMethod* method, int bci, int inline_depth) { |
|
1179 |
if (data != NULL) { |
|
1180 |
GrowableArray<ciInlineRecord*>* records = (GrowableArray<ciInlineRecord*>*)data; |
|
1181 |
VM_ENTRY_MARK; |
|
1182 |
// Inline record are ordered by bci and depth. |
|
1183 |
return CompileReplay::find_ciInlineRecord(records, method->get_Method(), bci, inline_depth) == NULL; |
|
1184 |
} else if (replay_state != NULL) { |
|
1185 |
VM_ENTRY_MARK; |
|
1186 |
// Inline record are ordered by bci and depth. |
|
1187 |
return replay_state->find_ciInlineRecord(method->get_Method(), bci, inline_depth) == NULL; |
|
1188 |
} |
|
1189 |
return false; |
|
1190 |
} |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1191 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1192 |
void ciReplay::initialize(ciMethod* m) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1193 |
if (replay_state == NULL) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1194 |
return; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1195 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1196 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1197 |
ASSERT_IN_VM; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1198 |
ResourceMark rm; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1199 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1200 |
Method* method = m->get_Method(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1201 |
ciMethodRecord* rec = replay_state->find_ciMethodRecord(method); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1202 |
if (rec == NULL) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1203 |
// This indicates some mismatch with the original environment and |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1204 |
// the replay environment though it's not always enough to |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1205 |
// interfere with reproducing a bug |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1206 |
tty->print_cr("Warning: requesting ciMethod record for method with no data: "); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1207 |
method->print_name(tty); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1208 |
tty->cr(); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1209 |
} else { |
17000
11bf92e571a2
8010862: The Method counter fields used for profiling can be allocated lazily.
jiangli
parents:
15483
diff
changeset
|
1210 |
EXCEPTION_CONTEXT; |
22243 | 1211 |
// m->_instructions_size = rec->_instructions_size; |
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1212 |
m->_instructions_size = -1; |
22243 | 1213 |
m->_interpreter_invocation_count = rec->_interpreter_invocation_count; |
1214 |
m->_interpreter_throwout_count = rec->_interpreter_throwout_count; |
|
20695
4f5a5e95090b
8025566: EXCEPTION_ACCESS_VIOLATION in compiled by C1 String.valueOf method
twisti
parents:
18984
diff
changeset
|
1215 |
MethodCounters* mcs = method->get_method_counters(CHECK_AND_CLEAR); |
4f5a5e95090b
8025566: EXCEPTION_ACCESS_VIOLATION in compiled by C1 String.valueOf method
twisti
parents:
18984
diff
changeset
|
1216 |
guarantee(mcs != NULL, "method counters allocation failed"); |
22243 | 1217 |
mcs->invocation_counter()->_counter = rec->_invocation_counter; |
1218 |
mcs->backedge_counter()->_counter = rec->_backedge_counter; |
|
14477
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1219 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1220 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1221 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1222 |
bool ciReplay::is_loaded(Method* method) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1223 |
if (replay_state == NULL) { |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1224 |
return true; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1225 |
} |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1226 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1227 |
ASSERT_IN_VM; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1228 |
ResourceMark rm; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1229 |
|
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1230 |
ciMethodRecord* rec = replay_state->find_ciMethodRecord(method); |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1231 |
return rec != NULL; |
95e66ea71f71
6830717: replay of compilations would help with debugging
minqi
parents:
diff
changeset
|
1232 |
} |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14477
diff
changeset
|
1233 |
#endif // PRODUCT |