1332 break; // m->in(0)? If so, we can use it |
1332 break; // m->in(0)? If so, we can use it |
1333 } |
1333 } |
1334 if( j == max_scan ) // No post-domination before scan end? |
1334 if( j == max_scan ) // No post-domination before scan end? |
1335 return true; // Then break the match tree up |
1335 return true; // Then break the match tree up |
1336 } |
1336 } |
1337 if (m->is_DecodeN() && Matcher::clone_shift_expressions) { |
1337 if (m->is_DecodeN() && Matcher::narrow_oop_use_complex_address()) { |
1338 // These are commonly used in address expressions and can |
1338 // These are commonly used in address expressions and can |
1339 // efficiently fold into them on X64 in some cases. |
1339 // efficiently fold into them on X64 in some cases. |
1340 return false; |
1340 return false; |
1341 } |
1341 } |
1342 } |
1342 } |
2108 } |
2108 } |
2109 if( push_it ) { |
2109 if( push_it ) { |
2110 _null_check_tests.push(proj); |
2110 _null_check_tests.push(proj); |
2111 Node* val = cmp->in(1); |
2111 Node* val = cmp->in(1); |
2112 #ifdef _LP64 |
2112 #ifdef _LP64 |
2113 if (UseCompressedOops && !Matcher::clone_shift_expressions && |
2113 if (val->bottom_type()->isa_narrowoop() && |
2114 val->bottom_type()->isa_narrowoop()) { |
2114 !Matcher::narrow_oop_use_complex_address()) { |
2115 // |
2115 // |
2116 // Look for DecodeN node which should be pinned to orig_proj. |
2116 // Look for DecodeN node which should be pinned to orig_proj. |
2117 // On platforms (Sparc) which can not handle 2 adds |
2117 // On platforms (Sparc) which can not handle 2 adds |
2118 // in addressing mode we have to keep a DecodeN node and |
2118 // in addressing mode we have to keep a DecodeN node and |
2119 // use it to do implicit NULL check in address. |
2119 // use it to do implicit NULL check in address. |
2125 for (uint i = 0; i < orig_proj->outcnt(); i++) { |
2125 for (uint i = 0; i < orig_proj->outcnt(); i++) { |
2126 Node* d = orig_proj->raw_out(i); |
2126 Node* d = orig_proj->raw_out(i); |
2127 if (d->is_DecodeN() && d->in(1) == val) { |
2127 if (d->is_DecodeN() && d->in(1) == val) { |
2128 val = d; |
2128 val = d; |
2129 val->set_req(0, NULL); // Unpin now. |
2129 val->set_req(0, NULL); // Unpin now. |
|
2130 // Mark this as special case to distinguish from |
|
2131 // a regular case: CmpP(DecodeN, NULL). |
|
2132 val = (Node*)(((intptr_t)val) | 1); |
2130 break; |
2133 break; |
2131 } |
2134 } |
2132 } |
2135 } |
2133 } |
2136 } |
2134 #endif |
2137 #endif |
2144 void Matcher::validate_null_checks( ) { |
2147 void Matcher::validate_null_checks( ) { |
2145 uint cnt = _null_check_tests.size(); |
2148 uint cnt = _null_check_tests.size(); |
2146 for( uint i=0; i < cnt; i+=2 ) { |
2149 for( uint i=0; i < cnt; i+=2 ) { |
2147 Node *test = _null_check_tests[i]; |
2150 Node *test = _null_check_tests[i]; |
2148 Node *val = _null_check_tests[i+1]; |
2151 Node *val = _null_check_tests[i+1]; |
|
2152 bool is_decoden = ((intptr_t)val) & 1; |
|
2153 val = (Node*)(((intptr_t)val) & ~1); |
2149 if (has_new_node(val)) { |
2154 if (has_new_node(val)) { |
|
2155 Node* new_val = new_node(val); |
|
2156 if (is_decoden) { |
|
2157 assert(val->is_DecodeN() && val->in(0) == NULL, "sanity"); |
|
2158 // Note: new_val may have a control edge if |
|
2159 // the original ideal node DecodeN was matched before |
|
2160 // it was unpinned in Matcher::collect_null_checks(). |
|
2161 // Unpin the mach node and mark it. |
|
2162 new_val->set_req(0, NULL); |
|
2163 new_val = (Node*)(((intptr_t)new_val) | 1); |
|
2164 } |
2150 // Is a match-tree root, so replace with the matched value |
2165 // Is a match-tree root, so replace with the matched value |
2151 _null_check_tests.map(i+1, new_node(val)); |
2166 _null_check_tests.map(i+1, new_val); |
2152 } else { |
2167 } else { |
2153 // Yank from candidate list |
2168 // Yank from candidate list |
2154 _null_check_tests.map(i+1,_null_check_tests[--cnt]); |
2169 _null_check_tests.map(i+1,_null_check_tests[--cnt]); |
2155 _null_check_tests.map(i,_null_check_tests[--cnt]); |
2170 _null_check_tests.map(i,_null_check_tests[--cnt]); |
2156 _null_check_tests.pop(); |
2171 _null_check_tests.pop(); |