Mercurial > hg > truffle
annotate src/share/vm/c1/c1_InstructionPrinter.cpp @ 4710:41406797186b
7113012: G1: rename not-fully-young GCs as "mixed"
Summary: Renamed partially-young GCs as mixed and fully-young GCs as young. Change all external output that includes those terms (GC log and GC ergo log) as well as any comments, fields, methods, etc. The changeset also includes very minor code tidying up (added some curly brackets).
Reviewed-by: johnc, brutisso
author | tonyp |
---|---|
date | Fri, 16 Dec 2011 02:14:27 -0500 |
parents | d4c1fbc3de95 |
children | 701a83c86f28 |
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 { | |
3362
d4c1fbc3de95
7042153: guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp
iveresov
parents:
2166
diff
changeset
|
140 output()->print("<object " PTR_FORMAT ">", value->constant_encoding()); |
0 | 141 } |
142 } 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
|
143 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
|
144 if (value->is_loaded()) { |
d4c1fbc3de95
7042153: guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp
iveresov
parents:
2166
diff
changeset
|
145 output()->print("<instance " PTR_FORMAT ">", value->constant_encoding()); |
d4c1fbc3de95
7042153: guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp
iveresov
parents:
2166
diff
changeset
|
146 } else { |
d4c1fbc3de95
7042153: guarantee(x_compare_res != Constant::not_comparable) failed: incomparable constants in IfOp
iveresov
parents:
2166
diff
changeset
|
147 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
|
148 } |
0 | 149 } 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
|
150 output()->print("<array " PTR_FORMAT ">", type->as_ArrayConstant()->value()->constant_encoding()); |
0 | 151 } else if (type->as_ClassConstant() != NULL) { |
152 ciInstanceKlass* klass = type->as_ClassConstant()->value(); | |
153 if (!klass->is_loaded()) { | |
154 output()->print("<unloaded> "); | |
155 } | |
156 output()->print("class "); | |
157 print_klass(klass); | |
158 } else { | |
159 output()->print("???"); | |
160 } | |
161 } | |
162 | |
163 | |
164 void InstructionPrinter::print_temp(Value value) { | |
165 output()->print("%c%d", value->type()->tchar(), value->id()); | |
166 } | |
167 | |
168 | |
169 void InstructionPrinter::print_field(AccessField* field) { | |
170 print_value(field->obj()); | |
171 output()->print("._%d", field->offset()); | |
172 } | |
173 | |
174 | |
175 void InstructionPrinter::print_indexed(AccessIndexed* indexed) { | |
176 print_value(indexed->array()); | |
177 output()->put('['); | |
178 print_value(indexed->index()); | |
179 output()->put(']'); | |
180 } | |
181 | |
182 | |
183 void InstructionPrinter::print_monitor(AccessMonitor* monitor) { | |
184 output()->print("monitor[%d](", monitor->monitor_no()); | |
185 print_value(monitor->obj()); | |
186 output()->put(')'); | |
187 } | |
188 | |
189 | |
190 void InstructionPrinter::print_op2(Op2* instr) { | |
191 print_value(instr->x()); | |
192 output()->print(" %s ", op_name(instr->op())); | |
193 print_value(instr->y()); | |
194 } | |
195 | |
196 | |
197 void InstructionPrinter::print_value(Value value) { | |
198 if (value == NULL) { | |
199 output()->print("NULL"); | |
200 } else { | |
201 print_temp(value); | |
202 } | |
203 } | |
204 | |
205 | |
206 void InstructionPrinter::print_instr(Instruction* instr) { | |
207 instr->visit(this); | |
208 } | |
209 | |
210 | |
211 void InstructionPrinter::print_stack(ValueStack* stack) { | |
212 int start_position = output()->position(); | |
213 if (stack->stack_is_empty()) { | |
214 output()->print("empty stack"); | |
215 } else { | |
216 output()->print("stack ["); | |
217 for (int i = 0; i < stack->stack_size();) { | |
218 if (i > 0) output()->print(", "); | |
219 output()->print("%d:", i); | |
220 Value value = stack->stack_at_inc(i); | |
221 print_value(value); | |
222 Phi* phi = value->as_Phi(); | |
223 if (phi != NULL) { | |
224 if (phi->operand()->is_valid()) { | |
225 output()->print(" "); | |
226 phi->operand()->print(output()); | |
227 } | |
228 } | |
229 } | |
230 output()->put(']'); | |
231 } | |
232 if (!stack->no_active_locks()) { | |
233 // print out the lines on the line below this | |
234 // one at the same indentation level. | |
235 output()->cr(); | |
236 fill_to(start_position, ' '); | |
237 output()->print("locks ["); | |
238 for (int i = i = 0; i < stack->locks_size(); i++) { | |
239 Value t = stack->lock_at(i); | |
240 if (i > 0) output()->print(", "); | |
241 output()->print("%d:", i); | |
242 if (t == NULL) { | |
243 // synchronized methods push null on the lock stack | |
244 output()->print("this"); | |
245 } else { | |
246 print_value(t); | |
247 } | |
248 } | |
249 output()->print("]"); | |
250 } | |
251 } | |
252 | |
253 | |
254 void InstructionPrinter::print_inline_level(BlockBegin* block) { | |
255 output()->print_cr("inlining depth %d", block->scope()->level()); | |
256 } | |
257 | |
258 | |
259 void InstructionPrinter::print_unsafe_op(UnsafeOp* op, const char* name) { | |
260 output()->print(name); | |
261 output()->print(".("); | |
262 } | |
263 | |
264 void InstructionPrinter::print_unsafe_raw_op(UnsafeRawOp* op, const char* name) { | |
265 print_unsafe_op(op, name); | |
266 output()->print("base "); | |
267 print_value(op->base()); | |
268 if (op->has_index()) { | |
269 output()->print(", index "); print_value(op->index()); | |
270 output()->print(", log2_scale %d", op->log2_scale()); | |
271 } | |
272 } | |
273 | |
274 | |
275 void InstructionPrinter::print_unsafe_object_op(UnsafeObjectOp* op, const char* name) { | |
276 print_unsafe_op(op, name); | |
277 print_value(op->object()); | |
278 output()->print(", "); | |
279 print_value(op->offset()); | |
280 } | |
281 | |
282 | |
283 void InstructionPrinter::print_phi(int i, Value v, BlockBegin* b) { | |
284 Phi* phi = v->as_Phi(); | |
285 output()->print("%2d ", i); | |
286 print_value(v); | |
287 // print phi operands | |
288 if (phi && phi->block() == b) { | |
289 output()->print(" ["); | |
290 for (int j = 0; j < phi->operand_count(); j ++) { | |
291 output()->print(" "); | |
292 Value opd = phi->operand_at(j); | |
293 if (opd) print_value(opd); | |
294 else output()->print("NULL"); | |
295 } | |
296 output()->print("] "); | |
297 } | |
298 print_alias(v); | |
299 } | |
300 | |
301 | |
302 void InstructionPrinter::print_alias(Value v) { | |
303 if (v != v->subst()) { | |
304 output()->print("alias "); print_value(v->subst()); | |
305 } | |
306 } | |
307 | |
308 | |
309 void InstructionPrinter::fill_to(int pos, char filler) { | |
310 while (output()->position() < pos) output()->put(filler); | |
311 } | |
312 | |
313 | |
314 void InstructionPrinter::print_head() { | |
315 const char filler = '_'; | |
316 fill_to(bci_pos , filler); output()->print("bci" ); | |
317 fill_to(use_pos , filler); output()->print("use" ); | |
318 fill_to(temp_pos , filler); output()->print("tid" ); | |
319 fill_to(instr_pos, filler); output()->print("instr"); | |
320 fill_to(end_pos , filler); | |
321 output()->cr(); | |
322 } | |
323 | |
324 | |
325 void InstructionPrinter::print_line(Instruction* instr) { | |
326 // print instruction data on one line | |
327 if (instr->is_pinned()) output()->put('.'); | |
1819 | 328 fill_to(bci_pos ); output()->print("%d", instr->printable_bci()); |
0 | 329 fill_to(use_pos ); output()->print("%d", instr->use_count()); |
330 fill_to(temp_pos ); print_temp(instr); | |
331 fill_to(instr_pos); print_instr(instr); | |
332 output()->cr(); | |
333 // add a line for StateSplit instructions w/ non-empty stacks | |
334 // (make it robust so we can print incomplete instructions) | |
335 StateSplit* split = instr->as_StateSplit(); | |
336 if (split != NULL && split->state() != NULL && !split->state()->stack_is_empty()) { | |
337 fill_to(instr_pos); print_stack(split->state()); | |
338 output()->cr(); | |
339 } | |
340 } | |
341 | |
342 | |
343 void InstructionPrinter::do_Phi(Phi* x) { | |
344 output()->print("phi function"); // make that more detailed later | |
345 if (x->is_illegal()) | |
346 output()->print(" (illegal)"); | |
347 } | |
348 | |
349 | |
350 void InstructionPrinter::do_Local(Local* x) { | |
351 output()->print("local[index %d]", x->java_index()); | |
352 } | |
353 | |
354 | |
355 void InstructionPrinter::do_Constant(Constant* x) { | |
356 ValueType* t = x->type(); | |
357 switch (t->tag()) { | |
358 case intTag : output()->print("%d" , t->as_IntConstant ()->value()); break; | |
359 case longTag : output()->print(os::jlong_format_specifier(), t->as_LongConstant()->value()); output()->print("L"); break; | |
360 case floatTag : output()->print("%g" , t->as_FloatConstant ()->value()); break; | |
361 case doubleTag : output()->print("%gD" , t->as_DoubleConstant()->value()); break; | |
362 case objectTag : print_object(x); break; | |
363 case addressTag: output()->print("bci:%d", t->as_AddressConstant()->value()); break; | |
364 default : output()->print("???"); break; | |
365 } | |
366 } | |
367 | |
368 | |
369 void InstructionPrinter::do_LoadField(LoadField* x) { | |
370 print_field(x); | |
371 output()->print(" (%c)", type2char(x->field()->type()->basic_type())); | |
372 } | |
373 | |
374 | |
375 void InstructionPrinter::do_StoreField(StoreField* x) { | |
376 print_field(x); | |
377 output()->print(" := "); | |
378 print_value(x->value()); | |
379 output()->print(" (%c)", type2char(x->field()->type()->basic_type())); | |
380 } | |
381 | |
382 | |
383 void InstructionPrinter::do_ArrayLength(ArrayLength* x) { | |
384 print_value(x->array()); | |
385 output()->print(".length"); | |
386 } | |
387 | |
388 | |
389 void InstructionPrinter::do_LoadIndexed(LoadIndexed* x) { | |
390 print_indexed(x); | |
391 output()->print(" (%c)", type2char(x->elt_type())); | |
392 } | |
393 | |
394 | |
395 void InstructionPrinter::do_StoreIndexed(StoreIndexed* x) { | |
396 print_indexed(x); | |
397 output()->print(" := "); | |
398 print_value(x->value()); | |
399 output()->print(" (%c)", type2char(x->elt_type())); | |
400 } | |
401 | |
402 void InstructionPrinter::do_NegateOp(NegateOp* x) { | |
403 output()->put('-'); | |
404 print_value(x->x()); | |
405 } | |
406 | |
407 | |
408 void InstructionPrinter::do_ArithmeticOp(ArithmeticOp* x) { | |
409 print_op2(x); | |
410 } | |
411 | |
412 | |
413 void InstructionPrinter::do_ShiftOp(ShiftOp* x) { | |
414 print_op2(x); | |
415 } | |
416 | |
417 | |
418 void InstructionPrinter::do_LogicOp(LogicOp* x) { | |
419 print_op2(x); | |
420 } | |
421 | |
422 | |
423 void InstructionPrinter::do_CompareOp(CompareOp* x) { | |
424 print_op2(x); | |
425 } | |
426 | |
427 | |
428 void InstructionPrinter::do_IfOp(IfOp* x) { | |
429 print_value(x->x()); | |
430 output()->print(" %s ", cond_name(x->cond())); | |
431 print_value(x->y()); | |
432 output()->print(" ? "); | |
433 print_value(x->tval()); | |
434 output()->print(" : "); | |
435 print_value(x->fval()); | |
436 } | |
437 | |
438 | |
439 void InstructionPrinter::do_Convert(Convert* x) { | |
440 output()->print("%s(", Bytecodes::name(x->op())); | |
441 print_value(x->value()); | |
442 output()->put(')'); | |
443 } | |
444 | |
445 | |
446 void InstructionPrinter::do_NullCheck(NullCheck* x) { | |
447 output()->print("null_check("); | |
448 print_value(x->obj()); | |
449 output()->put(')'); | |
450 if (!x->can_trap()) { | |
451 output()->print(" (eliminated)"); | |
452 } | |
453 } | |
454 | |
455 | |
456 void InstructionPrinter::do_Invoke(Invoke* x) { | |
457 if (x->receiver() != NULL) { | |
458 print_value(x->receiver()); | |
459 output()->print("."); | |
460 } | |
461 | |
462 output()->print("%s(", Bytecodes::name(x->code())); | |
463 for (int i = 0; i < x->number_of_arguments(); i++) { | |
464 if (i > 0) output()->print(", "); | |
465 print_value(x->argument_at(i)); | |
466 } | |
467 output()->print_cr(")"); | |
468 fill_to(instr_pos); | |
469 output()->print("%s.%s%s", | |
470 x->target()->holder()->name()->as_utf8(), | |
471 x->target()->name()->as_utf8(), | |
472 x->target()->signature()->as_symbol()->as_utf8()); | |
473 } | |
474 | |
475 | |
476 void InstructionPrinter::do_NewInstance(NewInstance* x) { | |
477 output()->print("new instance "); | |
478 print_klass(x->klass()); | |
479 } | |
480 | |
481 | |
482 void InstructionPrinter::do_NewTypeArray(NewTypeArray* x) { | |
483 output()->print("new %s array [", basic_type_name(x->elt_type())); | |
484 print_value(x->length()); | |
485 output()->put(']'); | |
486 } | |
487 | |
488 | |
489 void InstructionPrinter::do_NewObjectArray(NewObjectArray* x) { | |
490 output()->print("new object array ["); | |
491 print_value(x->length()); | |
492 output()->print("] "); | |
493 print_klass(x->klass()); | |
494 } | |
495 | |
496 | |
497 void InstructionPrinter::do_NewMultiArray(NewMultiArray* x) { | |
498 output()->print("new multi array ["); | |
499 Values* dims = x->dims(); | |
500 for (int i = 0; i < dims->length(); i++) { | |
501 if (i > 0) output()->print(", "); | |
502 print_value(dims->at(i)); | |
503 } | |
504 output()->print("] "); | |
505 print_klass(x->klass()); | |
506 } | |
507 | |
508 | |
509 void InstructionPrinter::do_MonitorEnter(MonitorEnter* x) { | |
510 output()->print("enter "); | |
511 print_monitor(x); | |
512 } | |
513 | |
514 | |
515 void InstructionPrinter::do_MonitorExit(MonitorExit* x) { | |
516 output()->print("exit "); | |
517 print_monitor(x); | |
518 } | |
519 | |
520 | |
521 void InstructionPrinter::do_Intrinsic(Intrinsic* x) { | |
522 const char* name = vmIntrinsics::name_at(x->id()); | |
523 if (name[0] == '_') name++; // strip leading bug from _hashCode, etc. | |
524 const char* kname = vmSymbols::name_for(vmIntrinsics::class_for(x->id())); | |
525 if (strchr(name, '_') == NULL) { | |
526 kname = NULL; | |
527 } else { | |
528 const char* kptr = strrchr(kname, '/'); | |
529 if (kptr != NULL) kname = kptr + 1; | |
530 } | |
531 if (kname == NULL) | |
532 output()->print("%s(", name); | |
533 else | |
534 output()->print("%s.%s(", kname, name); | |
535 for (int i = 0; i < x->number_of_arguments(); i++) { | |
536 if (i > 0) output()->print(", "); | |
537 print_value(x->argument_at(i)); | |
538 } | |
539 output()->put(')'); | |
540 } | |
541 | |
542 | |
543 void InstructionPrinter::do_BlockBegin(BlockBegin* x) { | |
544 // print block id | |
545 BlockEnd* end = x->end(); | |
546 output()->print("B%d ", x->block_id()); | |
547 | |
548 // print flags | |
549 bool printed_flag = false; | |
550 if (x->is_set(BlockBegin::std_entry_flag)) { | |
551 if (!printed_flag) output()->print("("); | |
552 output()->print("S"); printed_flag = true; | |
553 } | |
554 if (x->is_set(BlockBegin::osr_entry_flag)) { | |
555 if (!printed_flag) output()->print("("); | |
556 output()->print("O"); printed_flag = true; | |
557 } | |
558 if (x->is_set(BlockBegin::exception_entry_flag)) { | |
559 if (!printed_flag) output()->print("("); | |
560 output()->print("E"); printed_flag = true; | |
561 } | |
562 if (x->is_set(BlockBegin::subroutine_entry_flag)) { | |
563 if (!printed_flag) output()->print("("); | |
564 output()->print("s"); printed_flag = true; | |
565 } | |
566 if (x->is_set(BlockBegin::parser_loop_header_flag)) { | |
567 if (!printed_flag) output()->print("("); | |
568 output()->print("LH"); printed_flag = true; | |
569 } | |
570 if (x->is_set(BlockBegin::backward_branch_target_flag)) { | |
571 if (!printed_flag) output()->print("("); | |
572 output()->print("b"); printed_flag = true; | |
573 } | |
574 if (x->is_set(BlockBegin::was_visited_flag)) { | |
575 if (!printed_flag) output()->print("("); | |
576 output()->print("V"); printed_flag = true; | |
577 } | |
578 if (printed_flag) output()->print(") "); | |
579 | |
580 // print block bci range | |
1819 | 581 output()->print("[%d, %d]", x->bci(), (end == NULL ? -1 : end->printable_bci())); |
0 | 582 |
583 // print block successors | |
584 if (end != NULL && end->number_of_sux() > 0) { | |
585 output()->print(" ->"); | |
586 for (int i = 0; i < end->number_of_sux(); i++) { | |
587 output()->print(" B%d", end->sux_at(i)->block_id()); | |
588 } | |
589 } | |
590 // print exception handlers | |
591 if (x->number_of_exception_handlers() > 0) { | |
592 output()->print(" (xhandlers "); | |
593 for (int i = 0; i < x->number_of_exception_handlers(); i++) { | |
594 if (i > 0) output()->print(" "); | |
595 output()->print("B%d", x->exception_handler_at(i)->block_id()); | |
596 } | |
597 output()->put(')'); | |
598 } | |
599 | |
600 // print dominator block | |
601 if (x->dominator() != NULL) { | |
602 output()->print(" dom B%d", x->dominator()->block_id()); | |
603 } | |
604 | |
605 // print predecessors and successors | |
606 if (x->successors()->length() > 0) { | |
607 output()->print(" sux:"); | |
608 for (int i = 0; i < x->successors()->length(); i ++) { | |
609 output()->print(" B%d", x->successors()->at(i)->block_id()); | |
610 } | |
611 } | |
612 | |
613 if (x->number_of_preds() > 0) { | |
614 output()->print(" pred:"); | |
615 for (int i = 0; i < x->number_of_preds(); i ++) { | |
616 output()->print(" B%d", x->pred_at(i)->block_id()); | |
617 } | |
618 } | |
619 | |
620 if (!_print_phis) { | |
621 return; | |
622 } | |
623 | |
624 // print phi functions | |
625 bool has_phis_in_locals = false; | |
626 bool has_phis_on_stack = false; | |
627 | |
628 if (x->end() && x->end()->state()) { | |
629 ValueStack* state = x->state(); | |
630 | |
631 int i = 0; | |
632 while (!has_phis_on_stack && i < state->stack_size()) { | |
633 Value v = state->stack_at_inc(i); | |
634 has_phis_on_stack = is_phi_of_block(v, x); | |
635 } | |
636 | |
637 do { | |
638 for (i = 0; !has_phis_in_locals && i < state->locals_size();) { | |
639 Value v = state->local_at(i); | |
640 has_phis_in_locals = is_phi_of_block(v, x); | |
641 // also ignore illegal HiWords | |
642 if (v && !v->type()->is_illegal()) i += v->type()->size(); else i ++; | |
643 } | |
644 state = state->caller_state(); | |
645 } while (state != NULL); | |
646 | |
647 } | |
648 | |
649 // print values in locals | |
650 if (has_phis_in_locals) { | |
651 output()->cr(); output()->print_cr("Locals:"); | |
652 | |
653 ValueStack* state = x->state(); | |
654 do { | |
655 for (int i = 0; i < state->locals_size();) { | |
656 Value v = state->local_at(i); | |
657 if (v) { | |
658 print_phi(i, v, x); output()->cr(); | |
659 // also ignore illegal HiWords | |
660 i += (v->type()->is_illegal() ? 1 : v->type()->size()); | |
661 } else { | |
662 i ++; | |
663 } | |
664 } | |
665 output()->cr(); | |
666 state = state->caller_state(); | |
667 } while (state != NULL); | |
668 } | |
669 | |
670 // print values on stack | |
671 if (has_phis_on_stack) { | |
672 output()->print_cr("Stack:"); | |
673 int i = 0; | |
674 while (i < x->state()->stack_size()) { | |
675 int o = i; | |
676 Value v = x->state()->stack_at_inc(i); | |
677 if (v) { | |
678 print_phi(o, v, x); output()->cr(); | |
679 } | |
680 } | |
681 } | |
682 } | |
683 | |
684 | |
685 void InstructionPrinter::do_CheckCast(CheckCast* x) { | |
686 output()->print("checkcast("); | |
687 print_value(x->obj()); | |
688 output()->print(") "); | |
689 print_klass(x->klass()); | |
690 } | |
691 | |
692 | |
693 void InstructionPrinter::do_InstanceOf(InstanceOf* x) { | |
694 output()->print("instanceof("); | |
695 print_value(x->obj()); | |
696 output()->print(") "); | |
697 print_klass(x->klass()); | |
698 } | |
699 | |
700 | |
701 void InstructionPrinter::do_Goto(Goto* x) { | |
702 output()->print("goto B%d", x->default_sux()->block_id()); | |
703 if (x->is_safepoint()) output()->print(" (safepoint)"); | |
704 } | |
705 | |
706 | |
707 void InstructionPrinter::do_If(If* x) { | |
708 output()->print("if "); | |
709 print_value(x->x()); | |
710 output()->print(" %s ", cond_name(x->cond())); | |
711 print_value(x->y()); | |
712 output()->print(" then B%d else B%d", x->sux_at(0)->block_id(), x->sux_at(1)->block_id()); | |
713 if (x->is_safepoint()) output()->print(" (safepoint)"); | |
714 } | |
715 | |
716 | |
717 void InstructionPrinter::do_IfInstanceOf(IfInstanceOf* x) { | |
718 output()->print("<IfInstanceOf>"); | |
719 } | |
720 | |
721 | |
722 void InstructionPrinter::do_TableSwitch(TableSwitch* x) { | |
723 output()->print("tableswitch "); | |
724 if (x->is_safepoint()) output()->print("(safepoint) "); | |
725 print_value(x->tag()); | |
726 output()->cr(); | |
727 int l = x->length(); | |
728 for (int i = 0; i < l; i++) { | |
729 fill_to(instr_pos); | |
730 output()->print_cr("case %5d: B%d", x->lo_key() + i, x->sux_at(i)->block_id()); | |
731 } | |
732 fill_to(instr_pos); | |
733 output()->print("default : B%d", x->default_sux()->block_id()); | |
734 } | |
735 | |
736 | |
737 void InstructionPrinter::do_LookupSwitch(LookupSwitch* x) { | |
738 output()->print("lookupswitch "); | |
739 if (x->is_safepoint()) output()->print("(safepoint) "); | |
740 print_value(x->tag()); | |
741 output()->cr(); | |
742 int l = x->length(); | |
743 for (int i = 0; i < l; i++) { | |
744 fill_to(instr_pos); | |
745 output()->print_cr("case %5d: B%d", x->key_at(i), x->sux_at(i)->block_id()); | |
746 } | |
747 fill_to(instr_pos); | |
748 output()->print("default : B%d", x->default_sux()->block_id()); | |
749 } | |
750 | |
751 | |
752 void InstructionPrinter::do_Return(Return* x) { | |
753 if (x->result() == NULL) { | |
754 output()->print("return"); | |
755 } else { | |
756 output()->print("%creturn ", x->type()->tchar()); | |
757 print_value(x->result()); | |
758 } | |
759 } | |
760 | |
761 | |
762 void InstructionPrinter::do_Throw(Throw* x) { | |
763 output()->print("throw "); | |
764 print_value(x->exception()); | |
765 } | |
766 | |
767 | |
768 void InstructionPrinter::do_Base(Base* x) { | |
769 output()->print("std entry B%d", x->std_entry()->block_id()); | |
770 if (x->number_of_sux() > 1) { | |
771 output()->print(" osr entry B%d", x->osr_entry()->block_id()); | |
772 } | |
773 } | |
774 | |
775 | |
776 void InstructionPrinter::do_OsrEntry(OsrEntry* x) { | |
777 output()->print("osr entry"); | |
778 } | |
779 | |
780 | |
781 void InstructionPrinter::do_ExceptionObject(ExceptionObject* x) { | |
782 output()->print("incoming exception"); | |
783 } | |
784 | |
785 | |
786 void InstructionPrinter::do_RoundFP(RoundFP* x) { | |
787 output()->print("round_fp "); | |
788 print_value(x->input()); | |
789 } | |
790 | |
791 | |
792 void InstructionPrinter::do_UnsafeGetRaw(UnsafeGetRaw* x) { | |
793 print_unsafe_raw_op(x, "UnsafeGetRaw"); | |
794 output()->put(')'); | |
795 } | |
796 | |
797 | |
798 void InstructionPrinter::do_UnsafePutRaw(UnsafePutRaw* x) { | |
799 print_unsafe_raw_op(x, "UnsafePutRaw"); | |
800 output()->print(", value "); | |
801 print_value(x->value()); | |
802 output()->put(')'); | |
803 } | |
804 | |
805 | |
806 void InstructionPrinter::do_UnsafeGetObject(UnsafeGetObject* x) { | |
807 print_unsafe_object_op(x, "UnsafeGetObject"); | |
808 output()->put(')'); | |
809 } | |
810 | |
811 | |
812 void InstructionPrinter::do_UnsafePutObject(UnsafePutObject* x) { | |
813 print_unsafe_object_op(x, "UnsafePutObject"); | |
814 output()->print(", value "); | |
815 print_value(x->value()); | |
816 output()->put(')'); | |
817 } | |
818 | |
819 | |
820 void InstructionPrinter::do_UnsafePrefetchRead(UnsafePrefetchRead* x) { | |
821 print_unsafe_object_op(x, "UnsafePrefetchRead"); | |
822 output()->put(')'); | |
823 } | |
824 | |
825 | |
826 void InstructionPrinter::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { | |
827 print_unsafe_object_op(x, "UnsafePrefetchWrite"); | |
828 output()->put(')'); | |
829 } | |
830 | |
831 void InstructionPrinter::do_ProfileCall(ProfileCall* x) { | |
832 output()->print("profile "); | |
833 print_value(x->recv()); | |
834 output()->print(" %s.%s", x->method()->holder()->name()->as_utf8(), x->method()->name()->as_utf8()); | |
835 if (x->known_holder() != NULL) { | |
836 output()->print(", "); | |
837 print_klass(x->known_holder()); | |
838 } | |
839 output()->put(')'); | |
840 } | |
841 | |
1783 | 842 void InstructionPrinter::do_ProfileInvoke(ProfileInvoke* x) { |
843 output()->print("profile_invoke "); | |
844 output()->print(" %s.%s", x->inlinee()->holder()->name()->as_utf8(), x->inlinee()->name()->as_utf8()); | |
845 output()->put(')'); | |
0 | 846 |
847 } | |
848 | |
2166
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
849 void InstructionPrinter::do_RuntimeCall(RuntimeCall* x) { |
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
850 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
|
851 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
|
852 if (i > 0) output()->print(", "); |
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
853 print_value(x->argument_at(i)); |
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
854 } |
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
855 output()->put(')'); |
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
856 } |
403dc4c1d7f5
6809483: hotspot:::method_entry are not correctly generated for "method()V"
never
parents:
1972
diff
changeset
|
857 |
0 | 858 #endif // PRODUCT |