< prev index next >

src/hotspot/share/opto/machnode.cpp

Print this page

399       offset != 0 &&
400 #endif
401       offset != Type::OffsetBot) {
402     // We cannot assert that the offset does not look oop-ish here.
403     // Depending on the heap layout the cardmark base could land
404     // inside some oopish region.  It definitely does for Win2K.
405     // The sum of cardmark-base plus shift-by-9-oop lands outside
406     // the oop-ish area but we can't assert for that statically.
407     return TypeRawPtr::BOTTOM;
408   }
409 
410   const TypePtr *tp = t->isa_ptr();
411 
412   // be conservative if we do not recognize the type
413   if (tp == nullptr) {
414     assert(false, "this path may produce not optimal code");
415     return TypePtr::BOTTOM;
416   }
417   assert(tp->base() != Type::AnyPtr, "not a bare pointer");
418 
















419   return tp->add_offset(offset);
420 }
421 
422 
423 //-----------------------------operand_index---------------------------------
424 int MachNode::operand_index(uint operand) const {
425   if (operand < 1)  return -1;
426   assert(operand < num_opnds(), "oob");
427   if (_opnds[operand]->num_edges() == 0)  return -1;
428 
429   uint skipped   = oper_input_base(); // Sum of leaves skipped so far
430   for (uint opcnt = 1; opcnt < operand; opcnt++) {
431     uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand
432     skipped += num_edges;
433   }
434   return skipped;
435 }
436 
437 int MachNode::operand_index(const MachOper *oper) const {
438   uint skipped = oper_input_base(); // Sum of leaves skipped so far

692 const RegMask &MachSafePointNode::in_RegMask( uint idx ) const {
693   // Values in the domain use the users calling convention, embodied in the
694   // _in_rms array of RegMasks.
695   if( idx < TypeFunc::Parms ) return _in_rms[idx];
696 
697   if (idx == TypeFunc::Parms &&
698       ideal_Opcode() == Op_SafePoint) {
699     return MachNode::in_RegMask(idx);
700   }
701 
702   // Values outside the domain represent debug info
703   assert(in(idx)->ideal_reg() != Op_RegFlags, "flags register is not spillable");
704   return *Compile::current()->matcher()->idealreg2spillmask[in(idx)->ideal_reg()];
705 }
706 
707 
708 //=============================================================================
709 
710 bool MachCallNode::cmp( const Node &n ) const
711 { return _tf == ((MachCallNode&)n)._tf; }
712 const Type *MachCallNode::bottom_type() const { return tf()->range(); }
713 const Type* MachCallNode::Value(PhaseGVN* phase) const { return tf()->range(); }
714 
715 #ifndef PRODUCT
716 void MachCallNode::dump_spec(outputStream *st) const {
717   st->print("# ");
718   if (tf() != nullptr)  tf()->dump_on(st);
719   if (_cnt != COUNT_UNKNOWN)  st->print(" C=%f",_cnt);
720   if (jvms() != nullptr)  jvms()->dump_spec(st);
721 }
722 #endif
723 
724 #ifndef _LP64
725 bool MachCallNode::return_value_is_used() const {
726   if (tf()->range()->cnt() == TypeFunc::Parms) {
727     // void return
728     return false;
729   }
730 
731   // find the projection corresponding to the return value
732   for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
733     Node *use = fast_out(i);
734     if (!use->is_Proj()) continue;
735     if (use->as_Proj()->_con == TypeFunc::Parms) {
736       return true;
737     }
738   }
739   return false;
740 }
741 #endif
742 
743 // Similar to cousin class CallNode::returns_pointer
744 // Because this is used in deoptimization, we want the type info, not the data
745 // flow info; the interpreter will "use" things that are dead to the optimizer.
746 bool MachCallNode::returns_pointer() const {
747   const TypeTuple *r = tf()->range();
748   return (r->cnt() > TypeFunc::Parms &&
749           r->field_at(TypeFunc::Parms)->isa_ptr());
750 }
751 




