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