Sat, 01 Sep 2012 13:25:18 -0400
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
1 /*
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
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"
33 #ifndef PRODUCT
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 }
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 }
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 }
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 }
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 }
123 void InstructionPrinter::print_klass(ciKlass* klass) {
124 klass->name()->print_symbol_on(output());
125 }
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 " PTR_FORMAT ">", value);
136 } else {
137 output()->print("<object " PTR_FORMAT " klass=", value->constant_encoding());
138 print_klass(value->klass());
139 output()->print(">");
140 }
141 } else if (type->as_InstanceConstant() != NULL) {
142 ciInstance* value = type->as_InstanceConstant()->value();
143 if (value->is_loaded()) {
144 output()->print("<instance " PTR_FORMAT " klass=", value->constant_encoding());
145 print_klass(value->klass());
146 output()->print(">");
147 } else {
148 output()->print("<unloaded instance " PTR_FORMAT ">", value);
149 }
150 } else if (type->as_ArrayConstant() != NULL) {
151 output()->print("<array " PTR_FORMAT ">", type->as_ArrayConstant()->value()->constant_encoding());
152 } else if (type->as_ClassConstant() != NULL) {
153 ciInstanceKlass* klass = type->as_ClassConstant()->value();
154 if (!klass->is_loaded()) {
155 output()->print("<unloaded> ");
156 }
157 output()->print("class ");
158 print_klass(klass);
159 } else if (type->as_MethodConstant() != NULL) {
160 ciMethod* m = type->as_MethodConstant()->value();
161 output()->print("<method %s.%s>", m->holder()->name()->as_utf8(), m->name()->as_utf8());
162 } else {
163 output()->print("???");
164 }
165 }
168 void InstructionPrinter::print_temp(Value value) {
169 output()->print("%c%d", value->type()->tchar(), value->id());
170 }
173 void InstructionPrinter::print_field(AccessField* field) {
174 print_value(field->obj());
175 output()->print("._%d", field->offset());
176 }
179 void InstructionPrinter::print_indexed(AccessIndexed* indexed) {
180 print_value(indexed->array());
181 output()->put('[');
182 print_value(indexed->index());
183 output()->put(']');
184 }
187 void InstructionPrinter::print_monitor(AccessMonitor* monitor) {
188 output()->print("monitor[%d](", monitor->monitor_no());
189 print_value(monitor->obj());
190 output()->put(')');
191 }
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 }
201 void InstructionPrinter::print_value(Value value) {
202 if (value == NULL) {
203 output()->print("NULL");
204 } else {
205 print_temp(value);
206 }
207 }
210 void InstructionPrinter::print_instr(Instruction* instr) {
211 instr->visit(this);
212 }
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 }
258 void InstructionPrinter::print_inline_level(BlockBegin* block) {
259 output()->print_cr("inlining depth %d", block->scope()->level());
260 }
263 void InstructionPrinter::print_unsafe_op(UnsafeOp* op, const char* name) {
264 output()->print(name);
265 output()->print(".(");
266 }
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 }
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 }
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 }
306 void InstructionPrinter::print_alias(Value v) {
307 if (v != v->subst()) {
308 output()->print("alias "); print_value(v->subst());
309 }
310 }
313 void InstructionPrinter::fill_to(int pos, char filler) {
314 while (output()->position() < pos) output()->put(filler);
315 }
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 }
329 void InstructionPrinter::print_line(Instruction* instr) {
330 // print instruction data on one line
331 if (instr->is_pinned()) output()->put('.');
332 fill_to(bci_pos ); output()->print("%d", instr->printable_bci());
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 }
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 }
354 void InstructionPrinter::do_Local(Local* x) {
355 output()->print("local[index %d]", x->java_index());
356 }
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 }
373 void InstructionPrinter::do_LoadField(LoadField* x) {
374 print_field(x);
375 output()->print(" (%c)", type2char(x->field()->type()->basic_type()));
376 }
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 }
387 void InstructionPrinter::do_ArrayLength(ArrayLength* x) {
388 print_value(x->array());
389 output()->print(".length");
390 }
393 void InstructionPrinter::do_LoadIndexed(LoadIndexed* x) {
394 print_indexed(x);
395 output()->print(" (%c)", type2char(x->elt_type()));
396 }
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 }
406 void InstructionPrinter::do_NegateOp(NegateOp* x) {
407 output()->put('-');
408 print_value(x->x());
409 }
412 void InstructionPrinter::do_ArithmeticOp(ArithmeticOp* x) {
413 print_op2(x);
414 }
417 void InstructionPrinter::do_ShiftOp(ShiftOp* x) {
418 print_op2(x);
419 }
422 void InstructionPrinter::do_LogicOp(LogicOp* x) {
423 print_op2(x);
424 }
427 void InstructionPrinter::do_CompareOp(CompareOp* x) {
428 print_op2(x);
429 }
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 }
443 void InstructionPrinter::do_Convert(Convert* x) {
444 output()->print("%s(", Bytecodes::name(x->op()));
445 print_value(x->value());
446 output()->put(')');
447 }
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 }
460 void InstructionPrinter::do_TypeCast(TypeCast* x) {
461 output()->print("type_cast(");
462 print_value(x->obj());
463 output()->print(") ");
464 if (x->declared_type()->is_klass())
465 print_klass(x->declared_type()->as_klass());
466 else
467 output()->print(type2name(x->declared_type()->basic_type()));
468 }
471 void InstructionPrinter::do_Invoke(Invoke* x) {
472 if (x->receiver() != NULL) {
473 print_value(x->receiver());
474 output()->print(".");
475 }
477 output()->print("%s(", Bytecodes::name(x->code()));
478 for (int i = 0; i < x->number_of_arguments(); i++) {
479 if (i > 0) output()->print(", ");
480 print_value(x->argument_at(i));
481 }
482 output()->print_cr(")");
483 fill_to(instr_pos);
484 output()->print("%s.%s%s",
485 x->target()->holder()->name()->as_utf8(),
486 x->target()->name()->as_utf8(),
487 x->target()->signature()->as_symbol()->as_utf8());
488 }
491 void InstructionPrinter::do_NewInstance(NewInstance* x) {
492 output()->print("new instance ");
493 print_klass(x->klass());
494 }
497 void InstructionPrinter::do_NewTypeArray(NewTypeArray* x) {
498 output()->print("new %s array [", basic_type_name(x->elt_type()));
499 print_value(x->length());
500 output()->put(']');
501 }
504 void InstructionPrinter::do_NewObjectArray(NewObjectArray* x) {
505 output()->print("new object array [");
506 print_value(x->length());
507 output()->print("] ");
508 print_klass(x->klass());
509 }
512 void InstructionPrinter::do_NewMultiArray(NewMultiArray* x) {
513 output()->print("new multi array [");
514 Values* dims = x->dims();
515 for (int i = 0; i < dims->length(); i++) {
516 if (i > 0) output()->print(", ");
517 print_value(dims->at(i));
518 }
519 output()->print("] ");
520 print_klass(x->klass());
521 }
524 void InstructionPrinter::do_MonitorEnter(MonitorEnter* x) {
525 output()->print("enter ");
526 print_monitor(x);
527 }
530 void InstructionPrinter::do_MonitorExit(MonitorExit* x) {
531 output()->print("exit ");
532 print_monitor(x);
533 }
536 void InstructionPrinter::do_Intrinsic(Intrinsic* x) {
537 const char* name = vmIntrinsics::name_at(x->id());
538 if (name[0] == '_') name++; // strip leading bug from _hashCode, etc.
539 const char* kname = vmSymbols::name_for(vmIntrinsics::class_for(x->id()));
540 if (strchr(name, '_') == NULL) {
541 kname = NULL;
542 } else {
543 const char* kptr = strrchr(kname, '/');
544 if (kptr != NULL) kname = kptr + 1;
545 }
546 if (kname == NULL)
547 output()->print("%s(", name);
548 else
549 output()->print("%s.%s(", kname, name);
550 for (int i = 0; i < x->number_of_arguments(); i++) {
551 if (i > 0) output()->print(", ");
552 print_value(x->argument_at(i));
553 }
554 output()->put(')');
555 }
558 void InstructionPrinter::do_BlockBegin(BlockBegin* x) {
559 // print block id
560 BlockEnd* end = x->end();
561 output()->print("B%d ", x->block_id());
563 // print flags
564 bool printed_flag = false;
565 if (x->is_set(BlockBegin::std_entry_flag)) {
566 if (!printed_flag) output()->print("(");
567 output()->print("S"); printed_flag = true;
568 }
569 if (x->is_set(BlockBegin::osr_entry_flag)) {
570 if (!printed_flag) output()->print("(");
571 output()->print("O"); printed_flag = true;
572 }
573 if (x->is_set(BlockBegin::exception_entry_flag)) {
574 if (!printed_flag) output()->print("(");
575 output()->print("E"); printed_flag = true;
576 }
577 if (x->is_set(BlockBegin::subroutine_entry_flag)) {
578 if (!printed_flag) output()->print("(");
579 output()->print("s"); printed_flag = true;
580 }
581 if (x->is_set(BlockBegin::parser_loop_header_flag)) {
582 if (!printed_flag) output()->print("(");
583 output()->print("LH"); printed_flag = true;
584 }
585 if (x->is_set(BlockBegin::backward_branch_target_flag)) {
586 if (!printed_flag) output()->print("(");
587 output()->print("b"); printed_flag = true;
588 }
589 if (x->is_set(BlockBegin::was_visited_flag)) {
590 if (!printed_flag) output()->print("(");
591 output()->print("V"); printed_flag = true;
592 }
593 if (printed_flag) output()->print(") ");
595 // print block bci range
596 output()->print("[%d, %d]", x->bci(), (end == NULL ? -1 : end->printable_bci()));
598 // print block successors
599 if (end != NULL && end->number_of_sux() > 0) {
600 output()->print(" ->");
601 for (int i = 0; i < end->number_of_sux(); i++) {
602 output()->print(" B%d", end->sux_at(i)->block_id());
603 }
604 }
605 // print exception handlers
606 if (x->number_of_exception_handlers() > 0) {
607 output()->print(" (xhandlers ");
608 for (int i = 0; i < x->number_of_exception_handlers(); i++) {
609 if (i > 0) output()->print(" ");
610 output()->print("B%d", x->exception_handler_at(i)->block_id());
611 }
612 output()->put(')');
613 }
615 // print dominator block
616 if (x->dominator() != NULL) {
617 output()->print(" dom B%d", x->dominator()->block_id());
618 }
620 // print predecessors and successors
621 if (x->successors()->length() > 0) {
622 output()->print(" sux:");
623 for (int i = 0; i < x->successors()->length(); i ++) {
624 output()->print(" B%d", x->successors()->at(i)->block_id());
625 }
626 }
628 if (x->number_of_preds() > 0) {
629 output()->print(" pred:");
630 for (int i = 0; i < x->number_of_preds(); i ++) {
631 output()->print(" B%d", x->pred_at(i)->block_id());
632 }
633 }
635 if (!_print_phis) {
636 return;
637 }
639 // print phi functions
640 bool has_phis_in_locals = false;
641 bool has_phis_on_stack = false;
643 if (x->end() && x->end()->state()) {
644 ValueStack* state = x->state();
646 int i = 0;
647 while (!has_phis_on_stack && i < state->stack_size()) {
648 Value v = state->stack_at_inc(i);
649 has_phis_on_stack = is_phi_of_block(v, x);
650 }
652 do {
653 for (i = 0; !has_phis_in_locals && i < state->locals_size();) {
654 Value v = state->local_at(i);
655 has_phis_in_locals = is_phi_of_block(v, x);
656 // also ignore illegal HiWords
657 if (v && !v->type()->is_illegal()) i += v->type()->size(); else i ++;
658 }
659 state = state->caller_state();
660 } while (state != NULL);
662 }
664 // print values in locals
665 if (has_phis_in_locals) {
666 output()->cr(); output()->print_cr("Locals:");
668 ValueStack* state = x->state();
669 do {
670 for (int i = 0; i < state->locals_size();) {
671 Value v = state->local_at(i);
672 if (v) {
673 print_phi(i, v, x); output()->cr();
674 // also ignore illegal HiWords
675 i += (v->type()->is_illegal() ? 1 : v->type()->size());
676 } else {
677 i ++;
678 }
679 }
680 output()->cr();
681 state = state->caller_state();
682 } while (state != NULL);
683 }
685 // print values on stack
686 if (has_phis_on_stack) {
687 output()->print_cr("Stack:");
688 int i = 0;
689 while (i < x->state()->stack_size()) {
690 int o = i;
691 Value v = x->state()->stack_at_inc(i);
692 if (v) {
693 print_phi(o, v, x); output()->cr();
694 }
695 }
696 }
697 }
700 void InstructionPrinter::do_CheckCast(CheckCast* x) {
701 output()->print("checkcast(");
702 print_value(x->obj());
703 output()->print(") ");
704 print_klass(x->klass());
705 }
708 void InstructionPrinter::do_InstanceOf(InstanceOf* x) {
709 output()->print("instanceof(");
710 print_value(x->obj());
711 output()->print(") ");
712 print_klass(x->klass());
713 }
716 void InstructionPrinter::do_Goto(Goto* x) {
717 output()->print("goto B%d", x->default_sux()->block_id());
718 if (x->is_safepoint()) output()->print(" (safepoint)");
719 }
722 void InstructionPrinter::do_If(If* x) {
723 output()->print("if ");
724 print_value(x->x());
725 output()->print(" %s ", cond_name(x->cond()));
726 print_value(x->y());
727 output()->print(" then B%d else B%d", x->sux_at(0)->block_id(), x->sux_at(1)->block_id());
728 if (x->is_safepoint()) output()->print(" (safepoint)");
729 }
732 void InstructionPrinter::do_IfInstanceOf(IfInstanceOf* x) {
733 output()->print("<IfInstanceOf>");
734 }
737 void InstructionPrinter::do_TableSwitch(TableSwitch* x) {
738 output()->print("tableswitch ");
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->lo_key() + 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 }
752 void InstructionPrinter::do_LookupSwitch(LookupSwitch* x) {
753 output()->print("lookupswitch ");
754 if (x->is_safepoint()) output()->print("(safepoint) ");
755 print_value(x->tag());
756 output()->cr();
757 int l = x->length();
758 for (int i = 0; i < l; i++) {
759 fill_to(instr_pos);
760 output()->print_cr("case %5d: B%d", x->key_at(i), x->sux_at(i)->block_id());
761 }
762 fill_to(instr_pos);
763 output()->print("default : B%d", x->default_sux()->block_id());
764 }
767 void InstructionPrinter::do_Return(Return* x) {
768 if (x->result() == NULL) {
769 output()->print("return");
770 } else {
771 output()->print("%creturn ", x->type()->tchar());
772 print_value(x->result());
773 }
774 }
777 void InstructionPrinter::do_Throw(Throw* x) {
778 output()->print("throw ");
779 print_value(x->exception());
780 }
783 void InstructionPrinter::do_Base(Base* x) {
784 output()->print("std entry B%d", x->std_entry()->block_id());
785 if (x->number_of_sux() > 1) {
786 output()->print(" osr entry B%d", x->osr_entry()->block_id());
787 }
788 }
791 void InstructionPrinter::do_OsrEntry(OsrEntry* x) {
792 output()->print("osr entry");
793 }
796 void InstructionPrinter::do_ExceptionObject(ExceptionObject* x) {
797 output()->print("incoming exception");
798 }
801 void InstructionPrinter::do_RoundFP(RoundFP* x) {
802 output()->print("round_fp ");
803 print_value(x->input());
804 }
807 void InstructionPrinter::do_UnsafeGetRaw(UnsafeGetRaw* x) {
808 print_unsafe_raw_op(x, "UnsafeGetRaw");
809 output()->put(')');
810 }
813 void InstructionPrinter::do_UnsafePutRaw(UnsafePutRaw* x) {
814 print_unsafe_raw_op(x, "UnsafePutRaw");
815 output()->print(", value ");
816 print_value(x->value());
817 output()->put(')');
818 }
821 void InstructionPrinter::do_UnsafeGetObject(UnsafeGetObject* x) {
822 print_unsafe_object_op(x, "UnsafeGetObject");
823 output()->put(')');
824 }
827 void InstructionPrinter::do_UnsafePutObject(UnsafePutObject* x) {
828 print_unsafe_object_op(x, "UnsafePutObject");
829 output()->print(", value ");
830 print_value(x->value());
831 output()->put(')');
832 }
835 void InstructionPrinter::do_UnsafePrefetchRead(UnsafePrefetchRead* x) {
836 print_unsafe_object_op(x, "UnsafePrefetchRead");
837 output()->put(')');
838 }
841 void InstructionPrinter::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {
842 print_unsafe_object_op(x, "UnsafePrefetchWrite");
843 output()->put(')');
844 }
846 void InstructionPrinter::do_ProfileCall(ProfileCall* x) {
847 output()->print("profile ");
848 print_value(x->recv());
849 output()->print(" %s.%s", x->method()->holder()->name()->as_utf8(), x->method()->name()->as_utf8());
850 if (x->known_holder() != NULL) {
851 output()->print(", ");
852 print_klass(x->known_holder());
853 }
854 output()->put(')');
855 }
857 void InstructionPrinter::do_ProfileInvoke(ProfileInvoke* x) {
858 output()->print("profile_invoke ");
859 output()->print(" %s.%s", x->inlinee()->holder()->name()->as_utf8(), x->inlinee()->name()->as_utf8());
860 output()->put(')');
862 }
864 void InstructionPrinter::do_RuntimeCall(RuntimeCall* x) {
865 output()->print("call_rt %s(", x->entry_name());
866 for (int i = 0; i < x->number_of_arguments(); i++) {
867 if (i > 0) output()->print(", ");
868 print_value(x->argument_at(i));
869 }
870 output()->put(')');
871 }
873 void InstructionPrinter::do_MemBar(MemBar* x) {
874 if (os::is_MP()) {
875 LIR_Code code = x->code();
876 switch (code) {
877 case lir_membar_acquire : output()->print("membar_acquire"); break;
878 case lir_membar_release : output()->print("membar_release"); break;
879 case lir_membar : output()->print("membar"); break;
880 case lir_membar_loadload : output()->print("membar_loadload"); break;
881 case lir_membar_storestore: output()->print("membar_storestore"); break;
882 case lir_membar_loadstore : output()->print("membar_loadstore"); break;
883 case lir_membar_storeload : output()->print("membar_storeload"); break;
884 default : ShouldNotReachHere(); break;
885 }
886 }
887 }
889 #endif // PRODUCT