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