# HG changeset patch # User never # Date 1334790514 25200 # Node ID df3d4a91f7f6fa003ca8e2c6a0b73b01eb0fb8fa # Parent 847da049d62fd7a6c619788e50a57e6b8ffef80f 7161796: PhaseStringOpts::fetch_static_field tries to fetch field from the Klass instead of the mirror Reviewed-by: twisti diff -r 847da049d62f -r df3d4a91f7f6 src/share/vm/opto/stringopts.cpp --- a/src/share/vm/opto/stringopts.cpp Tue Apr 17 11:04:22 2012 -0700 +++ b/src/share/vm/opto/stringopts.cpp Wed Apr 18 16:08:34 2012 -0700 @@ -897,8 +897,8 @@ } Node* PhaseStringOpts::fetch_static_field(GraphKit& kit, ciField* field) { - const TypeKlassPtr* klass_type = TypeKlassPtr::make(field->holder()); - Node* klass_node = __ makecon(klass_type); + const TypeInstPtr* mirror_type = TypeInstPtr::make(field->holder()->java_mirror()); + Node* klass_node = __ makecon(mirror_type); BasicType bt = field->layout_type(); ciType* field_klass = field->type(); @@ -913,6 +913,7 @@ // and may yield a vacuous result if the field is of interface type. type = TypeOopPtr::make_from_constant(con, true)->isa_oopptr(); assert(type != NULL, "field singleton type must be consistent"); + return __ makecon(type); } else { type = TypeOopPtr::make_from_klass(field_klass->as_klass()); } @@ -922,7 +923,7 @@ return kit.make_load(NULL, kit.basic_plus_adr(klass_node, field->offset_in_bytes()), type, T_OBJECT, - C->get_alias_index(klass_type->add_offset(field->offset_in_bytes()))); + C->get_alias_index(mirror_type->add_offset(field->offset_in_bytes()))); } Node* PhaseStringOpts::int_stringSize(GraphKit& kit, Node* arg) {