1558 }
1559
1560 void AllocateNode::compute_MemBar_redundancy(ciMethod* initializer)
1561 {
1562 assert(initializer != nullptr &&
1563 initializer->is_initializer() &&
1564 !initializer->is_static(),
1565 "unexpected initializer method");
1566 BCEscapeAnalyzer* analyzer = initializer->get_bcea();
1567 if (analyzer == nullptr) {
1568 return;
1569 }
1570
1571 // Allocation node is first parameter in its initializer
1572 if (analyzer->is_arg_stack(0) || analyzer->is_arg_local(0)) {
1573 _is_allocation_MemBar_redundant = true;
1574 }
1575 }
1576 Node *AllocateNode::make_ideal_mark(PhaseGVN *phase, Node* obj, Node* control, Node* mem) {
1577 Node* mark_node = nullptr;
1578 // For now only enable fast locking for non-array types
1579 mark_node = phase->MakeConX(markWord::prototype().value());
1580 return mark_node;
1581 }
1582
1583 // Retrieve the length from the AllocateArrayNode. Narrow the type with a
1584 // CastII, if appropriate. If we are not allowed to create new nodes, and
1585 // a CastII is appropriate, return null.
1586 Node *AllocateArrayNode::make_ideal_length(const TypeOopPtr* oop_type, PhaseValues* phase, bool allow_new_nodes) {
1587 Node *length = in(AllocateNode::ALength);
1588 assert(length != nullptr, "length is not null");
1589
1590 const TypeInt* length_type = phase->find_int_type(length);
1591 const TypeAryPtr* ary_type = oop_type->isa_aryptr();
1592
1593 if (ary_type != nullptr && length_type != nullptr) {
1594 const TypeInt* narrow_length_type = ary_type->narrow_size_type(length_type);
1595 if (narrow_length_type != length_type) {
1596 // Assert one of:
1597 // - the narrow_length is 0
1598 // - the narrow_length is not wider than length
1599 assert(narrow_length_type == TypeInt::ZERO ||
|
1558 }
1559
1560 void AllocateNode::compute_MemBar_redundancy(ciMethod* initializer)
1561 {
1562 assert(initializer != nullptr &&
1563 initializer->is_initializer() &&
1564 !initializer->is_static(),
1565 "unexpected initializer method");
1566 BCEscapeAnalyzer* analyzer = initializer->get_bcea();
1567 if (analyzer == nullptr) {
1568 return;
1569 }
1570
1571 // Allocation node is first parameter in its initializer
1572 if (analyzer->is_arg_stack(0) || analyzer->is_arg_local(0)) {
1573 _is_allocation_MemBar_redundant = true;
1574 }
1575 }
1576 Node *AllocateNode::make_ideal_mark(PhaseGVN *phase, Node* obj, Node* control, Node* mem) {
1577 Node* mark_node = nullptr;
1578 if (UseCompactObjectHeaders) {
1579 Node* klass_node = in(AllocateNode::KlassNode);
1580 Node* proto_adr = phase->transform(new AddPNode(klass_node, klass_node, phase->MakeConX(in_bytes(Klass::prototype_header_offset()))));
1581 mark_node = LoadNode::make(*phase, control, mem, proto_adr, TypeRawPtr::BOTTOM, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
1582 } else {
1583 // For now only enable fast locking for non-array types
1584 mark_node = phase->MakeConX(markWord::prototype().value());
1585 }
1586 return mark_node;
1587 }
1588
1589 // Retrieve the length from the AllocateArrayNode. Narrow the type with a
1590 // CastII, if appropriate. If we are not allowed to create new nodes, and
1591 // a CastII is appropriate, return null.
1592 Node *AllocateArrayNode::make_ideal_length(const TypeOopPtr* oop_type, PhaseValues* phase, bool allow_new_nodes) {
1593 Node *length = in(AllocateNode::ALength);
1594 assert(length != nullptr, "length is not null");
1595
1596 const TypeInt* length_type = phase->find_int_type(length);
1597 const TypeAryPtr* ary_type = oop_type->isa_aryptr();
1598
1599 if (ary_type != nullptr && length_type != nullptr) {
1600 const TypeInt* narrow_length_type = ary_type->narrow_size_type(length_type);
1601 if (narrow_length_type != length_type) {
1602 // Assert one of:
1603 // - the narrow_length is 0
1604 // - the narrow_length is not wider than length
1605 assert(narrow_length_type == TypeInt::ZERO ||
|