comparison src/share/vm/opto/library_call.cpp @ 2383:9dc311b8473e

7008866: Missing loop predicate for loop with multiple entries Summary: Add predicates when loop head bytecode is parsed instead of when back branch bytecode is parsed. Reviewed-by: never
author kvn
date Mon, 21 Mar 2011 11:28:14 -0700
parents 0ac769a57c64
children 0e3ed5a14f73
comparison
equal deleted inserted replaced
2382:3ef1a1866a60 2383:9dc311b8473e
1099 1099
1100 Node* no_ctrl = NULL; 1100 Node* no_ctrl = NULL;
1101 float likely = PROB_LIKELY(0.9); 1101 float likely = PROB_LIKELY(0.9);
1102 float unlikely = PROB_UNLIKELY(0.9); 1102 float unlikely = PROB_UNLIKELY(0.9);
1103 1103
1104 const int nargs = 2; // number of arguments to push back for uncommon trap in predicate
1105
1104 const int value_offset = java_lang_String::value_offset_in_bytes(); 1106 const int value_offset = java_lang_String::value_offset_in_bytes();
1105 const int count_offset = java_lang_String::count_offset_in_bytes(); 1107 const int count_offset = java_lang_String::count_offset_in_bytes();
1106 const int offset_offset = java_lang_String::offset_offset_in_bytes(); 1108 const int offset_offset = java_lang_String::offset_offset_in_bytes();
1107 1109
1108 ciInstanceKlass* klass = env()->String_klass(); 1110 ciInstanceKlass* klass = env()->String_klass();
1136 IdealVariable rtn(kit), i(kit), j(kit); __ declarations_done(); 1138 IdealVariable rtn(kit), i(kit), j(kit); __ declarations_done();
1137 Node* outer_loop = __ make_label(2 /* goto */); 1139 Node* outer_loop = __ make_label(2 /* goto */);
1138 Node* return_ = __ make_label(1); 1140 Node* return_ = __ make_label(1);
1139 1141
1140 __ set(rtn,__ ConI(-1)); 1142 __ set(rtn,__ ConI(-1));
1141 __ loop(i, sourceOffset, BoolTest::lt, sourceEnd); { 1143 __ loop(this, nargs, i, sourceOffset, BoolTest::lt, sourceEnd); {
1142 Node* i2 = __ AddI(__ value(i), targetCountLess1); 1144 Node* i2 = __ AddI(__ value(i), targetCountLess1);
1143 // pin to prohibit loading of "next iteration" value which may SEGV (rare) 1145 // pin to prohibit loading of "next iteration" value which may SEGV (rare)
1144 Node* src = load_array_element(__ ctrl(), source, i2, TypeAryPtr::CHARS); 1146 Node* src = load_array_element(__ ctrl(), source, i2, TypeAryPtr::CHARS);
1145 __ if_then(src, BoolTest::eq, lastChar, unlikely); { 1147 __ if_then(src, BoolTest::eq, lastChar, unlikely); {
1146 __ loop(j, zero, BoolTest::lt, targetCountLess1); { 1148 __ loop(this, nargs, j, zero, BoolTest::lt, targetCountLess1); {
1147 Node* tpj = __ AddI(targetOffset, __ value(j)); 1149 Node* tpj = __ AddI(targetOffset, __ value(j));
1148 Node* targ = load_array_element(no_ctrl, target, tpj, target_type); 1150 Node* targ = load_array_element(no_ctrl, target, tpj, target_type);
1149 Node* ipj = __ AddI(__ value(i), __ value(j)); 1151 Node* ipj = __ AddI(__ value(i), __ value(j));
1150 Node* src2 = load_array_element(no_ctrl, source, ipj, TypeAryPtr::CHARS); 1152 Node* src2 = load_array_element(no_ctrl, source, ipj, TypeAryPtr::CHARS);
1151 __ if_then(targ, BoolTest::ne, src2); { 1153 __ if_then(targ, BoolTest::ne, src2); {