1600 }
1601
1602 void AllocateNode::compute_MemBar_redundancy(ciMethod* initializer)
1603 {
1604 assert(initializer != nullptr &&
1605 initializer->is_initializer() &&
1606 !initializer->is_static(),
1607 "unexpected initializer method");
1608 BCEscapeAnalyzer* analyzer = initializer->get_bcea();
1609 if (analyzer == nullptr) {
1610 return;
1611 }
1612
1613 // Allocation node is first parameter in its initializer
1614 if (analyzer->is_arg_stack(0) || analyzer->is_arg_local(0)) {
1615 _is_allocation_MemBar_redundant = true;
1616 }
1617 }
1618 Node *AllocateNode::make_ideal_mark(PhaseGVN *phase, Node* obj, Node* control, Node* mem) {
1619 Node* mark_node = nullptr;
1620 // For now only enable fast locking for non-array types
1621 mark_node = phase->MakeConX(markWord::prototype().value());
1622 return mark_node;
1623 }
1624
1625 // Retrieve the length from the AllocateArrayNode. Narrow the type with a
1626 // CastII, if appropriate. If we are not allowed to create new nodes, and
1627 // a CastII is appropriate, return null.
1628 Node *AllocateArrayNode::make_ideal_length(const TypeOopPtr* oop_type, PhaseValues* phase, bool allow_new_nodes) {
1629 Node *length = in(AllocateNode::ALength);
1630 assert(length != nullptr, "length is not null");
1631
1632 const TypeInt* length_type = phase->find_int_type(length);
1633 const TypeAryPtr* ary_type = oop_type->isa_aryptr();
1634
1635 if (ary_type != nullptr && length_type != nullptr) {
1636 const TypeInt* narrow_length_type = ary_type->narrow_size_type(length_type);
1637 if (narrow_length_type != length_type) {
1638 // Assert one of:
1639 // - the narrow_length is 0
1640 // - the narrow_length is not wider than length
1641 assert(narrow_length_type == TypeInt::ZERO ||
|
1600 }
1601
1602 void AllocateNode::compute_MemBar_redundancy(ciMethod* initializer)
1603 {
1604 assert(initializer != nullptr &&
1605 initializer->is_initializer() &&
1606 !initializer->is_static(),
1607 "unexpected initializer method");
1608 BCEscapeAnalyzer* analyzer = initializer->get_bcea();
1609 if (analyzer == nullptr) {
1610 return;
1611 }
1612
1613 // Allocation node is first parameter in its initializer
1614 if (analyzer->is_arg_stack(0) || analyzer->is_arg_local(0)) {
1615 _is_allocation_MemBar_redundant = true;
1616 }
1617 }
1618 Node *AllocateNode::make_ideal_mark(PhaseGVN *phase, Node* obj, Node* control, Node* mem) {
1619 Node* mark_node = nullptr;
1620 if (UseCompactObjectHeaders) {
1621 Node* klass_node = in(AllocateNode::KlassNode);
1622 Node* proto_adr = phase->transform(new AddPNode(klass_node, klass_node, phase->MakeConX(in_bytes(Klass::prototype_header_offset()))));
1623 mark_node = LoadNode::make(*phase, control, mem, proto_adr, TypeRawPtr::BOTTOM, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
1624 } else {
1625 // For now only enable fast locking for non-array types
1626 mark_node = phase->MakeConX(markWord::prototype().value());
1627 }
1628 return mark_node;
1629 }
1630
1631 // Retrieve the length from the AllocateArrayNode. Narrow the type with a
1632 // CastII, if appropriate. If we are not allowed to create new nodes, and
1633 // a CastII is appropriate, return null.
1634 Node *AllocateArrayNode::make_ideal_length(const TypeOopPtr* oop_type, PhaseValues* phase, bool allow_new_nodes) {
1635 Node *length = in(AllocateNode::ALength);
1636 assert(length != nullptr, "length is not null");
1637
1638 const TypeInt* length_type = phase->find_int_type(length);
1639 const TypeAryPtr* ary_type = oop_type->isa_aryptr();
1640
1641 if (ary_type != nullptr && length_type != nullptr) {
1642 const TypeInt* narrow_length_type = ary_type->narrow_size_type(length_type);
1643 if (narrow_length_type != length_type) {
1644 // Assert one of:
1645 // - the narrow_length is 0
1646 // - the narrow_length is not wider than length
1647 assert(narrow_length_type == TypeInt::ZERO ||
|