< prev index next >

src/share/vm/opto/lcm.cpp

Print this page




 157     if( !m->is_Mach() ) continue;
 158     MachNode *mach = m->as_Mach();
 159     was_store = false;
 160     int iop = mach->ideal_Opcode();
 161     switch( iop ) {
 162     case Op_LoadB:
 163     case Op_LoadUB:
 164     case Op_LoadUS:
 165     case Op_LoadD:
 166     case Op_LoadF:
 167     case Op_LoadI:
 168     case Op_LoadL:
 169     case Op_LoadP:
 170     case Op_LoadN:
 171     case Op_LoadS:
 172     case Op_LoadKlass:
 173     case Op_LoadNKlass:
 174     case Op_LoadRange:
 175     case Op_LoadD_unaligned:
 176     case Op_LoadL_unaligned:


 177       assert(mach->in(2) == val, "should be address");
 178       break;
 179     case Op_StoreB:
 180     case Op_StoreC:
 181     case Op_StoreCM:
 182     case Op_StoreD:
 183     case Op_StoreF:
 184     case Op_StoreI:
 185     case Op_StoreL:
 186     case Op_StoreP:
 187     case Op_StoreN:
 188     case Op_StoreNKlass:
 189       was_store = true;         // Memory op is a store op
 190       // Stores will have their address in slot 2 (memory in slot 1).
 191       // If the value being nul-checked is in another slot, it means we
 192       // are storing the checked value, which does NOT check the value!
 193       if( mach->in(2) != val ) continue;
 194       break;                    // Found a memory op?
 195     case Op_StrComp:
 196     case Op_StrEquals:


 363           block->add_inst(n);
 364           map_node_to_block(n, block);
 365         }
 366       }
 367     }
 368   }
 369   // Hoist the memory candidate up to the end of the test block.
 370   Block *old_block = get_block_for_node(best);
 371   old_block->find_remove(best);
 372   block->add_inst(best);
 373   map_node_to_block(best, block);
 374 
 375   // Move the control dependence
 376   if (best->in(0) && best->in(0) == old_block->head())
 377     best->set_req(0, block->head());
 378 
 379   // Check for flag-killing projections that also need to be hoisted
 380   // Should be DU safe because no edge updates.
 381   for (DUIterator_Fast jmax, j = best->fast_outs(jmax); j < jmax; j++) {
 382     Node* n = best->fast_out(j);
 383     if( n->is_MachProj() ) {
 384       get_block_for_node(n)->find_remove(n);
 385       block->add_inst(n);
 386       map_node_to_block(n, block);
 387     }
 388   }
 389 
 390   // proj==Op_True --> ne test; proj==Op_False --> eq test.
 391   // One of two graph shapes got matched:
 392   //   (IfTrue  (If (Bool NE (CmpP ptr NULL))))
 393   //   (IfFalse (If (Bool EQ (CmpP ptr NULL))))
 394   // NULL checks are always branch-if-eq.  If we see a IfTrue projection
 395   // then we are replacing a 'ne' test with a 'eq' NULL check test.
 396   // We need to flip the projections to keep the same semantics.
 397   if( proj->Opcode() == Op_IfTrue ) {
 398     // Swap order of projections in basic block to swap branch targets
 399     Node *tmp1 = block->get_node(block->end_idx()+1);
 400     Node *tmp2 = block->get_node(block->end_idx()+2);
 401     block->map_node(tmp2, block->end_idx()+1);
 402     block->map_node(tmp1, block->end_idx()+2);
 403     Node *tmp = new Node(C->top()); // Use not NULL input




 157     if( !m->is_Mach() ) continue;
 158     MachNode *mach = m->as_Mach();
 159     was_store = false;
 160     int iop = mach->ideal_Opcode();
 161     switch( iop ) {
 162     case Op_LoadB:
 163     case Op_LoadUB:
 164     case Op_LoadUS:
 165     case Op_LoadD:
 166     case Op_LoadF:
 167     case Op_LoadI:
 168     case Op_LoadL:
 169     case Op_LoadP:
 170     case Op_LoadN:
 171     case Op_LoadS:
 172     case Op_LoadKlass:
 173     case Op_LoadNKlass:
 174     case Op_LoadRange:
 175     case Op_LoadD_unaligned:
 176     case Op_LoadL_unaligned:
 177     case Op_ShenandoahReadBarrier:
 178     case Op_ShenandoahWriteBarrier:
 179       assert(mach->in(2) == val, "should be address");
 180       break;
 181     case Op_StoreB:
 182     case Op_StoreC:
 183     case Op_StoreCM:
 184     case Op_StoreD:
 185     case Op_StoreF:
 186     case Op_StoreI:
 187     case Op_StoreL:
 188     case Op_StoreP:
 189     case Op_StoreN:
 190     case Op_StoreNKlass:
 191       was_store = true;         // Memory op is a store op
 192       // Stores will have their address in slot 2 (memory in slot 1).
 193       // If the value being nul-checked is in another slot, it means we
 194       // are storing the checked value, which does NOT check the value!
 195       if( mach->in(2) != val ) continue;
 196       break;                    // Found a memory op?
 197     case Op_StrComp:
 198     case Op_StrEquals:


 365           block->add_inst(n);
 366           map_node_to_block(n, block);
 367         }
 368       }
 369     }
 370   }
 371   // Hoist the memory candidate up to the end of the test block.
 372   Block *old_block = get_block_for_node(best);
 373   old_block->find_remove(best);
 374   block->add_inst(best);
 375   map_node_to_block(best, block);
 376 
 377   // Move the control dependence
 378   if (best->in(0) && best->in(0) == old_block->head())
 379     best->set_req(0, block->head());
 380 
 381   // Check for flag-killing projections that also need to be hoisted
 382   // Should be DU safe because no edge updates.
 383   for (DUIterator_Fast jmax, j = best->fast_outs(jmax); j < jmax; j++) {
 384     Node* n = best->fast_out(j);
 385     if( n->is_MachProj() || n->Opcode() == Op_ShenandoahWBMemProj) {
 386       get_block_for_node(n)->find_remove(n);
 387       block->add_inst(n);
 388       map_node_to_block(n, block);
 389     }
 390   }
 391 
 392   // proj==Op_True --> ne test; proj==Op_False --> eq test.
 393   // One of two graph shapes got matched:
 394   //   (IfTrue  (If (Bool NE (CmpP ptr NULL))))
 395   //   (IfFalse (If (Bool EQ (CmpP ptr NULL))))
 396   // NULL checks are always branch-if-eq.  If we see a IfTrue projection
 397   // then we are replacing a 'ne' test with a 'eq' NULL check test.
 398   // We need to flip the projections to keep the same semantics.
 399   if( proj->Opcode() == Op_IfTrue ) {
 400     // Swap order of projections in basic block to swap branch targets
 401     Node *tmp1 = block->get_node(block->end_idx()+1);
 402     Node *tmp2 = block->get_node(block->end_idx()+2);
 403     block->map_node(tmp2, block->end_idx()+1);
 404     block->map_node(tmp1, block->end_idx()+2);
 405     Node *tmp = new Node(C->top()); // Use not NULL input


< prev index next >