1.1 --- a/src/share/vm/opto/matcher.cpp Tue Jun 01 11:48:33 2010 -0700 1.2 +++ b/src/share/vm/opto/matcher.cpp Wed Jun 02 22:45:42 2010 -0700 1.3 @@ -1334,7 +1334,7 @@ 1.4 if( j == max_scan ) // No post-domination before scan end? 1.5 return true; // Then break the match tree up 1.6 } 1.7 - if (m->is_DecodeN() && Matcher::clone_shift_expressions) { 1.8 + if (m->is_DecodeN() && Matcher::narrow_oop_use_complex_address()) { 1.9 // These are commonly used in address expressions and can 1.10 // efficiently fold into them on X64 in some cases. 1.11 return false; 1.12 @@ -2110,8 +2110,8 @@ 1.13 _null_check_tests.push(proj); 1.14 Node* val = cmp->in(1); 1.15 #ifdef _LP64 1.16 - if (UseCompressedOops && !Matcher::clone_shift_expressions && 1.17 - val->bottom_type()->isa_narrowoop()) { 1.18 + if (val->bottom_type()->isa_narrowoop() && 1.19 + !Matcher::narrow_oop_use_complex_address()) { 1.20 // 1.21 // Look for DecodeN node which should be pinned to orig_proj. 1.22 // On platforms (Sparc) which can not handle 2 adds 1.23 @@ -2127,6 +2127,9 @@ 1.24 if (d->is_DecodeN() && d->in(1) == val) { 1.25 val = d; 1.26 val->set_req(0, NULL); // Unpin now. 1.27 + // Mark this as special case to distinguish from 1.28 + // a regular case: CmpP(DecodeN, NULL). 1.29 + val = (Node*)(((intptr_t)val) | 1); 1.30 break; 1.31 } 1.32 } 1.33 @@ -2146,9 +2149,21 @@ 1.34 for( uint i=0; i < cnt; i+=2 ) { 1.35 Node *test = _null_check_tests[i]; 1.36 Node *val = _null_check_tests[i+1]; 1.37 + bool is_decoden = ((intptr_t)val) & 1; 1.38 + val = (Node*)(((intptr_t)val) & ~1); 1.39 if (has_new_node(val)) { 1.40 + Node* new_val = new_node(val); 1.41 + if (is_decoden) { 1.42 + assert(val->is_DecodeN() && val->in(0) == NULL, "sanity"); 1.43 + // Note: new_val may have a control edge if 1.44 + // the original ideal node DecodeN was matched before 1.45 + // it was unpinned in Matcher::collect_null_checks(). 1.46 + // Unpin the mach node and mark it. 1.47 + new_val->set_req(0, NULL); 1.48 + new_val = (Node*)(((intptr_t)new_val) | 1); 1.49 + } 1.50 // Is a match-tree root, so replace with the matched value 1.51 - _null_check_tests.map(i+1, new_node(val)); 1.52 + _null_check_tests.map(i+1, new_val); 1.53 } else { 1.54 // Yank from candidate list 1.55 _null_check_tests.map(i+1,_null_check_tests[--cnt]);