1699
1700 const int offset = !needs_patching ? field->offset() : -1;
1701 switch (code) {
1702 case Bytecodes::_getstatic: {
1703 // check for compile-time constants, i.e., initialized static final fields
1704 Value constant = NULL;
1705 if (field->is_static_constant() && !PatchALot) {
1706 ciConstant field_value = field->constant_value();
1707 assert(!field->is_stable() || !field_value.is_null_or_zero(),
1708 "stable static w/ default value shouldn't be a constant");
1709 constant = make_constant(field_value, field);
1710 }
1711 if (constant != NULL) {
1712 push(type, append(constant));
1713 } else {
1714 if (state_before == NULL) {
1715 state_before = copy_state_for_exception();
1716 }
1717 LoadField* load_field = new LoadField(append(obj), offset, field, true,
1718 state_before, needs_patching);
1719 if (field->is_q_type()) {
1720 load_field->set_never_null(true);
1721 }
1722 push(type, append(load_field));
1723 }
1724 break;
1725 }
1726 case Bytecodes::_putstatic: {
1727 Value val = pop(type);
1728 if (state_before == NULL) {
1729 state_before = copy_state_for_exception();
1730 }
1731 if (field->type()->basic_type() == T_BOOLEAN) {
1732 Value mask = append(new Constant(new IntConstant(1)));
1733 val = append(new LogicOp(Bytecodes::_iand, val, mask));
1734 }
1735 append(new StoreField(append(obj), offset, field, val, true, state_before, needs_patching));
1736 break;
1737 }
1738 case Bytecodes::_getfield: {
1739 // Check for compile-time constants, i.e., trusted final non-static fields.
|
1699
1700 const int offset = !needs_patching ? field->offset() : -1;
1701 switch (code) {
1702 case Bytecodes::_getstatic: {
1703 // check for compile-time constants, i.e., initialized static final fields
1704 Value constant = NULL;
1705 if (field->is_static_constant() && !PatchALot) {
1706 ciConstant field_value = field->constant_value();
1707 assert(!field->is_stable() || !field_value.is_null_or_zero(),
1708 "stable static w/ default value shouldn't be a constant");
1709 constant = make_constant(field_value, field);
1710 }
1711 if (constant != NULL) {
1712 push(type, append(constant));
1713 } else {
1714 if (state_before == NULL) {
1715 state_before = copy_state_for_exception();
1716 }
1717 LoadField* load_field = new LoadField(append(obj), offset, field, true,
1718 state_before, needs_patching);
1719 if (field->is_flattenable()) {
1720 load_field->set_never_null(true);
1721 }
1722 push(type, append(load_field));
1723 }
1724 break;
1725 }
1726 case Bytecodes::_putstatic: {
1727 Value val = pop(type);
1728 if (state_before == NULL) {
1729 state_before = copy_state_for_exception();
1730 }
1731 if (field->type()->basic_type() == T_BOOLEAN) {
1732 Value mask = append(new Constant(new IntConstant(1)));
1733 val = append(new LogicOp(Bytecodes::_iand, val, mask));
1734 }
1735 append(new StoreField(append(obj), offset, field, val, true, state_before, needs_patching));
1736 break;
1737 }
1738 case Bytecodes::_getfield: {
1739 // Check for compile-time constants, i.e., trusted final non-static fields.
|