752 //------------------------------Registers--------------------------------------
753 const RegMask &MachCallNode::in_RegMask(uint idx) const {
754   // Values in the domain use the users calling convention, embodied in the
755   // _in_rms array of RegMasks.
756   if (idx < tf()->domain()->cnt()) {





757     return _in_rms[idx];
758   }
759   if (idx == mach_constant_base_node_input()) {
760     return MachConstantBaseNode::static_out_RegMask();
761   }
762   // Values outside the domain represent debug info
763   return *Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()];
764 }
765 
766 //=============================================================================
767 uint MachCallJavaNode::size_of() const { return sizeof(*this); }
768 bool MachCallJavaNode::cmp( const Node &n ) const {
769   MachCallJavaNode &call = (MachCallJavaNode&)n;
770   return MachCallNode::cmp(call) && _method->equals(call._method) &&
771          _override_symbolic_info == call._override_symbolic_info;
772 }
773 #ifndef PRODUCT
774 void MachCallJavaNode::dump_spec(outputStream *st) const {
775   if (_method_handle_invoke)
776     st->print("MethodHandle ");
777   if (_method) {
778     _method->print_short_name(st);
779     st->print(" ");
780   }
781   MachCallNode::dump_spec(st);
782 }
783 #endif
784 
785 //------------------------------Registers--------------------------------------
786 const RegMask &MachCallJavaNode::in_RegMask(uint idx) const {
787   // Values in the domain use the users calling convention, embodied in the
788   // _in_rms array of RegMasks.
789   if (idx < tf()->domain()->cnt()) {
790     return _in_rms[idx];
791   }
792   if (idx == mach_constant_base_node_input()) {
793     return MachConstantBaseNode::static_out_RegMask();
794   }
795   // Values outside the domain represent debug info
796   Matcher* m = Compile::current()->matcher();
797   // If this call is a MethodHandle invoke we have to use a different
798   // debugmask which does not include the register we use to save the
799   // SP over MH invokes.
800   RegMask** debugmask = _method_handle_invoke ? m->idealreg2mhdebugmask : m->idealreg2debugmask;
801   return *debugmask[in(idx)->ideal_reg()];
802 }
803 
804 //=============================================================================
805 uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); }
806 bool MachCallStaticJavaNode::cmp( const Node &n ) const {
807   MachCallStaticJavaNode &call = (MachCallStaticJavaNode&)n;
808   return MachCallJavaNode::cmp(call) && _name == call._name;
809 }

399       offset != 0 &&
400 #endif
401       offset != Type::OffsetBot) {
402     // We cannot assert that the offset does not look oop-ish here.
403     // Depending on the heap layout the cardmark base could land
404     // inside some oopish region.  It definitely does for Win2K.
405     // The sum of cardmark-base plus shift-by-9-oop lands outside
406     // the oop-ish area but we can't assert for that statically.
407     return TypeRawPtr::BOTTOM;
408   }
409 
410   const TypePtr *tp = t->isa_ptr();
411 
412   // be conservative if we do not recognize the type
413   if (tp == nullptr) {
414     assert(false, "this path may produce not optimal code");
415     return TypePtr::BOTTOM;
416   }
417   assert(tp->base() != Type::AnyPtr, "not a bare pointer");
418 
419   if (tp->isa_aryptr()) {
420     // In the case of a flat inline type array, each field has its
421     // own slice so we need to extract the field being accessed from
422     // the address computation
423     if (offset == Type::OffsetBot) {
424       Node* base;
425       Node* index;
426       const MachOper* oper = memory_inputs(base, index);
427       if (oper != (MachOper*)-1) {
428         offset = oper->constant_disp();
429         return tp->is_aryptr()->add_field_offset_and_offset(offset)->add_offset(Type::OffsetBot);
430       }
431     }
432     return tp->is_aryptr()->add_field_offset_and_offset(offset);
433   }
434 
435   return tp->add_offset(offset);
436 }
437 
438 
439 //-----------------------------operand_index---------------------------------
440 int MachNode::operand_index(uint operand) const {
441   if (operand < 1)  return -1;
442   assert(operand < num_opnds(), "oob");
443   if (_opnds[operand]->num_edges() == 0)  return -1;
444 
445   uint skipped   = oper_input_base(); // Sum of leaves skipped so far
446   for (uint opcnt = 1; opcnt < operand; opcnt++) {
447     uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand
448     skipped += num_edges;
449   }
450   return skipped;
451 }
452 
453 int MachNode::operand_index(const MachOper *oper) const {
454   uint skipped = oper_input_base(); // Sum of leaves skipped so far

708 const RegMask &MachSafePointNode::in_RegMask( uint idx ) const {
709   // Values in the domain use the users calling convention, embodied in the
710   // _in_rms array of RegMasks.
711   if( idx < TypeFunc::Parms ) return _in_rms[idx];
712 
713   if (idx == TypeFunc::Parms &&
714       ideal_Opcode() == Op_SafePoint) {
715     return MachNode::in_RegMask(idx);
716   }
717 
718   // Values outside the domain represent debug info
719   assert(in(idx)->ideal_reg() != Op_RegFlags, "flags register is not spillable");
720   return *Compile::current()->matcher()->idealreg2spillmask[in(idx)->ideal_reg()];
721 }
722 
723 
724 //=============================================================================
725 
726 bool MachCallNode::cmp( const Node &n ) const
727 { return _tf == ((MachCallNode&)n)._tf; }
728 const Type *MachCallNode::bottom_type() const { return tf()->range_cc(); }
729 const Type* MachCallNode::Value(PhaseGVN* phase) const { return tf()->range_cc(); }
730 
731 #ifndef PRODUCT
732 void MachCallNode::dump_spec(outputStream *st) const {
733   st->print("# ");
734   if (tf() != nullptr)  tf()->dump_on(st);
735   if (_cnt != COUNT_UNKNOWN)  st->print(" C=%f",_cnt);
736   if (jvms() != nullptr)  jvms()->dump_spec(st);
737 }
738 #endif
739 

740 bool MachCallNode::return_value_is_used() const {
741   if (tf()->range_sig()->cnt() == TypeFunc::Parms) {
742     // void return
743     return false;
744   }
745 
746   // find the projection corresponding to the return value
747   for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
748     Node *use = fast_out(i);
749     if (!use->is_Proj()) continue;
750     if (use->as_Proj()->_con == TypeFunc::Parms) {
751       return true;
752     }
753   }
754   return false;
755 }

