< prev index next >

src/hotspot/share/opto/machnode.cpp

Print this page




 365     t = t->make_ptr();
 366   }
 367   if (t->isa_intptr_t() && offset != 0 && offset != Type::OffsetBot) {
 368     // We cannot assert that the offset does not look oop-ish here.
 369     // Depending on the heap layout the cardmark base could land
 370     // inside some oopish region.  It definitely does for Win2K.
 371     // The sum of cardmark-base plus shift-by-9-oop lands outside
 372     // the oop-ish area but we can't assert for that statically.
 373     return TypeRawPtr::BOTTOM;
 374   }
 375 
 376   const TypePtr *tp = t->isa_ptr();
 377 
 378   // be conservative if we do not recognize the type
 379   if (tp == NULL) {
 380     assert(false, "this path may produce not optimal code");
 381     return TypePtr::BOTTOM;
 382   }
 383   assert(tp->base() != Type::AnyPtr, "not a bare pointer");
 384 
















 385   return tp->add_offset(offset);
 386 }
 387 
 388 
 389 //-----------------------------operand_index---------------------------------
 390 int MachNode::operand_index( uint operand ) const {
 391   if( operand < 1 )  return -1;
 392   assert(operand < num_opnds(), "oob");
 393   if( _opnds[operand]->num_edges() == 0 )  return -1;
 394 
 395   uint skipped   = oper_input_base(); // Sum of leaves skipped so far
 396   for (uint opcnt = 1; opcnt < operand; opcnt++) {
 397     uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand
 398     skipped += num_edges;
 399   }
 400   return skipped;
 401 }
 402 
 403 int MachNode::operand_index(const MachOper *oper) const {
 404   uint skipped = oper_input_base(); // Sum of leaves skipped so far


 638   // Values in the domain use the users calling convention, embodied in the
 639   // _in_rms array of RegMasks.
 640   if( idx < TypeFunc::Parms ) return _in_rms[idx];
 641 
 642   if (SafePointNode::needs_polling_address_input() &&
 643       idx == TypeFunc::Parms &&
 644       ideal_Opcode() == Op_SafePoint) {
 645     return MachNode::in_RegMask(idx);
 646   }
 647 
 648   // Values outside the domain represent debug info
 649   assert(in(idx)->ideal_reg() != Op_RegFlags, "flags register is not spillable");
 650   return *Compile::current()->matcher()->idealreg2spillmask[in(idx)->ideal_reg()];
 651 }
 652 
 653 
 654 //=============================================================================
 655 
 656 bool MachCallNode::cmp( const Node &n ) const
 657 { return _tf == ((MachCallNode&)n)._tf; }
 658 const Type *MachCallNode::bottom_type() const { return tf()->range(); }
 659 const Type* MachCallNode::Value(PhaseGVN* phase) const { return tf()->range(); }
 660 
 661 #ifndef PRODUCT
 662 void MachCallNode::dump_spec(outputStream *st) const {
 663   st->print("# ");
 664   if (tf() != NULL)  tf()->dump_on(st);
 665   if (_cnt != COUNT_UNKNOWN)  st->print(" C=%f",_cnt);
 666   if (jvms() != NULL)  jvms()->dump_spec(st);
 667 }
 668 #endif
 669 
 670 bool MachCallNode::return_value_is_used() const {
 671   if (tf()->range()->cnt() == TypeFunc::Parms) {
 672     // void return
 673     return false;
 674   }
 675 


 676   // find the projection corresponding to the return value
 677   for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
 678     Node *use = fast_out(i);
 679     if (!use->is_Proj()) continue;
 680     if (use->as_Proj()->_con == TypeFunc::Parms) {
 681       return true;
 682     }
 683   }
 684   return false;
 685 }
 686 
 687 // Similar to cousin class CallNode::returns_pointer
 688 // Because this is used in deoptimization, we want the type info, not the data
 689 // flow info; the interpreter will "use" things that are dead to the optimizer.
 690 bool MachCallNode::returns_pointer() const {
 691   const TypeTuple *r = tf()->range();
 692   return (r->cnt() > TypeFunc::Parms &&
 693           r->field_at(TypeFunc::Parms)->isa_ptr());
 694 }
 695 




 696 //------------------------------Registers--------------------------------------
 697 const RegMask &MachCallNode::in_RegMask(uint idx) const {
 698   // Values in the domain use the users calling convention, embodied in the
 699   // _in_rms array of RegMasks.
 700   if (idx < tf()->domain()->cnt()) {





 701     return _in_rms[idx];
 702   }
 703   if (idx == mach_constant_base_node_input()) {
 704     return MachConstantBaseNode::static_out_RegMask();
 705   }
 706   // Values outside the domain represent debug info
 707   return *Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()];
 708 }
 709 
 710 //=============================================================================
 711 uint MachCallJavaNode::size_of() const { return sizeof(*this); }
 712 bool MachCallJavaNode::cmp( const Node &n ) const {
 713   MachCallJavaNode &call = (MachCallJavaNode&)n;
 714   return MachCallNode::cmp(call) && _method->equals(call._method) &&
 715          _override_symbolic_info == call._override_symbolic_info;
 716 }
 717 #ifndef PRODUCT
 718 void MachCallJavaNode::dump_spec(outputStream *st) const {
 719   if (_method_handle_invoke)
 720     st->print("MethodHandle ");
 721   if (_method) {
 722     _method->print_short_name(st);
 723     st->print(" ");
 724   }
 725   MachCallNode::dump_spec(st);
 726 }
 727 #endif
 728 
 729 //------------------------------Registers--------------------------------------
 730 const RegMask &MachCallJavaNode::in_RegMask(uint idx) const {
 731   // Values in the domain use the users calling convention, embodied in the
 732   // _in_rms array of RegMasks.
 733   if (idx < tf()->domain()->cnt()) {
 734     return _in_rms[idx];
 735   }
 736   if (idx == mach_constant_base_node_input()) {
 737     return MachConstantBaseNode::static_out_RegMask();
 738   }
 739   // Values outside the domain represent debug info
 740   Matcher* m = Compile::current()->matcher();
 741   // If this call is a MethodHandle invoke we have to use a different
 742   // debugmask which does not include the register we use to save the
 743   // SP over MH invokes.
 744   RegMask** debugmask = _method_handle_invoke ? m->idealreg2mhdebugmask : m->idealreg2debugmask;
 745   return *debugmask[in(idx)->ideal_reg()];
 746 }
 747 
 748 //=============================================================================
 749 uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); }
 750 bool MachCallStaticJavaNode::cmp( const Node &n ) const {
 751   MachCallStaticJavaNode &call = (MachCallStaticJavaNode&)n;
 752   return MachCallJavaNode::cmp(call) && _name == call._name;
 753 }




 365     t = t->make_ptr();
 366   }
 367   if (t->isa_intptr_t() && offset != 0 && offset != Type::OffsetBot) {
 368     // We cannot assert that the offset does not look oop-ish here.
 369     // Depending on the heap layout the cardmark base could land
 370     // inside some oopish region.  It definitely does for Win2K.
 371     // The sum of cardmark-base plus shift-by-9-oop lands outside
 372     // the oop-ish area but we can't assert for that statically.
 373     return TypeRawPtr::BOTTOM;
 374   }
 375 
 376   const TypePtr *tp = t->isa_ptr();
 377 
 378   // be conservative if we do not recognize the type
 379   if (tp == NULL) {
 380     assert(false, "this path may produce not optimal code");
 381     return TypePtr::BOTTOM;
 382   }
 383   assert(tp->base() != Type::AnyPtr, "not a bare pointer");
 384 
 385   if (tp->isa_aryptr()) {
 386     // In the case of a flattened value type array, each field has its
 387     // own slice so we need to extract the field being accessed from
 388     // the address computation
 389     if (offset == Type::OffsetBot) {
 390       Node* base;
 391       Node* index;
 392       const MachOper* oper = memory_inputs(base, index);
 393       if (oper != (MachOper*)-1) {
 394         offset = oper->constant_disp();
 395         return tp->is_aryptr()->add_field_offset_and_offset(offset)->add_offset(Type::OffsetBot);
 396       }
 397     }
 398     return tp->is_aryptr()->add_field_offset_and_offset(offset);
 399   }
 400 
 401   return tp->add_offset(offset);
 402 }
 403 
 404 
 405 //-----------------------------operand_index---------------------------------
 406 int MachNode::operand_index( uint operand ) const {
 407   if( operand < 1 )  return -1;
 408   assert(operand < num_opnds(), "oob");
 409   if( _opnds[operand]->num_edges() == 0 )  return -1;
 410 
 411   uint skipped   = oper_input_base(); // Sum of leaves skipped so far
 412   for (uint opcnt = 1; opcnt < operand; opcnt++) {
 413     uint num_edges = _opnds[opcnt]->num_edges(); // leaves for operand
 414     skipped += num_edges;
 415   }
 416   return skipped;
 417 }
 418 
 419 int MachNode::operand_index(const MachOper *oper) const {
 420   uint skipped = oper_input_base(); // Sum of leaves skipped so far


 654   // Values in the domain use the users calling convention, embodied in the
 655   // _in_rms array of RegMasks.
 656   if( idx < TypeFunc::Parms ) return _in_rms[idx];
 657 
 658   if (SafePointNode::needs_polling_address_input() &&
 659       idx == TypeFunc::Parms &&
 660       ideal_Opcode() == Op_SafePoint) {
 661     return MachNode::in_RegMask(idx);
 662   }
 663 
 664   // Values outside the domain represent debug info
 665   assert(in(idx)->ideal_reg() != Op_RegFlags, "flags register is not spillable");
 666   return *Compile::current()->matcher()->idealreg2spillmask[in(idx)->ideal_reg()];
 667 }
 668 
 669 
 670 //=============================================================================
 671 
 672 bool MachCallNode::cmp( const Node &n ) const
 673 { return _tf == ((MachCallNode&)n)._tf; }
 674 const Type *MachCallNode::bottom_type() const { return tf()->range_cc(); }
 675 const Type* MachCallNode::Value(PhaseGVN* phase) const { return tf()->range_cc(); }
 676 
 677 #ifndef PRODUCT
 678 void MachCallNode::dump_spec(outputStream *st) const {
 679   st->print("# ");
 680   if (tf() != NULL)  tf()->dump_on(st);
 681   if (_cnt != COUNT_UNKNOWN)  st->print(" C=%f",_cnt);
 682   if (jvms() != NULL)  jvms()->dump_spec(st);
 683 }
 684 #endif
 685 
 686 bool MachCallNode::return_value_is_used() const {
 687   if (tf()->range_sig()->cnt() == TypeFunc::Parms) {
 688     // void return
 689     return false;
 690   }
 691 
 692   assert(tf()->returns_value_type_as_fields(), "multiple return values not supported");
 693 
 694   // find the projection corresponding to the return value
 695   for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
 696     Node *use = fast_out(i);
 697     if (!use->is_Proj()) continue;
 698     if (use->as_Proj()->_con == TypeFunc::Parms) {
 699       return true;
 700     }
 701   }
 702   return false;
 703 }
 704 
 705 // Similar to cousin class CallNode::returns_pointer
 706 // Because this is used in deoptimization, we want the type info, not the data
 707 // flow info; the interpreter will "use" things that are dead to the optimizer.
 708 bool MachCallNode::returns_pointer() const {
 709   const TypeTuple *r = tf()->range_sig();
 710   return (r->cnt() > TypeFunc::Parms &&
 711           r->field_at(TypeFunc::Parms)->isa_ptr());
 712 }
 713 
 714 bool MachCallNode::returns_vt() const {
 715   return tf()->returns_value_type_as_fields();
 716 }
 717 
 718 //------------------------------Registers--------------------------------------
 719 const RegMask &MachCallNode::in_RegMask(uint idx) const {
 720   // Values in the domain use the users calling convention, embodied in the
 721   // _in_rms array of RegMasks.
 722   if (entry_point() == NULL && idx == TypeFunc::Parms) {
 723     // Null entry point is a special cast where the target of the call
 724     // is in a register.
 725     return MachNode::in_RegMask(idx);
 726   }
 727   if (idx < tf()->domain_sig()->cnt()) {
 728     return _in_rms[idx];
 729   }
 730   if (idx == mach_constant_base_node_input()) {
 731     return MachConstantBaseNode::static_out_RegMask();
 732   }
 733   // Values outside the domain represent debug info
 734   return *Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()];
 735 }
 736 
 737 //=============================================================================
 738 uint MachCallJavaNode::size_of() const { return sizeof(*this); }
 739 bool MachCallJavaNode::cmp( const Node &n ) const {
 740   MachCallJavaNode &call = (MachCallJavaNode&)n;
 741   return MachCallNode::cmp(call) && _method->equals(call._method) &&
 742          _override_symbolic_info == call._override_symbolic_info;
 743 }
 744 #ifndef PRODUCT
 745 void MachCallJavaNode::dump_spec(outputStream *st) const {
 746   if (_method_handle_invoke)
 747     st->print("MethodHandle ");
 748   if (_method) {
 749     _method->print_short_name(st);
 750     st->print(" ");
 751   }
 752   MachCallNode::dump_spec(st);
 753 }
 754 #endif
 755 
 756 //------------------------------Registers--------------------------------------
 757 const RegMask &MachCallJavaNode::in_RegMask(uint idx) const {
 758   // Values in the domain use the users calling convention, embodied in the
 759   // _in_rms array of RegMasks.
 760   if (idx < tf()->domain_cc()->cnt()) {
 761     return _in_rms[idx];
 762   }
 763   if (idx == mach_constant_base_node_input()) {
 764     return MachConstantBaseNode::static_out_RegMask();
 765   }
 766   // Values outside the domain represent debug info
 767   Matcher* m = Compile::current()->matcher();
 768   // If this call is a MethodHandle invoke we have to use a different
 769   // debugmask which does not include the register we use to save the
 770   // SP over MH invokes.
 771   RegMask** debugmask = _method_handle_invoke ? m->idealreg2mhdebugmask : m->idealreg2debugmask;
 772   return *debugmask[in(idx)->ideal_reg()];
 773 }
 774 
 775 //=============================================================================
 776 uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); }
 777 bool MachCallStaticJavaNode::cmp( const Node &n ) const {
 778   MachCallStaticJavaNode &call = (MachCallStaticJavaNode&)n;
 779   return MachCallJavaNode::cmp(call) && _name == call._name;
 780 }


< prev index next >