1567 Instruction* constant = NULL; |
1567 Instruction* constant = NULL; |
1568 obj = apop(); |
1568 obj = apop(); |
1569 ObjectType* obj_type = obj->type()->as_ObjectType(); |
1569 ObjectType* obj_type = obj->type()->as_ObjectType(); |
1570 if (obj_type->is_constant() && !PatchALot) { |
1570 if (obj_type->is_constant() && !PatchALot) { |
1571 ciObject* const_oop = obj_type->constant_value(); |
1571 ciObject* const_oop = obj_type->constant_value(); |
1572 if (field->is_constant()) { |
1572 if (!const_oop->is_null_object()) { |
1573 ciConstant field_val = field->constant_value_of(const_oop); |
1573 if (field->is_constant()) { |
1574 BasicType field_type = field_val.basic_type(); |
1574 ciConstant field_val = field->constant_value_of(const_oop); |
1575 switch (field_type) { |
1575 BasicType field_type = field_val.basic_type(); |
1576 case T_ARRAY: |
1576 switch (field_type) { |
1577 case T_OBJECT: |
1577 case T_ARRAY: |
1578 if (field_val.as_object()->should_be_constant()) { |
1578 case T_OBJECT: |
|
1579 if (field_val.as_object()->should_be_constant()) { |
|
1580 constant = new Constant(as_ValueType(field_val)); |
|
1581 } |
|
1582 break; |
|
1583 default: |
1579 constant = new Constant(as_ValueType(field_val)); |
1584 constant = new Constant(as_ValueType(field_val)); |
1580 } |
1585 } |
1581 break; |
1586 } else { |
1582 default: |
1587 // For CallSite objects treat the target field as a compile time constant. |
1583 constant = new Constant(as_ValueType(field_val)); |
1588 if (const_oop->is_call_site()) { |
1584 } |
1589 ciCallSite* call_site = const_oop->as_call_site(); |
1585 } else { |
1590 if (field->is_call_site_target()) { |
1586 // For constant CallSites treat the target field as a compile time constant. |
1591 ciMethodHandle* target = call_site->get_target(); |
1587 if (const_oop->is_call_site()) { |
1592 if (target != NULL) { // just in case |
1588 ciCallSite* call_site = const_oop->as_call_site(); |
1593 ciConstant field_val(T_OBJECT, target); |
1589 if (field->is_call_site_target()) { |
1594 constant = new Constant(as_ValueType(field_val)); |
1590 ciMethodHandle* target = call_site->get_target(); |
1595 // Add a dependence for invalidation of the optimization. |
1591 if (target != NULL) { // just in case |
1596 if (!call_site->is_constant_call_site()) { |
1592 ciConstant field_val(T_OBJECT, target); |
1597 dependency_recorder()->assert_call_site_target_value(call_site, target); |
1593 constant = new Constant(as_ValueType(field_val)); |
1598 } |
1594 // Add a dependence for invalidation of the optimization. |
|
1595 if (!call_site->is_constant_call_site()) { |
|
1596 dependency_recorder()->assert_call_site_target_value(call_site, target); |
|
1597 } |
1599 } |
1598 } |
1600 } |
1599 } |
1601 } |
1600 } |
1602 } |
1601 } |
1603 } |