comparison src/share/vm/opto/graphKit.cpp @ 12190:edb5ab0f3fe5

8001107: @Stable annotation for constant folding of lazily evaluated variables Reviewed-by: rbackman, twisti, kvn Contributed-by: john.r.rose@oracle.com, vladimir.x.ivanov@oracle.com
author vlivanov
date Tue, 10 Sep 2013 14:51:48 -0700
parents 29aa8936f03c
children d8d059e90ec1 69944b868a32
comparison
equal deleted inserted replaced
12188:cd16d587b0fa 12190:edb5ab0f3fe5
3823 const TypePtr* value_field_type = string_type->add_offset(value_offset); 3823 const TypePtr* value_field_type = string_type->add_offset(value_offset);
3824 const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull, 3824 const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull,
3825 TypeAry::make(TypeInt::CHAR,TypeInt::POS), 3825 TypeAry::make(TypeInt::CHAR,TypeInt::POS),
3826 ciTypeArrayKlass::make(T_CHAR), true, 0); 3826 ciTypeArrayKlass::make(T_CHAR), true, 0);
3827 int value_field_idx = C->get_alias_index(value_field_type); 3827 int value_field_idx = C->get_alias_index(value_field_type);
3828 return make_load(ctrl, basic_plus_adr(str, str, value_offset), 3828 Node* load = make_load(ctrl, basic_plus_adr(str, str, value_offset),
3829 value_type, T_OBJECT, value_field_idx); 3829 value_type, T_OBJECT, value_field_idx);
3830 // String.value field is known to be @Stable.
3831 if (UseImplicitStableValues) {
3832 load = cast_array_to_stable(load, value_type);
3833 }
3834 return load;
3830 } 3835 }
3831 3836
3832 void GraphKit::store_String_offset(Node* ctrl, Node* str, Node* value) { 3837 void GraphKit::store_String_offset(Node* ctrl, Node* str, Node* value) {
3833 int offset_offset = java_lang_String::offset_offset_in_bytes(); 3838 int offset_offset = java_lang_String::offset_offset_in_bytes();
3834 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), 3839 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3842 void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) { 3847 void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) {
3843 int value_offset = java_lang_String::value_offset_in_bytes(); 3848 int value_offset = java_lang_String::value_offset_in_bytes();
3844 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(), 3849 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3845 false, NULL, 0); 3850 false, NULL, 0);
3846 const TypePtr* value_field_type = string_type->add_offset(value_offset); 3851 const TypePtr* value_field_type = string_type->add_offset(value_offset);
3847 const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull,
3848 TypeAry::make(TypeInt::CHAR,TypeInt::POS),
3849 ciTypeArrayKlass::make(T_CHAR), true, 0);
3850 int value_field_idx = C->get_alias_index(value_field_type); 3852 int value_field_idx = C->get_alias_index(value_field_type);
3851 store_to_memory(ctrl, basic_plus_adr(str, value_offset), 3853 store_to_memory(ctrl, basic_plus_adr(str, value_offset),
3852 value, T_OBJECT, value_field_idx); 3854 value, T_OBJECT, value_field_idx);
3853 } 3855 }
3854 3856
3859 const TypePtr* count_field_type = string_type->add_offset(count_offset); 3861 const TypePtr* count_field_type = string_type->add_offset(count_offset);
3860 int count_field_idx = C->get_alias_index(count_field_type); 3862 int count_field_idx = C->get_alias_index(count_field_type);
3861 store_to_memory(ctrl, basic_plus_adr(str, count_offset), 3863 store_to_memory(ctrl, basic_plus_adr(str, count_offset),
3862 value, T_INT, count_field_idx); 3864 value, T_INT, count_field_idx);
3863 } 3865 }
3866
3867 Node* GraphKit::cast_array_to_stable(Node* ary, const TypeAryPtr* ary_type) {
3868 // Reify the property as a CastPP node in Ideal graph to comply with monotonicity
3869 // assumption of CCP analysis.
3870 return _gvn.transform(new(C) CastPPNode(ary, ary_type->cast_to_stable(true)));
3871 }