1566 push(type, append(new LoadField(append(obj), offset, field, true,
1567 state_before, needs_patching)));
1568 }
1569 break;
1570 }
1571 case Bytecodes::_putstatic:
1572 { Value val = pop(type);
1573 if (state_before == NULL) {
1574 state_before = copy_state_for_exception();
1575 }
1576 append(new StoreField(append(obj), offset, field, val, true, state_before, needs_patching));
1577 }
1578 break;
1579 case Bytecodes::_getfield: {
1580 // Check for compile-time constants, i.e., trusted final non-static fields.
1581 Instruction* constant = NULL;
1582 obj = apop();
1583 ObjectType* obj_type = obj->type()->as_ObjectType();
1584 if (obj_type->is_constant() && !PatchALot) {
1585 ciObject* const_oop = obj_type->constant_value();
1586 if (!const_oop->is_null_object()) {
1587 if (field->is_constant()) {
1588 ciConstant field_val = field->constant_value_of(const_oop);
1589 BasicType field_type = field_val.basic_type();
1590 switch (field_type) {
1591 case T_ARRAY:
1592 case T_OBJECT:
1593 if (field_val.as_object()->should_be_constant()) {
1594 constant = new Constant(as_ValueType(field_val));
1595 }
1596 break;
1597 default:
1598 constant = new Constant(as_ValueType(field_val));
1599 }
1600 } else {
1601 // For CallSite objects treat the target field as a compile time constant.
1602 if (const_oop->is_call_site()) {
1603 ciCallSite* call_site = const_oop->as_call_site();
1604 if (field->is_call_site_target()) {
1605 ciMethodHandle* target = call_site->get_target();
1606 if (target != NULL) { // just in case
|
1566 push(type, append(new LoadField(append(obj), offset, field, true,
1567 state_before, needs_patching)));
1568 }
1569 break;
1570 }
1571 case Bytecodes::_putstatic:
1572 { Value val = pop(type);
1573 if (state_before == NULL) {
1574 state_before = copy_state_for_exception();
1575 }
1576 append(new StoreField(append(obj), offset, field, val, true, state_before, needs_patching));
1577 }
1578 break;
1579 case Bytecodes::_getfield: {
1580 // Check for compile-time constants, i.e., trusted final non-static fields.
1581 Instruction* constant = NULL;
1582 obj = apop();
1583 ObjectType* obj_type = obj->type()->as_ObjectType();
1584 if (obj_type->is_constant() && !PatchALot) {
1585 ciObject* const_oop = obj_type->constant_value();
1586 if (!const_oop->is_null_object() && const_oop->is_loaded()) {
1587 if (field->is_constant()) {
1588 ciConstant field_val = field->constant_value_of(const_oop);
1589 BasicType field_type = field_val.basic_type();
1590 switch (field_type) {
1591 case T_ARRAY:
1592 case T_OBJECT:
1593 if (field_val.as_object()->should_be_constant()) {
1594 constant = new Constant(as_ValueType(field_val));
1595 }
1596 break;
1597 default:
1598 constant = new Constant(as_ValueType(field_val));
1599 }
1600 } else {
1601 // For CallSite objects treat the target field as a compile time constant.
1602 if (const_oop->is_call_site()) {
1603 ciCallSite* call_site = const_oop->as_call_site();
1604 if (field->is_call_site_target()) {
1605 ciMethodHandle* target = call_site->get_target();
1606 if (target != NULL) { // just in case
|