1660
1661 void AllocateNode::compute_MemBar_redundancy(ciMethod* initializer)
1662 {
1663 assert(initializer != nullptr &&
1664 initializer->is_initializer() &&
1665 !initializer->is_static(),
1666 "unexpected initializer method");
1667 BCEscapeAnalyzer* analyzer = initializer->get_bcea();
1668 if (analyzer == nullptr) {
1669 return;
1670 }
1671
1672 // Allocation node is first parameter in its initializer
1673 if (analyzer->is_arg_stack(0) || analyzer->is_arg_local(0)) {
1674 _is_allocation_MemBar_redundant = true;
1675 }
1676 }
1677 Node *AllocateNode::make_ideal_mark(PhaseGVN *phase, Node* obj, Node* control, Node* mem) {
1678 Node* mark_node = nullptr;
1679 // For now only enable fast locking for non-array types
1680 if (UseBiasedLocking && Opcode() == Op_Allocate) {
1681 Node* klass_node = in(AllocateNode::KlassNode);
1682 Node* proto_adr = phase->transform(new AddPNode(klass_node, klass_node, phase->MakeConX(in_bytes(Klass::prototype_header_offset()))));
1683 mark_node = LoadNode::make(*phase, control, mem, proto_adr, TypeRawPtr::BOTTOM, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
1684 } else {
1685 mark_node = phase->MakeConX(markWord::prototype().value());
1686 }
1687 return mark_node;
1688 }
1689
1690 // Retrieve the length from the AllocateArrayNode. Narrow the type with a
1691 // CastII, if appropriate. If we are not allowed to create new nodes, and
1692 // a CastII is appropriate, return null.
1693 Node *AllocateArrayNode::make_ideal_length(const TypeOopPtr* oop_type, PhaseTransform *phase, bool allow_new_nodes) {
1694 Node *length = in(AllocateNode::ALength);
1695 assert(length != nullptr, "length is not null");
1696
1697 const TypeInt* length_type = phase->find_int_type(length);
1698 const TypeAryPtr* ary_type = oop_type->isa_aryptr();
1699
1700 if (ary_type != nullptr && length_type != nullptr) {
1701 const TypeInt* narrow_length_type = ary_type->narrow_size_type(length_type);
1702 if (narrow_length_type != length_type) {
1703 // Assert one of:
1704 // - the narrow_length is 0
|
1660
1661 void AllocateNode::compute_MemBar_redundancy(ciMethod* initializer)
1662 {
1663 assert(initializer != nullptr &&
1664 initializer->is_initializer() &&
1665 !initializer->is_static(),
1666 "unexpected initializer method");
1667 BCEscapeAnalyzer* analyzer = initializer->get_bcea();
1668 if (analyzer == nullptr) {
1669 return;
1670 }
1671
1672 // Allocation node is first parameter in its initializer
1673 if (analyzer->is_arg_stack(0) || analyzer->is_arg_local(0)) {
1674 _is_allocation_MemBar_redundant = true;
1675 }
1676 }
1677 Node *AllocateNode::make_ideal_mark(PhaseGVN *phase, Node* obj, Node* control, Node* mem) {
1678 Node* mark_node = nullptr;
1679 // For now only enable fast locking for non-array types
1680 if ((UseBiasedLocking && Opcode() == Op_Allocate) || UseCompactObjectHeaders) {
1681 Node* klass_node = in(AllocateNode::KlassNode);
1682 Node* proto_adr = phase->transform(new AddPNode(klass_node, klass_node, phase->MakeConX(in_bytes(Klass::prototype_header_offset()))));
1683 mark_node = LoadNode::make(*phase, control, mem, proto_adr, TypeRawPtr::BOTTOM, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
1684 } else {
1685 // For now only enable fast locking for non-array types
1686 mark_node = phase->MakeConX(markWord::prototype().value());
1687 }
1688 return mark_node;
1689 }
1690
1691 // Retrieve the length from the AllocateArrayNode. Narrow the type with a
1692 // CastII, if appropriate. If we are not allowed to create new nodes, and
1693 // a CastII is appropriate, return null.
1694 Node *AllocateArrayNode::make_ideal_length(const TypeOopPtr* oop_type, PhaseTransform *phase, bool allow_new_nodes) {
1695 Node *length = in(AllocateNode::ALength);
1696 assert(length != nullptr, "length is not null");
1697
1698 const TypeInt* length_type = phase->find_int_type(length);
1699 const TypeAryPtr* ary_type = oop_type->isa_aryptr();
1700
1701 if (ary_type != nullptr && length_type != nullptr) {
1702 const TypeInt* narrow_length_type = ary_type->narrow_size_type(length_type);
1703 if (narrow_length_type != length_type) {
1704 // Assert one of:
1705 // - the narrow_length is 0
|