hotspot/src/share/vm/opto/macro.cpp
changeset 2154 72a9b7284ccf
parent 2105 347008ce7984
parent 2131 98f9cef66a34
child 2532 da0b1680593b
equal deleted inserted replaced
2106:ec595a5e793e 2154:72a9b7284ccf
    62     if (old_in != NULL && old_in->is_SafePointScalarObject()) {
    62     if (old_in != NULL && old_in->is_SafePointScalarObject()) {
    63       SafePointScalarObjectNode* old_sosn = old_in->as_SafePointScalarObject();
    63       SafePointScalarObjectNode* old_sosn = old_in->as_SafePointScalarObject();
    64       uint old_unique = C->unique();
    64       uint old_unique = C->unique();
    65       Node* new_in = old_sosn->clone(jvms_adj, sosn_map);
    65       Node* new_in = old_sosn->clone(jvms_adj, sosn_map);
    66       if (old_unique != C->unique()) {
    66       if (old_unique != C->unique()) {
       
    67         new_in->set_req(0, newcall->in(0)); // reset control edge
    67         new_in = transform_later(new_in); // Register new node.
    68         new_in = transform_later(new_in); // Register new node.
    68       }
    69       }
    69       old_in = new_in;
    70       old_in = new_in;
    70     }
    71     }
    71     newcall->add_req(old_in);
    72     newcall->add_req(old_in);
   213   Node *orig_mem = mem;
   214   Node *orig_mem = mem;
   214   Node *alloc_mem = alloc->in(TypeFunc::Memory);
   215   Node *alloc_mem = alloc->in(TypeFunc::Memory);
   215   const TypeOopPtr *tinst = phase->C->get_adr_type(alias_idx)->isa_oopptr();
   216   const TypeOopPtr *tinst = phase->C->get_adr_type(alias_idx)->isa_oopptr();
   216   while (true) {
   217   while (true) {
   217     if (mem == alloc_mem || mem == start_mem ) {
   218     if (mem == alloc_mem || mem == start_mem ) {
   218       return mem;  // hit one of our sentinals
   219       return mem;  // hit one of our sentinels
   219     } else if (mem->is_MergeMem()) {
   220     } else if (mem->is_MergeMem()) {
   220       mem = mem->as_MergeMem()->memory_at(alias_idx);
   221       mem = mem->as_MergeMem()->memory_at(alias_idx);
   221     } else if (mem->is_Proj() && mem->as_Proj()->_con == TypeFunc::Memory) {
   222     } else if (mem->is_Proj() && mem->as_Proj()->_con == TypeFunc::Memory) {
   222       Node *in = mem->in(0);
   223       Node *in = mem->in(0);
   223       // we can safely skip over safepoints, calls, locks and membars because we
   224       // we can safely skip over safepoints, calls, locks and membars because we
   248           return mem;
   249           return mem;
   249       } else {
   250       } else {
   250         assert(adr_idx == Compile::AliasIdxRaw, "address must match or be raw");
   251         assert(adr_idx == Compile::AliasIdxRaw, "address must match or be raw");
   251       }
   252       }
   252       mem = mem->in(MemNode::Memory);
   253       mem = mem->in(MemNode::Memory);
       
   254     } else if (mem->Opcode() == Op_SCMemProj) {
       
   255       assert(mem->in(0)->is_LoadStore(), "sanity");
       
   256       const TypePtr* atype = mem->in(0)->in(MemNode::Address)->bottom_type()->is_ptr();
       
   257       int adr_idx = Compile::current()->get_alias_index(atype);
       
   258       if (adr_idx == alias_idx) {
       
   259         assert(false, "Object is not scalar replaceable if a LoadStore node access its field");
       
   260         return NULL;
       
   261       }
       
   262       mem = mem->in(0)->in(MemNode::Memory);
   253     } else {
   263     } else {
   254       return mem;
   264       return mem;
   255     }
   265     }
   256     assert(mem != orig_mem, "dead memory loop");
   266     assert(mem != orig_mem, "dead memory loop");
   257   }
   267   }
   327         val = value_from_mem_phi(val, ft, phi_type, adr_t, alloc, value_phis, level-1);
   337         val = value_from_mem_phi(val, ft, phi_type, adr_t, alloc, value_phis, level-1);
   328         if (val == NULL) {
   338         if (val == NULL) {
   329           return NULL;
   339           return NULL;
   330         }
   340         }
   331         values.at_put(j, val);
   341         values.at_put(j, val);
       
   342       } else if (val->Opcode() == Op_SCMemProj) {
       
   343         assert(val->in(0)->is_LoadStore(), "sanity");
       
   344         assert(false, "Object is not scalar replaceable if a LoadStore node access its field");
       
   345         return NULL;
   332       } else {
   346       } else {
       
   347 #ifdef ASSERT
       
   348         val->dump();
   333         assert(false, "unknown node on this path");
   349         assert(false, "unknown node on this path");
       
   350 #endif
   334         return NULL;  // unknown node on this path
   351         return NULL;  // unknown node on this path
   335       }
   352       }
   336     }
   353     }
   337   }
   354   }
   338   // Set Phi's inputs
   355   // Set Phi's inputs
  1649   Node *mem_phi;
  1666   Node *mem_phi;
  1650   Node *slow_path;
  1667   Node *slow_path;
  1651 
  1668 
  1652   if (UseOptoBiasInlining) {
  1669   if (UseOptoBiasInlining) {
  1653     /*
  1670     /*
  1654      *  See the full descrition in MacroAssembler::biased_locking_enter().
  1671      *  See the full description in MacroAssembler::biased_locking_enter().
  1655      *
  1672      *
  1656      *  if( (mark_word & biased_lock_mask) == biased_lock_pattern ) {
  1673      *  if( (mark_word & biased_lock_mask) == biased_lock_pattern ) {
  1657      *    // The object is biased.
  1674      *    // The object is biased.
  1658      *    proto_node = klass->prototype_header;
  1675      *    proto_node = klass->prototype_header;
  1659      *    o_node = thread | proto_node;
  1676      *    o_node = thread | proto_node;
  1885   Node *region;
  1902   Node *region;
  1886   Node *mem_phi;
  1903   Node *mem_phi;
  1887 
  1904 
  1888   if (UseOptoBiasInlining) {
  1905   if (UseOptoBiasInlining) {
  1889     // Check for biased locking unlock case, which is a no-op.
  1906     // Check for biased locking unlock case, which is a no-op.
  1890     // See the full descrition in MacroAssembler::biased_locking_exit().
  1907     // See the full description in MacroAssembler::biased_locking_exit().
  1891     region  = new (C, 4) RegionNode(4);
  1908     region  = new (C, 4) RegionNode(4);
  1892     // create a Phi for the memory state
  1909     // create a Phi for the memory state
  1893     mem_phi = new (C, 4) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM);
  1910     mem_phi = new (C, 4) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM);
  1894     mem_phi->init_req(3, mem);
  1911     mem_phi->init_req(3, mem);
  1895 
  1912