108 --_sp; // pop receiver before getting
109 do_get_xxx(tjp, obj, field, is_field);
110 } else {
111 do_put_xxx(tjp, obj, field, is_field);
112 --_sp; // pop receiver after putting
113 }
114 } else {
115 const TypeKlassPtr* tkp = TypeKlassPtr::make(field_holder);
116 obj = _gvn.makecon(tkp);
117 if (is_get) {
118 do_get_xxx(tkp, obj, field, is_field);
119 } else {
120 do_put_xxx(tkp, obj, field, is_field);
121 }
122 }
123 }
124
125
126 void Parse::do_get_xxx(const TypePtr* obj_type, Node* obj, ciField* field, bool is_field) {
127 // Does this field have a constant value? If so, just push the value.
128 if (field->is_constant() && push_constant(field->constant_value())) return;
129
130 ciType* field_klass = field->type();
131 bool is_vol = field->is_volatile();
132
133 // Compute address and memory type.
134 int offset = field->offset_in_bytes();
135 const TypePtr* adr_type = C->alias_type(field)->adr_type();
136 Node *adr = basic_plus_adr(obj, obj, offset);
137 BasicType bt = field->layout_type();
138
139 // Build the resultant type of the load
140 const Type *type;
141
142 bool must_assert_null = false;
143
144 if( bt == T_OBJECT ) {
145 if (!field->type()->is_loaded()) {
146 type = TypeInstPtr::BOTTOM;
147 must_assert_null = true;
148 } else if (field->is_constant()) {
149 // This can happen if the constant oop is non-perm.
150 ciObject* con = field->constant_value().as_object();
151 // Do not "join" in the previous type; it doesn't add value,
152 // and may yield a vacuous result if the field is of interface type.
153 type = TypeOopPtr::make_from_constant(con)->isa_oopptr();
154 assert(type != NULL, "field singleton type must be consistent");
155 } else {
156 type = TypeOopPtr::make_from_klass(field_klass->as_klass());
157 }
158 } else {
159 type = Type::get_const_basic_type(bt);
160 }
161 // Build the load.
162 Node* ld = make_load(NULL, adr, type, bt, adr_type, is_vol);
163
164 // Adjust Java stack
165 if (type2size[bt] == 1)
166 push(ld);
167 else
168 push_pair(ld);
|
108 --_sp; // pop receiver before getting
109 do_get_xxx(tjp, obj, field, is_field);
110 } else {
111 do_put_xxx(tjp, obj, field, is_field);
112 --_sp; // pop receiver after putting
113 }
114 } else {
115 const TypeKlassPtr* tkp = TypeKlassPtr::make(field_holder);
116 obj = _gvn.makecon(tkp);
117 if (is_get) {
118 do_get_xxx(tkp, obj, field, is_field);
119 } else {
120 do_put_xxx(tkp, obj, field, is_field);
121 }
122 }
123 }
124
125
126 void Parse::do_get_xxx(const TypePtr* obj_type, Node* obj, ciField* field, bool is_field) {
127 // Does this field have a constant value? If so, just push the value.
128 if (field->is_constant()) {
129 if (field->is_static()) {
130 // final static field
131 if (push_constant(field->constant_value()))
132 return;
133 }
134 else {
135 // final non-static field of a trusted class ({java,sun}.dyn
136 // classes).
137 if (obj->is_Con()) {
138 const TypeOopPtr* oop_ptr = obj->bottom_type()->isa_oopptr();
139 ciObject* constant_oop = oop_ptr->const_oop();
140 ciConstant constant = field->constant_value_of(constant_oop);
141
142 if (push_constant(constant, true))
143 return;
144 }
145 }
146 }
147
148 ciType* field_klass = field->type();
149 bool is_vol = field->is_volatile();
150
151 // Compute address and memory type.
152 int offset = field->offset_in_bytes();
153 const TypePtr* adr_type = C->alias_type(field)->adr_type();
154 Node *adr = basic_plus_adr(obj, obj, offset);
155 BasicType bt = field->layout_type();
156
157 // Build the resultant type of the load
158 const Type *type;
159
160 bool must_assert_null = false;
161
162 if( bt == T_OBJECT ) {
163 if (!field->type()->is_loaded()) {
164 type = TypeInstPtr::BOTTOM;
165 must_assert_null = true;
166 } else if (field->is_constant() && field->is_static()) {
167 // This can happen if the constant oop is non-perm.
168 ciObject* con = field->constant_value().as_object();
169 // Do not "join" in the previous type; it doesn't add value,
170 // and may yield a vacuous result if the field is of interface type.
171 type = TypeOopPtr::make_from_constant(con)->isa_oopptr();
172 assert(type != NULL, "field singleton type must be consistent");
173 } else {
174 type = TypeOopPtr::make_from_klass(field_klass->as_klass());
175 }
176 } else {
177 type = Type::get_const_basic_type(bt);
178 }
179 // Build the load.
180 Node* ld = make_load(NULL, adr, type, bt, adr_type, is_vol);
181
182 // Adjust Java stack
183 if (type2size[bt] == 1)
184 push(ld);
185 else
186 push_pair(ld);
|