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