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