366 t = t->make_ptr();
367 }
368 if (t->isa_intptr_t() && offset != 0 && offset != Type::OffsetBot) {
369 // We cannot assert that the offset does not look oop-ish here.
370 // Depending on the heap layout the cardmark base could land
371 // inside some oopish region. It definitely does for Win2K.
372 // The sum of cardmark-base plus shift-by-9-oop lands outside
373 // the oop-ish area but we can't assert for that statically.
374 return TypeRawPtr::BOTTOM;
375 }
376
377 const TypePtr *tp = t->isa_ptr();
378
379 // be conservative if we do not recognize the type
380 if (tp == NULL) {
381 assert(false, "this path may produce not optimal code");
382 return TypePtr::BOTTOM;
383 }
384 assert(tp->base() != Type::AnyPtr, "not a bare pointer");
385
386 return tp->add_offset(offset);
387 }
388
389
390 //-----------------------------operand_index---------------------------------
391 int MachNode::operand_index(uint operand) const {
392 if (operand < 1) return -1;
393 assert(operand < num_opnds(), "oob");
394 if (_opnds[operand]->num_edges() == 0) return -1;
395
396 uint skipped = oper_input_base(); // Sum of leaves skipped so far
397 for (uint opcnt = 1; opcnt < operand; opcnt++) {
398 uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand
399 skipped += num_edges;
400 }
401 return skipped;
402 }
403
404 int MachNode::operand_index(const MachOper *oper) const {
405 uint skipped = oper_input_base(); // Sum of leaves skipped so far
652 const RegMask &MachSafePointNode::in_RegMask( uint idx ) const {
653 // Values in the domain use the users calling convention, embodied in the
654 // _in_rms array of RegMasks.
655 if( idx < TypeFunc::Parms ) return _in_rms[idx];
656
657 if (idx == TypeFunc::Parms &&
658 ideal_Opcode() == Op_SafePoint) {
659 return MachNode::in_RegMask(idx);
660 }
661
662 // Values outside the domain represent debug info
663 assert(in(idx)->ideal_reg() != Op_RegFlags, "flags register is not spillable");
664 return *Compile::current()->matcher()->idealreg2spillmask[in(idx)->ideal_reg()];
665 }
666
667
668 //=============================================================================
669
670 bool MachCallNode::cmp( const Node &n ) const
671 { return _tf == ((MachCallNode&)n)._tf; }
672 const Type *MachCallNode::bottom_type() const { return tf()->range(); }
673 const Type* MachCallNode::Value(PhaseGVN* phase) const { return tf()->range(); }
674
675 #ifndef PRODUCT
676 void MachCallNode::dump_spec(outputStream *st) const {
677 st->print("# ");
678 if (tf() != NULL) tf()->dump_on(st);
679 if (_cnt != COUNT_UNKNOWN) st->print(" C=%f",_cnt);
680 if (jvms() != NULL) jvms()->dump_spec(st);
681 }
682 #endif
683
684 #ifndef _LP64
685 bool MachCallNode::return_value_is_used() const {
686 if (tf()->range()->cnt() == TypeFunc::Parms) {
687 // void return
688 return false;
689 }
690
691 // find the projection corresponding to the return value
692 for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
693 Node *use = fast_out(i);
694 if (!use->is_Proj()) continue;
695 if (use->as_Proj()->_con == TypeFunc::Parms) {
696 return true;
697 }
698 }
699 return false;
700 }
701 #endif
702
703 // Similar to cousin class CallNode::returns_pointer
704 // Because this is used in deoptimization, we want the type info, not the data
705 // flow info; the interpreter will "use" things that are dead to the optimizer.
706 bool MachCallNode::returns_pointer() const {
707 const TypeTuple *r = tf()->range();
708 return (r->cnt() > TypeFunc::Parms &&
709 r->field_at(TypeFunc::Parms)->isa_ptr());
710 }
711
712 //------------------------------Registers--------------------------------------
713 const RegMask &MachCallNode::in_RegMask(uint idx) const {
714 // Values in the domain use the users calling convention, embodied in the
715 // _in_rms array of RegMasks.
716 if (idx < tf()->domain()->cnt()) {
717 return _in_rms[idx];
718 }
719 if (idx == mach_constant_base_node_input()) {
720 return MachConstantBaseNode::static_out_RegMask();
721 }
722 // Values outside the domain represent debug info
723 return *Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()];
724 }
725
726 //=============================================================================
727 uint MachCallJavaNode::size_of() const { return sizeof(*this); }
728 bool MachCallJavaNode::cmp( const Node &n ) const {
729 MachCallJavaNode &call = (MachCallJavaNode&)n;
730 return MachCallNode::cmp(call) && _method->equals(call._method) &&
731 _override_symbolic_info == call._override_symbolic_info;
732 }
733 #ifndef PRODUCT
734 void MachCallJavaNode::dump_spec(outputStream *st) const {
735 if (_method_handle_invoke)
736 st->print("MethodHandle ");
737 if (_method) {
738 _method->print_short_name(st);
739 st->print(" ");
740 }
741 MachCallNode::dump_spec(st);
742 }
743 #endif
744
745 //------------------------------Registers--------------------------------------
746 const RegMask &MachCallJavaNode::in_RegMask(uint idx) const {
747 // Values in the domain use the users calling convention, embodied in the
748 // _in_rms array of RegMasks.
749 if (idx < tf()->domain()->cnt()) {
750 return _in_rms[idx];
751 }
752 if (idx == mach_constant_base_node_input()) {
753 return MachConstantBaseNode::static_out_RegMask();
754 }
755 // Values outside the domain represent debug info
756 Matcher* m = Compile::current()->matcher();
757 // If this call is a MethodHandle invoke we have to use a different
758 // debugmask which does not include the register we use to save the
759 // SP over MH invokes.
760 RegMask** debugmask = _method_handle_invoke ? m->idealreg2mhdebugmask : m->idealreg2debugmask;
761 return *debugmask[in(idx)->ideal_reg()];
762 }
763
764 //=============================================================================
765 uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); }
766 bool MachCallStaticJavaNode::cmp( const Node &n ) const {
767 MachCallStaticJavaNode &call = (MachCallStaticJavaNode&)n;
768 return MachCallJavaNode::cmp(call) && _name == call._name;
769 }
|
366 t = t->make_ptr();
367 }
368 if (t->isa_intptr_t() && offset != 0 && offset != Type::OffsetBot) {
369 // We cannot assert that the offset does not look oop-ish here.
370 // Depending on the heap layout the cardmark base could land
371 // inside some oopish region. It definitely does for Win2K.
372 // The sum of cardmark-base plus shift-by-9-oop lands outside
373 // the oop-ish area but we can't assert for that statically.
374 return TypeRawPtr::BOTTOM;
375 }
376
377 const TypePtr *tp = t->isa_ptr();
378
379 // be conservative if we do not recognize the type
380 if (tp == NULL) {
381 assert(false, "this path may produce not optimal code");
382 return TypePtr::BOTTOM;
383 }
384 assert(tp->base() != Type::AnyPtr, "not a bare pointer");
385
386 if (tp->isa_aryptr()) {
387 // In the case of a flattened inline type array, each field has its
388 // own slice so we need to extract the field being accessed from
389 // the address computation
390 if (offset == Type::OffsetBot) {
391 Node* base;
392 Node* index;
393 const MachOper* oper = memory_inputs(base, index);
394 if (oper != (MachOper*)-1) {
395 offset = oper->constant_disp();
396 return tp->is_aryptr()->add_field_offset_and_offset(offset)->add_offset(Type::OffsetBot);
397 }
398 }
399 return tp->is_aryptr()->add_field_offset_and_offset(offset);
400 }
401
402 return tp->add_offset(offset);
403 }
404
405
406 //-----------------------------operand_index---------------------------------
407 int MachNode::operand_index(uint operand) const {
408 if (operand < 1) return -1;
409 assert(operand < num_opnds(), "oob");
410 if (_opnds[operand]->num_edges() == 0) return -1;
411
412 uint skipped = oper_input_base(); // Sum of leaves skipped so far
413 for (uint opcnt = 1; opcnt < operand; opcnt++) {
414 uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand
415 skipped += num_edges;
416 }
417 return skipped;
418 }
419
420 int MachNode::operand_index(const MachOper *oper) const {
421 uint skipped = oper_input_base(); // Sum of leaves skipped so far
668 const RegMask &MachSafePointNode::in_RegMask( uint idx ) const {
669 // Values in the domain use the users calling convention, embodied in the
670 // _in_rms array of RegMasks.
671 if( idx < TypeFunc::Parms ) return _in_rms[idx];
672
673 if (idx == TypeFunc::Parms &&
674 ideal_Opcode() == Op_SafePoint) {
675 return MachNode::in_RegMask(idx);
676 }
677
678 // Values outside the domain represent debug info
679 assert(in(idx)->ideal_reg() != Op_RegFlags, "flags register is not spillable");
680 return *Compile::current()->matcher()->idealreg2spillmask[in(idx)->ideal_reg()];
681 }
682
683
684 //=============================================================================
685
686 bool MachCallNode::cmp( const Node &n ) const
687 { return _tf == ((MachCallNode&)n)._tf; }
688 const Type *MachCallNode::bottom_type() const { return tf()->range_cc(); }
689 const Type* MachCallNode::Value(PhaseGVN* phase) const { return tf()->range_cc(); }
690
691 #ifndef PRODUCT
692 void MachCallNode::dump_spec(outputStream *st) const {
693 st->print("# ");
694 if (tf() != NULL) tf()->dump_on(st);
695 if (_cnt != COUNT_UNKNOWN) st->print(" C=%f",_cnt);
696 if (jvms() != NULL) jvms()->dump_spec(st);
697 }
698 #endif
699
700 bool MachCallNode::return_value_is_used() const {
701 if (tf()->range_sig()->cnt() == TypeFunc::Parms) {
702 // void return
703 return false;
704 }
705
706 // find the projection corresponding to the return value
707 for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
708 Node *use = fast_out(i);
709 if (!use->is_Proj()) continue;
710 if (use->as_Proj()->_con == TypeFunc::Parms) {
711 return true;
712 }
713 }
714 return false;
715 }
716
717 // Similar to cousin class CallNode::returns_pointer
718 // Because this is used in deoptimization, we want the type info, not the data
719 // flow info; the interpreter will "use" things that are dead to the optimizer.
720 bool MachCallNode::returns_pointer() const {
721 const TypeTuple *r = tf()->range_sig();
722 return (r->cnt() > TypeFunc::Parms &&
723 r->field_at(TypeFunc::Parms)->isa_ptr());
724 }
725
726 bool MachCallNode::returns_scalarized() const {
727 return tf()->returns_inline_type_as_fields();
728 }
729
730 //------------------------------Registers--------------------------------------
731 const RegMask &MachCallNode::in_RegMask(uint idx) const {
732 // Values in the domain use the users calling convention, embodied in the
733 // _in_rms array of RegMasks.
734 if (entry_point() == NULL && idx == TypeFunc::Parms) {
735 // Null entry point is a special cast where the target of the call
736 // is in a register.
737 return MachNode::in_RegMask(idx);
738 }
739 if (idx < tf()->domain_sig()->cnt()) {
740 return _in_rms[idx];
741 }
742 if (idx == mach_constant_base_node_input()) {
743 return MachConstantBaseNode::static_out_RegMask();
744 }
745 // Values outside the domain represent debug info
746 return *Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()];
747 }
748
749 //=============================================================================
750 uint MachCallJavaNode::size_of() const { return sizeof(*this); }
751 bool MachCallJavaNode::cmp( const Node &n ) const {
752 MachCallJavaNode &call = (MachCallJavaNode&)n;
753 return MachCallNode::cmp(call) && _method->equals(call._method) &&
754 _override_symbolic_info == call._override_symbolic_info;
755 }
756 #ifndef PRODUCT
757 void MachCallJavaNode::dump_spec(outputStream *st) const {
758 if (_method_handle_invoke)
759 st->print("MethodHandle ");
760 if (_method) {
761 _method->print_short_name(st);
762 st->print(" ");
763 }
764 MachCallNode::dump_spec(st);
765 }
766 #endif
767
768 //------------------------------Registers--------------------------------------
769 const RegMask &MachCallJavaNode::in_RegMask(uint idx) const {
770 // Values in the domain use the users calling convention, embodied in the
771 // _in_rms array of RegMasks.
772 if (idx < tf()->domain_cc()->cnt()) {
773 return _in_rms[idx];
774 }
775 if (idx == mach_constant_base_node_input()) {
776 return MachConstantBaseNode::static_out_RegMask();
777 }
778 // Values outside the domain represent debug info
779 Matcher* m = Compile::current()->matcher();
780 // If this call is a MethodHandle invoke we have to use a different
781 // debugmask which does not include the register we use to save the
782 // SP over MH invokes.
783 RegMask** debugmask = _method_handle_invoke ? m->idealreg2mhdebugmask : m->idealreg2debugmask;
784 return *debugmask[in(idx)->ideal_reg()];
785 }
786
787 //=============================================================================
788 uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); }
789 bool MachCallStaticJavaNode::cmp( const Node &n ) const {
790 MachCallStaticJavaNode &call = (MachCallStaticJavaNode&)n;
791 return MachCallJavaNode::cmp(call) && _name == call._name;
792 }
|