< 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

470 //------------------------------peephole---------------------------------------
471 // Apply peephole rule(s) to this instruction
472 int MachNode::peephole(Block *block, int block_index, PhaseCFG* cfg_, PhaseRegAlloc *ra_) {
473   return -1;
474 }
475 
476 //------------------------------add_case_label---------------------------------
477 // Adds the label for the case
478 void MachNode::add_case_label( int index_num, Label* blockLabel) {
479   ShouldNotCallThis();
480 }
481 
482 //------------------------------method_set-------------------------------------
483 // Set the absolute address of a method
484 void MachNode::method_set( intptr_t addr ) {
485   ShouldNotCallThis();
486 }
487 
488 //------------------------------rematerialize----------------------------------
489 bool MachNode::rematerialize() const {





490   // Temps are always rematerializable
491   if (is_MachTemp()) return true;
492 
493   uint r = rule();              // Match rule
494   if (r <  Matcher::_begin_rematerialize ||
495       r >= Matcher::_end_rematerialize) {
496     return false;
497   }
498 
499   // For 2-address instructions, the input live range is also the output
500   // live range. Remateralizing does not make progress on the that live range.
501   if (two_adr()) return false;
502 
503   // Check for rematerializing float constants, or not
504   if (!Matcher::rematerialize_float_constants) {
505     int op = ideal_Opcode();
506     if (op == Op_ConF || op == Op_ConD) {
507       return false;
508     }
509   }

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




762 //------------------------------Registers--------------------------------------
763 const RegMask &MachCallNode::in_RegMask(uint idx) const {
764   // Values in the domain use the users calling convention, embodied in the
765   // _in_rms array of RegMasks.
766   if (idx < tf()->domain()->cnt()) {





767     return _in_rms[idx];
768   }
769   if (idx == mach_constant_base_node_input()) {
770     return MachConstantBaseNode::static_out_RegMask();
771   }
772   // Values outside the domain represent debug info
773   return *Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()];
774 }
775 
776 //=============================================================================
777 uint MachCallJavaNode::size_of() const { return sizeof(*this); }
778 bool MachCallJavaNode::cmp( const Node &n ) const {
779   MachCallJavaNode &call = (MachCallJavaNode&)n;
780   return MachCallNode::cmp(call) && _method->equals(call._method) &&
781          _override_symbolic_info == call._override_symbolic_info;
782 }
783 #ifndef PRODUCT
784 void MachCallJavaNode::dump_spec(outputStream *st) const {
785   if (_method) {
786     _method->print_short_name(st);
787     st->print(" ");
788   }
789   MachCallNode::dump_spec(st);
790 }
791 #endif
792 
793 //------------------------------Registers--------------------------------------
794 const RegMask &MachCallJavaNode::in_RegMask(uint idx) const {
795   // Values in the domain use the users calling convention, embodied in the
796   // _in_rms array of RegMasks.
797   if (idx < tf()->domain()->cnt()) {
798     return _in_rms[idx];
799   }
800   if (idx == mach_constant_base_node_input()) {
801     return MachConstantBaseNode::static_out_RegMask();
802   }
803   // Values outside the domain represent debug info
804   Matcher* m = Compile::current()->matcher();
805   RegMask** debugmask = m->idealreg2debugmask;
806   return *debugmask[in(idx)->ideal_reg()];
807 }
808 
809 //=============================================================================
810 uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); }
811 bool MachCallStaticJavaNode::cmp( const Node &n ) const {
812   MachCallStaticJavaNode &call = (MachCallStaticJavaNode&)n;
813   return MachCallJavaNode::cmp(call) && _name == call._name;
814 }
815 
816 //----------------------------uncommon_trap_request----------------------------
817 // If this is an uncommon trap, return the request code, else zero.

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

