src/hotspot/share/opto/library_call.cpp
changeset 48595 5d699d81c10c
parent 48404 177e1783d886
child 49041 44122f767467
child 49796 6fa770f9f8ab
equal deleted inserted replaced
48594:4e4929530412 48595:5d699d81c10c
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
  1493     // other threads.
  1493     // other threads.
  1494     // Record what AllocateNode this StoreStore protects so that
  1494     // Record what AllocateNode this StoreStore protects so that
  1495     // escape analysis can go from the MemBarStoreStoreNode to the
  1495     // escape analysis can go from the MemBarStoreStoreNode to the
  1496     // AllocateNode and eliminate the MemBarStoreStoreNode if possible
  1496     // AllocateNode and eliminate the MemBarStoreStoreNode if possible
  1497     // based on the escape status of the AllocateNode.
  1497     // based on the escape status of the AllocateNode.
  1498     insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out(AllocateNode::RawAddress));
  1498     insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out_or_null(AllocateNode::RawAddress));
  1499   }
  1499   }
  1500   if (compress) {
  1500   if (compress) {
  1501     set_result(_gvn.transform(count));
  1501     set_result(_gvn.transform(count));
  1502   }
  1502   }
  1503   clear_upper_avx();
  1503   clear_upper_avx();
  1587       // other threads.
  1587       // other threads.
  1588       // Record what AllocateNode this StoreStore protects so that
  1588       // Record what AllocateNode this StoreStore protects so that
  1589       // escape analysis can go from the MemBarStoreStoreNode to the
  1589       // escape analysis can go from the MemBarStoreStoreNode to the
  1590       // AllocateNode and eliminate the MemBarStoreStoreNode if possible
  1590       // AllocateNode and eliminate the MemBarStoreStoreNode if possible
  1591       // based on the escape status of the AllocateNode.
  1591       // based on the escape status of the AllocateNode.
  1592       insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out(AllocateNode::RawAddress));
  1592       insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out_or_null(AllocateNode::RawAddress));
  1593     } else {
  1593     } else {
  1594       insert_mem_bar(Op_MemBarCPUOrder);
  1594       insert_mem_bar(Op_MemBarCPUOrder);
  1595     }
  1595     }
  1596   } // original reexecute is set back here
  1596   } // original reexecute is set back here
  1597 
  1597 
  1673       // other threads.
  1673       // other threads.
  1674       // Record what AllocateNode this StoreStore protects so that
  1674       // Record what AllocateNode this StoreStore protects so that
  1675       // escape analysis can go from the MemBarStoreStoreNode to the
  1675       // escape analysis can go from the MemBarStoreStoreNode to the
  1676       // AllocateNode and eliminate the MemBarStoreStoreNode if possible
  1676       // AllocateNode and eliminate the MemBarStoreStoreNode if possible
  1677       // based on the escape status of the AllocateNode.
  1677       // based on the escape status of the AllocateNode.
  1678       insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out(AllocateNode::RawAddress));
  1678       insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out_or_null(AllocateNode::RawAddress));
  1679     } else {
  1679     } else {
  1680       insert_mem_bar(Op_MemBarCPUOrder);
  1680       insert_mem_bar(Op_MemBarCPUOrder);
  1681     }
  1681     }
  1682   }
  1682   }
  1683 
  1683 
  4720     // other threads.
  4720     // other threads.
  4721     // Record what AllocateNode this StoreStore protects so that
  4721     // Record what AllocateNode this StoreStore protects so that
  4722     // escape analysis can go from the MemBarStoreStoreNode to the
  4722     // escape analysis can go from the MemBarStoreStoreNode to the
  4723     // AllocateNode and eliminate the MemBarStoreStoreNode if possible
  4723     // AllocateNode and eliminate the MemBarStoreStoreNode if possible
  4724     // based on the escape status of the AllocateNode.
  4724     // based on the escape status of the AllocateNode.
  4725     insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out(AllocateNode::RawAddress));
  4725     insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out_or_null(AllocateNode::RawAddress));
  4726   } else {
  4726   } else {
  4727     insert_mem_bar(Op_MemBarCPUOrder);
  4727     insert_mem_bar(Op_MemBarCPUOrder);
  4728   }
  4728   }
  4729 }
  4729 }
  4730 
  4730 
  5029     alloc->set_req(TypeFunc::Control, control());
  5029     alloc->set_req(TypeFunc::Control, control());
  5030     alloc->set_req(TypeFunc::I_O, i_o());
  5030     alloc->set_req(TypeFunc::I_O, i_o());
  5031     Node *mem = reset_memory();
  5031     Node *mem = reset_memory();
  5032     set_all_memory(mem);
  5032     set_all_memory(mem);
  5033     alloc->set_req(TypeFunc::Memory, mem);
  5033     alloc->set_req(TypeFunc::Memory, mem);
  5034     set_control(init->proj_out(TypeFunc::Control));
  5034     set_control(init->proj_out_or_null(TypeFunc::Control));
  5035     set_i_o(callprojs.fallthrough_ioproj);
  5035     set_i_o(callprojs.fallthrough_ioproj);
  5036 
  5036 
  5037     // Update memory as done in GraphKit::set_output_for_allocation()
  5037     // Update memory as done in GraphKit::set_output_for_allocation()
  5038     const TypeInt* length_type = _gvn.find_int_type(alloc->in(AllocateNode::ALength));
  5038     const TypeInt* length_type = _gvn.find_int_type(alloc->in(AllocateNode::ALength));
  5039     const TypeOopPtr* ary_type = _gvn.type(alloc->in(AllocateNode::KlassNode))->is_klassptr()->as_instance_type();
  5039     const TypeOopPtr* ary_type = _gvn.type(alloc->in(AllocateNode::KlassNode))->is_klassptr()->as_instance_type();
  5040     if (ary_type->isa_aryptr() && length_type != NULL) {
  5040     if (ary_type->isa_aryptr() && length_type != NULL) {
  5041       ary_type = ary_type->is_aryptr()->cast_to_size(length_type);
  5041       ary_type = ary_type->is_aryptr()->cast_to_size(length_type);
  5042     }
  5042     }
  5043     const TypePtr* telemref = ary_type->add_offset(Type::OffsetBot);
  5043     const TypePtr* telemref = ary_type->add_offset(Type::OffsetBot);
  5044     int            elemidx  = C->get_alias_index(telemref);
  5044     int            elemidx  = C->get_alias_index(telemref);
  5045     set_memory(init->proj_out(TypeFunc::Memory), Compile::AliasIdxRaw);
  5045     set_memory(init->proj_out_or_null(TypeFunc::Memory), Compile::AliasIdxRaw);
  5046     set_memory(init->proj_out(TypeFunc::Memory), elemidx);
  5046     set_memory(init->proj_out_or_null(TypeFunc::Memory), elemidx);
  5047 
  5047 
  5048     Node* allocx = _gvn.transform(alloc);
  5048     Node* allocx = _gvn.transform(alloc);
  5049     assert(allocx == alloc, "where has the allocation gone?");
  5049     assert(allocx == alloc, "where has the allocation gone?");
  5050     assert(dest->is_CheckCastPP(), "not an allocation result?");
  5050     assert(dest->is_CheckCastPP(), "not an allocation result?");
  5051 
  5051 
  5358     // There may be guards which feed into the slow_region.
  5358     // There may be guards which feed into the slow_region.
  5359     // Any other control flow means that we might not get a chance
  5359     // Any other control flow means that we might not get a chance
  5360     // to finish initializing the allocated object.
  5360     // to finish initializing the allocated object.
  5361     if ((ctl->is_IfFalse() || ctl->is_IfTrue()) && ctl->in(0)->is_If()) {
  5361     if ((ctl->is_IfFalse() || ctl->is_IfTrue()) && ctl->in(0)->is_If()) {
  5362       IfNode* iff = ctl->in(0)->as_If();
  5362       IfNode* iff = ctl->in(0)->as_If();
  5363       Node* not_ctl = iff->proj_out(1 - ctl->as_Proj()->_con);
  5363       Node* not_ctl = iff->proj_out_or_null(1 - ctl->as_Proj()->_con);
  5364       assert(not_ctl != NULL && not_ctl != ctl, "found alternate");
  5364       assert(not_ctl != NULL && not_ctl != ctl, "found alternate");
  5365       if (slow_region != NULL && slow_region->find_edge(not_ctl) >= 1) {
  5365       if (slow_region != NULL && slow_region->find_edge(not_ctl) >= 1) {
  5366         ctl = iff->in(0);       // This test feeds the known slow_region.
  5366         ctl = iff->in(0);       // This test feeds the known slow_region.
  5367         continue;
  5367         continue;
  5368       }
  5368       }