< 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   }

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




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





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

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

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

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