annotate src/share/vm/c1/c1_InstructionPrinter.cpp @ 6266:1d7922586cf6

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