1263
1264 //------------------------------string_indexOf------------------------
1265 Node* LibraryCallKit::string_indexOf(Node* string_object, ciTypeArray* target_array, jint targetOffset_i,
1266 jint cache_i, jint md2_i) {
1267
1268 Node* no_ctrl = NULL;
1269 float likely = PROB_LIKELY(0.9);
1270 float unlikely = PROB_UNLIKELY(0.9);
1271
1272 const int nargs = 0; // no arguments to push back for uncommon trap in predicate
1273
1274 Node* source = load_String_value(no_ctrl, string_object);
1275 Node* sourceOffset = load_String_offset(no_ctrl, string_object);
1276 Node* sourceCount = load_String_length(no_ctrl, string_object);
1277
1278 Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)));
1279 jint target_length = target_array->length();
1280 const TypeAry* target_array_type = TypeAry::make(TypeInt::CHAR, TypeInt::make(0, target_length, Type::WidenMin));
1281 const TypeAryPtr* target_type = TypeAryPtr::make(TypePtr::BotPTR, target_array_type, target_array->klass(), true, Type::OffsetBot);
1282
1283 IdealKit kit(this, false, true);
1284 #define __ kit.
1285 Node* zero = __ ConI(0);
1286 Node* one = __ ConI(1);
1287 Node* cache = __ ConI(cache_i);
1288 Node* md2 = __ ConI(md2_i);
1289 Node* lastChar = __ ConI(target_array->char_at(target_length - 1));
1290 Node* targetCount = __ ConI(target_length);
1291 Node* targetCountLess1 = __ ConI(target_length - 1);
1292 Node* targetOffset = __ ConI(targetOffset_i);
1293 Node* sourceEnd = __ SubI(__ AddI(sourceOffset, sourceCount), targetCountLess1);
1294
1295 IdealVariable rtn(kit), i(kit), j(kit); __ declarations_done();
1296 Node* outer_loop = __ make_label(2 /* goto */);
1297 Node* return_ = __ make_label(1);
1298
1299 __ set(rtn,__ ConI(-1));
1300 __ loop(this, nargs, i, sourceOffset, BoolTest::lt, sourceEnd); {
1301 Node* i2 = __ AddI(__ value(i), targetCountLess1);
1302 // pin to prohibit loading of "next iteration" value which may SEGV (rare)
|
1263
1264 //------------------------------string_indexOf------------------------
1265 Node* LibraryCallKit::string_indexOf(Node* string_object, ciTypeArray* target_array, jint targetOffset_i,
1266 jint cache_i, jint md2_i) {
1267
1268 Node* no_ctrl = NULL;
1269 float likely = PROB_LIKELY(0.9);
1270 float unlikely = PROB_UNLIKELY(0.9);
1271
1272 const int nargs = 0; // no arguments to push back for uncommon trap in predicate
1273
1274 Node* source = load_String_value(no_ctrl, string_object);
1275 Node* sourceOffset = load_String_offset(no_ctrl, string_object);
1276 Node* sourceCount = load_String_length(no_ctrl, string_object);
1277
1278 Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)));
1279 jint target_length = target_array->length();
1280 const TypeAry* target_array_type = TypeAry::make(TypeInt::CHAR, TypeInt::make(0, target_length, Type::WidenMin));
1281 const TypeAryPtr* target_type = TypeAryPtr::make(TypePtr::BotPTR, target_array_type, target_array->klass(), true, Type::OffsetBot);
1282
1283 // String.value field is known to be @Stable.
1284 if (UseImplicitStableValues) {
1285 target = cast_array_to_stable(target, target_type);
1286 }
1287
1288 IdealKit kit(this, false, true);
1289 #define __ kit.
1290 Node* zero = __ ConI(0);
1291 Node* one = __ ConI(1);
1292 Node* cache = __ ConI(cache_i);
1293 Node* md2 = __ ConI(md2_i);
1294 Node* lastChar = __ ConI(target_array->char_at(target_length - 1));
1295 Node* targetCount = __ ConI(target_length);
1296 Node* targetCountLess1 = __ ConI(target_length - 1);
1297 Node* targetOffset = __ ConI(targetOffset_i);
1298 Node* sourceEnd = __ SubI(__ AddI(sourceOffset, sourceCount), targetCountLess1);
1299
1300 IdealVariable rtn(kit), i(kit), j(kit); __ declarations_done();
1301 Node* outer_loop = __ make_label(2 /* goto */);
1302 Node* return_ = __ make_label(1);
1303
1304 __ set(rtn,__ ConI(-1));
1305 __ loop(this, nargs, i, sourceOffset, BoolTest::lt, sourceEnd); {
1306 Node* i2 = __ AddI(__ value(i), targetCountLess1);
1307 // pin to prohibit loading of "next iteration" value which may SEGV (rare)
|