389 t = t->make_ptr();
390 }
391 if (t->isa_intptr_t() && offset != 0 && offset != Type::OffsetBot) {
392 // We cannot assert that the offset does not look oop-ish here.
393 // Depending on the heap layout the cardmark base could land
394 // inside some oopish region. It definitely does for Win2K.
395 // The sum of cardmark-base plus shift-by-9-oop lands outside
396 // the oop-ish area but we can't assert for that statically.
397 return TypeRawPtr::BOTTOM;
398 }
399
400 const TypePtr *tp = t->isa_ptr();
401
402 // be conservative if we do not recognize the type
403 if (tp == nullptr) {
404 assert(false, "this path may produce not optimal code");
405 return TypePtr::BOTTOM;
406 }
407 assert(tp->base() != Type::AnyPtr, "not a bare pointer");
408
409 return tp->add_offset(offset);
410 }
411
412
413 //-----------------------------operand_index---------------------------------
414 int MachNode::operand_index(uint operand) const {
415 if (operand < 1) return -1;
416 assert(operand < num_opnds(), "oob");
417 if (_opnds[operand]->num_edges() == 0) return -1;
418
419 uint skipped = oper_input_base(); // Sum of leaves skipped so far
420 for (uint opcnt = 1; opcnt < operand; opcnt++) {
421 uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand
422 skipped += num_edges;
423 }
424 return skipped;
425 }
426
427 int MachNode::operand_index(const MachOper *oper) const {
428 uint skipped = oper_input_base(); // Sum of leaves skipped so far
681 const RegMask &MachSafePointNode::in_RegMask( uint idx ) const {
682 // Values in the domain use the users calling convention, embodied in the
683 // _in_rms array of RegMasks.
684 if( idx < TypeFunc::Parms ) return _in_rms[idx];
685
686 if (idx == TypeFunc::Parms &&
687 ideal_Opcode() == Op_SafePoint) {
688 return MachNode::in_RegMask(idx);
689 }
690
691 // Values outside the domain represent debug info
692 assert(in(idx)->ideal_reg() != Op_RegFlags, "flags register is not spillable");
693 return *Compile::current()->matcher()->idealreg2spillmask[in(idx)->ideal_reg()];
694 }
695
696
697 //=============================================================================
698
699 bool MachCallNode::cmp( const Node &n ) const
700 { return _tf == ((MachCallNode&)n)._tf; }
701 const Type *MachCallNode::bottom_type() const { return tf()->range(); }
702 const Type* MachCallNode::Value(PhaseGVN* phase) const { return tf()->range(); }
703
704 #ifndef PRODUCT
705 void MachCallNode::dump_spec(outputStream *st) const {
706 st->print("# ");
707 if (tf() != nullptr) tf()->dump_on(st);
708 if (_cnt != COUNT_UNKNOWN) st->print(" C=%f",_cnt);
709 if (jvms() != nullptr) jvms()->dump_spec(st);
710 }
711 #endif
712
713 #ifndef _LP64
714 bool MachCallNode::return_value_is_used() const {
715 if (tf()->range()->cnt() == TypeFunc::Parms) {
716 // void return
717 return false;
718 }
719
720 // find the projection corresponding to the return value
721 for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
722 Node *use = fast_out(i);
723 if (!use->is_Proj()) continue;
724 if (use->as_Proj()->_con == TypeFunc::Parms) {
725 return true;
726 }
727 }
728 return false;
729 }
730 #endif
731
732 // Similar to cousin class CallNode::returns_pointer
733 // Because this is used in deoptimization, we want the type info, not the data
734 // flow info; the interpreter will "use" things that are dead to the optimizer.
735 bool MachCallNode::returns_pointer() const {
736 const TypeTuple *r = tf()->range();
737 return (r->cnt() > TypeFunc::Parms &&
738 r->field_at(TypeFunc::Parms)->isa_ptr());
739 }
740
741 //------------------------------Registers--------------------------------------
742 const RegMask &MachCallNode::in_RegMask(uint idx) const {
743 // Values in the domain use the users calling convention, embodied in the
744 // _in_rms array of RegMasks.
745 if (idx < tf()->domain()->cnt()) {
746 return _in_rms[idx];
747 }
748 if (idx == mach_constant_base_node_input()) {
749 return MachConstantBaseNode::static_out_RegMask();
750 }
751 // Values outside the domain represent debug info
752 return *Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()];
753 }
754
755 //=============================================================================
756 uint MachCallJavaNode::size_of() const { return sizeof(*this); }
757 bool MachCallJavaNode::cmp( const Node &n ) const {
758 MachCallJavaNode &call = (MachCallJavaNode&)n;
759 return MachCallNode::cmp(call) && _method->equals(call._method) &&
760 _override_symbolic_info == call._override_symbolic_info;
761 }
762 #ifndef PRODUCT
763 void MachCallJavaNode::dump_spec(outputStream *st) const {
764 if (_method_handle_invoke)
765 st->print("MethodHandle ");
766 if (_method) {
767 _method->print_short_name(st);
768 st->print(" ");
769 }
770 MachCallNode::dump_spec(st);
771 }
772 #endif
773
774 //------------------------------Registers--------------------------------------
775 const RegMask &MachCallJavaNode::in_RegMask(uint idx) const {
776 // Values in the domain use the users calling convention, embodied in the
777 // _in_rms array of RegMasks.
778 if (idx < tf()->domain()->cnt()) {
779 return _in_rms[idx];
780 }
781 if (idx == mach_constant_base_node_input()) {
782 return MachConstantBaseNode::static_out_RegMask();
783 }
784 // Values outside the domain represent debug info
785 Matcher* m = Compile::current()->matcher();
786 // If this call is a MethodHandle invoke we have to use a different
787 // debugmask which does not include the register we use to save the
788 // SP over MH invokes.
789 RegMask** debugmask = _method_handle_invoke ? m->idealreg2mhdebugmask : m->idealreg2debugmask;
790 return *debugmask[in(idx)->ideal_reg()];
791 }
792
793 //=============================================================================
794 uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); }
795 bool MachCallStaticJavaNode::cmp( const Node &n ) const {
796 MachCallStaticJavaNode &call = (MachCallStaticJavaNode&)n;
797 return MachCallJavaNode::cmp(call) && _name == call._name;
798 }
|
389 t = t->make_ptr();
390 }
391 if (t->isa_intptr_t() && offset != 0 && offset != Type::OffsetBot) {
392 // We cannot assert that the offset does not look oop-ish here.
393 // Depending on the heap layout the cardmark base could land
394 // inside some oopish region. It definitely does for Win2K.
395 // The sum of cardmark-base plus shift-by-9-oop lands outside
396 // the oop-ish area but we can't assert for that statically.
397 return TypeRawPtr::BOTTOM;
398 }
399
400 const TypePtr *tp = t->isa_ptr();
401
402 // be conservative if we do not recognize the type
403 if (tp == nullptr) {
404 assert(false, "this path may produce not optimal code");
405 return TypePtr::BOTTOM;
406 }
407 assert(tp->base() != Type::AnyPtr, "not a bare pointer");
408
409 if (tp->isa_aryptr()) {
410 // In the case of a flat inline type array, each field has its
411 // own slice so we need to extract the field being accessed from
412 // the address computation
413 if (offset == Type::OffsetBot) {
414 Node* base;
415 Node* index;
416 const MachOper* oper = memory_inputs(base, index);
417 if (oper != (MachOper*)-1) {
418 offset = oper->constant_disp();
419 return tp->is_aryptr()->add_field_offset_and_offset(offset)->add_offset(Type::OffsetBot);
420 }
421 }
422 return tp->is_aryptr()->add_field_offset_and_offset(offset);
423 }
424
425 return tp->add_offset(offset);
426 }
427
428
429 //-----------------------------operand_index---------------------------------
430 int MachNode::operand_index(uint operand) const {
431 if (operand < 1) return -1;
432 assert(operand < num_opnds(), "oob");
433 if (_opnds[operand]->num_edges() == 0) return -1;
434
435 uint skipped = oper_input_base(); // Sum of leaves skipped so far
436 for (uint opcnt = 1; opcnt < operand; opcnt++) {
437 uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand
438 skipped += num_edges;
439 }
440 return skipped;
441 }
442
443 int MachNode::operand_index(const MachOper *oper) const {
444 uint skipped = oper_input_base(); // Sum of leaves skipped so far
697 const RegMask &MachSafePointNode::in_RegMask( uint idx ) const {
698 // Values in the domain use the users calling convention, embodied in the
699 // _in_rms array of RegMasks.
700 if( idx < TypeFunc::Parms ) return _in_rms[idx];
701
702 if (idx == TypeFunc::Parms &&
703 ideal_Opcode() == Op_SafePoint) {
704 return MachNode::in_RegMask(idx);
705 }
706
707 // Values outside the domain represent debug info
708 assert(in(idx)->ideal_reg() != Op_RegFlags, "flags register is not spillable");
709 return *Compile::current()->matcher()->idealreg2spillmask[in(idx)->ideal_reg()];
710 }
711
712
713 //=============================================================================
714
715 bool MachCallNode::cmp( const Node &n ) const
716 { return _tf == ((MachCallNode&)n)._tf; }
717 const Type *MachCallNode::bottom_type() const { return tf()->range_cc(); }
718 const Type* MachCallNode::Value(PhaseGVN* phase) const { return tf()->range_cc(); }
719
720 #ifndef PRODUCT
721 void MachCallNode::dump_spec(outputStream *st) const {
722 st->print("# ");
723 if (tf() != nullptr) tf()->dump_on(st);
724 if (_cnt != COUNT_UNKNOWN) st->print(" C=%f",_cnt);
725 if (jvms() != nullptr) jvms()->dump_spec(st);
726 }
727 #endif
728
729 bool MachCallNode::return_value_is_used() const {
730 if (tf()->range_sig()->cnt() == TypeFunc::Parms) {
731 // void return
732 return false;
733 }
734
735 // find the projection corresponding to the return value
736 for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
737 Node *use = fast_out(i);
738 if (!use->is_Proj()) continue;
739 if (use->as_Proj()->_con == TypeFunc::Parms) {
740 return true;
741 }
742 }
743 return false;
744 }
745
746 // Similar to cousin class CallNode::returns_pointer
747 // Because this is used in deoptimization, we want the type info, not the data
748 // flow info; the interpreter will "use" things that are dead to the optimizer.
749 bool MachCallNode::returns_pointer() const {
750 const TypeTuple *r = tf()->range_sig();
751 return (r->cnt() > TypeFunc::Parms &&
752 r->field_at(TypeFunc::Parms)->isa_ptr());
753 }
754
755 bool MachCallNode::returns_scalarized() const {
756 return tf()->returns_inline_type_as_fields();
757 }
758
759 //------------------------------Registers--------------------------------------
760 const RegMask &MachCallNode::in_RegMask(uint idx) const {
761 // Values in the domain use the users calling convention, embodied in the
762 // _in_rms array of RegMasks.
763 if (entry_point() == nullptr && idx == TypeFunc::Parms) {
764 // Null entry point is a special cast where the target of the call
765 // is in a register.
766 return MachNode::in_RegMask(idx);
767 }
768 if (idx < tf()->domain_sig()->cnt()) {
769 return _in_rms[idx];
770 }
771 if (idx == mach_constant_base_node_input()) {
772 return MachConstantBaseNode::static_out_RegMask();
773 }
774 // Values outside the domain represent debug info
775 return *Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()];
776 }
777
778 //=============================================================================
779 uint MachCallJavaNode::size_of() const { return sizeof(*this); }
780 bool MachCallJavaNode::cmp( const Node &n ) const {
781 MachCallJavaNode &call = (MachCallJavaNode&)n;
782 return MachCallNode::cmp(call) && _method->equals(call._method) &&
783 _override_symbolic_info == call._override_symbolic_info;
784 }
785 #ifndef PRODUCT
786 void MachCallJavaNode::dump_spec(outputStream *st) const {
787 if (_method_handle_invoke)
788 st->print("MethodHandle ");
789 if (_method) {
790 _method->print_short_name(st);
791 st->print(" ");
792 }
793 MachCallNode::dump_spec(st);
794 }
795 #endif
796
797 //------------------------------Registers--------------------------------------
798 const RegMask &MachCallJavaNode::in_RegMask(uint idx) const {
799 // Values in the domain use the users calling convention, embodied in the
800 // _in_rms array of RegMasks.
801 if (idx < tf()->domain_cc()->cnt()) {
802 return _in_rms[idx];
803 }
804 if (idx == mach_constant_base_node_input()) {
805 return MachConstantBaseNode::static_out_RegMask();
806 }
807 // Values outside the domain represent debug info
808 Matcher* m = Compile::current()->matcher();
809 // If this call is a MethodHandle invoke we have to use a different
810 // debugmask which does not include the register we use to save the
811 // SP over MH invokes.
812 RegMask** debugmask = _method_handle_invoke ? m->idealreg2mhdebugmask : m->idealreg2debugmask;
813 return *debugmask[in(idx)->ideal_reg()];
814 }
815
816 //=============================================================================
817 uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); }
818 bool MachCallStaticJavaNode::cmp( const Node &n ) const {
819 MachCallStaticJavaNode &call = (MachCallStaticJavaNode&)n;
820 return MachCallJavaNode::cmp(call) && _name == call._name;
821 }
|