c1_InstructionPrinter.cpp revision 0
0N/A/*
0N/A * Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0N/A * CA 95054 USA or visit www.sun.com if you need additional information or
0N/A * have any questions.
0N/A *
0N/A */
0N/A
0N/A#include "incls/_precompiled.incl"
0N/A#include "incls/_c1_InstructionPrinter.cpp.incl"
0N/A
0N/A
0N/A#ifndef PRODUCT
0N/A
0N/Aconst char* InstructionPrinter::basic_type_name(BasicType type) {
0N/A switch (type) {
0N/A case T_BOOLEAN: return "boolean";
0N/A case T_BYTE : return "byte";
0N/A case T_CHAR : return "char";
0N/A case T_SHORT : return "short";
0N/A case T_INT : return "int";
0N/A case T_LONG : return "long";
0N/A case T_FLOAT : return "float";
0N/A case T_DOUBLE : return "double";
0N/A case T_ARRAY : return "array";
0N/A case T_OBJECT : return "object";
0N/A default : return "???";
0N/A }
0N/A}
0N/A
0N/A
0N/Aconst char* InstructionPrinter::cond_name(If::Condition cond) {
0N/A switch (cond) {
0N/A case If::eql: return "==";
0N/A case If::neq: return "!=";
0N/A case If::lss: return "<";
0N/A case If::leq: return "<=";
0N/A case If::gtr: return ">";
0N/A case If::geq: return ">=";
0N/A }
0N/A ShouldNotReachHere();
0N/A return NULL;
0N/A}
0N/A
0N/A
0N/Aconst char* InstructionPrinter::op_name(Bytecodes::Code op) {
0N/A switch (op) {
0N/A // arithmetic ops
0N/A case Bytecodes::_iadd : // fall through
0N/A case Bytecodes::_ladd : // fall through
0N/A case Bytecodes::_fadd : // fall through
0N/A case Bytecodes::_dadd : return "+";
0N/A case Bytecodes::_isub : // fall through
0N/A case Bytecodes::_lsub : // fall through
0N/A case Bytecodes::_fsub : // fall through
0N/A case Bytecodes::_dsub : return "-";
0N/A case Bytecodes::_imul : // fall through
0N/A case Bytecodes::_lmul : // fall through
0N/A case Bytecodes::_fmul : // fall through
0N/A case Bytecodes::_dmul : return "*";
0N/A case Bytecodes::_idiv : // fall through
0N/A case Bytecodes::_ldiv : // fall through
0N/A case Bytecodes::_fdiv : // fall through
0N/A case Bytecodes::_ddiv : return "/";
0N/A case Bytecodes::_irem : // fall through
0N/A case Bytecodes::_lrem : // fall through
0N/A case Bytecodes::_frem : // fall through
0N/A case Bytecodes::_drem : return "%";
0N/A // shift ops
0N/A case Bytecodes::_ishl : // fall through
0N/A case Bytecodes::_lshl : return "<<";
0N/A case Bytecodes::_ishr : // fall through
0N/A case Bytecodes::_lshr : return ">>";
0N/A case Bytecodes::_iushr: // fall through
0N/A case Bytecodes::_lushr: return ">>>";
0N/A // logic ops
0N/A case Bytecodes::_iand : // fall through
0N/A case Bytecodes::_land : return "&";
0N/A case Bytecodes::_ior : // fall through
0N/A case Bytecodes::_lor : return "|";
0N/A case Bytecodes::_ixor : // fall through
0N/A case Bytecodes::_lxor : return "^";
0N/A }
0N/A return Bytecodes::name(op);
0N/A}
0N/A
0N/A
0N/Abool InstructionPrinter::is_illegal_phi(Value v) {
0N/A Phi* phi = v ? v->as_Phi() : NULL;
0N/A if (phi && phi->is_illegal()) {
0N/A return true;
0N/A }
0N/A return false;
0N/A}
0N/A
0N/A
0N/Abool InstructionPrinter::is_phi_of_block(Value v, BlockBegin* b) {
0N/A Phi* phi = v ? v->as_Phi() : NULL;
0N/A return phi && phi->block() == b;
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_klass(ciKlass* klass) {
0N/A klass->name()->print_symbol_on(output());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_object(Value obj) {
0N/A ValueType* type = obj->type();
0N/A if (type->as_ObjectConstant() != NULL) {
0N/A ciObject* value = type->as_ObjectConstant()->value();
0N/A if (value->is_null_object()) {
0N/A output()->print("null");
0N/A } else if (!value->is_loaded()) {
0N/A output()->print("<unloaded object 0x%x>", value);
0N/A } else if (value->is_method()) {
0N/A ciMethod* m = (ciMethod*)value;
0N/A output()->print("<method %s.%s>", m->holder()->name()->as_utf8(), m->name()->as_utf8());
0N/A } else {
0N/A output()->print("<object 0x%x>", value->encoding());
0N/A }
0N/A } else if (type->as_InstanceConstant() != NULL) {
0N/A output()->print("<instance 0x%x>", type->as_InstanceConstant()->value()->encoding());
0N/A } else if (type->as_ArrayConstant() != NULL) {
0N/A output()->print("<array 0x%x>", type->as_ArrayConstant()->value()->encoding());
0N/A } else if (type->as_ClassConstant() != NULL) {
0N/A ciInstanceKlass* klass = type->as_ClassConstant()->value();
0N/A if (!klass->is_loaded()) {
0N/A output()->print("<unloaded> ");
0N/A }
0N/A output()->print("class ");
0N/A print_klass(klass);
0N/A } else {
0N/A output()->print("???");
0N/A }
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_temp(Value value) {
0N/A output()->print("%c%d", value->type()->tchar(), value->id());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_field(AccessField* field) {
0N/A print_value(field->obj());
0N/A output()->print("._%d", field->offset());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_indexed(AccessIndexed* indexed) {
0N/A print_value(indexed->array());
0N/A output()->put('[');
0N/A print_value(indexed->index());
0N/A output()->put(']');
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_monitor(AccessMonitor* monitor) {
0N/A output()->print("monitor[%d](", monitor->monitor_no());
0N/A print_value(monitor->obj());
0N/A output()->put(')');
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_op2(Op2* instr) {
0N/A print_value(instr->x());
0N/A output()->print(" %s ", op_name(instr->op()));
0N/A print_value(instr->y());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_value(Value value) {
0N/A if (value == NULL) {
0N/A output()->print("NULL");
0N/A } else {
0N/A print_temp(value);
0N/A }
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_instr(Instruction* instr) {
0N/A instr->visit(this);
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_stack(ValueStack* stack) {
0N/A int start_position = output()->position();
0N/A if (stack->stack_is_empty()) {
0N/A output()->print("empty stack");
0N/A } else {
0N/A output()->print("stack [");
0N/A for (int i = 0; i < stack->stack_size();) {
0N/A if (i > 0) output()->print(", ");
0N/A output()->print("%d:", i);
0N/A Value value = stack->stack_at_inc(i);
0N/A print_value(value);
0N/A Phi* phi = value->as_Phi();
0N/A if (phi != NULL) {
0N/A if (phi->operand()->is_valid()) {
0N/A output()->print(" ");
0N/A phi->operand()->print(output());
0N/A }
0N/A }
0N/A }
0N/A output()->put(']');
0N/A }
0N/A if (!stack->no_active_locks()) {
0N/A // print out the lines on the line below this
0N/A // one at the same indentation level.
0N/A output()->cr();
0N/A fill_to(start_position, ' ');
0N/A output()->print("locks [");
0N/A for (int i = i = 0; i < stack->locks_size(); i++) {
0N/A Value t = stack->lock_at(i);
0N/A if (i > 0) output()->print(", ");
0N/A output()->print("%d:", i);
0N/A if (t == NULL) {
0N/A // synchronized methods push null on the lock stack
0N/A output()->print("this");
0N/A } else {
0N/A print_value(t);
0N/A }
0N/A }
0N/A output()->print("]");
0N/A }
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_inline_level(BlockBegin* block) {
0N/A output()->print_cr("inlining depth %d", block->scope()->level());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_unsafe_op(UnsafeOp* op, const char* name) {
0N/A output()->print(name);
0N/A output()->print(".(");
0N/A}
0N/A
0N/Avoid InstructionPrinter::print_unsafe_raw_op(UnsafeRawOp* op, const char* name) {
0N/A print_unsafe_op(op, name);
0N/A output()->print("base ");
0N/A print_value(op->base());
0N/A if (op->has_index()) {
0N/A output()->print(", index "); print_value(op->index());
0N/A output()->print(", log2_scale %d", op->log2_scale());
0N/A }
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_unsafe_object_op(UnsafeObjectOp* op, const char* name) {
0N/A print_unsafe_op(op, name);
0N/A print_value(op->object());
0N/A output()->print(", ");
0N/A print_value(op->offset());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_phi(int i, Value v, BlockBegin* b) {
0N/A Phi* phi = v->as_Phi();
0N/A output()->print("%2d ", i);
0N/A print_value(v);
0N/A // print phi operands
0N/A if (phi && phi->block() == b) {
0N/A output()->print(" [");
0N/A for (int j = 0; j < phi->operand_count(); j ++) {
0N/A output()->print(" ");
0N/A Value opd = phi->operand_at(j);
0N/A if (opd) print_value(opd);
0N/A else output()->print("NULL");
0N/A }
0N/A output()->print("] ");
0N/A }
0N/A print_alias(v);
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_alias(Value v) {
0N/A if (v != v->subst()) {
0N/A output()->print("alias "); print_value(v->subst());
0N/A }
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::fill_to(int pos, char filler) {
0N/A while (output()->position() < pos) output()->put(filler);
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_head() {
0N/A const char filler = '_';
0N/A fill_to(bci_pos , filler); output()->print("bci" );
0N/A fill_to(use_pos , filler); output()->print("use" );
0N/A fill_to(temp_pos , filler); output()->print("tid" );
0N/A fill_to(instr_pos, filler); output()->print("instr");
0N/A fill_to(end_pos , filler);
0N/A output()->cr();
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::print_line(Instruction* instr) {
0N/A // print instruction data on one line
0N/A if (instr->is_pinned()) output()->put('.');
0N/A fill_to(bci_pos ); output()->print("%d", instr->bci());
0N/A fill_to(use_pos ); output()->print("%d", instr->use_count());
0N/A fill_to(temp_pos ); print_temp(instr);
0N/A fill_to(instr_pos); print_instr(instr);
0N/A output()->cr();
0N/A // add a line for StateSplit instructions w/ non-empty stacks
0N/A // (make it robust so we can print incomplete instructions)
0N/A StateSplit* split = instr->as_StateSplit();
0N/A if (split != NULL && split->state() != NULL && !split->state()->stack_is_empty()) {
0N/A fill_to(instr_pos); print_stack(split->state());
0N/A output()->cr();
0N/A }
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_Phi(Phi* x) {
0N/A output()->print("phi function"); // make that more detailed later
0N/A if (x->is_illegal())
0N/A output()->print(" (illegal)");
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_Local(Local* x) {
0N/A output()->print("local[index %d]", x->java_index());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_Constant(Constant* x) {
0N/A ValueType* t = x->type();
0N/A switch (t->tag()) {
0N/A case intTag : output()->print("%d" , t->as_IntConstant ()->value()); break;
0N/A case longTag : output()->print(os::jlong_format_specifier(), t->as_LongConstant()->value()); output()->print("L"); break;
0N/A case floatTag : output()->print("%g" , t->as_FloatConstant ()->value()); break;
0N/A case doubleTag : output()->print("%gD" , t->as_DoubleConstant()->value()); break;
0N/A case objectTag : print_object(x); break;
0N/A case addressTag: output()->print("bci:%d", t->as_AddressConstant()->value()); break;
0N/A default : output()->print("???"); break;
0N/A }
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_LoadField(LoadField* x) {
0N/A print_field(x);
0N/A output()->print(" (%c)", type2char(x->field()->type()->basic_type()));
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_StoreField(StoreField* x) {
0N/A print_field(x);
0N/A output()->print(" := ");
0N/A print_value(x->value());
0N/A output()->print(" (%c)", type2char(x->field()->type()->basic_type()));
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_ArrayLength(ArrayLength* x) {
0N/A print_value(x->array());
0N/A output()->print(".length");
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_LoadIndexed(LoadIndexed* x) {
0N/A print_indexed(x);
0N/A output()->print(" (%c)", type2char(x->elt_type()));
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_StoreIndexed(StoreIndexed* x) {
0N/A print_indexed(x);
0N/A output()->print(" := ");
0N/A print_value(x->value());
0N/A output()->print(" (%c)", type2char(x->elt_type()));
0N/A}
0N/A
0N/Avoid InstructionPrinter::do_NegateOp(NegateOp* x) {
0N/A output()->put('-');
0N/A print_value(x->x());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_ArithmeticOp(ArithmeticOp* x) {
0N/A print_op2(x);
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_ShiftOp(ShiftOp* x) {
0N/A print_op2(x);
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_LogicOp(LogicOp* x) {
0N/A print_op2(x);
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_CompareOp(CompareOp* x) {
0N/A print_op2(x);
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_IfOp(IfOp* x) {
0N/A print_value(x->x());
0N/A output()->print(" %s ", cond_name(x->cond()));
0N/A print_value(x->y());
0N/A output()->print(" ? ");
0N/A print_value(x->tval());
0N/A output()->print(" : ");
0N/A print_value(x->fval());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_Convert(Convert* x) {
0N/A output()->print("%s(", Bytecodes::name(x->op()));
0N/A print_value(x->value());
0N/A output()->put(')');
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_NullCheck(NullCheck* x) {
0N/A output()->print("null_check(");
0N/A print_value(x->obj());
0N/A output()->put(')');
0N/A if (!x->can_trap()) {
0N/A output()->print(" (eliminated)");
0N/A }
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_Invoke(Invoke* x) {
0N/A if (x->receiver() != NULL) {
0N/A print_value(x->receiver());
0N/A output()->print(".");
0N/A }
0N/A
0N/A output()->print("%s(", Bytecodes::name(x->code()));
0N/A for (int i = 0; i < x->number_of_arguments(); i++) {
0N/A if (i > 0) output()->print(", ");
0N/A print_value(x->argument_at(i));
0N/A }
0N/A output()->print_cr(")");
0N/A fill_to(instr_pos);
0N/A output()->print("%s.%s%s",
0N/A x->target()->holder()->name()->as_utf8(),
0N/A x->target()->name()->as_utf8(),
0N/A x->target()->signature()->as_symbol()->as_utf8());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_NewInstance(NewInstance* x) {
0N/A output()->print("new instance ");
0N/A print_klass(x->klass());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_NewTypeArray(NewTypeArray* x) {
0N/A output()->print("new %s array [", basic_type_name(x->elt_type()));
0N/A print_value(x->length());
0N/A output()->put(']');
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_NewObjectArray(NewObjectArray* x) {
0N/A output()->print("new object array [");
0N/A print_value(x->length());
0N/A output()->print("] ");
0N/A print_klass(x->klass());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_NewMultiArray(NewMultiArray* x) {
0N/A output()->print("new multi array [");
0N/A Values* dims = x->dims();
0N/A for (int i = 0; i < dims->length(); i++) {
0N/A if (i > 0) output()->print(", ");
0N/A print_value(dims->at(i));
0N/A }
0N/A output()->print("] ");
0N/A print_klass(x->klass());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_MonitorEnter(MonitorEnter* x) {
0N/A output()->print("enter ");
0N/A print_monitor(x);
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_MonitorExit(MonitorExit* x) {
0N/A output()->print("exit ");
0N/A print_monitor(x);
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_Intrinsic(Intrinsic* x) {
0N/A const char* name = vmIntrinsics::name_at(x->id());
0N/A if (name[0] == '_') name++; // strip leading bug from _hashCode, etc.
0N/A const char* kname = vmSymbols::name_for(vmIntrinsics::class_for(x->id()));
0N/A if (strchr(name, '_') == NULL) {
0N/A kname = NULL;
0N/A } else {
0N/A const char* kptr = strrchr(kname, '/');
0N/A if (kptr != NULL) kname = kptr + 1;
0N/A }
0N/A if (kname == NULL)
0N/A output()->print("%s(", name);
0N/A else
0N/A output()->print("%s.%s(", kname, name);
0N/A for (int i = 0; i < x->number_of_arguments(); i++) {
0N/A if (i > 0) output()->print(", ");
0N/A print_value(x->argument_at(i));
0N/A }
0N/A output()->put(')');
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_BlockBegin(BlockBegin* x) {
0N/A // print block id
0N/A BlockEnd* end = x->end();
0N/A output()->print("B%d ", x->block_id());
0N/A
0N/A // print flags
0N/A bool printed_flag = false;
0N/A if (x->is_set(BlockBegin::std_entry_flag)) {
0N/A if (!printed_flag) output()->print("(");
0N/A output()->print("S"); printed_flag = true;
0N/A }
0N/A if (x->is_set(BlockBegin::osr_entry_flag)) {
0N/A if (!printed_flag) output()->print("(");
0N/A output()->print("O"); printed_flag = true;
0N/A }
0N/A if (x->is_set(BlockBegin::exception_entry_flag)) {
0N/A if (!printed_flag) output()->print("(");
0N/A output()->print("E"); printed_flag = true;
0N/A }
0N/A if (x->is_set(BlockBegin::subroutine_entry_flag)) {
0N/A if (!printed_flag) output()->print("(");
0N/A output()->print("s"); printed_flag = true;
0N/A }
0N/A if (x->is_set(BlockBegin::parser_loop_header_flag)) {
0N/A if (!printed_flag) output()->print("(");
0N/A output()->print("LH"); printed_flag = true;
0N/A }
0N/A if (x->is_set(BlockBegin::backward_branch_target_flag)) {
0N/A if (!printed_flag) output()->print("(");
0N/A output()->print("b"); printed_flag = true;
0N/A }
0N/A if (x->is_set(BlockBegin::was_visited_flag)) {
0N/A if (!printed_flag) output()->print("(");
0N/A output()->print("V"); printed_flag = true;
0N/A }
0N/A if (printed_flag) output()->print(") ");
0N/A
0N/A // print block bci range
0N/A output()->print("[%d, %d]", x->bci(), (end == NULL ? -1 : end->bci()));
0N/A
0N/A // print block successors
0N/A if (end != NULL && end->number_of_sux() > 0) {
0N/A output()->print(" ->");
0N/A for (int i = 0; i < end->number_of_sux(); i++) {
0N/A output()->print(" B%d", end->sux_at(i)->block_id());
0N/A }
0N/A }
0N/A // print exception handlers
0N/A if (x->number_of_exception_handlers() > 0) {
0N/A output()->print(" (xhandlers ");
0N/A for (int i = 0; i < x->number_of_exception_handlers(); i++) {
0N/A if (i > 0) output()->print(" ");
0N/A output()->print("B%d", x->exception_handler_at(i)->block_id());
0N/A }
0N/A output()->put(')');
0N/A }
0N/A
0N/A // print dominator block
0N/A if (x->dominator() != NULL) {
0N/A output()->print(" dom B%d", x->dominator()->block_id());
0N/A }
0N/A
0N/A // print predecessors and successors
0N/A if (x->successors()->length() > 0) {
0N/A output()->print(" sux:");
0N/A for (int i = 0; i < x->successors()->length(); i ++) {
0N/A output()->print(" B%d", x->successors()->at(i)->block_id());
0N/A }
0N/A }
0N/A
0N/A if (x->number_of_preds() > 0) {
0N/A output()->print(" pred:");
0N/A for (int i = 0; i < x->number_of_preds(); i ++) {
0N/A output()->print(" B%d", x->pred_at(i)->block_id());
0N/A }
0N/A }
0N/A
0N/A if (!_print_phis) {
0N/A return;
0N/A }
0N/A
0N/A // print phi functions
0N/A bool has_phis_in_locals = false;
0N/A bool has_phis_on_stack = false;
0N/A
0N/A if (x->end() && x->end()->state()) {
0N/A ValueStack* state = x->state();
0N/A
0N/A int i = 0;
0N/A while (!has_phis_on_stack && i < state->stack_size()) {
0N/A Value v = state->stack_at_inc(i);
0N/A has_phis_on_stack = is_phi_of_block(v, x);
0N/A }
0N/A
0N/A do {
0N/A for (i = 0; !has_phis_in_locals && i < state->locals_size();) {
0N/A Value v = state->local_at(i);
0N/A has_phis_in_locals = is_phi_of_block(v, x);
0N/A // also ignore illegal HiWords
0N/A if (v && !v->type()->is_illegal()) i += v->type()->size(); else i ++;
0N/A }
0N/A state = state->caller_state();
0N/A } while (state != NULL);
0N/A
0N/A }
0N/A
0N/A // print values in locals
0N/A if (has_phis_in_locals) {
0N/A output()->cr(); output()->print_cr("Locals:");
0N/A
0N/A ValueStack* state = x->state();
0N/A do {
0N/A for (int i = 0; i < state->locals_size();) {
0N/A Value v = state->local_at(i);
0N/A if (v) {
0N/A print_phi(i, v, x); output()->cr();
0N/A // also ignore illegal HiWords
0N/A i += (v->type()->is_illegal() ? 1 : v->type()->size());
0N/A } else {
0N/A i ++;
0N/A }
0N/A }
0N/A output()->cr();
0N/A state = state->caller_state();
0N/A } while (state != NULL);
0N/A }
0N/A
0N/A // print values on stack
0N/A if (has_phis_on_stack) {
0N/A output()->print_cr("Stack:");
0N/A int i = 0;
0N/A while (i < x->state()->stack_size()) {
0N/A int o = i;
0N/A Value v = x->state()->stack_at_inc(i);
0N/A if (v) {
0N/A print_phi(o, v, x); output()->cr();
0N/A }
0N/A }
0N/A }
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_CheckCast(CheckCast* x) {
0N/A output()->print("checkcast(");
0N/A print_value(x->obj());
0N/A output()->print(") ");
0N/A print_klass(x->klass());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_InstanceOf(InstanceOf* x) {
0N/A output()->print("instanceof(");
0N/A print_value(x->obj());
0N/A output()->print(") ");
0N/A print_klass(x->klass());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_Goto(Goto* x) {
0N/A output()->print("goto B%d", x->default_sux()->block_id());
0N/A if (x->is_safepoint()) output()->print(" (safepoint)");
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_If(If* x) {
0N/A output()->print("if ");
0N/A print_value(x->x());
0N/A output()->print(" %s ", cond_name(x->cond()));
0N/A print_value(x->y());
0N/A output()->print(" then B%d else B%d", x->sux_at(0)->block_id(), x->sux_at(1)->block_id());
0N/A if (x->is_safepoint()) output()->print(" (safepoint)");
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_IfInstanceOf(IfInstanceOf* x) {
0N/A output()->print("<IfInstanceOf>");
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_TableSwitch(TableSwitch* x) {
0N/A output()->print("tableswitch ");
0N/A if (x->is_safepoint()) output()->print("(safepoint) ");
0N/A print_value(x->tag());
0N/A output()->cr();
0N/A int l = x->length();
0N/A for (int i = 0; i < l; i++) {
0N/A fill_to(instr_pos);
0N/A output()->print_cr("case %5d: B%d", x->lo_key() + i, x->sux_at(i)->block_id());
0N/A }
0N/A fill_to(instr_pos);
0N/A output()->print("default : B%d", x->default_sux()->block_id());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_LookupSwitch(LookupSwitch* x) {
0N/A output()->print("lookupswitch ");
0N/A if (x->is_safepoint()) output()->print("(safepoint) ");
0N/A print_value(x->tag());
0N/A output()->cr();
0N/A int l = x->length();
0N/A for (int i = 0; i < l; i++) {
0N/A fill_to(instr_pos);
0N/A output()->print_cr("case %5d: B%d", x->key_at(i), x->sux_at(i)->block_id());
0N/A }
0N/A fill_to(instr_pos);
0N/A output()->print("default : B%d", x->default_sux()->block_id());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_Return(Return* x) {
0N/A if (x->result() == NULL) {
0N/A output()->print("return");
0N/A } else {
0N/A output()->print("%creturn ", x->type()->tchar());
0N/A print_value(x->result());
0N/A }
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_Throw(Throw* x) {
0N/A output()->print("throw ");
0N/A print_value(x->exception());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_Base(Base* x) {
0N/A output()->print("std entry B%d", x->std_entry()->block_id());
0N/A if (x->number_of_sux() > 1) {
0N/A output()->print(" osr entry B%d", x->osr_entry()->block_id());
0N/A }
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_OsrEntry(OsrEntry* x) {
0N/A output()->print("osr entry");
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_ExceptionObject(ExceptionObject* x) {
0N/A output()->print("incoming exception");
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_RoundFP(RoundFP* x) {
0N/A output()->print("round_fp ");
0N/A print_value(x->input());
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_UnsafeGetRaw(UnsafeGetRaw* x) {
0N/A print_unsafe_raw_op(x, "UnsafeGetRaw");
0N/A output()->put(')');
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_UnsafePutRaw(UnsafePutRaw* x) {
0N/A print_unsafe_raw_op(x, "UnsafePutRaw");
0N/A output()->print(", value ");
0N/A print_value(x->value());
0N/A output()->put(')');
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_UnsafeGetObject(UnsafeGetObject* x) {
0N/A print_unsafe_object_op(x, "UnsafeGetObject");
0N/A output()->put(')');
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_UnsafePutObject(UnsafePutObject* x) {
0N/A print_unsafe_object_op(x, "UnsafePutObject");
0N/A output()->print(", value ");
0N/A print_value(x->value());
0N/A output()->put(')');
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_UnsafePrefetchRead(UnsafePrefetchRead* x) {
0N/A print_unsafe_object_op(x, "UnsafePrefetchRead");
0N/A output()->put(')');
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {
0N/A print_unsafe_object_op(x, "UnsafePrefetchWrite");
0N/A output()->put(')');
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_ProfileCall(ProfileCall* x) {
0N/A output()->print("profile ");
0N/A print_value(x->recv());
0N/A output()->print(" %s.%s", x->method()->holder()->name()->as_utf8(), x->method()->name()->as_utf8());
0N/A if (x->known_holder() != NULL) {
0N/A output()->print(", ");
0N/A print_klass(x->known_holder());
0N/A }
0N/A output()->put(')');
0N/A}
0N/A
0N/A
0N/Avoid InstructionPrinter::do_ProfileCounter(ProfileCounter* x) {
0N/A
0N/A ObjectConstant* oc = x->mdo()->type()->as_ObjectConstant();
0N/A if (oc != NULL && oc->value()->is_method() &&
0N/A x->offset() == methodOopDesc::interpreter_invocation_counter_offset_in_bytes()) {
0N/A print_value(x->mdo());
0N/A output()->print(".interpreter_invocation_count += %d", x->increment());
0N/A } else {
0N/A output()->print("counter [");
0N/A print_value(x->mdo());
0N/A output()->print(" + %d] += %d", x->offset(), x->increment());
0N/A }
0N/A}
0N/A
0N/A
0N/A#endif // PRODUCT