1.1 --- a/src/share/vm/opto/compile.cpp Tue Jun 01 11:48:33 2010 -0700 1.2 +++ b/src/share/vm/opto/compile.cpp Wed Jun 02 22:45:42 2010 -0700 1.3 @@ -2176,14 +2176,14 @@ 1.4 1.5 #ifdef _LP64 1.6 case Op_CastPP: 1.7 - if (n->in(1)->is_DecodeN() && Universe::narrow_oop_use_implicit_null_checks()) { 1.8 + if (n->in(1)->is_DecodeN() && Matcher::gen_narrow_oop_implicit_null_checks()) { 1.9 Compile* C = Compile::current(); 1.10 Node* in1 = n->in(1); 1.11 const Type* t = n->bottom_type(); 1.12 Node* new_in1 = in1->clone(); 1.13 new_in1->as_DecodeN()->set_type(t); 1.14 1.15 - if (!Matcher::clone_shift_expressions) { 1.16 + if (!Matcher::narrow_oop_use_complex_address()) { 1.17 // 1.18 // x86, ARM and friends can handle 2 adds in addressing mode 1.19 // and Matcher can fold a DecodeN node into address by using 1.20 @@ -2231,8 +2231,12 @@ 1.21 new_in2 = in2->in(1); 1.22 } else if (in2->Opcode() == Op_ConP) { 1.23 const Type* t = in2->bottom_type(); 1.24 - if (t == TypePtr::NULL_PTR && Universe::narrow_oop_use_implicit_null_checks()) { 1.25 - new_in2 = ConNode::make(C, TypeNarrowOop::NULL_PTR); 1.26 + if (t == TypePtr::NULL_PTR) { 1.27 + // Don't convert CmpP null check into CmpN if compressed 1.28 + // oops implicit null check is not generated. 1.29 + // This will allow to generate normal oop implicit null check. 1.30 + if (Matcher::gen_narrow_oop_implicit_null_checks()) 1.31 + new_in2 = ConNode::make(C, TypeNarrowOop::NULL_PTR); 1.32 // 1.33 // This transformation together with CastPP transformation above 1.34 // will generated code for implicit NULL checks for compressed oops. 1.35 @@ -2289,9 +2293,9 @@ 1.36 1.37 case Op_DecodeN: 1.38 assert(!n->in(1)->is_EncodeP(), "should be optimized out"); 1.39 - // DecodeN could be pinned on Sparc where it can't be fold into 1.40 + // DecodeN could be pinned when it can't be fold into 1.41 // an address expression, see the code for Op_CastPP above. 1.42 - assert(n->in(0) == NULL || !Matcher::clone_shift_expressions, "no control except on sparc"); 1.43 + assert(n->in(0) == NULL || !Matcher::narrow_oop_use_complex_address(), "no control"); 1.44 break; 1.45 1.46 case Op_EncodeP: { 1.47 @@ -2496,6 +2500,10 @@ 1.48 } 1.49 } 1.50 1.51 + // Skip next transformation if compressed oops are not used. 1.52 + if (!UseCompressedOops || !Matcher::gen_narrow_oop_implicit_null_checks()) 1.53 + return; 1.54 + 1.55 // Go over safepoints nodes to skip DecodeN nodes for debug edges. 1.56 // It could be done for an uncommon traps or any safepoints/calls 1.57 // if the DecodeN node is referenced only in a debug info.