Mercurial > hg > graal-jvmci-8
annotate src/share/vm/c1/c1_InstructionPrinter.cpp @ 7062:8c5333c80cfd
increased CompileThreshold to increase reliability of profiling information
increased InitialCodeCacheSize to fit the bootstrapping
added flag -XX:GraalClassPath to allow providing a .jar or .zip file that contains all Graal classes
added support for the flag -XX:TraceCompilationPolicy to the Graal-specific compilation policy
author | Christian Haeubl <haeubl@ssw.jku.at> |
---|---|
date | Thu, 15 Nov 2012 11:40:50 +0100 |
parents | 1d7922586cf6 |
children | da91efe96a93 |
rev | line source |
---|---|
0 | 1 /* |
2166
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
989
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
989
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
989
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "c1/c1_InstructionPrinter.hpp" | |
27 #include "c1/c1_ValueStack.hpp" | |
28 #include "ci/ciArray.hpp" | |
29 #include "ci/ciInstance.hpp" | |
30 #include "ci/ciObject.hpp" | |
0 | 31 |
32 | |
33 #ifndef PRODUCT | |
34 | |
35 const char* InstructionPrinter::basic_type_name(BasicType type) { | |
36 switch (type) { | |
37 case T_BOOLEAN: return "boolean"; | |
38 case T_BYTE : return "byte"; | |
39 case T_CHAR : return "char"; | |
40 case T_SHORT : return "short"; | |
41 case T_INT : return "int"; | |
42 case T_LONG : return "long"; | |
43 case T_FLOAT : return "float"; | |
44 case T_DOUBLE : return "double"; | |
45 case T_ARRAY : return "array"; | |
46 case T_OBJECT : return "object"; | |
47 default : return "???"; | |
48 } | |
49 } | |
50 | |
51 | |
52 const char* InstructionPrinter::cond_name(If::Condition cond) { | |
53 switch (cond) { | |
54 case If::eql: return "=="; | |
55 case If::neq: return "!="; | |
56 case If::lss: return "<"; | |
57 case If::leq: return "<="; | |
58 case If::gtr: return ">"; | |
59 case If::geq: return ">="; | |
60 } | |
61 ShouldNotReachHere(); | |
62 return NULL; | |
63 } | |
64 | |
65 | |
66 const char* InstructionPrinter::op_name(Bytecodes::Code op) { | |
67 switch (op) { | |
68 // arithmetic ops | |
69 case Bytecodes::_iadd : // fall through | |
70 case Bytecodes::_ladd : // fall through | |
71 case Bytecodes::_fadd : // fall through | |
72 case Bytecodes::_dadd : return "+"; | |
73 case Bytecodes::_isub : // fall through | |
74 case Bytecodes::_lsub : // fall through | |
75 case Bytecodes::_fsub : // fall through | |
76 case Bytecodes::_dsub : return "-"; | |
77 case Bytecodes::_imul : // fall through | |
78 case Bytecodes::_lmul : // fall through | |
79 case Bytecodes::_fmul : // fall through | |
80 case Bytecodes::_dmul : return "*"; | |
81 case Bytecodes::_idiv : // fall through | |
82 case Bytecodes::_ldiv : // fall through | |
83 case Bytecodes::_fdiv : // fall through | |
84 case Bytecodes::_ddiv : return "/"; | |
85 case Bytecodes::_irem : // fall through | |
86 case Bytecodes::_lrem : // fall through | |
87 case Bytecodes::_frem : // fall through | |
88 case Bytecodes::_drem : return "%"; | |
89 // shift ops | |
90 case Bytecodes::_ishl : // fall through | |
91 case Bytecodes::_lshl : return "<<"; | |
92 case Bytecodes::_ishr : // fall through | |
93 case Bytecodes::_lshr : return ">>"; | |
94 case Bytecodes::_iushr: // fall through | |
95 case Bytecodes::_lushr: return ">>>"; | |
96 // logic ops | |
97 case Bytecodes::_iand : // fall through | |
98 case Bytecodes::_land : return "&"; | |
99 case Bytecodes::_ior : // fall through | |
100 case Bytecodes::_lor : return "|"; | |
101 case Bytecodes::_ixor : // fall through | |
102 case Bytecodes::_lxor : return "^"; | |
103 } | |
104 return Bytecodes::name(op); | |
105 } | |
106 | |
107 | |
108 bool InstructionPrinter::is_illegal_phi(Value v) { | |
109 Phi* phi = v ? v->as_Phi() : NULL; | |
110 if (phi && phi->is_illegal()) { | |
111 return true; | |
112 } | |
113 return false; | |
114 } | |
115 | |
116 | |
117 bool InstructionPrinter::is_phi_of_block(Value v, BlockBegin* b) { | |
118 Phi* phi = v ? v->as_Phi() : NULL; | |
119 return phi && phi->block() == b; | |
120 } | |
121 | |
122 | |
123 void InstructionPrinter::print_klass(ciKlass* klass) { | |
124 klass->name()->print_symbol_on(output()); | |
125 } | |
126 | |
127 | |
128 void InstructionPrinter::print_object(Value obj) { | |
129 ValueType* type = obj->type(); | |
130 if (type->as_ObjectConstant() != NULL) { | |
131 ciObject* value = type->as_ObjectConstant()->value(); | |
132 if (value->is_null_object()) { | |
133 output()->print("null"); | |
134 } else if (!value->is_loaded()) { | |
3362
d4c1fbc3de95
7042153: guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp
iveresov
parents:
2166
diff
changeset
|
135 output()->print("<unloaded object " PTR_FORMAT ">", value); |
0 | 136 } else if (value->is_method()) { |
137 ciMethod* m = (ciMethod*)value; | |
138 output()->print("<method %s.%s>", m->holder()->name()->as_utf8(), m->name()->as_utf8()); | |
139 } else { | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4966
diff
changeset
|
140 output()->print("<object " PTR_FORMAT " klass=", value->constant_encoding()); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4966
diff
changeset
|
141 print_klass(value->klass()); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4966
diff
changeset
|
142 output()->print(">"); |
0 | 143 } |
144 } else if (type->as_InstanceConstant() != NULL) { | |
3362
d4c1fbc3de95
7042153: guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp
iveresov
parents:
2166
diff
changeset
|
145 ciInstance* value = type->as_InstanceConstant()->value(); |
d4c1fbc3de95
7042153: guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp
iveresov
parents:
2166
diff
changeset
|
146 if (value->is_loaded()) { |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4966
diff
changeset
|
147 output()->print("<instance " PTR_FORMAT " klass=", value->constant_encoding()); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4966
diff
changeset
|
148 print_klass(value->klass()); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4966
diff
changeset
|
149 output()->print(">"); |
3362
d4c1fbc3de95
7042153: guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp
iveresov
parents:
2166
diff
changeset
|
150 } else { |
d4c1fbc3de95
7042153: guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp
iveresov
parents:
2166
diff
changeset
|
151 output()->print("<unloaded instance " PTR_FORMAT ">", value); |
d4c1fbc3de95
7042153: guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp
iveresov
parents:
2166
diff
changeset
|
152 } |
0 | 153 } else if (type->as_ArrayConstant() != NULL) { |
3362
d4c1fbc3de95
7042153: guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp
iveresov
parents:
2166
diff
changeset
|
154 output()->print("<array " PTR_FORMAT ">", type->as_ArrayConstant()->value()->constant_encoding()); |
0 | 155 } else if (type->as_ClassConstant() != NULL) { |
156 ciInstanceKlass* klass = type->as_ClassConstant()->value(); | |
157 if (!klass->is_loaded()) { | |
158 output()->print("<unloaded> "); | |
159 } | |
160 output()->print("class "); | |
161 print_klass(klass); | |
162 } else { | |
163 output()->print("???"); | |
164 } | |
165 } | |
166 | |
167 | |
168 void InstructionPrinter::print_temp(Value value) { | |
169 output()->print("%c%d", value->type()->tchar(), value->id()); | |
170 } | |
171 | |
172 | |
173 void InstructionPrinter::print_field(AccessField* field) { | |
174 print_value(field->obj()); | |
175 output()->print("._%d", field->offset()); | |
176 } | |
177 | |
178 | |
179 void InstructionPrinter::print_indexed(AccessIndexed* indexed) { | |
180 print_value(indexed->array()); | |
181 output()->put('['); | |
182 print_value(indexed->index()); | |
183 output()->put(']'); | |
184 } | |
185 | |
186 | |
187 void InstructionPrinter::print_monitor(AccessMonitor* monitor) { | |
188 output()->print("monitor[%d](", monitor->monitor_no()); | |
189 print_value(monitor->obj()); | |
190 output()->put(')'); | |
191 } | |
192 | |
193 | |
194 void InstructionPrinter::print_op2(Op2* instr) { | |
195 print_value(instr->x()); | |
196 output()->print(" %s ", op_name(instr->op())); | |
197 print_value(instr->y()); | |
198 } | |
199 | |
200 | |
201 void InstructionPrinter::print_value(Value value) { | |
202 if (value == NULL) { | |
203 output()->print("NULL"); | |
204 } else { | |
205 print_temp(value); | |
206 } | |
207 } | |
208 | |
209 | |
210 void InstructionPrinter::print_instr(Instruction* instr) { | |
211 instr->visit(this); | |
212 } | |
213 | |
214 | |
215 void InstructionPrinter::print_stack(ValueStack* stack) { | |
216 int start_position = output()->position(); | |
217 if (stack->stack_is_empty()) { | |
218 output()->print("empty stack"); | |
219 } else { | |
220 output()->print("stack ["); | |
221 for (int i = 0; i < stack->stack_size();) { | |
222 if (i > 0) output()->print(", "); | |
223 output()->print("%d:", i); | |
224 Value value = stack->stack_at_inc(i); | |
225 print_value(value); | |
226 Phi* phi = value->as_Phi(); | |
227 if (phi != NULL) { | |
228 if (phi->operand()->is_valid()) { | |
229 output()->print(" "); | |
230 phi->operand()->print(output()); | |
231 } | |
232 } | |
233 } | |
234 output()->put(']'); | |
235 } | |
236 if (!stack->no_active_locks()) { | |
237 // print out the lines on the line below this | |
238 // one at the same indentation level. | |
239 output()->cr(); | |
240 fill_to(start_position, ' '); | |
241 output()->print("locks ["); | |
242 for (int i = i = 0; i < stack->locks_size(); i++) { | |
243 Value t = stack->lock_at(i); | |
244 if (i > 0) output()->print(", "); | |
245 output()->print("%d:", i); | |
246 if (t == NULL) { | |
247 // synchronized methods push null on the lock stack | |
248 output()->print("this"); | |
249 } else { | |
250 print_value(t); | |
251 } | |
252 } | |
253 output()->print("]"); | |
254 } | |
255 } | |
256 | |
257 | |
258 void InstructionPrinter::print_inline_level(BlockBegin* block) { | |
259 output()->print_cr("inlining depth %d", block->scope()->level()); | |
260 } | |
261 | |
262 | |
263 void InstructionPrinter::print_unsafe_op(UnsafeOp* op, const char* name) { | |
264 output()->print(name); | |
265 output()->print(".("); | |
266 } | |
267 | |
268 void InstructionPrinter::print_unsafe_raw_op(UnsafeRawOp* op, const char* name) { | |
269 print_unsafe_op(op, name); | |
270 output()->print("base "); | |
271 print_value(op->base()); | |
272 if (op->has_index()) { | |
273 output()->print(", index "); print_value(op->index()); | |
274 output()->print(", log2_scale %d", op->log2_scale()); | |
275 } | |
276 } | |
277 | |
278 | |
279 void InstructionPrinter::print_unsafe_object_op(UnsafeObjectOp* op, const char* name) { | |
280 print_unsafe_op(op, name); | |
281 print_value(op->object()); | |
282 output()->print(", "); | |
283 print_value(op->offset()); | |
284 } | |
285 | |
286 | |
287 void InstructionPrinter::print_phi(int i, Value v, BlockBegin* b) { | |
288 Phi* phi = v->as_Phi(); | |
289 output()->print("%2d ", i); | |
290 print_value(v); | |
291 // print phi operands | |
292 if (phi && phi->block() == b) { | |
293 output()->print(" ["); | |
294 for (int j = 0; j < phi->operand_count(); j ++) { | |
295 output()->print(" "); | |
296 Value opd = phi->operand_at(j); | |
297 if (opd) print_value(opd); | |
298 else output()->print("NULL"); | |
299 } | |
300 output()->print("] "); | |
301 } | |
302 print_alias(v); | |
303 } | |
304 | |
305 | |
306 void InstructionPrinter::print_alias(Value v) { | |
307 if (v != v->subst()) { | |
308 output()->print("alias "); print_value(v->subst()); | |
309 } | |
310 } | |
311 | |
312 | |
313 void InstructionPrinter::fill_to(int pos, char filler) { | |
314 while (output()->position() < pos) output()->put(filler); | |
315 } | |
316 | |
317 | |
318 void InstructionPrinter::print_head() { | |
319 const char filler = '_'; | |
320 fill_to(bci_pos , filler); output()->print("bci" ); | |
321 fill_to(use_pos , filler); output()->print("use" ); | |
322 fill_to(temp_pos , filler); output()->print("tid" ); | |
323 fill_to(instr_pos, filler); output()->print("instr"); | |
324 fill_to(end_pos , filler); | |
325 output()->cr(); | |
326 } | |
327 | |
328 | |
329 void InstructionPrinter::print_line(Instruction* instr) { | |
330 // print instruction data on one line | |
331 if (instr->is_pinned()) output()->put('.'); | |
1819 | 332 fill_to(bci_pos ); output()->print("%d", instr->printable_bci()); |
0 | 333 fill_to(use_pos ); output()->print("%d", instr->use_count()); |
334 fill_to(temp_pos ); print_temp(instr); | |
335 fill_to(instr_pos); print_instr(instr); | |
336 output()->cr(); | |
337 // add a line for StateSplit instructions w/ non-empty stacks | |
338 // (make it robust so we can print incomplete instructions) | |
339 StateSplit* split = instr->as_StateSplit(); | |
340 if (split != NULL && split->state() != NULL && !split->state()->stack_is_empty()) { | |
341 fill_to(instr_pos); print_stack(split->state()); | |
342 output()->cr(); | |
343 } | |
344 } | |
345 | |
346 | |
347 void InstructionPrinter::do_Phi(Phi* x) { | |
348 output()->print("phi function"); // make that more detailed later | |
349 if (x->is_illegal()) | |
350 output()->print(" (illegal)"); | |
351 } | |
352 | |
353 | |
354 void InstructionPrinter::do_Local(Local* x) { | |
355 output()->print("local[index %d]", x->java_index()); | |
356 } | |
357 | |
358 | |
359 void InstructionPrinter::do_Constant(Constant* x) { | |
360 ValueType* t = x->type(); | |
361 switch (t->tag()) { | |
362 case intTag : output()->print("%d" , t->as_IntConstant ()->value()); break; | |
363 case longTag : output()->print(os::jlong_format_specifier(), t->as_LongConstant()->value()); output()->print("L"); break; | |
364 case floatTag : output()->print("%g" , t->as_FloatConstant ()->value()); break; | |
365 case doubleTag : output()->print("%gD" , t->as_DoubleConstant()->value()); break; | |
366 case objectTag : print_object(x); break; | |
367 case addressTag: output()->print("bci:%d", t->as_AddressConstant()->value()); break; | |
368 default : output()->print("???"); break; | |
369 } | |
370 } | |
371 | |
372 | |
373 void InstructionPrinter::do_LoadField(LoadField* x) { | |
374 print_field(x); | |
375 output()->print(" (%c)", type2char(x->field()->type()->basic_type())); | |
376 } | |
377 | |
378 | |
379 void InstructionPrinter::do_StoreField(StoreField* x) { | |
380 print_field(x); | |
381 output()->print(" := "); | |
382 print_value(x->value()); | |
383 output()->print(" (%c)", type2char(x->field()->type()->basic_type())); | |
384 } | |
385 | |
386 | |
387 void InstructionPrinter::do_ArrayLength(ArrayLength* x) { | |
388 print_value(x->array()); | |
389 output()->print(".length"); | |
390 } | |
391 | |
392 | |
393 void InstructionPrinter::do_LoadIndexed(LoadIndexed* x) { | |
394 print_indexed(x); | |
395 output()->print(" (%c)", type2char(x->elt_type())); | |
396 } | |
397 | |
398 | |
399 void InstructionPrinter::do_StoreIndexed(StoreIndexed* x) { | |
400 print_indexed(x); | |
401 output()->print(" := "); | |
402 print_value(x->value()); | |
403 output()->print(" (%c)", type2char(x->elt_type())); | |
404 } | |
405 | |
406 void InstructionPrinter::do_NegateOp(NegateOp* x) { | |
407 output()->put('-'); | |
408 print_value(x->x()); | |
409 } | |
410 | |
411 | |
412 void InstructionPrinter::do_ArithmeticOp(ArithmeticOp* x) { | |
413 print_op2(x); | |
414 } | |
415 | |
416 | |
417 void InstructionPrinter::do_ShiftOp(ShiftOp* x) { | |
418 print_op2(x); | |
419 } | |
420 | |
421 | |
422 void InstructionPrinter::do_LogicOp(LogicOp* x) { | |
423 print_op2(x); | |
424 } | |
425 | |
426 | |
427 void InstructionPrinter::do_CompareOp(CompareOp* x) { | |
428 print_op2(x); | |
429 } | |
430 | |
431 | |
432 void InstructionPrinter::do_IfOp(IfOp* x) { | |
433 print_value(x->x()); | |
434 output()->print(" %s ", cond_name(x->cond())); | |
435 print_value(x->y()); | |
436 output()->print(" ? "); | |
437 print_value(x->tval()); | |
438 output()->print(" : "); | |
439 print_value(x->fval()); | |
440 } | |
441 | |
442 | |
443 void InstructionPrinter::do_Convert(Convert* x) { | |
444 output()->print("%s(", Bytecodes::name(x->op())); | |
445 print_value(x->value()); | |
446 output()->put(')'); | |
447 } | |
448 | |
449 | |
450 void InstructionPrinter::do_NullCheck(NullCheck* x) { | |
451 output()->print("null_check("); | |
452 print_value(x->obj()); | |
453 output()->put(')'); | |
454 if (!x->can_trap()) { | |
455 output()->print(" (eliminated)"); | |
456 } | |
457 } | |
458 | |
459 | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4966
diff
changeset
|
460 void InstructionPrinter::do_TypeCast(TypeCast* x) { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4966
diff
changeset
|
461 output()->print("type_cast("); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4966
diff
changeset
|
462 print_value(x->obj()); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4966
diff
changeset
|
463 output()->print(") "); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4966
diff
changeset
|
464 print_klass(x->declared_type()->klass()); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4966
diff
changeset
|
465 } |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4966
diff
changeset
|
466 |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4966
diff
changeset
|
467 |
0 | 468 void InstructionPrinter::do_Invoke(Invoke* x) { |
469 if (x->receiver() != NULL) { | |
470 print_value(x->receiver()); | |
471 output()->print("."); | |
472 } | |
473 | |
474 output()->print("%s(", Bytecodes::name(x->code())); | |
475 for (int i = 0; i < x->number_of_arguments(); i++) { | |
476 if (i > 0) output()->print(", "); | |
477 print_value(x->argument_at(i)); | |
478 } | |
479 output()->print_cr(")"); | |
480 fill_to(instr_pos); | |
481 output()->print("%s.%s%s", | |
482 x->target()->holder()->name()->as_utf8(), | |
483 x->target()->name()->as_utf8(), | |
484 x->target()->signature()->as_symbol()->as_utf8()); | |
485 } | |
486 | |
487 | |
488 void InstructionPrinter::do_NewInstance(NewInstance* x) { | |
489 output()->print("new instance "); | |
490 print_klass(x->klass()); | |
491 } | |
492 | |
493 | |
494 void InstructionPrinter::do_NewTypeArray(NewTypeArray* x) { | |
495 output()->print("new %s array [", basic_type_name(x->elt_type())); | |
496 print_value(x->length()); | |
497 output()->put(']'); | |
498 } | |
499 | |
500 | |
501 void InstructionPrinter::do_NewObjectArray(NewObjectArray* x) { | |
502 output()->print("new object array ["); | |
503 print_value(x->length()); | |
504 output()->print("] "); | |
505 print_klass(x->klass()); | |
506 } | |
507 | |
508 | |
509 void InstructionPrinter::do_NewMultiArray(NewMultiArray* x) { | |
510 output()->print("new multi array ["); | |
511 Values* dims = x->dims(); | |
512 for (int i = 0; i < dims->length(); i++) { | |
513 if (i > 0) output()->print(", "); | |
514 print_value(dims->at(i)); | |
515 } | |
516 output()->print("] "); | |
517 print_klass(x->klass()); | |
518 } | |
519 | |
520 | |
521 void InstructionPrinter::do_MonitorEnter(MonitorEnter* x) { | |
522 output()->print("enter "); | |
523 print_monitor(x); | |
524 } | |
525 | |
526 | |
527 void InstructionPrinter::do_MonitorExit(MonitorExit* x) { | |
528 output()->print("exit "); | |
529 print_monitor(x); | |
530 } | |
531 | |
532 | |
533 void InstructionPrinter::do_Intrinsic(Intrinsic* x) { | |
534 const char* name = vmIntrinsics::name_at(x->id()); | |
535 if (name[0] == '_') name++; // strip leading bug from _hashCode, etc. | |
536 const char* kname = vmSymbols::name_for(vmIntrinsics::class_for(x->id())); | |
537 if (strchr(name, '_') == NULL) { | |
538 kname = NULL; | |
539 } else { | |
540 const char* kptr = strrchr(kname, '/'); | |
541 if (kptr != NULL) kname = kptr + 1; | |
542 } | |
543 if (kname == NULL) | |
544 output()->print("%s(", name); | |
545 else | |
546 output()->print("%s.%s(", kname, name); | |
547 for (int i = 0; i < x->number_of_arguments(); i++) { | |
548 if (i > 0) output()->print(", "); | |
549 print_value(x->argument_at(i)); | |
550 } | |
551 output()->put(')'); | |
552 } | |
553 | |
554 | |
555 void InstructionPrinter::do_BlockBegin(BlockBegin* x) { | |
556 // print block id | |
557 BlockEnd* end = x->end(); | |
558 output()->print("B%d ", x->block_id()); | |
559 | |
560 // print flags | |
561 bool printed_flag = false; | |
562 if (x->is_set(BlockBegin::std_entry_flag)) { | |
563 if (!printed_flag) output()->print("("); | |
564 output()->print("S"); printed_flag = true; | |
565 } | |
566 if (x->is_set(BlockBegin::osr_entry_flag)) { | |
567 if (!printed_flag) output()->print("("); | |
568 output()->print("O"); printed_flag = true; | |
569 } | |
570 if (x->is_set(BlockBegin::exception_entry_flag)) { | |
571 if (!printed_flag) output()->print("("); | |
572 output()->print("E"); printed_flag = true; | |
573 } | |
574 if (x->is_set(BlockBegin::subroutine_entry_flag)) { | |
575 if (!printed_flag) output()->print("("); | |
576 output()->print("s"); printed_flag = true; | |
577 } | |
578 if (x->is_set(BlockBegin::parser_loop_header_flag)) { | |
579 if (!printed_flag) output()->print("("); | |
580 output()->print("LH"); printed_flag = true; | |
581 } | |
582 if (x->is_set(BlockBegin::backward_branch_target_flag)) { | |
583 if (!printed_flag) output()->print("("); | |
584 output()->print("b"); printed_flag = true; | |
585 } | |
586 if (x->is_set(BlockBegin::was_visited_flag)) { | |
587 if (!printed_flag) output()->print("("); | |
588 output()->print("V"); printed_flag = true; | |
589 } | |
590 if (printed_flag) output()->print(") "); | |
591 | |
592 // print block bci range | |
1819 | 593 output()->print("[%d, %d]", x->bci(), (end == NULL ? -1 : end->printable_bci())); |
0 | 594 |
595 // print block successors | |
596 if (end != NULL && end->number_of_sux() > 0) { | |
597 output()->print(" ->"); | |
598 for (int i = 0; i < end->number_of_sux(); i++) { | |
599 output()->print(" B%d", end->sux_at(i)->block_id()); | |
600 } | |
601 } | |
602 // print exception handlers | |
603 if (x->number_of_exception_handlers() > 0) { | |
604 output()->print(" (xhandlers "); | |
605 for (int i = 0; i < x->number_of_exception_handlers(); i++) { | |
606 if (i > 0) output()->print(" "); | |
607 output()->print("B%d", x->exception_handler_at(i)->block_id()); | |
608 } | |
609 output()->put(')'); | |
610 } | |
611 | |
612 // print dominator block | |
613 if (x->dominator() != NULL) { | |
614 output()->print(" dom B%d", x->dominator()->block_id()); | |
615 } | |
616 | |
617 // print predecessors and successors | |
618 if (x->successors()->length() > 0) { | |
619 output()->print(" sux:"); | |
620 for (int i = 0; i < x->successors()->length(); i ++) { | |
621 output()->print(" B%d", x->successors()->at(i)->block_id()); | |
622 } | |
623 } | |
624 | |
625 if (x->number_of_preds() > 0) { | |
626 output()->print(" pred:"); | |
627 for (int i = 0; i < x->number_of_preds(); i ++) { | |
628 output()->print(" B%d", x->pred_at(i)->block_id()); | |
629 } | |
630 } | |
631 | |
632 if (!_print_phis) { | |
633 return; | |
634 } | |
635 | |
636 // print phi functions | |
637 bool has_phis_in_locals = false; | |
638 bool has_phis_on_stack = false; | |
639 | |
640 if (x->end() && x->end()->state()) { | |
641 ValueStack* state = x->state(); | |
642 | |
643 int i = 0; | |
644 while (!has_phis_on_stack && i < state->stack_size()) { | |
645 Value v = state->stack_at_inc(i); | |
646 has_phis_on_stack = is_phi_of_block(v, x); | |
647 } | |
648 | |
649 do { | |
650 for (i = 0; !has_phis_in_locals && i < state->locals_size();) { | |
651 Value v = state->local_at(i); | |
652 has_phis_in_locals = is_phi_of_block(v, x); | |
653 // also ignore illegal HiWords | |
654 if (v && !v->type()->is_illegal()) i += v->type()->size(); else i ++; | |
655 } | |
656 state = state->caller_state(); | |
657 } while (state != NULL); | |
658 | |
659 } | |
660 | |
661 // print values in locals | |
662 if (has_phis_in_locals) { | |
663 output()->cr(); output()->print_cr("Locals:"); | |
664 | |
665 ValueStack* state = x->state(); | |
666 do { | |
667 for (int i = 0; i < state->locals_size();) { | |
668 Value v = state->local_at(i); | |
669 if (v) { | |
670 print_phi(i, v, x); output()->cr(); | |
671 // also ignore illegal HiWords | |
672 i += (v->type()->is_illegal() ? 1 : v->type()->size()); | |
673 } else { | |
674 i ++; | |
675 } | |
676 } | |
677 output()->cr(); | |
678 state = state->caller_state(); | |
679 } while (state != NULL); | |
680 } | |
681 | |
682 // print values on stack | |
683 if (has_phis_on_stack) { | |
684 output()->print_cr("Stack:"); | |
685 int i = 0; | |
686 while (i < x->state()->stack_size()) { | |
687 int o = i; | |
688 Value v = x->state()->stack_at_inc(i); | |
689 if (v) { | |
690 print_phi(o, v, x); output()->cr(); | |
691 } | |
692 } | |
693 } | |
694 } | |
695 | |
696 | |
697 void InstructionPrinter::do_CheckCast(CheckCast* x) { | |
698 output()->print("checkcast("); | |
699 print_value(x->obj()); | |
700 output()->print(") "); | |
701 print_klass(x->klass()); | |
702 } | |
703 | |
704 | |
705 void InstructionPrinter::do_InstanceOf(InstanceOf* x) { | |
706 output()->print("instanceof("); | |
707 print_value(x->obj()); | |
708 output()->print(") "); | |
709 print_klass(x->klass()); | |
710 } | |
711 | |
712 | |
713 void InstructionPrinter::do_Goto(Goto* x) { | |
714 output()->print("goto B%d", x->default_sux()->block_id()); | |
715 if (x->is_safepoint()) output()->print(" (safepoint)"); | |
716 } | |
717 | |
718 | |
719 void InstructionPrinter::do_If(If* x) { | |
720 output()->print("if "); | |
721 print_value(x->x()); | |
722 output()->print(" %s ", cond_name(x->cond())); | |
723 print_value(x->y()); | |
724 output()->print(" then B%d else B%d", x->sux_at(0)->block_id(), x->sux_at(1)->block_id()); | |
725 if (x->is_safepoint()) output()->print(" (safepoint)"); | |
726 } | |
727 | |
728 | |
729 void InstructionPrinter::do_IfInstanceOf(IfInstanceOf* x) { | |
730 output()->print("<IfInstanceOf>"); | |
731 } | |
732 | |
733 | |
734 void InstructionPrinter::do_TableSwitch(TableSwitch* x) { | |
735 output()->print("tableswitch "); | |
736 if (x->is_safepoint()) output()->print("(safepoint) "); | |
737 print_value(x->tag()); | |
738 output()->cr(); | |
739 int l = x->length(); | |
740 for (int i = 0; i < l; i++) { | |
741 fill_to(instr_pos); | |
742 output()->print_cr("case %5d: B%d", x->lo_key() + i, x->sux_at(i)->block_id()); | |
743 } | |
744 fill_to(instr_pos); | |
745 output()->print("default : B%d", x->default_sux()->block_id()); | |
746 } | |
747 | |
748 | |
749 void InstructionPrinter::do_LookupSwitch(LookupSwitch* x) { | |
750 output()->print("lookupswitch "); | |
751 if (x->is_safepoint()) output()->print("(safepoint) "); | |
752 print_value(x->tag()); | |
753 output()->cr(); | |
754 int l = x->length(); | |
755 for (int i = 0; i < l; i++) { | |
756 fill_to(instr_pos); | |
757 output()->print_cr("case %5d: B%d", x->key_at(i), x->sux_at(i)->block_id()); | |
758 } | |
759 fill_to(instr_pos); | |
760 output()->print("default : B%d", x->default_sux()->block_id()); | |
761 } | |
762 | |
763 | |
764 void InstructionPrinter::do_Return(Return* x) { | |
765 if (x->result() == NULL) { | |
766 output()->print("return"); | |
767 } else { | |
768 output()->print("%creturn ", x->type()->tchar()); | |
769 print_value(x->result()); | |
770 } | |
771 } | |
772 | |
773 | |
774 void InstructionPrinter::do_Throw(Throw* x) { | |
775 output()->print("throw "); | |
776 print_value(x->exception()); | |
777 } | |
778 | |
779 | |
780 void InstructionPrinter::do_Base(Base* x) { | |
781 output()->print("std entry B%d", x->std_entry()->block_id()); | |
782 if (x->number_of_sux() > 1) { | |
783 output()->print(" osr entry B%d", x->osr_entry()->block_id()); | |
784 } | |
785 } | |
786 | |
787 | |
788 void InstructionPrinter::do_OsrEntry(OsrEntry* x) { | |
789 output()->print("osr entry"); | |
790 } | |
791 | |
792 | |
793 void InstructionPrinter::do_ExceptionObject(ExceptionObject* x) { | |
794 output()->print("incoming exception"); | |
795 } | |
796 | |
797 | |
798 void InstructionPrinter::do_RoundFP(RoundFP* x) { | |
799 output()->print("round_fp "); | |
800 print_value(x->input()); | |
801 } | |
802 | |
803 | |
804 void InstructionPrinter::do_UnsafeGetRaw(UnsafeGetRaw* x) { | |
805 print_unsafe_raw_op(x, "UnsafeGetRaw"); | |
806 output()->put(')'); | |
807 } | |
808 | |
809 | |
810 void InstructionPrinter::do_UnsafePutRaw(UnsafePutRaw* x) { | |
811 print_unsafe_raw_op(x, "UnsafePutRaw"); | |
812 output()->print(", value "); | |
813 print_value(x->value()); | |
814 output()->put(')'); | |
815 } | |
816 | |
817 | |
818 void InstructionPrinter::do_UnsafeGetObject(UnsafeGetObject* x) { | |
819 print_unsafe_object_op(x, "UnsafeGetObject"); | |
820 output()->put(')'); | |
821 } | |
822 | |
823 | |
824 void InstructionPrinter::do_UnsafePutObject(UnsafePutObject* x) { | |
825 print_unsafe_object_op(x, "UnsafePutObject"); | |
826 output()->print(", value "); | |
827 print_value(x->value()); | |
828 output()->put(')'); | |
829 } | |
830 | |
831 | |
832 void InstructionPrinter::do_UnsafePrefetchRead(UnsafePrefetchRead* x) { | |
833 print_unsafe_object_op(x, "UnsafePrefetchRead"); | |
834 output()->put(')'); | |
835 } | |
836 | |
837 | |
838 void InstructionPrinter::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { | |
839 print_unsafe_object_op(x, "UnsafePrefetchWrite"); | |
840 output()->put(')'); | |
841 } | |
842 | |
843 void InstructionPrinter::do_ProfileCall(ProfileCall* x) { | |
844 output()->print("profile "); | |
845 print_value(x->recv()); | |
846 output()->print(" %s.%s", x->method()->holder()->name()->as_utf8(), x->method()->name()->as_utf8()); | |
847 if (x->known_holder() != NULL) { | |
848 output()->print(", "); | |
849 print_klass(x->known_holder()); | |
850 } | |
851 output()->put(')'); | |
852 } | |
853 | |
1783 | 854 void InstructionPrinter::do_ProfileInvoke(ProfileInvoke* x) { |
855 output()->print("profile_invoke "); | |
856 output()->print(" %s.%s", x->inlinee()->holder()->name()->as_utf8(), x->inlinee()->name()->as_utf8()); | |
857 output()->put(')'); | |
0 | 858 |
859 } | |
860 | |
2166
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
861 void InstructionPrinter::do_RuntimeCall(RuntimeCall* x) { |
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
862 output()->print("call_rt %s(", x->entry_name()); |
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
863 for (int i = 0; i < x->number_of_arguments(); i++) { |
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
864 if (i > 0) output()->print(", "); |
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
865 print_value(x->argument_at(i)); |
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
866 } |
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
867 output()->put(')'); |
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
868 } |
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
869 |
4966
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
870 void InstructionPrinter::do_MemBar(MemBar* x) { |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
871 if (os::is_MP()) { |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
872 LIR_Code code = x->code(); |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
873 switch (code) { |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
874 case lir_membar_acquire : output()->print("membar_acquire"); break; |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
875 case lir_membar_release : output()->print("membar_release"); break; |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
876 case lir_membar : output()->print("membar"); break; |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
877 case lir_membar_loadload : output()->print("membar_loadload"); break; |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
878 case lir_membar_storestore: output()->print("membar_storestore"); break; |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
879 case lir_membar_loadstore : output()->print("membar_loadstore"); break; |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
880 case lir_membar_storeload : output()->print("membar_storeload"); break; |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
881 default : ShouldNotReachHere(); break; |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
882 } |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
883 } |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
884 } |
701a83c86f28
7120481: storeStore barrier in constructor with final field
jiangli
parents:
3362
diff
changeset
|
885 |
0 | 886 #endif // PRODUCT |