Mercurial > hg > truffle
comparison src/share/vm/opto/type.cpp @ 2376:c7f3d0b4570f
7017732: move static fields into Class to prepare for perm gen removal
Reviewed-by: kvn, coleenp, twisti, stefank
author | never |
---|---|
date | Fri, 18 Mar 2011 16:00:34 -0700 |
parents | 83f08886981c |
children | 8c92982cbbc4 d2a62e0f25eb |
comparison
equal
deleted
inserted
replaced
2375:d673ef06fe96 | 2376:c7f3d0b4570f |
---|---|
30 #include "libadt/dict.hpp" | 30 #include "libadt/dict.hpp" |
31 #include "memory/gcLocker.hpp" | 31 #include "memory/gcLocker.hpp" |
32 #include "memory/oopFactory.hpp" | 32 #include "memory/oopFactory.hpp" |
33 #include "memory/resourceArea.hpp" | 33 #include "memory/resourceArea.hpp" |
34 #include "oops/instanceKlass.hpp" | 34 #include "oops/instanceKlass.hpp" |
35 #include "oops/instanceMirrorKlass.hpp" | |
35 #include "oops/klassKlass.hpp" | 36 #include "oops/klassKlass.hpp" |
36 #include "oops/objArrayKlass.hpp" | 37 #include "oops/objArrayKlass.hpp" |
37 #include "oops/typeArrayKlass.hpp" | 38 #include "oops/typeArrayKlass.hpp" |
38 #include "opto/matcher.hpp" | 39 #include "opto/matcher.hpp" |
39 #include "opto/node.hpp" | 40 #include "opto/node.hpp" |
2239 } else if (_offset == oopDesc::klass_offset_in_bytes()) { | 2240 } else if (_offset == oopDesc::klass_offset_in_bytes()) { |
2240 _is_ptr_to_narrowoop = true; | 2241 _is_ptr_to_narrowoop = true; |
2241 } else if (this->isa_aryptr()) { | 2242 } else if (this->isa_aryptr()) { |
2242 _is_ptr_to_narrowoop = (klass()->is_obj_array_klass() && | 2243 _is_ptr_to_narrowoop = (klass()->is_obj_array_klass() && |
2243 _offset != arrayOopDesc::length_offset_in_bytes()); | 2244 _offset != arrayOopDesc::length_offset_in_bytes()); |
2244 } else if (klass() == ciEnv::current()->Class_klass() && | |
2245 (_offset == java_lang_Class::klass_offset_in_bytes() || | |
2246 _offset == java_lang_Class::array_klass_offset_in_bytes())) { | |
2247 // Special hidden fields from the Class. | |
2248 assert(this->isa_instptr(), "must be an instance ptr."); | |
2249 _is_ptr_to_narrowoop = true; | |
2250 } else if (klass()->is_instance_klass()) { | 2245 } else if (klass()->is_instance_klass()) { |
2251 ciInstanceKlass* ik = klass()->as_instance_klass(); | 2246 ciInstanceKlass* ik = klass()->as_instance_klass(); |
2252 ciField* field = NULL; | 2247 ciField* field = NULL; |
2253 if (this->isa_klassptr()) { | 2248 if (this->isa_klassptr()) { |
2254 // Perm objects don't use compressed references, except for | 2249 // Perm objects don't use compressed references |
2255 // static fields which are currently compressed. | |
2256 field = ik->get_field_by_offset(_offset, true); | |
2257 if (field != NULL) { | |
2258 BasicType basic_elem_type = field->layout_type(); | |
2259 _is_ptr_to_narrowoop = (basic_elem_type == T_OBJECT || | |
2260 basic_elem_type == T_ARRAY); | |
2261 } | |
2262 } else if (_offset == OffsetBot || _offset == OffsetTop) { | 2250 } else if (_offset == OffsetBot || _offset == OffsetTop) { |
2263 // unsafe access | 2251 // unsafe access |
2264 _is_ptr_to_narrowoop = true; | 2252 _is_ptr_to_narrowoop = true; |
2265 } else { // exclude unsafe ops | 2253 } else { // exclude unsafe ops |
2266 assert(this->isa_instptr(), "must be an instance ptr."); | 2254 assert(this->isa_instptr(), "must be an instance ptr."); |
2267 // Field which contains a compressed oop references. | 2255 |
2268 field = ik->get_field_by_offset(_offset, false); | 2256 if (klass() == ciEnv::current()->Class_klass() && |
2269 if (field != NULL) { | 2257 (_offset == java_lang_Class::klass_offset_in_bytes() || |
2258 _offset == java_lang_Class::array_klass_offset_in_bytes())) { | |
2259 // Special hidden fields from the Class. | |
2260 assert(this->isa_instptr(), "must be an instance ptr."); | |
2261 _is_ptr_to_narrowoop = true; | |
2262 } else if (klass() == ciEnv::current()->Class_klass() && | |
2263 _offset >= instanceMirrorKlass::offset_of_static_fields()) { | |
2264 // Static fields | |
2265 assert(o != NULL, "must be constant"); | |
2266 ciInstanceKlass* k = o->as_instance()->java_lang_Class_klass()->as_instance_klass(); | |
2267 ciField* field = k->get_field_by_offset(_offset, true); | |
2268 assert(field != NULL, "missing field"); | |
2270 BasicType basic_elem_type = field->layout_type(); | 2269 BasicType basic_elem_type = field->layout_type(); |
2271 _is_ptr_to_narrowoop = (basic_elem_type == T_OBJECT || | 2270 _is_ptr_to_narrowoop = (basic_elem_type == T_OBJECT || |
2272 basic_elem_type == T_ARRAY); | 2271 basic_elem_type == T_ARRAY); |
2273 } else if (klass()->equals(ciEnv::current()->Object_klass())) { | |
2274 // Compile::find_alias_type() cast exactness on all types to verify | |
2275 // that it does not affect alias type. | |
2276 _is_ptr_to_narrowoop = true; | |
2277 } else { | 2272 } else { |
2278 // Type for the copy start in LibraryCallKit::inline_native_clone(). | 2273 // Instance fields which contains a compressed oop references. |
2279 assert(!klass_is_exact(), "only non-exact klass"); | 2274 field = ik->get_field_by_offset(_offset, false); |
2280 _is_ptr_to_narrowoop = true; | 2275 if (field != NULL) { |
2276 BasicType basic_elem_type = field->layout_type(); | |
2277 _is_ptr_to_narrowoop = (basic_elem_type == T_OBJECT || | |
2278 basic_elem_type == T_ARRAY); | |
2279 } else if (klass()->equals(ciEnv::current()->Object_klass())) { | |
2280 // Compile::find_alias_type() cast exactness on all types to verify | |
2281 // that it does not affect alias type. | |
2282 _is_ptr_to_narrowoop = true; | |
2283 } else { | |
2284 // Type for the copy start in LibraryCallKit::inline_native_clone(). | |
2285 assert(!klass_is_exact(), "only non-exact klass"); | |
2286 _is_ptr_to_narrowoop = true; | |
2287 } | |
2281 } | 2288 } |
2282 } | 2289 } |
2283 } | 2290 } |
2284 } | 2291 } |
2285 #endif | 2292 #endif |