Mercurial > hg > graal-compiler
comparison src/share/vm/opto/stringopts.cpp @ 6043:df3d4a91f7f6
7161796: PhaseStringOpts::fetch_static_field tries to fetch field from the Klass instead of the mirror
Reviewed-by: twisti
author | never |
---|---|
date | Wed, 18 Apr 2012 16:08:34 -0700 |
parents | 2b27ef5c2173 |
children | 8f972594effc |
comparison
equal
deleted
inserted
replaced
6042:847da049d62f | 6043:df3d4a91f7f6 |
---|---|
895 | 895 |
896 return !fail; | 896 return !fail; |
897 } | 897 } |
898 | 898 |
899 Node* PhaseStringOpts::fetch_static_field(GraphKit& kit, ciField* field) { | 899 Node* PhaseStringOpts::fetch_static_field(GraphKit& kit, ciField* field) { |
900 const TypeKlassPtr* klass_type = TypeKlassPtr::make(field->holder()); | 900 const TypeInstPtr* mirror_type = TypeInstPtr::make(field->holder()->java_mirror()); |
901 Node* klass_node = __ makecon(klass_type); | 901 Node* klass_node = __ makecon(mirror_type); |
902 BasicType bt = field->layout_type(); | 902 BasicType bt = field->layout_type(); |
903 ciType* field_klass = field->type(); | 903 ciType* field_klass = field->type(); |
904 | 904 |
905 const Type *type; | 905 const Type *type; |
906 if( bt == T_OBJECT ) { | 906 if( bt == T_OBJECT ) { |
911 ciObject* con = field->constant_value().as_object(); | 911 ciObject* con = field->constant_value().as_object(); |
912 // Do not "join" in the previous type; it doesn't add value, | 912 // Do not "join" in the previous type; it doesn't add value, |
913 // and may yield a vacuous result if the field is of interface type. | 913 // and may yield a vacuous result if the field is of interface type. |
914 type = TypeOopPtr::make_from_constant(con, true)->isa_oopptr(); | 914 type = TypeOopPtr::make_from_constant(con, true)->isa_oopptr(); |
915 assert(type != NULL, "field singleton type must be consistent"); | 915 assert(type != NULL, "field singleton type must be consistent"); |
916 return __ makecon(type); | |
916 } else { | 917 } else { |
917 type = TypeOopPtr::make_from_klass(field_klass->as_klass()); | 918 type = TypeOopPtr::make_from_klass(field_klass->as_klass()); |
918 } | 919 } |
919 } else { | 920 } else { |
920 type = Type::get_const_basic_type(bt); | 921 type = Type::get_const_basic_type(bt); |
921 } | 922 } |
922 | 923 |
923 return kit.make_load(NULL, kit.basic_plus_adr(klass_node, field->offset_in_bytes()), | 924 return kit.make_load(NULL, kit.basic_plus_adr(klass_node, field->offset_in_bytes()), |
924 type, T_OBJECT, | 925 type, T_OBJECT, |
925 C->get_alias_index(klass_type->add_offset(field->offset_in_bytes()))); | 926 C->get_alias_index(mirror_type->add_offset(field->offset_in_bytes()))); |
926 } | 927 } |
927 | 928 |
928 Node* PhaseStringOpts::int_stringSize(GraphKit& kit, Node* arg) { | 929 Node* PhaseStringOpts::int_stringSize(GraphKit& kit, Node* arg) { |
929 RegionNode *final_merge = new (C, 3) RegionNode(3); | 930 RegionNode *final_merge = new (C, 3) RegionNode(3); |
930 kit.gvn().set_type(final_merge, Type::CONTROL); | 931 kit.gvn().set_type(final_merge, Type::CONTROL); |