author | sspitsyn |
Sat, 12 Jul 2014 01:26:13 -0700 | |
changeset 25627 | b5a1a1f02388 |
parent 24424 | 2658d7834c6e |
child 29081 | c61eb4914428 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23526
diff
changeset
|
2 |
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4567
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4567
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4567
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "interpreter/bytecodeHistogram.hpp" |
|
27 |
#include "interpreter/bytecodeTracer.hpp" |
|
28 |
#include "interpreter/bytecodes.hpp" |
|
29 |
#include "interpreter/interpreter.hpp" |
|
30 |
#include "interpreter/interpreterRuntime.hpp" |
|
31 |
#include "memory/resourceArea.hpp" |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
32 |
#include "oops/methodData.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
33 |
#include "oops/method.hpp" |
7397 | 34 |
#include "runtime/mutexLocker.hpp" |
35 |
#include "runtime/timer.hpp" |
|
1 | 36 |
|
37 |
||
38 |
// Standard closure for BytecodeTracer: prints the current bytecode |
|
39 |
// and its attributes using bytecode-specific information. |
|
40 |
||
41 |
class BytecodePrinter: public BytecodeClosure { |
|
42 |
private: |
|
43 |
// %%% This field is not GC-ed, and so can contain garbage |
|
44 |
// between critical sections. Use only pointer-comparison |
|
45 |
// operations on the pointer, except within a critical section. |
|
46 |
// (Also, ensure that occasional false positives are benign.) |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
47 |
Method* _current_method; |
1 | 48 |
bool _is_wide; |
5688 | 49 |
Bytecodes::Code _code; |
1 | 50 |
address _next_pc; // current decoding position |
51 |
||
52 |
void align() { _next_pc = (address)round_to((intptr_t)_next_pc, sizeof(jint)); } |
|
53 |
int get_byte() { return *(jbyte*) _next_pc++; } // signed |
|
54 |
short get_short() { short i=Bytes::get_Java_u2(_next_pc); _next_pc+=2; return i; } |
|
55 |
int get_int() { int i=Bytes::get_Java_u4(_next_pc); _next_pc+=4; return i; } |
|
56 |
||
5688 | 57 |
int get_index_u1() { return *(address)_next_pc++; } |
58 |
int get_index_u2() { int i=Bytes::get_Java_u2(_next_pc); _next_pc+=2; return i; } |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
59 |
int get_index_u1_cpcache() { return get_index_u1() + ConstantPool::CPCACHE_INDEX_TAG; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
60 |
int get_index_u2_cpcache() { int i=Bytes::get_native_u2(_next_pc); _next_pc+=2; return i + ConstantPool::CPCACHE_INDEX_TAG; } |
5688 | 61 |
int get_index_u4() { int i=Bytes::get_native_u4(_next_pc); _next_pc+=4; return i; } |
62 |
int get_index_special() { return (is_wide()) ? get_index_u2() : get_index_u1(); } |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
63 |
Method* method() { return _current_method; } |
1 | 64 |
bool is_wide() { return _is_wide; } |
5688 | 65 |
Bytecodes::Code raw_code() { return Bytecodes::Code(_code); } |
1 | 66 |
|
67 |
||
5688 | 68 |
bool check_index(int i, int& cp_index, outputStream* st = tty); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
69 |
bool check_cp_cache_index(int i, int& cp_index, outputStream* st = tty); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
70 |
bool check_obj_index(int i, int& cp_index, outputStream* st = tty); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
71 |
bool check_invokedynamic_index(int i, int& cp_index, outputStream* st = tty); |
1 | 72 |
void print_constant(int i, outputStream* st = tty); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
73 |
void print_field_or_method(int i, outputStream* st = tty); |
5882 | 74 |
void print_field_or_method(int orig_i, int i, outputStream* st = tty); |
5688 | 75 |
void print_attributes(int bci, outputStream* st = tty); |
1 | 76 |
void bytecode_epilog(int bci, outputStream* st = tty); |
77 |
||
78 |
public: |
|
79 |
BytecodePrinter() { |
|
80 |
_is_wide = false; |
|
5688 | 81 |
_code = Bytecodes::_illegal; |
1 | 82 |
} |
83 |
||
84 |
// This method is called while executing the raw bytecodes, so none of |
|
85 |
// the adjustments that BytecodeStream performs applies. |
|
86 |
void trace(methodHandle method, address bcp, uintptr_t tos, uintptr_t tos2, outputStream* st) { |
|
87 |
ResourceMark rm; |
|
88 |
if (_current_method != method()) { |
|
89 |
// Note 1: This code will not work as expected with true MT/MP. |
|
90 |
// Need an explicit lock or a different solution. |
|
91 |
// It is possible for this block to be skipped, if a garbage |
|
92 |
// _current_method pointer happens to have the same bits as |
|
93 |
// the incoming method. We could lose a line of trace output. |
|
94 |
// This is acceptable in a debug-only feature. |
|
95 |
st->cr(); |
|
10565 | 96 |
st->print("[%ld] ", (long) Thread::current()->osthread()->thread_id()); |
1 | 97 |
method->print_name(st); |
98 |
st->cr(); |
|
99 |
_current_method = method(); |
|
100 |
} |
|
101 |
Bytecodes::Code code; |
|
102 |
if (is_wide()) { |
|
103 |
// bcp wasn't advanced if previous bytecode was _wide. |
|
7913 | 104 |
code = Bytecodes::code_at(method(), bcp+1); |
1 | 105 |
} else { |
7913 | 106 |
code = Bytecodes::code_at(method(), bcp); |
1 | 107 |
} |
5688 | 108 |
_code = code; |
109 |
int bci = bcp - method->code_base(); |
|
10565 | 110 |
st->print("[%ld] ", (long) Thread::current()->osthread()->thread_id()); |
1 | 111 |
if (Verbose) { |
112 |
st->print("%8d %4d " INTPTR_FORMAT " " INTPTR_FORMAT " %s", |
|
113 |
BytecodeCounter::counter_value(), bci, tos, tos2, Bytecodes::name(code)); |
|
114 |
} else { |
|
115 |
st->print("%8d %4d %s", |
|
116 |
BytecodeCounter::counter_value(), bci, Bytecodes::name(code)); |
|
117 |
} |
|
118 |
_next_pc = is_wide() ? bcp+2 : bcp+1; |
|
5688 | 119 |
print_attributes(bci); |
1 | 120 |
// Set is_wide for the next one, since the caller of this doesn't skip |
121 |
// the next bytecode. |
|
122 |
_is_wide = (code == Bytecodes::_wide); |
|
5688 | 123 |
_code = Bytecodes::_illegal; |
1 | 124 |
} |
125 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
126 |
// Used for Method*::print_codes(). The input bcp comes from |
1 | 127 |
// BytecodeStream, which will skip wide bytecodes. |
128 |
void trace(methodHandle method, address bcp, outputStream* st) { |
|
129 |
_current_method = method(); |
|
130 |
ResourceMark rm; |
|
7913 | 131 |
Bytecodes::Code code = Bytecodes::code_at(method(), bcp); |
1 | 132 |
// Set is_wide |
133 |
_is_wide = (code == Bytecodes::_wide); |
|
134 |
if (is_wide()) { |
|
7913 | 135 |
code = Bytecodes::code_at(method(), bcp+1); |
1 | 136 |
} |
5688 | 137 |
_code = code; |
1 | 138 |
int bci = bcp - method->code_base(); |
139 |
// Print bytecode index and name |
|
140 |
if (is_wide()) { |
|
141 |
st->print("%d %s_w", bci, Bytecodes::name(code)); |
|
142 |
} else { |
|
143 |
st->print("%d %s", bci, Bytecodes::name(code)); |
|
144 |
} |
|
145 |
_next_pc = is_wide() ? bcp+2 : bcp+1; |
|
5688 | 146 |
print_attributes(bci, st); |
1 | 147 |
bytecode_epilog(bci, st); |
148 |
} |
|
149 |
}; |
|
150 |
||
151 |
||
152 |
// Implementation of BytecodeTracer |
|
153 |
||
154 |
// %%% This set_closure thing seems overly general, given that |
|
155 |
// nobody uses it. Also, if BytecodePrinter weren't hidden |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
156 |
// then Method* could use instances of it directly and it |
1 | 157 |
// would be easier to remove races on _current_method and bcp. |
158 |
// Since this is not product functionality, we can defer cleanup. |
|
159 |
||
160 |
BytecodeClosure* BytecodeTracer::_closure = NULL; |
|
161 |
||
162 |
static BytecodePrinter std_closure; |
|
163 |
BytecodeClosure* BytecodeTracer::std_closure() { |
|
164 |
return &::std_closure; |
|
165 |
} |
|
166 |
||
167 |
||
168 |
void BytecodeTracer::trace(methodHandle method, address bcp, uintptr_t tos, uintptr_t tos2, outputStream* st) { |
|
169 |
if (TraceBytecodes && BytecodeCounter::counter_value() >= TraceBytecodesAt) { |
|
170 |
ttyLocker ttyl; // 5065316: keep the following output coherent |
|
171 |
// The ttyLocker also prevents races between two threads |
|
172 |
// trying to use the single instance of BytecodePrinter. |
|
173 |
// Using the ttyLocker prevents the system from coming to |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
174 |
// a safepoint within this code, which is sensitive to Method* |
1 | 175 |
// movement. |
176 |
// |
|
177 |
// There used to be a leaf mutex here, but the ttyLocker will |
|
178 |
// work just as well, as long as the printing operations never block. |
|
179 |
// |
|
180 |
// We put the locker on the static trace method, not the |
|
181 |
// virtual one, because the clients of this module go through |
|
182 |
// the static method. |
|
183 |
_closure->trace(method, bcp, tos, tos2, st); |
|
184 |
} |
|
185 |
} |
|
186 |
||
187 |
void BytecodeTracer::trace(methodHandle method, address bcp, outputStream* st) { |
|
188 |
ttyLocker ttyl; // 5065316: keep the following output coherent |
|
189 |
_closure->trace(method, bcp, st); |
|
190 |
} |
|
191 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7913
diff
changeset
|
192 |
void print_symbol(Symbol* sym, outputStream* st) { |
5882 | 193 |
char buf[40]; |
194 |
int len = sym->utf8_length(); |
|
195 |
if (len >= (int)sizeof(buf)) { |
|
196 |
st->print_cr(" %s...[%d]", sym->as_C_string(buf, sizeof(buf)), len); |
|
197 |
} else { |
|
198 |
st->print(" "); |
|
199 |
sym->print_on(st); st->cr(); |
|
200 |
} |
|
201 |
} |
|
202 |
||
1 | 203 |
void print_oop(oop value, outputStream* st) { |
204 |
if (value == NULL) { |
|
205 |
st->print_cr(" NULL"); |
|
5882 | 206 |
} else if (java_lang_String::is_instance(value)) { |
9946
b3d5b50e2289
7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
never
parents:
9116
diff
changeset
|
207 |
char buf[40]; |
b3d5b50e2289
7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
never
parents:
9116
diff
changeset
|
208 |
int len = java_lang_String::utf8_length(value); |
b3d5b50e2289
7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
never
parents:
9116
diff
changeset
|
209 |
java_lang_String::as_utf8_string(value, buf, sizeof(buf)); |
b3d5b50e2289
7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
never
parents:
9116
diff
changeset
|
210 |
if (len >= (int)sizeof(buf)) { |
b3d5b50e2289
7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
never
parents:
9116
diff
changeset
|
211 |
st->print_cr(" %s...[%d]", buf, len); |
b3d5b50e2289
7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
never
parents:
9116
diff
changeset
|
212 |
} else { |
b3d5b50e2289
7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
never
parents:
9116
diff
changeset
|
213 |
st->print_cr(" %s", buf); |
b3d5b50e2289
7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
never
parents:
9116
diff
changeset
|
214 |
} |
5882 | 215 |
} else { |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23526
diff
changeset
|
216 |
st->print_cr(" " INTPTR_FORMAT, p2i((void *)value)); |
1 | 217 |
} |
218 |
} |
|
219 |
||
5688 | 220 |
bool BytecodePrinter::check_index(int i, int& cp_index, outputStream* st) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
221 |
ConstantPool* constants = method()->constants(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
222 |
int ilimit = constants->length(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
223 |
Bytecodes::Code code = raw_code(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
224 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
225 |
ConstantPoolCache* cache = NULL; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
226 |
if (Bytecodes::uses_cp_cache(code)) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
227 |
bool okay = true; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
228 |
switch (code) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
229 |
case Bytecodes::_fast_aldc: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
230 |
case Bytecodes::_fast_aldc_w: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
231 |
okay = check_obj_index(i, cp_index, st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
232 |
break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
233 |
case Bytecodes::_invokedynamic: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
234 |
okay = check_invokedynamic_index(i, cp_index, st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
235 |
break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
236 |
default: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
237 |
okay = check_cp_cache_index(i, cp_index, st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
238 |
break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
239 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
240 |
if (!okay) return false; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
241 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
242 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
243 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
244 |
// check cp index |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
245 |
if (cp_index >= 0 && cp_index < ilimit) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
246 |
if (WizardMode) st->print(" cp[%d]", cp_index); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
247 |
return true; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
248 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
249 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
250 |
st->print_cr(" CP[%d] not in CP", cp_index); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
251 |
return false; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
252 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
253 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
254 |
bool BytecodePrinter::check_cp_cache_index(int i, int& cp_index, outputStream* st) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
255 |
ConstantPool* constants = method()->constants(); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
256 |
int ilimit = constants->length(), climit = 0; |
5688 | 257 |
Bytecodes::Code code = raw_code(); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
258 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
259 |
ConstantPoolCache* cache = constants->cache(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
260 |
// If rewriter hasn't run, the index is the cp_index |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
261 |
if (cache == NULL) { |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
262 |
cp_index = i; |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
263 |
return true; |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
264 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
265 |
//climit = cache->length(); // %%% private! |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
266 |
size_t size = cache->size() * HeapWordSize; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
267 |
size -= sizeof(ConstantPoolCache); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
268 |
size /= sizeof(ConstantPoolCacheEntry); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
269 |
climit = (int) size; |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
270 |
|
5688 | 271 |
#ifdef ASSERT |
272 |
{ |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
273 |
const int CPCACHE_INDEX_TAG = ConstantPool::CPCACHE_INDEX_TAG; |
5688 | 274 |
if (i >= CPCACHE_INDEX_TAG && i < climit + CPCACHE_INDEX_TAG) { |
275 |
i -= CPCACHE_INDEX_TAG; |
|
276 |
} else { |
|
277 |
st->print_cr(" CP[%d] missing bias?", i); |
|
278 |
return false; |
|
279 |
} |
|
280 |
} |
|
281 |
#endif //ASSERT |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
282 |
if (i >= 0 && i < climit) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
283 |
cp_index = cache->entry_at(i)->constant_pool_index(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
284 |
} else { |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23526
diff
changeset
|
285 |
st->print_cr("%d not in CP[*]?", i); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
286 |
return false; |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
287 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
288 |
return true; |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
289 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
290 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
291 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
292 |
bool BytecodePrinter::check_obj_index(int i, int& cp_index, outputStream* st) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
293 |
ConstantPool* constants = method()->constants(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
294 |
i -= ConstantPool::CPCACHE_INDEX_TAG; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
295 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
296 |
if (i >= 0 && i < constants->resolved_references()->length()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
297 |
cp_index = constants->object_to_cp_index(i); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
298 |
return true; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
299 |
} else { |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23526
diff
changeset
|
300 |
st->print_cr("%d not in OBJ[*]?", i); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
301 |
return false; |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
302 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
303 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
304 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
305 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
306 |
bool BytecodePrinter::check_invokedynamic_index(int i, int& cp_index, outputStream* st) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
307 |
ConstantPool* constants = method()->constants(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
308 |
assert(ConstantPool::is_invokedynamic_index(i), "not secondary index?"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
309 |
i = ConstantPool::decode_invokedynamic_index(i) + ConstantPool::CPCACHE_INDEX_TAG; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
310 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
311 |
return check_cp_cache_index(i, cp_index, st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
312 |
} |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
313 |
|
1 | 314 |
void BytecodePrinter::print_constant(int i, outputStream* st) { |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
315 |
int orig_i = i; |
5688 | 316 |
if (!check_index(orig_i, i, st)) return; |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
317 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
318 |
ConstantPool* constants = method()->constants(); |
1 | 319 |
constantTag tag = constants->tag_at(i); |
320 |
||
321 |
if (tag.is_int()) { |
|
322 |
st->print_cr(" " INT32_FORMAT, constants->int_at(i)); |
|
323 |
} else if (tag.is_long()) { |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23526
diff
changeset
|
324 |
st->print_cr(" " INT64_FORMAT, (int64_t)(constants->long_at(i))); |
1 | 325 |
} else if (tag.is_float()) { |
326 |
st->print_cr(" %f", constants->float_at(i)); |
|
327 |
} else if (tag.is_double()) { |
|
328 |
st->print_cr(" %f", constants->double_at(i)); |
|
329 |
} else if (tag.is_string()) { |
|
5882 | 330 |
const char* string = constants->string_at_noresolve(i); |
331 |
st->print_cr(" %s", string); |
|
1 | 332 |
} else if (tag.is_klass()) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
333 |
st->print_cr(" %s", constants->resolved_klass_at(i)->external_name()); |
1 | 334 |
} else if (tag.is_unresolved_klass()) { |
335 |
st->print_cr(" <unresolved klass at %d>", i); |
|
5882 | 336 |
} else if (tag.is_method_type()) { |
337 |
int i2 = constants->method_type_index_at(i); |
|
338 |
st->print(" <MethodType> %d", i2); |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7913
diff
changeset
|
339 |
print_symbol(constants->symbol_at(i2), st); |
5882 | 340 |
} else if (tag.is_method_handle()) { |
341 |
int kind = constants->method_handle_ref_kind_at(i); |
|
342 |
int i2 = constants->method_handle_index_at(i); |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23526
diff
changeset
|
343 |
st->print(" <MethodHandle of kind %d index at %d>", kind, i2); |
5882 | 344 |
print_field_or_method(-i, i2, st); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
345 |
} else { |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
346 |
st->print_cr(" bad tag=%d at %d", tag.value(), i); |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
347 |
} |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
348 |
} |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
349 |
|
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
350 |
void BytecodePrinter::print_field_or_method(int i, outputStream* st) { |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
351 |
int orig_i = i; |
5688 | 352 |
if (!check_index(orig_i, i, st)) return; |
5882 | 353 |
print_field_or_method(orig_i, i, st); |
354 |
} |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
355 |
|
5882 | 356 |
void BytecodePrinter::print_field_or_method(int orig_i, int i, outputStream* st) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
357 |
ConstantPool* constants = method()->constants(); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
358 |
constantTag tag = constants->tag_at(i); |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
359 |
|
6062
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5882
diff
changeset
|
360 |
bool has_klass = true; |
4429
d7eb4e2099aa
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
3261
diff
changeset
|
361 |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
362 |
switch (tag.value()) { |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
363 |
case JVM_CONSTANT_InterfaceMethodref: |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
364 |
case JVM_CONSTANT_Methodref: |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
365 |
case JVM_CONSTANT_Fieldref: |
6062
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5882
diff
changeset
|
366 |
break; |
4429
d7eb4e2099aa
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
3261
diff
changeset
|
367 |
case JVM_CONSTANT_NameAndType: |
6062
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5882
diff
changeset
|
368 |
case JVM_CONSTANT_InvokeDynamic: |
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5882
diff
changeset
|
369 |
has_klass = false; |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
370 |
break; |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
371 |
default: |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
372 |
st->print_cr(" bad tag=%d at %d", tag.value(), i); |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
373 |
return; |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
374 |
} |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
375 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7913
diff
changeset
|
376 |
Symbol* name = constants->uncached_name_ref_at(i); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7913
diff
changeset
|
377 |
Symbol* signature = constants->uncached_signature_ref_at(i); |
5882 | 378 |
const char* sep = (tag.is_field() ? "/" : ""); |
6062
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5882
diff
changeset
|
379 |
if (has_klass) { |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7913
diff
changeset
|
380 |
Symbol* klass = constants->klass_name_at(constants->uncached_klass_ref_index_at(i)); |
6062
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5882
diff
changeset
|
381 |
st->print_cr(" %d <%s.%s%s%s> ", i, klass->as_C_string(), name->as_C_string(), sep, signature->as_C_string()); |
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5882
diff
changeset
|
382 |
} else { |
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5882
diff
changeset
|
383 |
if (tag.is_invoke_dynamic()) { |
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5882
diff
changeset
|
384 |
int bsm = constants->invoke_dynamic_bootstrap_method_ref_index_at(i); |
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5882
diff
changeset
|
385 |
st->print(" bsm=%d", bsm); |
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5882
diff
changeset
|
386 |
} |
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5882
diff
changeset
|
387 |
st->print_cr(" %d <%s%s%s>", i, name->as_C_string(), sep, signature->as_C_string()); |
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5882
diff
changeset
|
388 |
} |
1 | 389 |
} |
390 |
||
391 |
||
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23526
diff
changeset
|
392 |
PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL |
5688 | 393 |
void BytecodePrinter::print_attributes(int bci, outputStream* st) { |
1 | 394 |
// Show attributes of pre-rewritten codes |
5688 | 395 |
Bytecodes::Code code = Bytecodes::java_code(raw_code()); |
1 | 396 |
// If the code doesn't have any fields there's nothing to print. |
397 |
// note this is ==1 because the tableswitch and lookupswitch are |
|
398 |
// zero size (for some reason) and we want to print stuff out for them. |
|
399 |
if (Bytecodes::length_for(code) == 1) { |
|
400 |
st->cr(); |
|
401 |
return; |
|
402 |
} |
|
403 |
||
404 |
switch(code) { |
|
405 |
// Java specific bytecodes only matter. |
|
406 |
case Bytecodes::_bipush: |
|
407 |
st->print_cr(" " INT32_FORMAT, get_byte()); |
|
408 |
break; |
|
409 |
case Bytecodes::_sipush: |
|
410 |
st->print_cr(" " INT32_FORMAT, get_short()); |
|
411 |
break; |
|
412 |
case Bytecodes::_ldc: |
|
5882 | 413 |
if (Bytecodes::uses_cp_cache(raw_code())) { |
414 |
print_constant(get_index_u1_cpcache(), st); |
|
415 |
} else { |
|
416 |
print_constant(get_index_u1(), st); |
|
417 |
} |
|
1 | 418 |
break; |
419 |
||
420 |
case Bytecodes::_ldc_w: |
|
421 |
case Bytecodes::_ldc2_w: |
|
5882 | 422 |
if (Bytecodes::uses_cp_cache(raw_code())) { |
423 |
print_constant(get_index_u2_cpcache(), st); |
|
424 |
} else { |
|
425 |
print_constant(get_index_u2(), st); |
|
426 |
} |
|
1 | 427 |
break; |
428 |
||
429 |
case Bytecodes::_iload: |
|
430 |
case Bytecodes::_lload: |
|
431 |
case Bytecodes::_fload: |
|
432 |
case Bytecodes::_dload: |
|
433 |
case Bytecodes::_aload: |
|
434 |
case Bytecodes::_istore: |
|
435 |
case Bytecodes::_lstore: |
|
436 |
case Bytecodes::_fstore: |
|
437 |
case Bytecodes::_dstore: |
|
438 |
case Bytecodes::_astore: |
|
439 |
st->print_cr(" #%d", get_index_special()); |
|
440 |
break; |
|
441 |
||
442 |
case Bytecodes::_iinc: |
|
443 |
{ int index = get_index_special(); |
|
444 |
jint offset = is_wide() ? get_short(): get_byte(); |
|
445 |
st->print_cr(" #%d " INT32_FORMAT, index, offset); |
|
446 |
} |
|
447 |
break; |
|
448 |
||
449 |
case Bytecodes::_newarray: { |
|
5688 | 450 |
BasicType atype = (BasicType)get_index_u1(); |
1 | 451 |
const char* str = type2name(atype); |
452 |
if (str == NULL || atype == T_OBJECT || atype == T_ARRAY) { |
|
453 |
assert(false, "Unidentified basic type"); |
|
454 |
} |
|
455 |
st->print_cr(" %s", str); |
|
456 |
} |
|
457 |
break; |
|
458 |
case Bytecodes::_anewarray: { |
|
5688 | 459 |
int klass_index = get_index_u2(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
460 |
ConstantPool* constants = method()->constants(); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7913
diff
changeset
|
461 |
Symbol* name = constants->klass_name_at(klass_index); |
1 | 462 |
st->print_cr(" %s ", name->as_C_string()); |
463 |
} |
|
464 |
break; |
|
465 |
case Bytecodes::_multianewarray: { |
|
5688 | 466 |
int klass_index = get_index_u2(); |
467 |
int nof_dims = get_index_u1(); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
468 |
ConstantPool* constants = method()->constants(); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7913
diff
changeset
|
469 |
Symbol* name = constants->klass_name_at(klass_index); |
1 | 470 |
st->print_cr(" %s %d", name->as_C_string(), nof_dims); |
471 |
} |
|
472 |
break; |
|
473 |
||
474 |
case Bytecodes::_ifeq: |
|
475 |
case Bytecodes::_ifnull: |
|
476 |
case Bytecodes::_iflt: |
|
477 |
case Bytecodes::_ifle: |
|
478 |
case Bytecodes::_ifne: |
|
479 |
case Bytecodes::_ifnonnull: |
|
480 |
case Bytecodes::_ifgt: |
|
481 |
case Bytecodes::_ifge: |
|
482 |
case Bytecodes::_if_icmpeq: |
|
483 |
case Bytecodes::_if_icmpne: |
|
484 |
case Bytecodes::_if_icmplt: |
|
485 |
case Bytecodes::_if_icmpgt: |
|
486 |
case Bytecodes::_if_icmple: |
|
487 |
case Bytecodes::_if_icmpge: |
|
488 |
case Bytecodes::_if_acmpeq: |
|
489 |
case Bytecodes::_if_acmpne: |
|
490 |
case Bytecodes::_goto: |
|
491 |
case Bytecodes::_jsr: |
|
492 |
st->print_cr(" %d", bci + get_short()); |
|
493 |
break; |
|
494 |
||
495 |
case Bytecodes::_goto_w: |
|
496 |
case Bytecodes::_jsr_w: |
|
497 |
st->print_cr(" %d", bci + get_int()); |
|
498 |
break; |
|
499 |
||
500 |
case Bytecodes::_ret: st->print_cr(" %d", get_index_special()); break; |
|
501 |
||
502 |
case Bytecodes::_tableswitch: |
|
503 |
{ align(); |
|
504 |
int default_dest = bci + get_int(); |
|
505 |
int lo = get_int(); |
|
506 |
int hi = get_int(); |
|
507 |
int len = hi - lo + 1; |
|
508 |
jint* dest = NEW_RESOURCE_ARRAY(jint, len); |
|
509 |
for (int i = 0; i < len; i++) { |
|
510 |
dest[i] = bci + get_int(); |
|
511 |
} |
|
512 |
st->print(" %d " INT32_FORMAT " " INT32_FORMAT " ", |
|
513 |
default_dest, lo, hi); |
|
514 |
int first = true; |
|
515 |
for (int ll = lo; ll <= hi; ll++, first = false) { |
|
516 |
int idx = ll - lo; |
|
517 |
const char *format = first ? " %d:" INT32_FORMAT " (delta: %d)" : |
|
518 |
", %d:" INT32_FORMAT " (delta: %d)"; |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23526
diff
changeset
|
519 |
PRAGMA_DIAG_PUSH |
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23526
diff
changeset
|
520 |
PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL |
1 | 521 |
st->print(format, ll, dest[idx], dest[idx]-bci); |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23526
diff
changeset
|
522 |
PRAGMA_DIAG_POP |
1 | 523 |
} |
524 |
st->cr(); |
|
525 |
} |
|
526 |
break; |
|
527 |
case Bytecodes::_lookupswitch: |
|
528 |
{ align(); |
|
529 |
int default_dest = bci + get_int(); |
|
530 |
int len = get_int(); |
|
531 |
jint* key = NEW_RESOURCE_ARRAY(jint, len); |
|
532 |
jint* dest = NEW_RESOURCE_ARRAY(jint, len); |
|
533 |
for (int i = 0; i < len; i++) { |
|
534 |
key [i] = get_int(); |
|
535 |
dest[i] = bci + get_int(); |
|
536 |
}; |
|
537 |
st->print(" %d %d ", default_dest, len); |
|
538 |
bool first = true; |
|
539 |
for (int ll = 0; ll < len; ll++, first = false) { |
|
540 |
const char *format = first ? " " INT32_FORMAT ":" INT32_FORMAT : |
|
541 |
", " INT32_FORMAT ":" INT32_FORMAT ; |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23526
diff
changeset
|
542 |
PRAGMA_DIAG_PUSH |
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23526
diff
changeset
|
543 |
PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL |
1 | 544 |
st->print(format, key[ll], dest[ll]); |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23526
diff
changeset
|
545 |
PRAGMA_DIAG_POP |
1 | 546 |
} |
547 |
st->cr(); |
|
548 |
} |
|
549 |
break; |
|
550 |
||
551 |
case Bytecodes::_putstatic: |
|
552 |
case Bytecodes::_getstatic: |
|
553 |
case Bytecodes::_putfield: |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
554 |
case Bytecodes::_getfield: |
5688 | 555 |
print_field_or_method(get_index_u2_cpcache(), st); |
1 | 556 |
break; |
557 |
||
558 |
case Bytecodes::_invokevirtual: |
|
559 |
case Bytecodes::_invokespecial: |
|
560 |
case Bytecodes::_invokestatic: |
|
5688 | 561 |
print_field_or_method(get_index_u2_cpcache(), st); |
1 | 562 |
break; |
563 |
||
564 |
case Bytecodes::_invokeinterface: |
|
5688 | 565 |
{ int i = get_index_u2_cpcache(); |
566 |
int n = get_index_u1(); |
|
567 |
get_byte(); // ignore zero byte |
|
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
568 |
print_field_or_method(i, st); |
1 | 569 |
} |
570 |
break; |
|
571 |
||
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
572 |
case Bytecodes::_invokedynamic: |
5688 | 573 |
print_field_or_method(get_index_u4(), st); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
574 |
break; |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
1
diff
changeset
|
575 |
|
1 | 576 |
case Bytecodes::_new: |
577 |
case Bytecodes::_checkcast: |
|
578 |
case Bytecodes::_instanceof: |
|
5688 | 579 |
{ int i = get_index_u2(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
580 |
ConstantPool* constants = method()->constants(); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7913
diff
changeset
|
581 |
Symbol* name = constants->klass_name_at(i); |
1 | 582 |
st->print_cr(" %d <%s>", i, name->as_C_string()); |
583 |
} |
|
584 |
break; |
|
585 |
||
586 |
case Bytecodes::_wide: |
|
587 |
// length is zero not one, but printed with no more info. |
|
588 |
break; |
|
589 |
||
590 |
default: |
|
591 |
ShouldNotReachHere(); |
|
592 |
break; |
|
593 |
} |
|
594 |
} |
|
595 |
||
596 |
||
597 |
void BytecodePrinter::bytecode_epilog(int bci, outputStream* st) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
10966
diff
changeset
|
598 |
MethodData* mdo = method()->method_data(); |
1 | 599 |
if (mdo != NULL) { |
600 |
ProfileData* data = mdo->bci_to_data(bci); |
|
601 |
if (data != NULL) { |
|
602 |
st->print(" %d", mdo->dp_to_di(data->dp())); |
|
603 |
st->fill_to(6); |
|
22916
582da2ed4dfa
8031752: Failed speculative optimizations should be reattempted when root of compilation is different
roland
parents:
20282
diff
changeset
|
604 |
data->print_data_on(st, mdo); |
1 | 605 |
} |
606 |
} |
|
607 |
} |