src/hotspot/share/opto/macro.cpp
changeset 58372 43c4fb8ba96b
parent 58332 b311681bc3f9
child 58679 9c3209ff7550
child 59053 ba6c248cae19
equal deleted inserted replaced
58367:b3ca57ddfc92 58372:43c4fb8ba96b
  1650                                     Node* control, Node* rawmem, Node* object,
  1650                                     Node* control, Node* rawmem, Node* object,
  1651                                     Node* klass_node, Node* length,
  1651                                     Node* klass_node, Node* length,
  1652                                     Node* size_in_bytes) {
  1652                                     Node* size_in_bytes) {
  1653   InitializeNode* init = alloc->initialization();
  1653   InitializeNode* init = alloc->initialization();
  1654   // Store the klass & mark bits
  1654   // Store the klass & mark bits
  1655   Node* mark_node = NULL;
  1655   Node* mark_node = alloc->make_ideal_mark(&_igvn, object, control, rawmem);
  1656   // For now only enable fast locking for non-array types
  1656   if (!mark_node->is_Con()) {
  1657   if (UseBiasedLocking && (length == NULL)) {
  1657     transform_later(mark_node);
  1658     mark_node = make_load(control, rawmem, klass_node, in_bytes(Klass::prototype_header_offset()), TypeRawPtr::BOTTOM, T_ADDRESS);
  1658   }
  1659   } else {
  1659   rawmem = make_store(control, rawmem, object, oopDesc::mark_offset_in_bytes(), mark_node, TypeX_X->basic_type());
  1660     mark_node = makecon(TypeRawPtr::make((address)markWord::prototype().value()));
       
  1661   }
       
  1662   rawmem = make_store(control, rawmem, object, oopDesc::mark_offset_in_bytes(), mark_node, T_ADDRESS);
       
  1663 
  1660 
  1664   rawmem = make_store(control, rawmem, object, oopDesc::klass_offset_in_bytes(), klass_node, T_METADATA);
  1661   rawmem = make_store(control, rawmem, object, oopDesc::klass_offset_in_bytes(), klass_node, T_METADATA);
  1665   int header_size = alloc->minimum_header_size();  // conservatively small
  1662   int header_size = alloc->minimum_header_size();  // conservatively small
  1666 
  1663 
  1667   // Array length
  1664   // Array length
  2594     Node * n = C->macro_node(macro_idx);
  2591     Node * n = C->macro_node(macro_idx);
  2595     assert(n->is_macro(), "only macro nodes expected here");
  2592     assert(n->is_macro(), "only macro nodes expected here");
  2596     if (_igvn.type(n) == Type::TOP || (n->in(0) != NULL && n->in(0)->is_top())) {
  2593     if (_igvn.type(n) == Type::TOP || (n->in(0) != NULL && n->in(0)->is_top())) {
  2597       // node is unreachable, so don't try to expand it
  2594       // node is unreachable, so don't try to expand it
  2598       C->remove_macro_node(n);
  2595       C->remove_macro_node(n);
  2599     } else if (n->is_ArrayCopy()){
  2596       continue;
  2600       int macro_count = C->macro_count();
  2597     }
       
  2598     int macro_count = C->macro_count();
       
  2599     switch (n->class_id()) {
       
  2600     case Node::Class_Lock:
       
  2601       expand_lock_node(n->as_Lock());
       
  2602       assert(C->macro_count() < macro_count, "must have deleted a node from macro list");
       
  2603       break;
       
  2604     case Node::Class_Unlock:
       
  2605       expand_unlock_node(n->as_Unlock());
       
  2606       assert(C->macro_count() < macro_count, "must have deleted a node from macro list");
       
  2607       break;
       
  2608     case Node::Class_ArrayCopy:
  2601       expand_arraycopy_node(n->as_ArrayCopy());
  2609       expand_arraycopy_node(n->as_ArrayCopy());
  2602       assert(C->macro_count() < macro_count, "must have deleted a node from macro list");
  2610       assert(C->macro_count() < macro_count, "must have deleted a node from macro list");
       
  2611       break;
  2603     }
  2612     }
  2604     if (C->failing())  return true;
  2613     if (C->failing())  return true;
  2605     macro_idx --;
  2614     macro_idx --;
  2606   }
  2615   }
       
  2616 
       
  2617   // All nodes except Allocate nodes are expanded now. There could be
       
  2618   // new optimization opportunities (such as folding newly created
       
  2619   // load from a just allocated object). Run IGVN.
       
  2620   _igvn.set_delay_transform(false);
       
  2621   _igvn.optimize();
       
  2622   if (C->failing())  return true;
       
  2623 
       
  2624   _igvn.set_delay_transform(true);
  2607 
  2625 
  2608   // expand "macro" nodes
  2626   // expand "macro" nodes
  2609   // nodes are removed from the macro list as they are processed
  2627   // nodes are removed from the macro list as they are processed
  2610   while (C->macro_count() > 0) {
  2628   while (C->macro_count() > 0) {
  2611     int macro_count = C->macro_count();
  2629     int macro_count = C->macro_count();
  2621       expand_allocate(n->as_Allocate());
  2639       expand_allocate(n->as_Allocate());
  2622       break;
  2640       break;
  2623     case Node::Class_AllocateArray:
  2641     case Node::Class_AllocateArray:
  2624       expand_allocate_array(n->as_AllocateArray());
  2642       expand_allocate_array(n->as_AllocateArray());
  2625       break;
  2643       break;
  2626     case Node::Class_Lock:
       
  2627       expand_lock_node(n->as_Lock());
       
  2628       break;
       
  2629     case Node::Class_Unlock:
       
  2630       expand_unlock_node(n->as_Unlock());
       
  2631       break;
       
  2632     default:
  2644     default:
  2633       assert(false, "unknown node type in macro list");
  2645       assert(false, "unknown node type in macro list");
  2634     }
  2646     }
  2635     assert(C->macro_count() < macro_count, "must have deleted a node from macro list");
  2647     assert(C->macro_count() < macro_count, "must have deleted a node from macro list");
  2636     if (C->failing())  return true;
  2648     if (C->failing())  return true;