Wed, 18 Apr 2012 16:08:34 -0700
7161796: PhaseStringOpts::fetch_static_field tries to fetch field from the Klass instead of the mirror
Reviewed-by: twisti
src/share/vm/opto/stringopts.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/opto/stringopts.cpp Tue Apr 17 11:04:22 2012 -0700 1.2 +++ b/src/share/vm/opto/stringopts.cpp Wed Apr 18 16:08:34 2012 -0700 1.3 @@ -897,8 +897,8 @@ 1.4 } 1.5 1.6 Node* PhaseStringOpts::fetch_static_field(GraphKit& kit, ciField* field) { 1.7 - const TypeKlassPtr* klass_type = TypeKlassPtr::make(field->holder()); 1.8 - Node* klass_node = __ makecon(klass_type); 1.9 + const TypeInstPtr* mirror_type = TypeInstPtr::make(field->holder()->java_mirror()); 1.10 + Node* klass_node = __ makecon(mirror_type); 1.11 BasicType bt = field->layout_type(); 1.12 ciType* field_klass = field->type(); 1.13 1.14 @@ -913,6 +913,7 @@ 1.15 // and may yield a vacuous result if the field is of interface type. 1.16 type = TypeOopPtr::make_from_constant(con, true)->isa_oopptr(); 1.17 assert(type != NULL, "field singleton type must be consistent"); 1.18 + return __ makecon(type); 1.19 } else { 1.20 type = TypeOopPtr::make_from_klass(field_klass->as_klass()); 1.21 } 1.22 @@ -922,7 +923,7 @@ 1.23 1.24 return kit.make_load(NULL, kit.basic_plus_adr(klass_node, field->offset_in_bytes()), 1.25 type, T_OBJECT, 1.26 - C->get_alias_index(klass_type->add_offset(field->offset_in_bytes()))); 1.27 + C->get_alias_index(mirror_type->add_offset(field->offset_in_bytes()))); 1.28 } 1.29 1.30 Node* PhaseStringOpts::int_stringSize(GraphKit& kit, Node* arg) {