1555 C->add_macro_node(this);
1556 }
1557
1558 void AllocateNode::compute_MemBar_redundancy(ciMethod* initializer)
1559 {
1560 assert(initializer != NULL &&
1561 initializer->is_initializer() &&
1562 !initializer->is_static(),
1563 "unexpected initializer method");
1564 BCEscapeAnalyzer* analyzer = initializer->get_bcea();
1565 if (analyzer == NULL) {
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 = NULL;
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, PhaseTransform *phase, bool allow_new_nodes) {
1585 Node *length = in(AllocateNode::ALength);
1586 assert(length != NULL, "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 != NULL && length_type != NULL) {
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 ||
|
1555 C->add_macro_node(this);
1556 }
1557
1558 void AllocateNode::compute_MemBar_redundancy(ciMethod* initializer)
1559 {
1560 assert(initializer != NULL &&
1561 initializer->is_initializer() &&
1562 !initializer->is_static(),
1563 "unexpected initializer method");
1564 BCEscapeAnalyzer* analyzer = initializer->get_bcea();
1565 if (analyzer == NULL) {
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* klass_node = in(AllocateNode::KlassNode);
1576 Node* proto_adr = phase->transform(new AddPNode(klass_node, klass_node, phase->MakeConX(in_bytes(Klass::prototype_header_offset()))));
1577 Node* mark_node = LoadNode::make(*phase, control, mem, proto_adr, TypeRawPtr::BOTTOM, TypeX_X, TypeX_X->basic_type(), MemNode::unordered);
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, PhaseTransform *phase, bool allow_new_nodes) {
1585 Node *length = in(AllocateNode::ALength);
1586 assert(length != NULL, "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 != NULL && length_type != NULL) {
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 ||
|