< 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

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





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

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

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

713 const RegMask &MachSafePointNode::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 < TypeFunc::Parms ) return _in_rms[idx];
717 
718   if (idx == TypeFunc::Parms &&
719       ideal_Opcode() == Op_SafePoint) {
720     return MachNode::in_RegMask(idx);
721   }
722 
723   // Values outside the domain represent debug info
724   assert(in(idx)->ideal_reg() != Op_RegFlags, "flags register is not spillable");
725   return *Compile::current()->matcher()->idealreg2spillmask[in(idx)->ideal_reg()];
726 }
727 
728 
729 //=============================================================================
730 
731 bool MachCallNode::cmp( const Node &n ) const
732 { return _tf == ((MachCallNode&)n)._tf; }
733 const Type *MachCallNode::bottom_type() const { return tf()->range_cc(); }
734 const Type* MachCallNode::Value(PhaseGVN* phase) const { return tf()->range_cc(); }
735 
736 #ifndef PRODUCT
737 void MachCallNode::dump_spec(outputStream *st) const {
738   st->print("# ");
739   if (tf() != nullptr)  tf()->dump_on(st);
740   if (_cnt != COUNT_UNKNOWN)  st->print(" C=%f",_cnt);
741   if (jvms() != nullptr)  jvms()->dump_spec(st);
742 }
743 #endif
744 

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

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