34 #include "opto/regmask.hpp"
35 #include "utilities/growableArray.hpp"
36
37 class BufferBlob;
38 class JVMState;
39 class MachCallDynamicJavaNode;
40 class MachCallJavaNode;
41 class MachCallLeafNode;
42 class MachCallNode;
43 class MachCallRuntimeNode;
44 class MachCallStaticJavaNode;
45 class MachEpilogNode;
46 class MachIfNode;
47 class MachNullCheckNode;
48 class MachOper;
49 class MachProjNode;
50 class MachPrologNode;
51 class MachReturnNode;
52 class MachSafePointNode;
53 class MachSpillCopyNode;
54 class Matcher;
55 class PhaseRegAlloc;
56 class RegMask;
57 class State;
58
59 //---------------------------MachOper------------------------------------------
60 class MachOper : public ResourceObj {
61 public:
62 // Allocate right next to the MachNodes in the same arena
63 void *operator new(size_t x) throw() {
64 Compile* C = Compile::current();
65 return C->node_arena()->AmallocWords(x);
66 }
67
68 // Opcode
69 virtual uint opcode() const = 0;
70
71 // Number of input edges.
72 // Generally at least 1
73 virtual uint num_edges() const { return 1; }
492 #endif
493 ShouldNotCallThis();
494 }
495
496 virtual const RegMask &in_RegMask(uint idx) const {
497 if (idx == mach_constant_base_node_input())
498 return MachConstantBaseNode::static_out_RegMask();
499 return MachNode::in_RegMask(idx);
500 }
501
502 // Input edge of MachConstantBaseNode.
503 virtual uint mach_constant_base_node_input() const { return req() - 1; }
504
505 int constant_offset();
506 int constant_offset() const { return ((MachConstantNode*) this)->constant_offset(); }
507 // Unchecked version to avoid assertions in debug output.
508 int constant_offset_unchecked() const;
509 virtual uint size_of() const { return sizeof(MachConstantNode); }
510 };
511
512 //------------------------------MachUEPNode-----------------------------------
513 // Machine Unvalidated Entry Point Node
514 class MachUEPNode : public MachIdealNode {
515 public:
516 MachUEPNode( ) {}
517 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
518 virtual uint size(PhaseRegAlloc *ra_) const;
519
520 #ifndef PRODUCT
521 virtual const char *Name() const { return "Unvalidated-Entry-Point"; }
522 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
523 #endif
524 };
525
526 //------------------------------MachPrologNode--------------------------------
527 // Machine function Prolog Node
528 class MachPrologNode : public MachIdealNode {
529 public:
530 MachPrologNode( ) {}
531 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
532 virtual uint size(PhaseRegAlloc *ra_) const;
533 virtual int reloc() const;
534
535 #ifndef PRODUCT
536 virtual const char *Name() const { return "Prolog"; }
537 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
538 #endif
539 };
540
541 //------------------------------MachEpilogNode--------------------------------
542 // Machine function Epilog Node
543 class MachEpilogNode : public MachIdealNode {
544 private:
545 bool _do_polling;
546 public:
547 MachEpilogNode(bool do_poll = false) : _do_polling(do_poll) {}
548 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
549 virtual uint size(PhaseRegAlloc *ra_) const;
550 virtual int reloc() const;
551 virtual const Pipeline *pipeline() const;
552 virtual uint size_of() const { return sizeof(MachEpilogNode); }
553 bool do_polling() const { return _do_polling; }
554
555 #ifndef PRODUCT
556 virtual const char *Name() const { return "Epilog"; }
557 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
558 #endif
559 };
560
561 //------------------------------MachNopNode-----------------------------------
562 // Machine function Nop Node
563 class MachNopNode : public MachIdealNode {
564 private:
565 int _count;
566 public:
567 MachNopNode( ) : _count(1) {}
568 MachNopNode( int count ) : _count(count) {}
569 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
918
919 const TypeFunc* tf() const { return _tf; }
920 address entry_point() const { return _entry_point; }
921 float cnt() const { return _cnt; }
922
923 void set_tf(const TypeFunc* tf) { _tf = tf; }
924 void set_entry_point(address p) { _entry_point = p; }
925 void set_cnt(float c) { _cnt = c; }
926 void set_guaranteed_safepoint(bool b) { _guaranteed_safepoint = b; }
927
928 MachCallNode() : MachSafePointNode() {
929 init_class_id(Class_MachCall);
930 }
931
932 virtual const Type *bottom_type() const;
933 virtual bool pinned() const { return false; }
934 virtual const Type* Value(PhaseGVN* phase) const;
935 virtual const RegMask &in_RegMask(uint) const;
936 virtual int ret_addr_offset() { return 0; }
937
938 NOT_LP64(bool return_value_is_used() const;)
939
940 // Similar to cousin class CallNode::returns_pointer
941 bool returns_pointer() const;
942
943 bool guaranteed_safepoint() const { return _guaranteed_safepoint; }
944
945 #ifndef PRODUCT
946 virtual void dump_spec(outputStream *st) const;
947 #endif
948 };
949
950 //------------------------------MachCallJavaNode------------------------------
951 // "Base" class for machine-specific versions of subroutine calls
952 class MachCallJavaNode : public MachCallNode {
953 protected:
954 virtual bool cmp( const Node &n ) const;
955 virtual uint size_of() const; // Size is bigger
956 public:
957 ciMethod* _method; // Method being direct called
958 bool _override_symbolic_info; // Override symbolic call site info from bytecode
959 bool _optimized_virtual; // Tells if node is a static call or an optimized virtual
960 bool _method_handle_invoke; // Tells if the call has to preserve SP
961 bool _arg_escape; // ArgEscape in parameter list
|
34 #include "opto/regmask.hpp"
35 #include "utilities/growableArray.hpp"
36
37 class BufferBlob;
38 class JVMState;
39 class MachCallDynamicJavaNode;
40 class MachCallJavaNode;
41 class MachCallLeafNode;
42 class MachCallNode;
43 class MachCallRuntimeNode;
44 class MachCallStaticJavaNode;
45 class MachEpilogNode;
46 class MachIfNode;
47 class MachNullCheckNode;
48 class MachOper;
49 class MachProjNode;
50 class MachPrologNode;
51 class MachReturnNode;
52 class MachSafePointNode;
53 class MachSpillCopyNode;
54 class MachVEPNode;
55 class Matcher;
56 class PhaseRegAlloc;
57 class RegMask;
58 class State;
59
60 //---------------------------MachOper------------------------------------------
61 class MachOper : public ResourceObj {
62 public:
63 // Allocate right next to the MachNodes in the same arena
64 void *operator new(size_t x) throw() {
65 Compile* C = Compile::current();
66 return C->node_arena()->AmallocWords(x);
67 }
68
69 // Opcode
70 virtual uint opcode() const = 0;
71
72 // Number of input edges.
73 // Generally at least 1
74 virtual uint num_edges() const { return 1; }
493 #endif
494 ShouldNotCallThis();
495 }
496
497 virtual const RegMask &in_RegMask(uint idx) const {
498 if (idx == mach_constant_base_node_input())
499 return MachConstantBaseNode::static_out_RegMask();
500 return MachNode::in_RegMask(idx);
501 }
502
503 // Input edge of MachConstantBaseNode.
504 virtual uint mach_constant_base_node_input() const { return req() - 1; }
505
506 int constant_offset();
507 int constant_offset() const { return ((MachConstantNode*) this)->constant_offset(); }
508 // Unchecked version to avoid assertions in debug output.
509 int constant_offset_unchecked() const;
510 virtual uint size_of() const { return sizeof(MachConstantNode); }
511 };
512
513 //------------------------------MachVEPNode-----------------------------------
514 // Machine Inline Type Entry Point Node
515 class MachVEPNode : public MachIdealNode {
516 public:
517 Label* _verified_entry;
518
519 MachVEPNode(Label* verified_entry, bool verified, bool receiver_only) :
520 _verified_entry(verified_entry),
521 _verified(verified),
522 _receiver_only(receiver_only) {
523 init_class_id(Class_MachVEP);
524 }
525 virtual bool cmp(const Node &n) const {
526 return (_verified_entry == ((MachVEPNode&)n)._verified_entry) &&
527 (_verified == ((MachVEPNode&)n)._verified) &&
528 (_receiver_only == ((MachVEPNode&)n)._receiver_only) &&
529 MachIdealNode::cmp(n);
530 }
531 virtual uint size_of() const { return sizeof(*this); }
532 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc* ra_) const;
533
534 #ifndef PRODUCT
535 virtual const char* Name() const { return "InlineType Entry-Point"; }
536 virtual void format(PhaseRegAlloc*, outputStream* st) const;
537 #endif
538 private:
539 bool _verified;
540 bool _receiver_only;
541 };
542
543 //------------------------------MachUEPNode-----------------------------------
544 // Machine Unvalidated Entry Point Node
545 class MachUEPNode : public MachIdealNode {
546 public:
547 MachUEPNode( ) {}
548 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
549
550 #ifndef PRODUCT
551 virtual const char *Name() const { return "Unvalidated-Entry-Point"; }
552 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
553 #endif
554 };
555
556 //------------------------------MachPrologNode--------------------------------
557 // Machine function Prolog Node
558 class MachPrologNode : public MachIdealNode {
559 public:
560 Label* _verified_entry;
561
562 MachPrologNode(Label* verified_entry) : _verified_entry(verified_entry) {
563 init_class_id(Class_MachProlog);
564 }
565 virtual bool cmp(const Node &n) const {
566 return (_verified_entry == ((MachPrologNode&)n)._verified_entry) && MachIdealNode::cmp(n);
567 }
568 virtual uint size_of() const { return sizeof(*this); }
569 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
570 virtual int reloc() const;
571
572 #ifndef PRODUCT
573 virtual const char *Name() const { return "Prolog"; }
574 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
575 #endif
576 };
577
578 //------------------------------MachEpilogNode--------------------------------
579 // Machine function Epilog Node
580 class MachEpilogNode : public MachIdealNode {
581 private:
582 bool _do_polling;
583 public:
584 MachEpilogNode(bool do_poll = false) : _do_polling(do_poll) {}
585 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
586 virtual int reloc() const;
587 virtual const Pipeline *pipeline() const;
588 virtual uint size_of() const { return sizeof(MachEpilogNode); }
589 bool do_polling() const { return _do_polling; }
590
591 #ifndef PRODUCT
592 virtual const char *Name() const { return "Epilog"; }
593 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
594 #endif
595 };
596
597 //------------------------------MachNopNode-----------------------------------
598 // Machine function Nop Node
599 class MachNopNode : public MachIdealNode {
600 private:
601 int _count;
602 public:
603 MachNopNode( ) : _count(1) {}
604 MachNopNode( int count ) : _count(count) {}
605 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
954
955 const TypeFunc* tf() const { return _tf; }
956 address entry_point() const { return _entry_point; }
957 float cnt() const { return _cnt; }
958
959 void set_tf(const TypeFunc* tf) { _tf = tf; }
960 void set_entry_point(address p) { _entry_point = p; }
961 void set_cnt(float c) { _cnt = c; }
962 void set_guaranteed_safepoint(bool b) { _guaranteed_safepoint = b; }
963
964 MachCallNode() : MachSafePointNode() {
965 init_class_id(Class_MachCall);
966 }
967
968 virtual const Type *bottom_type() const;
969 virtual bool pinned() const { return false; }
970 virtual const Type* Value(PhaseGVN* phase) const;
971 virtual const RegMask &in_RegMask(uint) const;
972 virtual int ret_addr_offset() { return 0; }
973
974 bool return_value_is_used() const;
975
976 // Similar to cousin class CallNode::returns_pointer
977 bool returns_pointer() const;
978 bool returns_scalarized() const;
979
980 bool guaranteed_safepoint() const { return _guaranteed_safepoint; }
981
982 #ifndef PRODUCT
983 virtual void dump_spec(outputStream *st) const;
984 #endif
985 };
986
987 //------------------------------MachCallJavaNode------------------------------
988 // "Base" class for machine-specific versions of subroutine calls
989 class MachCallJavaNode : public MachCallNode {
990 protected:
991 virtual bool cmp( const Node &n ) const;
992 virtual uint size_of() const; // Size is bigger
993 public:
994 ciMethod* _method; // Method being direct called
995 bool _override_symbolic_info; // Override symbolic call site info from bytecode
996 bool _optimized_virtual; // Tells if node is a static call or an optimized virtual
997 bool _method_handle_invoke; // Tells if the call has to preserve SP
998 bool _arg_escape; // ArgEscape in parameter list
|