486 //------------------------------peephole---------------------------------------
487 // Apply peephole rule(s) to this instruction
488 int MachNode::peephole(Block *block, int block_index, PhaseCFG* cfg_, PhaseRegAlloc *ra_) {
489   return -1;
490 }
491 
492 //------------------------------add_case_label---------------------------------
493 // Adds the label for the case
494 void MachNode::add_case_label( int index_num, Label* blockLabel) {
495   ShouldNotCallThis();
496 }
497 
498 //------------------------------method_set-------------------------------------
499 // Set the absolute address of a method
500 void MachNode::method_set( intptr_t addr ) {
501   ShouldNotCallThis();
502 }
503 
504 //------------------------------rematerialize----------------------------------
505 bool MachNode::rematerialize() const {
506   // Never rematerialize CastI2N because it might "hide" narrow oops from a safepoint
507   if (ideal_Opcode() == Op_CastI2N) {
508     return false;
509   }
510 
511   // Temps are always rematerializable
512   if (is_MachTemp()) return true;
513 
514   uint r = rule();              // Match rule
515   if (r <  Matcher::_begin_rematerialize ||
516       r >= Matcher::_end_rematerialize) {
517     return false;
518   }
519 
520   // For 2-address instructions, the input live range is also the output
521   // live range. Remateralizing does not make progress on the that live range.
522   if (two_adr()) return false;
523 
524   // Check for rematerializing float constants, or not
525   if (!Matcher::rematerialize_float_constants) {
526     int op = ideal_Opcode();
527     if (op == Op_ConF || op == Op_ConD) {
528       return false;
529     }
530   }

723 const RegMask &MachSafePointNode::in_RegMask( uint idx ) const {
724   // Values in the domain use the users calling convention, embodied in the
725   // _in_rms array of RegMasks.
726   if( idx < TypeFunc::Parms ) return _in_rms[idx];
727 
728   if (idx == TypeFunc::Parms &&
729       ideal_Opcode() == Op_SafePoint) {
730     return MachNode::in_RegMask(idx);
731   }
732 
733   // Values outside the domain represent debug info
734   assert(in(idx)->ideal_reg() != Op_RegFlags, "flags register is not spillable");
735   return *Compile::current()->matcher()->idealreg2spillmask[in(idx)->ideal_reg()];
736 }
737 
738 
739 //=============================================================================
740 
741 bool MachCallNode::cmp( const Node &n ) const
742 { return _tf == ((MachCallNode&)n)._tf; }
743 const Type *MachCallNode::bottom_type() const { return tf()->range_cc(); }
744 const Type* MachCallNode::Value(PhaseGVN* phase) const { return tf()->range_cc(); }
745 
746 #ifndef PRODUCT
747 void MachCallNode::dump_spec(outputStream *st) const {
748   st->print("# ");
749   if (tf() != nullptr)  tf()->dump_on(st);
750   if (_cnt != COUNT_UNKNOWN)  st->print(" C=%f",_cnt);
751   if (jvms() != nullptr)  jvms()->dump_spec(st);
752 }
753 #endif
754 

755 bool MachCallNode::return_value_is_used() const {
756   if (tf()->range_sig()->cnt() == TypeFunc::Parms) {
757     // void return
758     return false;
759   }
760 
761   // find the projection corresponding to the return value
762   for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
763     Node *use = fast_out(i);
764     if (!use->is_Proj()) continue;
765     if (use->as_Proj()->_con == TypeFunc::Parms) {
766       return true;
767     }
768   }
769   return false;
770 }

771 
772 // Similar to cousin class CallNode::returns_pointer
773 // Because this is used in deoptimization, we want the type info, not the data
774 // flow info; the interpreter will "use" things that are dead to the optimizer.
775 bool MachCallNode::returns_pointer() const {
776   const TypeTuple *r = tf()->range_sig();
777   return (r->cnt() > TypeFunc::Parms &&
778           r->field_at(TypeFunc::Parms)->isa_ptr());
779 }
780 
781 bool MachCallNode::returns_scalarized() const {
782   return tf()->returns_inline_type_as_fields();
783 }
784 
785 //------------------------------Registers--------------------------------------
786 const RegMask &MachCallNode::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 (entry_point() == nullptr && idx == TypeFunc::Parms) {
790     // Null entry point is a special cast where the target of the call
791     // is in a register.
792     return MachNode::in_RegMask(idx);
793   }
794   if (idx < tf()->domain_sig()->cnt()) {
795     return _in_rms[idx];
796   }
797   if (idx == mach_constant_base_node_input()) {
798     return MachConstantBaseNode::static_out_RegMask();
799   }
800   // Values outside the domain represent debug info
801   return *Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()];
802 }
803 
804 //=============================================================================
805 uint MachCallJavaNode::size_of() const { return sizeof(*this); }
806 bool MachCallJavaNode::cmp( const Node &n ) const {
807   MachCallJavaNode &call = (MachCallJavaNode&)n;
808   return MachCallNode::cmp(call) && _method->equals(call._method) &&
809          _override_symbolic_info == call._override_symbolic_info;
810 }
811 #ifndef PRODUCT
812 void MachCallJavaNode::dump_spec(outputStream *st) const {
813   if (_method) {
814     _method->print_short_name(st);
815     st->print(" ");
816   }
817   MachCallNode::dump_spec(st);
818 }
819 #endif
820 
821 //------------------------------Registers--------------------------------------
822 const RegMask &MachCallJavaNode::in_RegMask(uint idx) const {
823   // Values in the domain use the users calling convention, embodied in the
824   // _in_rms array of RegMasks.
825   if (idx < tf()->domain_cc()->cnt()) {
826     return _in_rms[idx];
827   }
828   if (idx == mach_constant_base_node_input()) {
829     return MachConstantBaseNode::static_out_RegMask();
830   }
831   // Values outside the domain represent debug info
832   Matcher* m = Compile::current()->matcher();
833   RegMask** debugmask = m->idealreg2debugmask;
834   return *debugmask[in(idx)->ideal_reg()];
835 }
836 
837 //=============================================================================
838 uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); }
839 bool MachCallStaticJavaNode::cmp( const Node &n ) const {
840   MachCallStaticJavaNode &call = (MachCallStaticJavaNode&)n;
841   return MachCallJavaNode::cmp(call) && _name == call._name;
842 }
843 
844 //----------------------------uncommon_trap_request----------------------------
845 // If this is an uncommon trap, return the request code, else zero.
< prev index next >