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