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 }
695 const RegMask &MachSafePointNode::in_RegMask( uint idx ) const {
696 // Values in the domain use the users calling convention, embodied in the
697 // _in_rms array of RegMasks.
698 if( idx < TypeFunc::Parms ) return _in_rms[idx];
699
700 if (idx == TypeFunc::Parms &&
701 ideal_Opcode() == Op_SafePoint) {
702 return MachNode::in_RegMask(idx);
703 }
704
705 // Values outside the domain represent debug info
706 assert(in(idx)->ideal_reg() != Op_RegFlags, "flags register is not spillable");
707 return *Compile::current()->matcher()->idealreg2spillmask[in(idx)->ideal_reg()];
708 }
709
710
711 //=============================================================================
712
713 bool MachCallNode::cmp( const Node &n ) const
714 { return _tf == ((MachCallNode&)n)._tf; }
715 const Type *MachCallNode::bottom_type() const { return tf()->range(); }
716 const Type* MachCallNode::Value(PhaseGVN* phase) const { return tf()->range(); }
717
718 #ifndef PRODUCT
719 void MachCallNode::dump_spec(outputStream *st) const {
720 st->print("# ");
721 if (tf() != nullptr) tf()->dump_on(st);
722 if (_cnt != COUNT_UNKNOWN) st->print(" C=%f",_cnt);
723 if (jvms() != nullptr) jvms()->dump_spec(st);
724 }
725 #endif
726
727 #ifndef _LP64
728 bool MachCallNode::return_value_is_used() const {
729 if (tf()->range()->cnt() == TypeFunc::Parms) {
730 // void return
731 return false;
732 }
733
734 // find the projection corresponding to the return value
735 for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
736 Node *use = fast_out(i);
737 if (!use->is_Proj()) continue;
738 if (use->as_Proj()->_con == TypeFunc::Parms) {
739 return true;
740 }
741 }
742 return false;
743 }
744 #endif
745
746 // Similar to cousin class CallNode::returns_pointer
747 // Because this is used in deoptimization, we want the type info, not the data
748 // flow info; the interpreter will "use" things that are dead to the optimizer.
749 bool MachCallNode::returns_pointer() const {
750 const TypeTuple *r = tf()->range();
751 return (r->cnt() > TypeFunc::Parms &&
752 r->field_at(TypeFunc::Parms)->isa_ptr());
753 }
754
755 //------------------------------Registers--------------------------------------
756 const RegMask &MachCallNode::in_RegMask(uint idx) const {
757 // Values in the domain use the users calling convention, embodied in the
758 // _in_rms array of RegMasks.
759 if (idx < tf()->domain()->cnt()) {
760 return _in_rms[idx];
761 }
762 if (idx == mach_constant_base_node_input()) {
763 return MachConstantBaseNode::static_out_RegMask();
764 }
765 // Values outside the domain represent debug info
766 return *Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()];
767 }
768
769 //=============================================================================
770 uint MachCallJavaNode::size_of() const { return sizeof(*this); }
771 bool MachCallJavaNode::cmp( const Node &n ) const {
772 MachCallJavaNode &call = (MachCallJavaNode&)n;
773 return MachCallNode::cmp(call) && _method->equals(call._method) &&
774 _override_symbolic_info == call._override_symbolic_info;
775 }
776 #ifndef PRODUCT
777 void MachCallJavaNode::dump_spec(outputStream *st) const {
778 if (_method) {
779 _method->print_short_name(st);
780 st->print(" ");
781 }
782 MachCallNode::dump_spec(st);
783 }
784 #endif
785
786 //------------------------------Registers--------------------------------------
787 const RegMask &MachCallJavaNode::in_RegMask(uint idx) const {
788 // Values in the domain use the users calling convention, embodied in the
789 // _in_rms array of RegMasks.
790 if (idx < tf()->domain()->cnt()) {
791 return _in_rms[idx];
792 }
793 if (idx == mach_constant_base_node_input()) {
794 return MachConstantBaseNode::static_out_RegMask();
795 }
796 // Values outside the domain represent debug info
797 Matcher* m = Compile::current()->matcher();
798 RegMask** debugmask = m->idealreg2debugmask;
799 return *debugmask[in(idx)->ideal_reg()];
800 }
801
802 //=============================================================================
803 uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); }
804 bool MachCallStaticJavaNode::cmp( const Node &n ) const {
805 MachCallStaticJavaNode &call = (MachCallStaticJavaNode&)n;
806 return MachCallJavaNode::cmp(call) && _name == call._name;
807 }
808
809 //----------------------------uncommon_trap_request----------------------------
810 // 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
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 }
716 const RegMask &MachSafePointNode::in_RegMask( uint idx ) const {
717 // Values in the domain use the users calling convention, embodied in the
718 // _in_rms array of RegMasks.
719 if( idx < TypeFunc::Parms ) return _in_rms[idx];
720
721 if (idx == TypeFunc::Parms &&
722 ideal_Opcode() == Op_SafePoint) {
723 return MachNode::in_RegMask(idx);
724 }
725
726 // Values outside the domain represent debug info
727 assert(in(idx)->ideal_reg() != Op_RegFlags, "flags register is not spillable");
728 return *Compile::current()->matcher()->idealreg2spillmask[in(idx)->ideal_reg()];
729 }
730
731
732 //=============================================================================
733
734 bool MachCallNode::cmp( const Node &n ) const
735 { return _tf == ((MachCallNode&)n)._tf; }
736 const Type *MachCallNode::bottom_type() const { return tf()->range_cc(); }
737 const Type* MachCallNode::Value(PhaseGVN* phase) const { return tf()->range_cc(); }
738
739 #ifndef PRODUCT
740 void MachCallNode::dump_spec(outputStream *st) const {
741 st->print("# ");
742 if (tf() != nullptr) tf()->dump_on(st);
743 if (_cnt != COUNT_UNKNOWN) st->print(" C=%f",_cnt);
744 if (jvms() != nullptr) jvms()->dump_spec(st);
745 }
746 #endif
747
748 bool MachCallNode::return_value_is_used() const {
749 if (tf()->range_sig()->cnt() == TypeFunc::Parms) {
750 // void return
751 return false;
752 }
753
754 // find the projection corresponding to the return value
755 for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
756 Node *use = fast_out(i);
757 if (!use->is_Proj()) continue;
758 if (use->as_Proj()->_con == TypeFunc::Parms) {
759 return true;
760 }
761 }
762 return false;
763 }
764
765 // Similar to cousin class CallNode::returns_pointer
766 // Because this is used in deoptimization, we want the type info, not the data
767 // flow info; the interpreter will "use" things that are dead to the optimizer.
768 bool MachCallNode::returns_pointer() const {
769 const TypeTuple *r = tf()->range_sig();
770 return (r->cnt() > TypeFunc::Parms &&
771 r->field_at(TypeFunc::Parms)->isa_ptr());
772 }
773
774 bool MachCallNode::returns_scalarized() const {
775 return tf()->returns_inline_type_as_fields();
776 }
777
778 //------------------------------Registers--------------------------------------
779 const RegMask &MachCallNode::in_RegMask(uint idx) const {
780 // Values in the domain use the users calling convention, embodied in the
781 // _in_rms array of RegMasks.
782 if (entry_point() == nullptr && idx == TypeFunc::Parms) {
783 // Null entry point is a special cast where the target of the call
784 // is in a register.
785 return MachNode::in_RegMask(idx);
786 }
787 if (idx < tf()->domain_sig()->cnt()) {
788 return _in_rms[idx];
789 }
790 if (idx == mach_constant_base_node_input()) {
791 return MachConstantBaseNode::static_out_RegMask();
792 }
793 // Values outside the domain represent debug info
794 return *Compile::current()->matcher()->idealreg2debugmask[in(idx)->ideal_reg()];
795 }
796
797 //=============================================================================
798 uint MachCallJavaNode::size_of() const { return sizeof(*this); }
799 bool MachCallJavaNode::cmp( const Node &n ) const {
800 MachCallJavaNode &call = (MachCallJavaNode&)n;
801 return MachCallNode::cmp(call) && _method->equals(call._method) &&
802 _override_symbolic_info == call._override_symbolic_info;
803 }
804 #ifndef PRODUCT
805 void MachCallJavaNode::dump_spec(outputStream *st) const {
806 if (_method) {
807 _method->print_short_name(st);
808 st->print(" ");
809 }
810 MachCallNode::dump_spec(st);
811 }
812 #endif
813
814 //------------------------------Registers--------------------------------------
815 const RegMask &MachCallJavaNode::in_RegMask(uint idx) const {
816 // Values in the domain use the users calling convention, embodied in the
817 // _in_rms array of RegMasks.
818 if (idx < tf()->domain_cc()->cnt()) {
819 return _in_rms[idx];
820 }
821 if (idx == mach_constant_base_node_input()) {
822 return MachConstantBaseNode::static_out_RegMask();
823 }
824 // Values outside the domain represent debug info
825 Matcher* m = Compile::current()->matcher();
826 RegMask** debugmask = m->idealreg2debugmask;
827 return *debugmask[in(idx)->ideal_reg()];
828 }
829
830 //=============================================================================
831 uint MachCallStaticJavaNode::size_of() const { return sizeof(*this); }
832 bool MachCallStaticJavaNode::cmp( const Node &n ) const {
833 MachCallStaticJavaNode &call = (MachCallStaticJavaNode&)n;
834 return MachCallJavaNode::cmp(call) && _name == call._name;
835 }
836
837 //----------------------------uncommon_trap_request----------------------------
838 // If this is an uncommon trap, return the request code, else zero.
|