807 const int offset_offset = java_lang_String::offset_offset_in_bytes(); |
807 const int offset_offset = java_lang_String::offset_offset_in_bytes(); |
808 |
808 |
809 Node* no_ctrl = NULL; |
809 Node* no_ctrl = NULL; |
810 |
810 |
811 ciInstanceKlass* klass = env()->String_klass(); |
811 ciInstanceKlass* klass = env()->String_klass(); |
812 const TypeInstPtr* string_type = |
812 const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); |
813 TypeInstPtr::make(TypePtr::BotPTR, klass, false, NULL, 0); |
|
814 |
813 |
815 const TypeAryPtr* value_type = |
814 const TypeAryPtr* value_type = |
816 TypeAryPtr::make(TypePtr::NotNull, |
815 TypeAryPtr::make(TypePtr::NotNull, |
817 TypeAry::make(TypeInt::CHAR,TypeInt::POS), |
816 TypeAry::make(TypeInt::CHAR,TypeInt::POS), |
818 ciTypeArrayKlass::make(T_CHAR), true, 0); |
817 ciTypeArrayKlass::make(T_CHAR), true, 0); |
881 if (stopped()) { |
880 if (stopped()) { |
882 return true; |
881 return true; |
883 } |
882 } |
884 |
883 |
885 ciInstanceKlass* klass = env()->String_klass(); |
884 ciInstanceKlass* klass = env()->String_klass(); |
886 const TypeInstPtr* string_type = |
885 const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); |
887 TypeInstPtr::make(TypePtr::BotPTR, klass, false, NULL, 0); |
|
888 Node* no_ctrl = NULL; |
886 Node* no_ctrl = NULL; |
889 |
887 |
890 // Get counts for string and argument |
888 // Get counts for string and argument |
891 Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); |
889 Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); |
892 Node* receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); |
890 Node* receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); |
956 phi->init_req(3, intcon(0)); |
954 phi->init_req(3, intcon(0)); |
957 region->init_req(3, inst_false); |
955 region->init_req(3, inst_false); |
958 } |
956 } |
959 } |
957 } |
960 |
958 |
961 const TypeInstPtr* string_type = |
959 const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); |
962 TypeInstPtr::make(TypePtr::BotPTR, klass, false, NULL, 0); |
|
963 |
960 |
964 Node* no_ctrl = NULL; |
961 Node* no_ctrl = NULL; |
965 Node* receiver_cnt; |
962 Node* receiver_cnt; |
966 Node* argument_cnt; |
963 Node* argument_cnt; |
967 |
964 |
968 if (!stopped()) { |
965 if (!stopped()) { |
|
966 // Properly cast the argument to String |
|
967 argument = _gvn.transform(new (C, 2) CheckCastPPNode(control(), argument, string_type)); |
|
968 |
969 // Get counts for string and argument |
969 // Get counts for string and argument |
970 Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); |
970 Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); |
971 receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); |
971 receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); |
972 |
972 |
973 // Pin load from argument string since it could be NULL. |
973 // Pin load from argument string since it could be NULL. |
1088 const int value_offset = java_lang_String::value_offset_in_bytes(); |
1088 const int value_offset = java_lang_String::value_offset_in_bytes(); |
1089 const int count_offset = java_lang_String::count_offset_in_bytes(); |
1089 const int count_offset = java_lang_String::count_offset_in_bytes(); |
1090 const int offset_offset = java_lang_String::offset_offset_in_bytes(); |
1090 const int offset_offset = java_lang_String::offset_offset_in_bytes(); |
1091 |
1091 |
1092 ciInstanceKlass* klass = env()->String_klass(); |
1092 ciInstanceKlass* klass = env()->String_klass(); |
1093 const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::BotPTR, klass, false, NULL, 0); |
1093 const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); |
1094 const TypeAryPtr* source_type = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInt::CHAR,TypeInt::POS), ciTypeArrayKlass::make(T_CHAR), true, 0); |
1094 const TypeAryPtr* source_type = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInt::CHAR,TypeInt::POS), ciTypeArrayKlass::make(T_CHAR), true, 0); |
1095 |
1095 |
1096 Node* sourceOffseta = basic_plus_adr(string_object, string_object, offset_offset); |
1096 Node* sourceOffseta = basic_plus_adr(string_object, string_object, offset_offset); |
1097 Node* sourceOffset = make_load(no_ctrl, sourceOffseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); |
1097 Node* sourceOffset = make_load(no_ctrl, sourceOffseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); |
1098 Node* sourceCounta = basic_plus_adr(string_object, string_object, count_offset); |
1098 Node* sourceCounta = basic_plus_adr(string_object, string_object, count_offset); |
1197 RegionNode* result_rgn = new (C, 3) RegionNode(3); |
1197 RegionNode* result_rgn = new (C, 3) RegionNode(3); |
1198 Node* result_phi = new (C, 3) PhiNode(result_rgn, TypeInt::INT); |
1198 Node* result_phi = new (C, 3) PhiNode(result_rgn, TypeInt::INT); |
1199 Node* no_ctrl = NULL; |
1199 Node* no_ctrl = NULL; |
1200 |
1200 |
1201 ciInstanceKlass* klass = env()->String_klass(); |
1201 ciInstanceKlass* klass = env()->String_klass(); |
1202 const TypeInstPtr* string_type = |
1202 const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass); |
1203 TypeInstPtr::make(TypePtr::BotPTR, klass, false, NULL, 0); |
|
1204 |
1203 |
1205 // Get counts for string and substr |
1204 // Get counts for string and substr |
1206 Node* source_cnta = basic_plus_adr(receiver, receiver, count_offset); |
1205 Node* source_cnta = basic_plus_adr(receiver, receiver, count_offset); |
1207 Node* source_cnt = make_load(no_ctrl, source_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); |
1206 Node* source_cnt = make_load(no_ctrl, source_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); |
1208 |
1207 |