3787 false, NULL, 0);
3788 const TypePtr* count_field_type = string_type->add_offset(count_offset);
3789 int count_field_idx = C->get_alias_index(count_field_type);
3790 return make_load(ctrl,
3791 basic_plus_adr(str, str, count_offset),
3792 TypeInt::INT, T_INT, count_field_idx);
3793 } else {
3794 return load_array_length(load_String_value(ctrl, str));
3795 }
3796 }
3797
3798 Node* GraphKit::load_String_value(Node* ctrl, Node* str) {
3799 int value_offset = java_lang_String::value_offset_in_bytes();
3800 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3801 false, NULL, 0);
3802 const TypePtr* value_field_type = string_type->add_offset(value_offset);
3803 const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull,
3804 TypeAry::make(TypeInt::CHAR,TypeInt::POS),
3805 ciTypeArrayKlass::make(T_CHAR), true, 0);
3806 int value_field_idx = C->get_alias_index(value_field_type);
3807 return make_load(ctrl, basic_plus_adr(str, str, value_offset),
3808 value_type, T_OBJECT, value_field_idx);
3809 }
3810
3811 void GraphKit::store_String_offset(Node* ctrl, Node* str, Node* value) {
3812 int offset_offset = java_lang_String::offset_offset_in_bytes();
3813 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3814 false, NULL, 0);
3815 const TypePtr* offset_field_type = string_type->add_offset(offset_offset);
3816 int offset_field_idx = C->get_alias_index(offset_field_type);
3817 store_to_memory(ctrl, basic_plus_adr(str, offset_offset),
3818 value, T_INT, offset_field_idx);
3819 }
3820
3821 void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) {
3822 int value_offset = java_lang_String::value_offset_in_bytes();
3823 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3824 false, NULL, 0);
3825 const TypePtr* value_field_type = string_type->add_offset(value_offset);
3826 const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull,
3827 TypeAry::make(TypeInt::CHAR,TypeInt::POS),
3828 ciTypeArrayKlass::make(T_CHAR), true, 0);
3829 int value_field_idx = C->get_alias_index(value_field_type);
3830 store_to_memory(ctrl, basic_plus_adr(str, value_offset),
3831 value, T_OBJECT, value_field_idx);
3832 }
3833
3834 void GraphKit::store_String_length(Node* ctrl, Node* str, Node* value) {
3835 int count_offset = java_lang_String::count_offset_in_bytes();
3836 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3837 false, NULL, 0);
3838 const TypePtr* count_field_type = string_type->add_offset(count_offset);
3839 int count_field_idx = C->get_alias_index(count_field_type);
3840 store_to_memory(ctrl, basic_plus_adr(str, count_offset),
3841 value, T_INT, count_field_idx);
3842 }
|
3787 false, NULL, 0);
3788 const TypePtr* count_field_type = string_type->add_offset(count_offset);
3789 int count_field_idx = C->get_alias_index(count_field_type);
3790 return make_load(ctrl,
3791 basic_plus_adr(str, str, count_offset),
3792 TypeInt::INT, T_INT, count_field_idx);
3793 } else {
3794 return load_array_length(load_String_value(ctrl, str));
3795 }
3796 }
3797
3798 Node* GraphKit::load_String_value(Node* ctrl, Node* str) {
3799 int value_offset = java_lang_String::value_offset_in_bytes();
3800 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3801 false, NULL, 0);
3802 const TypePtr* value_field_type = string_type->add_offset(value_offset);
3803 const TypeAryPtr* value_type = TypeAryPtr::make(TypePtr::NotNull,
3804 TypeAry::make(TypeInt::CHAR,TypeInt::POS),
3805 ciTypeArrayKlass::make(T_CHAR), true, 0);
3806 int value_field_idx = C->get_alias_index(value_field_type);
3807 Node* load = make_load(ctrl, basic_plus_adr(str, str, value_offset),
3808 value_type, T_OBJECT, value_field_idx);
3809
3810 if (UseImplicitStableValues) {
3811 // String.value field is known to be @Stable.
3812 // Reify the property as a CastPP node in Ideal graph to comply with monotonicity
3813 // assumption of CCP analysis.
3814 load = _gvn.transform(new (C) CastPPNode(load, value_type->cast_to_stable(true)));
3815 }
3816
3817 return load;
3818 }
3819
3820 void GraphKit::store_String_offset(Node* ctrl, Node* str, Node* value) {
3821 int offset_offset = java_lang_String::offset_offset_in_bytes();
3822 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3823 false, NULL, 0);
3824 const TypePtr* offset_field_type = string_type->add_offset(offset_offset);
3825 int offset_field_idx = C->get_alias_index(offset_field_type);
3826 store_to_memory(ctrl, basic_plus_adr(str, offset_offset),
3827 value, T_INT, offset_field_idx);
3828 }
3829
3830 void GraphKit::store_String_value(Node* ctrl, Node* str, Node* value) {
3831 int value_offset = java_lang_String::value_offset_in_bytes();
3832 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3833 false, NULL, 0);
3834 const TypePtr* value_field_type = string_type->add_offset(value_offset);
3835 int value_field_idx = C->get_alias_index(value_field_type);
3836 store_to_memory(ctrl, basic_plus_adr(str, value_offset),
3837 value, T_OBJECT, value_field_idx);
3838 }
3839
3840 void GraphKit::store_String_length(Node* ctrl, Node* str, Node* value) {
3841 int count_offset = java_lang_String::count_offset_in_bytes();
3842 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3843 false, NULL, 0);
3844 const TypePtr* count_field_type = string_type->add_offset(count_offset);
3845 int count_field_idx = C->get_alias_index(count_field_type);
3846 store_to_memory(ctrl, basic_plus_adr(str, count_offset),
3847 value, T_INT, count_field_idx);
3848 }
|