< prev index next >

src/hotspot/share/opto/machnode.cpp

Print this page

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 #ifndef _LP64
701 bool MachCallNode::return_value_is_used() const {
702   if (tf()->range_sig()->cnt() == TypeFunc::Parms) {
703     // void return
704     return false;
705   }
706 
707   assert(tf()->returns_inline_type_as_fields(), "multiple return values not supported");
708 
709   // find the projection corresponding to the return value
710   for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
711     Node *use = fast_out(i);
712     if (!use->is_Proj()) continue;
713     if (use->as_Proj()->_con == TypeFunc::Parms) {
714       return true;
715     }
716   }
717   return false;
718 }
719 #endif
720 
721 // Similar to cousin class CallNode::returns_pointer
722 // Because this is used in deoptimization, we want the type info, not the data
723 // flow info; the interpreter will "use" things that are dead to the optimizer.
724 bool MachCallNode::returns_pointer() const {
725   const TypeTuple *r = tf()->range_sig();
726   return (r->cnt() > TypeFunc::Parms &&
727           r->field_at(TypeFunc::Parms)->isa_ptr());
728 }
729 
730 bool MachCallNode::returns_scalarized() const {
731   return tf()->returns_inline_type_as_fields();
732 }
733 
734 //------------------------------Registers--------------------------------------
735 const RegMask &MachCallNode::in_RegMask(uint idx) const {
736   // Values in the domain use the users calling convention, embodied in the
737   // _in_rms array of RegMasks.
738   if (entry_point() == NULL && idx == TypeFunc::Parms) {
739     // Null entry point is a special cast where the target of the call
740     // is in a register.
741     return MachNode::in_RegMask(idx);
742   }
743   if (idx < tf()->domain_sig()->cnt()) {
744     return _in_rms[idx];
745   }
746   if (idx == mach_constant_base_node_input()) {
747     return MachConstantBaseNode::static_out_RegMask();
748   }
749   // Values outside the domain represent debug info
750   return *Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()];
751 }
752 
753 //=============================================================================
754 uint MachCallJavaNode::size_of() const { return sizeof(*this); }
755 bool MachCallJavaNode::cmp( const Node &n ) const {
756   MachCallJavaNode &call = (MachCallJavaNode&)n;
757   return MachCallNode::cmp(call) && _method->equals(call._method) &&
758          _override_symbolic_info == call._override_symbolic_info;
759 }
760 #ifndef PRODUCT
761 void MachCallJavaNode::dump_spec(outputStream *st) const {
762   if (_method_handle_invoke)
763     st->print("MethodHandle ");
764   if (_method) {
765     _method->print_short_name(st);
766     st->print(" ");
767   }
768   MachCallNode::dump_spec(st);
769 }
770 #endif
771 
772 //------------------------------Registers--------------------------------------
773 const RegMask &MachCallJavaNode::in_RegMask(uint idx) const {
774   // Values in the domain use the users calling convention, embodied in the
775   // _in_rms array of RegMasks.
776   if (idx < tf()->domain_cc()->cnt()) {
777     return _in_rms[idx];
778   }
779   if (idx == mach_constant_base_node_input()) {
780     return MachConstantBaseNode::static_out_RegMask();
781   }
782   // Values outside the domain represent debug info
783   Matcher* m = Compile::current()->matcher();
784   // If this call is a MethodHandle invoke we have to use a different
785   // debugmask which does not include the register we use to save the
786   // SP over MH invokes.
787   RegMask** debugmask = _method_handle_invoke ? m->idealreg2mhdebugmask : m->idealreg2debugmask;
788   return *debugmask[in(idx)->ideal_reg()];
789 }
790 
791 //=============================================================================
792 uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); }
793 bool MachCallStaticJavaNode::cmp( const Node &n ) const {
794   MachCallStaticJavaNode &call = (MachCallStaticJavaNode&)n;
795   return MachCallJavaNode::cmp(call) && _name == call._name;
796 }
< prev index next >