3808 false, NULL, 0);
3809 const TypePtr* count_field_type = string_type->add_offset(count_offset);
3810 int count_field_idx = C->get_alias_index(count_field_type);
3811 return make_load(ctrl,
3812 basic_plus_adr(str, str, count_offset),
3813 TypeInt::INT, T_INT, count_field_idx);
3814 } else {
3815 return load_array_length(load_String_value(ctrl, str));
3816 }
3817 }
3818
3819 Node* GraphKit::load_String_value(Node* ctrl, Node* str) {
3820 int value_offset = java_lang_String::value_offset_in_bytes();
3821 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3822 false, NULL, 0);
3823 const TypePtr* value_field_type = string_type->add_offset(value_offset);
3824 const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull,
3825 TypeAry::make(TypeInt::CHAR,TypeInt::POS),
3826 ciTypeArrayKlass::make(T_CHAR), true, 0);
3827 int value_field_idx = C->get_alias_index(value_field_type);
3828 return make_load(ctrl, basic_plus_adr(str, str, value_offset),
3829 value_type, T_OBJECT, value_field_idx);
3830 }
3831
3832 void GraphKit::store_String_offset(Node* ctrl, Node* str, Node* value) {
3833 int offset_offset = java_lang_String::offset_offset_in_bytes();
3834 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3835 false, NULL, 0);
3836 const TypePtr* offset_field_type = string_type->add_offset(offset_offset);
3837 int offset_field_idx = C->get_alias_index(offset_field_type);
3838 store_to_memory(ctrl, basic_plus_adr(str, offset_offset),
3839 value, T_INT, offset_field_idx);
3840 }
3841
3842 void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) {
3843 int value_offset = java_lang_String::value_offset_in_bytes();
3844 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3845 false, NULL, 0);
3846 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);
3851 store_to_memory(ctrl, basic_plus_adr(str, value_offset),
3852 value, T_OBJECT, value_field_idx);
3853 }
3854
3855 void GraphKit::store_String_length(Node* ctrl, Node* str, Node* value) {
3856 int count_offset = java_lang_String::count_offset_in_bytes();
3857 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3858 false, NULL, 0);
3859 const TypePtr* count_field_type = string_type->add_offset(count_offset);
3860 int count_field_idx = C->get_alias_index(count_field_type);
3861 store_to_memory(ctrl, basic_plus_adr(str, count_offset),
3862 value, T_INT, count_field_idx);
3863 }
|
3808 false, NULL, 0);
3809 const TypePtr* count_field_type = string_type->add_offset(count_offset);
3810 int count_field_idx = C->get_alias_index(count_field_type);
3811 return make_load(ctrl,
3812 basic_plus_adr(str, str, count_offset),
3813 TypeInt::INT, T_INT, count_field_idx);
3814 } else {
3815 return load_array_length(load_String_value(ctrl, str));
3816 }
3817 }
3818
3819 Node* GraphKit::load_String_value(Node* ctrl, Node* str) {
3820 int value_offset = java_lang_String::value_offset_in_bytes();
3821 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3822 false, NULL, 0);
3823 const TypePtr* value_field_type = string_type->add_offset(value_offset);
3824 const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull,
3825 TypeAry::make(TypeInt::CHAR,TypeInt::POS),
3826 ciTypeArrayKlass::make(T_CHAR), true, 0);
3827 int value_field_idx = C->get_alias_index(value_field_type);
3828 Node* load = make_load(ctrl, basic_plus_adr(str, str, value_offset),
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;
3835 }
3836
3837 void GraphKit::store_String_offset(Node* ctrl, Node* str, Node* value) {
3838 int offset_offset = java_lang_String::offset_offset_in_bytes();
3839 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3840 false, NULL, 0);
3841 const TypePtr* offset_field_type = string_type->add_offset(offset_offset);
3842 int offset_field_idx = C->get_alias_index(offset_field_type);
3843 store_to_memory(ctrl, basic_plus_adr(str, offset_offset),
3844 value, T_INT, offset_field_idx);
3845 }
3846
3847 void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) {
3848 int value_offset = java_lang_String::value_offset_in_bytes();
3849 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3850 false, NULL, 0);
3851 const TypePtr* value_field_type = string_type->add_offset(value_offset);
3852 int value_field_idx = C->get_alias_index(value_field_type);
3853 store_to_memory(ctrl, basic_plus_adr(str, value_offset),
3854 value, T_OBJECT, value_field_idx);
3855 }
3856
3857 void GraphKit::store_String_length(Node* ctrl, Node* str, Node* value) {
3858 int count_offset = java_lang_String::count_offset_in_bytes();
3859 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3860 false, NULL, 0);
3861 const TypePtr* count_field_type = string_type->add_offset(count_offset);
3862 int count_field_idx = C->get_alias_index(count_field_type);
3863 store_to_memory(ctrl, basic_plus_adr(str, count_offset),
3864 value, T_INT, count_field_idx);
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 }
|