756 
757 // Similar to cousin class CallNode::returns_pointer
758 // Because this is used in deoptimization, we want the type info, not the data
759 // flow info; the interpreter will "use" things that are dead to the optimizer.
760 bool MachCallNode::returns_pointer() const {
761   const TypeTuple *r = tf()->range_sig();
762   return (r->cnt() > TypeFunc::Parms &&
763           r->field_at(TypeFunc::Parms)->isa_ptr());
764 }
765 
766 bool MachCallNode::returns_scalarized() const {
767   return tf()->returns_inline_type_as_fields();
768 }
769 
770 //------------------------------Registers--------------------------------------
771 const RegMask &MachCallNode::in_RegMask(uint idx) const {
772   // Values in the domain use the users calling convention, embodied in the
773   // _in_rms array of RegMasks.
774   if (entry_point() == nullptr && idx == TypeFunc::Parms) {
775     // Null entry point is a special cast where the target of the call
776     // is in a register.
777     return MachNode::in_RegMask(idx);
778   }
779   if (idx < tf()->domain_sig()->cnt()) {
780     return _in_rms[idx];
781   }
782   if (idx == mach_constant_base_node_input()) {
783     return MachConstantBaseNode::static_out_RegMask();
784   }
785   // Values outside the domain represent debug info
786   return *Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()];
787 }
788 
789 //=============================================================================
790 uint MachCallJavaNode::size_of() const { return sizeof(*this); }
791 bool MachCallJavaNode::cmp( const Node &n ) const {
792   MachCallJavaNode &call = (MachCallJavaNode&)n;
793   return MachCallNode::cmp(call) && _method->equals(call._method) &&
794          _override_symbolic_info == call._override_symbolic_info;
795 }
796 #ifndef PRODUCT
797 void MachCallJavaNode::dump_spec(outputStream *st) const {
798   if (_method_handle_invoke)
799     st->print("MethodHandle ");
800   if (_method) {
801     _method->print_short_name(st);
802     st->print(" ");
803   }
804   MachCallNode::dump_spec(st);
805 }
806 #endif
807 
808 //------------------------------Registers--------------------------------------
809 const RegMask &MachCallJavaNode::in_RegMask(uint idx) const {
810   // Values in the domain use the users calling convention, embodied in the
811   // _in_rms array of RegMasks.
812   if (idx < tf()->domain_cc()->cnt()) {
813     return _in_rms[idx];
814   }
815   if (idx == mach_constant_base_node_input()) {
816     return MachConstantBaseNode::static_out_RegMask();
817   }
818   // Values outside the domain represent debug info
819   Matcher* m = Compile::current()->matcher();
820   // If this call is a MethodHandle invoke we have to use a different
821   // debugmask which does not include the register we use to save the
822   // SP over MH invokes.
823   RegMask** debugmask = _method_handle_invoke ? m->idealreg2mhdebugmask : m->idealreg2debugmask;
824   return *debugmask[in(idx)->ideal_reg()];
825 }
826 
827 //=============================================================================
828 uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); }
829 bool MachCallStaticJavaNode::cmp( const Node &n ) const {
830   MachCallStaticJavaNode &call = (MachCallStaticJavaNode&)n;
831   return MachCallJavaNode::cmp(call) && _name == call._name;
832 }
< prev index next >