10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "c1/c1_IR.hpp"
27 #include "c1/c1_Instruction.hpp"
28 #include "c1/c1_InstructionPrinter.hpp"
29 #include "c1/c1_ValueStack.hpp"
30 #include "ci/ciObjArrayKlass.hpp"
31 #include "ci/ciTypeArrayKlass.hpp"
32 #include "utilities/bitMap.inline.hpp"
33
34
35 // Implementation of Instruction
36
37
38 int Instruction::dominator_depth() {
39 int result = -1;
40 if (block()) {
41 result = block()->dominator_depth();
42 }
43 assert(result != -1 || this->as_Local(), "Only locals have dominator depth -1");
44 return result;
45 }
46
47 Instruction::Condition Instruction::mirror(Condition cond) {
48 switch (cond) {
49 case eql: return eql;
89 Instruction* p = NULL;
90 Instruction* q = block();
91 while (q != this) {
92 assert(q != NULL, "this is not in the block's instruction list");
93 p = q; q = q->next();
94 }
95 return p;
96 }
97
98
99 void Instruction::state_values_do(ValueVisitor* f) {
100 if (state_before() != NULL) {
101 state_before()->values_do(f);
102 }
103 if (exception_state() != NULL){
104 exception_state()->values_do(f);
105 }
106 }
107
108 ciType* Instruction::exact_type() const {
109 ciType* t = declared_type();
110 if (t != NULL && t->is_klass()) {
111 return t->as_klass()->exact_klass();
112 }
113 return NULL;
114 }
115
116
117 #ifndef PRODUCT
118 void Instruction::check_state(ValueStack* state) {
119 if (state != NULL) {
120 state->verify();
121 }
122 }
123
124
125 void Instruction::print() {
126 InstructionPrinter ip;
127 print(ip);
128 }
129
130
131 void Instruction::print_line() {
132 InstructionPrinter ip;
133 ip.print_line(this);
134 }
135
156 }
157 }
158
159 if (!this->check_flag(NeedsRangeCheckFlag)) {
160 return false;
161 }
162
163 return true;
164 }
165
166
167 ciType* Constant::exact_type() const {
168 if (type()->is_object() && type()->as_ObjectType()->is_loaded()) {
169 return type()->as_ObjectType()->exact_type();
170 }
171 return NULL;
172 }
173
174 ciType* LoadIndexed::exact_type() const {
175 ciType* array_type = array()->exact_type();
176 if (array_type != NULL) {
177 assert(array_type->is_array_klass(), "what else?");
178 ciArrayKlass* ak = (ciArrayKlass*)array_type;
179
180 if (ak->element_type()->is_instance_klass()) {
181 ciInstanceKlass* ik = (ciInstanceKlass*)ak->element_type();
182 if (ik->is_loaded() && ik->is_final()) {
183 return ik;
184 }
185 }
186 }
187 return Instruction::exact_type();
188 }
189
190
191 ciType* LoadIndexed::declared_type() const {
192 ciType* array_type = array()->declared_type();
193 if (array_type == NULL || !array_type->is_loaded()) {
194 return NULL;
195 }
196 assert(array_type->is_array_klass(), "what else?");
197 ciArrayKlass* ak = (ciArrayKlass*)array_type;
198 return ak->element_type();
199 }
200
201
202 ciType* LoadField::declared_type() const {
203 return field()->type();
204 }
205
206
207 ciType* NewTypeArray::exact_type() const {
208 return ciTypeArrayKlass::make(elt_type());
209 }
210
211 ciType* NewObjectArray::exact_type() const {
212 return ciObjArrayKlass::make(klass());
213 }
214
215 ciType* NewArray::declared_type() const {
216 return exact_type();
217 }
218
219 ciType* NewInstance::exact_type() const {
220 return klass();
221 }
222
223 ciType* NewInstance::declared_type() const {
224 return exact_type();
225 }
226
227 ciType* CheckCast::declared_type() const {
228 return klass();
229 }
230
231 // Implementation of ArithmeticOp
232
233 bool ArithmeticOp::is_commutative() const {
234 switch (op()) {
235 case Bytecodes::_iadd: // fall through
236 case Bytecodes::_ladd: // fall through
237 case Bytecodes::_fadd: // fall through
238 case Bytecodes::_dadd: // fall through
239 case Bytecodes::_imul: // fall through
240 case Bytecodes::_lmul: // fall through
241 case Bytecodes::_fmul: // fall through
242 case Bytecodes::_dmul: return true;
243 default : return false;
244 }
245 }
246
302 }
303
304
305 void StateSplit::state_values_do(ValueVisitor* f) {
306 Instruction::state_values_do(f);
307 if (state() != NULL) state()->values_do(f);
308 }
309
310
311 void BlockBegin::state_values_do(ValueVisitor* f) {
312 StateSplit::state_values_do(f);
313
314 if (is_set(BlockBegin::exception_entry_flag)) {
315 for (int i = 0; i < number_of_exception_states(); i++) {
316 exception_state_at(i)->values_do(f);
317 }
318 }
319 }
320
321
322 // Implementation of Invoke
323
324
325 Invoke::Invoke(Bytecodes::Code code, ValueType* result_type, Value recv, Values* args,
326 ciMethod* target, ValueStack* state_before)
327 : StateSplit(result_type, state_before)
328 , _code(code)
329 , _recv(recv)
330 , _args(args)
331 , _target(target)
332 {
333 set_flag(TargetIsLoadedFlag, target->is_loaded());
334 set_flag(TargetIsFinalFlag, target_is_loaded() && target->is_final_method());
335
336 assert(args != NULL, "args must exist");
337 #ifdef ASSERT
338 AssertValues assert_value;
339 values_do(&assert_value);
340 #endif
341
342 // provide an initial guess of signature size.
343 _signature = new BasicTypeList(number_of_arguments() + (has_receiver() ? 1 : 0));
344 if (has_receiver()) {
345 _signature->append(as_BasicType(receiver()->type()));
346 }
347 for (int i = 0; i < number_of_arguments(); i++) {
348 ValueType* t = argument_at(i)->type();
349 BasicType bt = as_BasicType(t);
350 _signature->append(bt);
351 }
352 }
353
354
355 void Invoke::state_values_do(ValueVisitor* f) {
356 StateSplit::state_values_do(f);
357 if (state_before() != NULL) state_before()->values_do(f);
358 if (state() != NULL) state()->values_do(f);
359 }
360
361 ciType* Invoke::declared_type() const {
362 ciSignature* declared_signature = state()->scope()->method()->get_declared_signature_at_bci(state()->bci());
363 ciType *t = declared_signature->return_type();
364 assert(t->basic_type() != T_VOID, "need return value of void method?");
365 return t;
366 }
367
368 // Implementation of Constant
369 intx Constant::hash() const {
370 if (state_before() == NULL) {
812 // check that all necessary phi functions are present
813 for_each_stack_value(existing_state, index, existing_value) {
814 assert(existing_value->as_Phi() != NULL && existing_value->as_Phi()->block() == this, "phi function required");
815 }
816 for_each_local_value(existing_state, index, existing_value) {
817 assert(existing_value == new_state->local_at(index) || (existing_value->as_Phi() != NULL && existing_value->as_Phi()->as_Phi()->block() == this), "phi function required");
818 }
819 #endif
820
821 } else {
822 TRACE_PHI(tty->print_cr("creating phi functions on demand"));
823
824 // create necessary phi functions for stack
825 for_each_stack_value(existing_state, index, existing_value) {
826 Value new_value = new_state->stack_at(index);
827 Phi* existing_phi = existing_value->as_Phi();
828
829 if (new_value != existing_value && (existing_phi == NULL || existing_phi->block() != this)) {
830 existing_state->setup_phi_for_stack(this, index);
831 TRACE_PHI(tty->print_cr("creating phi-function %c%d for stack %d", existing_state->stack_at(index)->type()->tchar(), existing_state->stack_at(index)->id(), index));
832 }
833 }
834
835 // create necessary phi functions for locals
836 for_each_local_value(existing_state, index, existing_value) {
837 Value new_value = new_state->local_at(index);
838 Phi* existing_phi = existing_value->as_Phi();
839
840 if (new_value == NULL || new_value->type()->tag() != existing_value->type()->tag()) {
841 existing_state->invalidate_local(index);
842 TRACE_PHI(tty->print_cr("invalidating local %d because of type mismatch", index));
843 } else if (new_value != existing_value && (existing_phi == NULL || existing_phi->block() != this)) {
844 existing_state->setup_phi_for_local(this, index);
845 TRACE_PHI(tty->print_cr("creating phi-function %c%d for local %d", existing_state->local_at(index)->type()->tchar(), existing_state->local_at(index)->id(), index));
846 }
847 }
848 }
849
850 assert(existing_state->caller_state() == new_state->caller_state(), "caller states must be equal");
851
852 } else {
853 assert(false, "stack or locks not matching (invalid bytecodes)");
854 return false;
855 }
856
857 TRACE_PHI(tty->print_cr("********** try_merge for block B%d successful", block_id()));
858
859 return true;
860 }
861
862
863 #ifndef PRODUCT
864 void BlockBegin::print_block() {
865 InstructionPrinter ip;
971 ip1.print_instr(x);
972
973 stringStream strStream2;
974 InstructionPrinter ip2(1, &strStream2);
975 ip2.print_instr(y);
976
977 stringStream ss;
978 ss.print("Assertion %s %s %s in method %s", strStream1.freeze(), ip2.cond_name(cond), strStream2.freeze(), strStream.freeze());
979
980 _message = ss.as_string();
981 }
982 #endif
983
984 void RangeCheckPredicate::check_state() {
985 assert(state()->kind() != ValueStack::EmptyExceptionState && state()->kind() != ValueStack::ExceptionState, "will deopt with empty state");
986 }
987
988 void ProfileInvoke::state_values_do(ValueVisitor* f) {
989 if (state() != NULL) state()->values_do(f);
990 }
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "c1/c1_IR.hpp"
27 #include "c1/c1_Instruction.hpp"
28 #include "c1/c1_InstructionPrinter.hpp"
29 #include "c1/c1_ValueStack.hpp"
30 #include "ci/ciFlatArrayKlass.hpp"
31 #include "ci/ciInlineKlass.hpp"
32 #include "ci/ciObjArrayKlass.hpp"
33 #include "ci/ciTypeArrayKlass.hpp"
34 #include "utilities/bitMap.inline.hpp"
35
36
37 // Implementation of Instruction
38
39
40 int Instruction::dominator_depth() {
41 int result = -1;
42 if (block()) {
43 result = block()->dominator_depth();
44 }
45 assert(result != -1 || this->as_Local(), "Only locals have dominator depth -1");
46 return result;
47 }
48
49 Instruction::Condition Instruction::mirror(Condition cond) {
50 switch (cond) {
51 case eql: return eql;
91 Instruction* p = NULL;
92 Instruction* q = block();
93 while (q != this) {
94 assert(q != NULL, "this is not in the block's instruction list");
95 p = q; q = q->next();
96 }
97 return p;
98 }
99
100
101 void Instruction::state_values_do(ValueVisitor* f) {
102 if (state_before() != NULL) {
103 state_before()->values_do(f);
104 }
105 if (exception_state() != NULL){
106 exception_state()->values_do(f);
107 }
108 }
109
110 ciType* Instruction::exact_type() const {
111 ciType* t = declared_type();
112 if (t != NULL && t->is_klass()) {
113 return t->as_klass()->exact_klass();
114 }
115 return NULL;
116 }
117
118 ciKlass* Instruction::as_loaded_klass_or_null() const {
119 ciType* type = declared_type();
120 if (type != NULL && type->is_klass()) {
121 ciKlass* klass = type->as_klass();
122 if (klass->is_loaded()) {
123 return klass;
124 }
125 }
126 return NULL;
127 }
128
129 bool Instruction::is_loaded_flattened_array() const {
130 if (UseFlatArray) {
131 ciType* type = declared_type();
132 return type != NULL && type->is_flat_array_klass();
133 }
134 return false;
135 }
136
137 bool Instruction::maybe_flattened_array() {
138 if (UseFlatArray) {
139 ciType* type = declared_type();
140 if (type != NULL) {
141 if (type->is_obj_array_klass() && !type->as_obj_array_klass()->is_elem_null_free()) {
142 // The runtime type of [LMyValue might be [QMyValue due to [QMyValue <: [LMyValue.
143 ciKlass* element_klass = type->as_obj_array_klass()->element_klass();
144 if (element_klass->can_be_inline_klass() && (!element_klass->is_inlinetype() || element_klass->as_inline_klass()->flatten_array())) {
145 return true;
146 }
147 } else if (type->is_flat_array_klass()) {
148 return true;
149 } else if (type->is_klass() && type->as_klass()->is_java_lang_Object()) {
150 // This can happen as a parameter to System.arraycopy()
151 return true;
152 }
153 } else {
154 // Type info gets lost during Phi merging (Phi, IfOp, etc), but we might be storing into a
155 // flattened array, so we should do a runtime check.
156 return true;
157 }
158 }
159 return false;
160 }
161
162 bool Instruction::maybe_null_free_array() {
163 ciType* type = declared_type();
164 if (type != NULL) {
165 if (type->is_obj_array_klass()) {
166 // Due to array covariance, the runtime type might be a null-free array.
167 if (type->as_obj_array_klass()->can_be_inline_array_klass()) {
168 return true;
169 }
170 }
171 } else {
172 // Type info gets lost during Phi merging (Phi, IfOp, etc), but we might be storing into a
173 // null-free array, so we should do a runtime check.
174 return true;
175 }
176 return false;
177 }
178
179 #ifndef PRODUCT
180 void Instruction::check_state(ValueStack* state) {
181 if (state != NULL) {
182 state->verify();
183 }
184 }
185
186
187 void Instruction::print() {
188 InstructionPrinter ip;
189 print(ip);
190 }
191
192
193 void Instruction::print_line() {
194 InstructionPrinter ip;
195 ip.print_line(this);
196 }
197
218 }
219 }
220
221 if (!this->check_flag(NeedsRangeCheckFlag)) {
222 return false;
223 }
224
225 return true;
226 }
227
228
229 ciType* Constant::exact_type() const {
230 if (type()->is_object() && type()->as_ObjectType()->is_loaded()) {
231 return type()->as_ObjectType()->exact_type();
232 }
233 return NULL;
234 }
235
236 ciType* LoadIndexed::exact_type() const {
237 ciType* array_type = array()->exact_type();
238 if (delayed() == NULL && array_type != NULL) {
239 assert(array_type->is_array_klass(), "what else?");
240 ciArrayKlass* ak = (ciArrayKlass*)array_type;
241
242 if (ak->element_type()->is_instance_klass()) {
243 ciInstanceKlass* ik = (ciInstanceKlass*)ak->element_type();
244 if (ik->is_loaded() && ik->is_final()) {
245 return ik;
246 }
247 }
248 }
249 return Instruction::exact_type();
250 }
251
252 ciType* LoadIndexed::declared_type() const {
253 if (delayed() != NULL) {
254 return delayed()->field()->type();
255 }
256 ciType* array_type = array()->declared_type();
257 if (array_type == NULL || !array_type->is_loaded()) {
258 return NULL;
259 }
260 assert(array_type->is_array_klass(), "what else?");
261 ciArrayKlass* ak = (ciArrayKlass*)array_type;
262 return ak->element_type();
263 }
264
265 bool StoreIndexed::is_exact_flattened_array_store() const {
266 if (array()->is_loaded_flattened_array() && value()->as_Constant() == NULL && value()->declared_type() != NULL) {
267 ciKlass* element_klass = array()->declared_type()->as_flat_array_klass()->element_klass();
268 ciKlass* actual_klass = value()->declared_type()->as_klass();
269
270 // The following check can fail with inlining:
271 // void test45_inline(Object[] oa, Object o, int index) { oa[index] = o; }
272 // void test45(MyValue1[] va, int index, MyValue2 v) { test45_inline(va, v, index); }
273 if (element_klass == actual_klass) {
274 return true;
275 }
276 }
277 return false;
278 }
279
280 ciType* LoadField::declared_type() const {
281 return field()->type();
282 }
283
284
285 ciType* NewTypeArray::exact_type() const {
286 return ciTypeArrayKlass::make(elt_type());
287 }
288
289 ciType* NewObjectArray::exact_type() const {
290 return ciArrayKlass::make(klass(), is_null_free());
291 }
292
293 ciType* NewMultiArray::exact_type() const {
294 return _klass;
295 }
296
297 ciType* NewArray::declared_type() const {
298 return exact_type();
299 }
300
301 ciType* NewInstance::exact_type() const {
302 return klass();
303 }
304
305 ciType* NewInstance::declared_type() const {
306 return exact_type();
307 }
308
309 ciType* NewInlineTypeInstance::exact_type() const {
310 return klass();
311 }
312
313 ciType* NewInlineTypeInstance::declared_type() const {
314 return exact_type();
315 }
316
317 ciType* CheckCast::declared_type() const {
318 return klass();
319 }
320
321 // Implementation of ArithmeticOp
322
323 bool ArithmeticOp::is_commutative() const {
324 switch (op()) {
325 case Bytecodes::_iadd: // fall through
326 case Bytecodes::_ladd: // fall through
327 case Bytecodes::_fadd: // fall through
328 case Bytecodes::_dadd: // fall through
329 case Bytecodes::_imul: // fall through
330 case Bytecodes::_lmul: // fall through
331 case Bytecodes::_fmul: // fall through
332 case Bytecodes::_dmul: return true;
333 default : return false;
334 }
335 }
336
392 }
393
394
395 void StateSplit::state_values_do(ValueVisitor* f) {
396 Instruction::state_values_do(f);
397 if (state() != NULL) state()->values_do(f);
398 }
399
400
401 void BlockBegin::state_values_do(ValueVisitor* f) {
402 StateSplit::state_values_do(f);
403
404 if (is_set(BlockBegin::exception_entry_flag)) {
405 for (int i = 0; i < number_of_exception_states(); i++) {
406 exception_state_at(i)->values_do(f);
407 }
408 }
409 }
410
411
412 StoreField::StoreField(Value obj, int offset, ciField* field, Value value, bool is_static,
413 ValueStack* state_before, bool needs_patching)
414 : AccessField(obj, offset, field, is_static, state_before, needs_patching)
415 , _value(value)
416 , _enclosing_field(NULL)
417 {
418 set_flag(NeedsWriteBarrierFlag, as_ValueType(field_type())->is_object());
419 #ifdef ASSERT
420 AssertValues assert_value;
421 values_do(&assert_value);
422 #endif
423 pin();
424 if (value->as_NewInlineTypeInstance() != NULL) {
425 value->as_NewInlineTypeInstance()->set_not_larva_anymore();
426 }
427 }
428
429 StoreIndexed::StoreIndexed(Value array, Value index, Value length, BasicType elt_type, Value value,
430 ValueStack* state_before, bool check_boolean, bool mismatched)
431 : AccessIndexed(array, index, length, elt_type, state_before, mismatched)
432 , _value(value), _check_boolean(check_boolean)
433 {
434 set_flag(NeedsWriteBarrierFlag, (as_ValueType(elt_type)->is_object()));
435 set_flag(NeedsStoreCheckFlag, (as_ValueType(elt_type)->is_object()));
436 #ifdef ASSERT
437 AssertValues assert_value;
438 values_do(&assert_value);
439 #endif
440 pin();
441 if (value->as_NewInlineTypeInstance() != NULL) {
442 value->as_NewInlineTypeInstance()->set_not_larva_anymore();
443 }
444 }
445
446
447 // Implementation of Invoke
448
449
450 Invoke::Invoke(Bytecodes::Code code, ValueType* result_type, Value recv, Values* args,
451 ciMethod* target, ValueStack* state_before, bool null_free)
452 : StateSplit(result_type, state_before)
453 , _code(code)
454 , _recv(recv)
455 , _args(args)
456 , _target(target)
457 {
458 set_flag(TargetIsLoadedFlag, target->is_loaded());
459 set_flag(TargetIsFinalFlag, target_is_loaded() && target->is_final_method());
460 set_null_free(null_free);
461
462 assert(args != NULL, "args must exist");
463 #ifdef ASSERT
464 AssertValues assert_value;
465 values_do(&assert_value);
466 #endif
467
468 // provide an initial guess of signature size.
469 _signature = new BasicTypeList(number_of_arguments() + (has_receiver() ? 1 : 0));
470 if (has_receiver()) {
471 _signature->append(as_BasicType(receiver()->type()));
472 if (receiver()->as_NewInlineTypeInstance() != NULL) {
473 receiver()->as_NewInlineTypeInstance()->set_not_larva_anymore();
474 }
475 }
476 for (int i = 0; i < number_of_arguments(); i++) {
477 Value v = argument_at(i);
478 ValueType* t = v->type();
479 BasicType bt = as_BasicType(t);
480 _signature->append(bt);
481 if (v->as_NewInlineTypeInstance() != NULL) {
482 v->as_NewInlineTypeInstance()->set_not_larva_anymore();
483 }
484 }
485 }
486
487
488 void Invoke::state_values_do(ValueVisitor* f) {
489 StateSplit::state_values_do(f);
490 if (state_before() != NULL) state_before()->values_do(f);
491 if (state() != NULL) state()->values_do(f);
492 }
493
494 ciType* Invoke::declared_type() const {
495 ciSignature* declared_signature = state()->scope()->method()->get_declared_signature_at_bci(state()->bci());
496 ciType *t = declared_signature->return_type();
497 assert(t->basic_type() != T_VOID, "need return value of void method?");
498 return t;
499 }
500
501 // Implementation of Constant
502 intx Constant::hash() const {
503 if (state_before() == NULL) {
945 // check that all necessary phi functions are present
946 for_each_stack_value(existing_state, index, existing_value) {
947 assert(existing_value->as_Phi() != NULL && existing_value->as_Phi()->block() == this, "phi function required");
948 }
949 for_each_local_value(existing_state, index, existing_value) {
950 assert(existing_value == new_state->local_at(index) || (existing_value->as_Phi() != NULL && existing_value->as_Phi()->as_Phi()->block() == this), "phi function required");
951 }
952 #endif
953
954 } else {
955 TRACE_PHI(tty->print_cr("creating phi functions on demand"));
956
957 // create necessary phi functions for stack
958 for_each_stack_value(existing_state, index, existing_value) {
959 Value new_value = new_state->stack_at(index);
960 Phi* existing_phi = existing_value->as_Phi();
961
962 if (new_value != existing_value && (existing_phi == NULL || existing_phi->block() != this)) {
963 existing_state->setup_phi_for_stack(this, index);
964 TRACE_PHI(tty->print_cr("creating phi-function %c%d for stack %d", existing_state->stack_at(index)->type()->tchar(), existing_state->stack_at(index)->id(), index));
965 if (new_value->as_NewInlineTypeInstance() != NULL) {new_value->as_NewInlineTypeInstance()->set_not_larva_anymore(); }
966 if (existing_value->as_NewInlineTypeInstance() != NULL) {existing_value->as_NewInlineTypeInstance()->set_not_larva_anymore(); }
967 }
968 }
969
970 // create necessary phi functions for locals
971 for_each_local_value(existing_state, index, existing_value) {
972 Value new_value = new_state->local_at(index);
973 Phi* existing_phi = existing_value->as_Phi();
974
975 if (new_value == NULL || new_value->type()->tag() != existing_value->type()->tag()) {
976 existing_state->invalidate_local(index);
977 TRACE_PHI(tty->print_cr("invalidating local %d because of type mismatch", index));
978 } else if (new_value != existing_value && (existing_phi == NULL || existing_phi->block() != this)) {
979 existing_state->setup_phi_for_local(this, index);
980 TRACE_PHI(tty->print_cr("creating phi-function %c%d for local %d", existing_state->local_at(index)->type()->tchar(), existing_state->local_at(index)->id(), index));
981 if (new_value->as_NewInlineTypeInstance() != NULL) {new_value->as_NewInlineTypeInstance()->set_not_larva_anymore(); }
982 if (existing_value->as_NewInlineTypeInstance() != NULL) {existing_value->as_NewInlineTypeInstance()->set_not_larva_anymore(); }
983 }
984 }
985 }
986
987 assert(existing_state->caller_state() == new_state->caller_state(), "caller states must be equal");
988
989 } else {
990 assert(false, "stack or locks not matching (invalid bytecodes)");
991 return false;
992 }
993
994 TRACE_PHI(tty->print_cr("********** try_merge for block B%d successful", block_id()));
995
996 return true;
997 }
998
999
1000 #ifndef PRODUCT
1001 void BlockBegin::print_block() {
1002 InstructionPrinter ip;
1108 ip1.print_instr(x);
1109
1110 stringStream strStream2;
1111 InstructionPrinter ip2(1, &strStream2);
1112 ip2.print_instr(y);
1113
1114 stringStream ss;
1115 ss.print("Assertion %s %s %s in method %s", strStream1.freeze(), ip2.cond_name(cond), strStream2.freeze(), strStream.freeze());
1116
1117 _message = ss.as_string();
1118 }
1119 #endif
1120
1121 void RangeCheckPredicate::check_state() {
1122 assert(state()->kind() != ValueStack::EmptyExceptionState && state()->kind() != ValueStack::ExceptionState, "will deopt with empty state");
1123 }
1124
1125 void ProfileInvoke::state_values_do(ValueVisitor* f) {
1126 if (state() != NULL) state()->values_do(f);
1127 }
1128
|