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