1.1 --- a/src/share/vm/opto/matcher.cpp Fri Apr 11 09:56:35 2008 -0400 1.2 +++ b/src/share/vm/opto/matcher.cpp Sun Apr 13 17:43:42 2008 -0400 1.3 @@ -30,7 +30,7 @@ 1.4 1.5 1.6 const int Matcher::base2reg[Type::lastype] = { 1.7 - Node::NotAMachineReg,0,0, Op_RegI, Op_RegL, 0, 1.8 + Node::NotAMachineReg,0,0, Op_RegI, Op_RegL, 0, Op_RegN, 1.9 Node::NotAMachineReg, Node::NotAMachineReg, /* tuple, array */ 1.10 Op_RegP, Op_RegP, Op_RegP, Op_RegP, Op_RegP, Op_RegP, /* the pointers */ 1.11 0, 0/*abio*/, 1.12 @@ -70,12 +70,14 @@ 1.13 C->set_matcher(this); 1.14 1.15 idealreg2spillmask[Op_RegI] = NULL; 1.16 + idealreg2spillmask[Op_RegN] = NULL; 1.17 idealreg2spillmask[Op_RegL] = NULL; 1.18 idealreg2spillmask[Op_RegF] = NULL; 1.19 idealreg2spillmask[Op_RegD] = NULL; 1.20 idealreg2spillmask[Op_RegP] = NULL; 1.21 1.22 idealreg2debugmask[Op_RegI] = NULL; 1.23 + idealreg2debugmask[Op_RegN] = NULL; 1.24 idealreg2debugmask[Op_RegL] = NULL; 1.25 idealreg2debugmask[Op_RegF] = NULL; 1.26 idealreg2debugmask[Op_RegD] = NULL; 1.27 @@ -366,17 +368,19 @@ 1.28 void Matcher::init_first_stack_mask() { 1.29 1.30 // Allocate storage for spill masks as masks for the appropriate load type. 1.31 - RegMask *rms = (RegMask*)C->comp_arena()->Amalloc_D(sizeof(RegMask)*10); 1.32 - idealreg2spillmask[Op_RegI] = &rms[0]; 1.33 - idealreg2spillmask[Op_RegL] = &rms[1]; 1.34 - idealreg2spillmask[Op_RegF] = &rms[2]; 1.35 - idealreg2spillmask[Op_RegD] = &rms[3]; 1.36 - idealreg2spillmask[Op_RegP] = &rms[4]; 1.37 - idealreg2debugmask[Op_RegI] = &rms[5]; 1.38 - idealreg2debugmask[Op_RegL] = &rms[6]; 1.39 - idealreg2debugmask[Op_RegF] = &rms[7]; 1.40 - idealreg2debugmask[Op_RegD] = &rms[8]; 1.41 - idealreg2debugmask[Op_RegP] = &rms[9]; 1.42 + RegMask *rms = (RegMask*)C->comp_arena()->Amalloc_D(sizeof(RegMask)*12); 1.43 + idealreg2spillmask[Op_RegN] = &rms[0]; 1.44 + idealreg2spillmask[Op_RegI] = &rms[1]; 1.45 + idealreg2spillmask[Op_RegL] = &rms[2]; 1.46 + idealreg2spillmask[Op_RegF] = &rms[3]; 1.47 + idealreg2spillmask[Op_RegD] = &rms[4]; 1.48 + idealreg2spillmask[Op_RegP] = &rms[5]; 1.49 + idealreg2debugmask[Op_RegN] = &rms[6]; 1.50 + idealreg2debugmask[Op_RegI] = &rms[7]; 1.51 + idealreg2debugmask[Op_RegL] = &rms[8]; 1.52 + idealreg2debugmask[Op_RegF] = &rms[9]; 1.53 + idealreg2debugmask[Op_RegD] = &rms[10]; 1.54 + idealreg2debugmask[Op_RegP] = &rms[11]; 1.55 1.56 OptoReg::Name i; 1.57 1.58 @@ -399,6 +403,10 @@ 1.59 C->FIRST_STACK_mask().set_AllStack(); 1.60 1.61 // Make spill masks. Registers for their class, plus FIRST_STACK_mask. 1.62 +#ifdef _LP64 1.63 + *idealreg2spillmask[Op_RegN] = *idealreg2regmask[Op_RegN]; 1.64 + idealreg2spillmask[Op_RegN]->OR(C->FIRST_STACK_mask()); 1.65 +#endif 1.66 *idealreg2spillmask[Op_RegI] = *idealreg2regmask[Op_RegI]; 1.67 idealreg2spillmask[Op_RegI]->OR(C->FIRST_STACK_mask()); 1.68 *idealreg2spillmask[Op_RegL] = *idealreg2regmask[Op_RegL]; 1.69 @@ -413,6 +421,7 @@ 1.70 // Make up debug masks. Any spill slot plus callee-save registers. 1.71 // Caller-save registers are assumed to be trashable by the various 1.72 // inline-cache fixup routines. 1.73 + *idealreg2debugmask[Op_RegN]= *idealreg2spillmask[Op_RegN]; 1.74 *idealreg2debugmask[Op_RegI]= *idealreg2spillmask[Op_RegI]; 1.75 *idealreg2debugmask[Op_RegL]= *idealreg2spillmask[Op_RegL]; 1.76 *idealreg2debugmask[Op_RegF]= *idealreg2spillmask[Op_RegF]; 1.77 @@ -428,6 +437,7 @@ 1.78 if( _register_save_policy[i] == 'C' || 1.79 _register_save_policy[i] == 'A' || 1.80 (_register_save_policy[i] == 'E' && exclude_soe) ) { 1.81 + idealreg2debugmask[Op_RegN]->Remove(i); 1.82 idealreg2debugmask[Op_RegI]->Remove(i); // Exclude save-on-call 1.83 idealreg2debugmask[Op_RegL]->Remove(i); // registers from debug 1.84 idealreg2debugmask[Op_RegF]->Remove(i); // masks 1.85 @@ -661,6 +671,9 @@ 1.86 set_shared(fp); 1.87 1.88 // Compute generic short-offset Loads 1.89 +#ifdef _LP64 1.90 + MachNode *spillCP = match_tree(new (C, 3) LoadNNode(NULL,mem,fp,atp,TypeInstPtr::BOTTOM)); 1.91 +#endif 1.92 MachNode *spillI = match_tree(new (C, 3) LoadINode(NULL,mem,fp,atp)); 1.93 MachNode *spillL = match_tree(new (C, 3) LoadLNode(NULL,mem,fp,atp)); 1.94 MachNode *spillF = match_tree(new (C, 3) LoadFNode(NULL,mem,fp,atp)); 1.95 @@ -670,6 +683,9 @@ 1.96 spillD != NULL && spillP != NULL, ""); 1.97 1.98 // Get the ADLC notion of the right regmask, for each basic type. 1.99 +#ifdef _LP64 1.100 + idealreg2regmask[Op_RegN] = &spillCP->out_RegMask(); 1.101 +#endif 1.102 idealreg2regmask[Op_RegI] = &spillI->out_RegMask(); 1.103 idealreg2regmask[Op_RegL] = &spillL->out_RegMask(); 1.104 idealreg2regmask[Op_RegF] = &spillF->out_RegMask(); 1.105 @@ -1227,6 +1243,13 @@ 1.106 if( j == max_scan ) // No post-domination before scan end? 1.107 return true; // Then break the match tree up 1.108 } 1.109 + 1.110 + if (m->Opcode() == Op_DecodeN && m->outcnt() == 2) { 1.111 + // These are commonly used in address expressions and can 1.112 + // efficiently fold into them in some cases but because they are 1.113 + // consumed by AddP they commonly have two users. 1.114 + if (m->raw_out(0) == m->raw_out(1) && m->raw_out(0)->Opcode() == Op_AddP) return false; 1.115 + } 1.116 } 1.117 1.118 // Not forceably cloning. If shared, put it into a register. 1.119 @@ -1714,6 +1737,7 @@ 1.120 case Op_StoreI: 1.121 case Op_StoreL: 1.122 case Op_StoreP: 1.123 + case Op_StoreN: 1.124 case Op_Store16B: 1.125 case Op_Store8B: 1.126 case Op_Store4B: 1.127 @@ -1739,6 +1763,7 @@ 1.128 case Op_LoadL: 1.129 case Op_LoadS: 1.130 case Op_LoadP: 1.131 + case Op_LoadN: 1.132 case Op_LoadRange: 1.133 case Op_LoadD_unaligned: 1.134 case Op_LoadL_unaligned: 1.135 @@ -1853,7 +1878,8 @@ 1.136 case Op_StoreLConditional: 1.137 case Op_CompareAndSwapI: 1.138 case Op_CompareAndSwapL: 1.139 - case Op_CompareAndSwapP: { // Convert trinary to binary-tree 1.140 + case Op_CompareAndSwapP: 1.141 + case Op_CompareAndSwapN: { // Convert trinary to binary-tree 1.142 Node *newval = n->in(MemNode::ValueIn ); 1.143 Node *oldval = n->in(LoadStoreNode::ExpectedIn); 1.144 Node *pair = new (C, 3) BinaryNode( oldval, newval ); 1.145 @@ -1905,22 +1931,25 @@ 1.146 // During matching If's have Bool & Cmp side-by-side 1.147 BoolNode *b = iff->in(1)->as_Bool(); 1.148 Node *cmp = iff->in(2); 1.149 - if( cmp->Opcode() == Op_CmpP ) { 1.150 - if( cmp->in(2)->bottom_type() == TypePtr::NULL_PTR ) { 1.151 + int opc = cmp->Opcode(); 1.152 + if (opc != Op_CmpP && opc != Op_CmpN) return; 1.153 1.154 - if( proj->Opcode() == Op_IfTrue ) { 1.155 - extern int all_null_checks_found; 1.156 - all_null_checks_found++; 1.157 - if( b->_test._test == BoolTest::ne ) { 1.158 - _null_check_tests.push(proj); 1.159 - _null_check_tests.push(cmp->in(1)); 1.160 - } 1.161 - } else { 1.162 - assert( proj->Opcode() == Op_IfFalse, "" ); 1.163 - if( b->_test._test == BoolTest::eq ) { 1.164 - _null_check_tests.push(proj); 1.165 - _null_check_tests.push(cmp->in(1)); 1.166 - } 1.167 + const Type* ct = cmp->in(2)->bottom_type(); 1.168 + if (ct == TypePtr::NULL_PTR || 1.169 + (opc == Op_CmpN && ct == TypeNarrowOop::NULL_PTR)) { 1.170 + 1.171 + if( proj->Opcode() == Op_IfTrue ) { 1.172 + extern int all_null_checks_found; 1.173 + all_null_checks_found++; 1.174 + if( b->_test._test == BoolTest::ne ) { 1.175 + _null_check_tests.push(proj); 1.176 + _null_check_tests.push(cmp->in(1)); 1.177 + } 1.178 + } else { 1.179 + assert( proj->Opcode() == Op_IfFalse, "" ); 1.180 + if( b->_test._test == BoolTest::eq ) { 1.181 + _null_check_tests.push(proj); 1.182 + _null_check_tests.push(cmp->in(1)); 1.183 } 1.184 } 1.185 } 1.186 @@ -2038,6 +2067,7 @@ 1.187 xop == Op_FastLock || 1.188 xop == Op_CompareAndSwapL || 1.189 xop == Op_CompareAndSwapP || 1.190 + xop == Op_CompareAndSwapN || 1.191 xop == Op_CompareAndSwapI) 1.192 return true; 1.193