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; }
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 //------------------------------MachUEPNode-----------------------------------
514 // Machine Unvalidated Entry Point Node
515 class MachUEPNode : public MachIdealNode {
516 public:
517 MachUEPNode( ) {}
518 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
519 virtual uint size(PhaseRegAlloc *ra_) const;
520
521 #ifndef PRODUCT
522 virtual const char *Name() const { return "Unvalidated-Entry-Point"; }
523 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
524 #endif
525 };
526
527 //------------------------------MachPrologNode--------------------------------
528 // Machine function Prolog Node
529 class MachPrologNode : public MachIdealNode {
530 public:
531 MachPrologNode( ) {}
532 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
533 virtual uint size(PhaseRegAlloc *ra_) const;
534 virtual int reloc() const;
535
536 #ifndef PRODUCT
537 virtual const char *Name() const { return "Prolog"; }
538 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
539 #endif
540 };
541
542 //------------------------------MachEpilogNode--------------------------------
543 // Machine function Epilog Node
544 class MachEpilogNode : public MachIdealNode {
545 private:
546 bool _do_polling;
547 public:
548 MachEpilogNode(bool do_poll = false) : _do_polling(do_poll) {}
549 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
550 virtual uint size(PhaseRegAlloc *ra_) const;
551 virtual int reloc() const;
552 virtual const Pipeline *pipeline() const;
553 virtual uint size_of() const { return sizeof(MachEpilogNode); }
554 bool do_polling() const { return _do_polling; }
555
556 #ifndef PRODUCT
557 virtual const char *Name() const { return "Epilog"; }
558 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
559 #endif
560 };
561
562 //------------------------------MachNopNode-----------------------------------
563 // Machine function Nop Node
564 class MachNopNode : public MachIdealNode {
565 private:
566 int _count;
567 public:
568 MachNopNode( ) : _count(1) {}
569 MachNopNode( int count ) : _count(count) {}
570 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
922
923 const TypeFunc* tf() const { return _tf; }
924 address entry_point() const { return _entry_point; }
925 float cnt() const { return _cnt; }
926
927 void set_tf(const TypeFunc* tf) { _tf = tf; }
928 void set_entry_point(address p) { _entry_point = p; }
929 void set_cnt(float c) { _cnt = c; }
930 void set_guaranteed_safepoint(bool b) { _guaranteed_safepoint = b; }
931
932 MachCallNode() : MachSafePointNode() {
933 init_class_id(Class_MachCall);
934 }
935
936 virtual const Type *bottom_type() const;
937 virtual bool pinned() const { return false; }
938 virtual const Type* Value(PhaseGVN* phase) const;
939 virtual const RegMask &in_RegMask(uint) const;
940 virtual int ret_addr_offset() { return 0; }
941
942 NOT_LP64(bool return_value_is_used() const;)
943
944 // Similar to cousin class CallNode::returns_pointer
945 bool returns_pointer() const;
946
947 bool guaranteed_safepoint() const { return _guaranteed_safepoint; }
948
949 #ifndef PRODUCT
950 virtual void dump_spec(outputStream *st) const;
951 #endif
952 };
953
954 //------------------------------MachCallJavaNode------------------------------
955 // "Base" class for machine-specific versions of subroutine calls
956 class MachCallJavaNode : public MachCallNode {
957 protected:
958 virtual bool cmp( const Node &n ) const;
959 virtual uint size_of() const; // Size is bigger
960 public:
961 ciMethod* _method; // Method being direct called
962 bool _override_symbolic_info; // Override symbolic call site info from bytecode
963 bool _optimized_virtual; // Tells if node is a static call or an optimized virtual
964 bool _arg_escape; // ArgEscape in parameter list
965 MachCallJavaNode() : MachCallNode(), _override_symbolic_info(false) {
|
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; }
494 #endif
495 ShouldNotCallThis();
496 }
497
498 virtual const RegMask &in_RegMask(uint idx) const {
499 if (idx == mach_constant_base_node_input())
500 return MachConstantBaseNode::static_out_RegMask();
501 return MachNode::in_RegMask(idx);
502 }
503
504 // Input edge of MachConstantBaseNode.
505 virtual uint mach_constant_base_node_input() const { return req() - 1; }
506
507 int constant_offset();
508 int constant_offset() const { return ((MachConstantNode*) this)->constant_offset(); }
509 // Unchecked version to avoid assertions in debug output.
510 int constant_offset_unchecked() const;
511 virtual uint size_of() const { return sizeof(MachConstantNode); }
512 };
513
514 //------------------------------MachVEPNode-----------------------------------
515 // Machine Inline Type Entry Point Node
516 class MachVEPNode : public MachIdealNode {
517 public:
518 Label* _verified_entry;
519
520 MachVEPNode(Label* verified_entry, bool verified, bool receiver_only) :
521 _verified_entry(verified_entry),
522 _verified(verified),
523 _receiver_only(receiver_only) {
524 init_class_id(Class_MachVEP);
525 }
526 virtual bool cmp(const Node &n) const {
527 return (_verified_entry == ((MachVEPNode&)n)._verified_entry) &&
528 (_verified == ((MachVEPNode&)n)._verified) &&
529 (_receiver_only == ((MachVEPNode&)n)._receiver_only) &&
530 MachIdealNode::cmp(n);
531 }
532 virtual uint size_of() const { return sizeof(*this); }
533 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc* ra_) const;
534
535 #ifndef PRODUCT
536 virtual const char* Name() const { return "InlineType Entry-Point"; }
537 virtual void format(PhaseRegAlloc*, outputStream* st) const;
538 #endif
539 private:
540 bool _verified;
541 bool _receiver_only;
542 };
543
544 //------------------------------MachUEPNode-----------------------------------
545 // Machine Unvalidated Entry Point Node
546 class MachUEPNode : public MachIdealNode {
547 public:
548 MachUEPNode( ) {}
549 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
550
551 #ifndef PRODUCT
552 virtual const char *Name() const { return "Unvalidated-Entry-Point"; }
553 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
554 #endif
555 };
556
557 //------------------------------MachPrologNode--------------------------------
558 // Machine function Prolog Node
559 class MachPrologNode : public MachIdealNode {
560 public:
561 Label* _verified_entry;
562
563 MachPrologNode(Label* verified_entry) : _verified_entry(verified_entry) {
564 init_class_id(Class_MachProlog);
565 }
566 virtual bool cmp(const Node &n) const {
567 return (_verified_entry == ((MachPrologNode&)n)._verified_entry) && MachIdealNode::cmp(n);
568 }
569 virtual uint size_of() const { return sizeof(*this); }
570 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
571 virtual int reloc() const;
572
573 #ifndef PRODUCT
574 virtual const char *Name() const { return "Prolog"; }
575 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
576 #endif
577 };
578
579 //------------------------------MachEpilogNode--------------------------------
580 // Machine function Epilog Node
581 class MachEpilogNode : public MachIdealNode {
582 private:
583 bool _do_polling;
584 public:
585 MachEpilogNode(bool do_poll = false) : _do_polling(do_poll) {}
586 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
587 virtual int reloc() const;
588 virtual const Pipeline *pipeline() const;
589 virtual uint size_of() const { return sizeof(MachEpilogNode); }
590 bool do_polling() const { return _do_polling; }
591
592 #ifndef PRODUCT
593 virtual const char *Name() const { return "Epilog"; }
594 virtual void format( PhaseRegAlloc *, outputStream *st ) const;
595 #endif
596 };
597
598 //------------------------------MachNopNode-----------------------------------
599 // Machine function Nop Node
600 class MachNopNode : public MachIdealNode {
601 private:
602 int _count;
603 public:
604 MachNopNode( ) : _count(1) {}
605 MachNopNode( int count ) : _count(count) {}
606 virtual void emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const;
958
959 const TypeFunc* tf() const { return _tf; }
960 address entry_point() const { return _entry_point; }
961 float cnt() const { return _cnt; }
962
963 void set_tf(const TypeFunc* tf) { _tf = tf; }
964 void set_entry_point(address p) { _entry_point = p; }
965 void set_cnt(float c) { _cnt = c; }
966 void set_guaranteed_safepoint(bool b) { _guaranteed_safepoint = b; }
967
968 MachCallNode() : MachSafePointNode() {
969 init_class_id(Class_MachCall);
970 }
971
972 virtual const Type *bottom_type() const;
973 virtual bool pinned() const { return false; }
974 virtual const Type* Value(PhaseGVN* phase) const;
975 virtual const RegMask &in_RegMask(uint) const;
976 virtual int ret_addr_offset() { return 0; }
977
978 bool return_value_is_used() const;
979
980 // Similar to cousin class CallNode::returns_pointer
981 bool returns_pointer() const;
982 bool returns_scalarized() const;
983
984 bool guaranteed_safepoint() const { return _guaranteed_safepoint; }
985
986 #ifndef PRODUCT
987 virtual void dump_spec(outputStream *st) const;
988 #endif
989 };
990
991 //------------------------------MachCallJavaNode------------------------------
992 // "Base" class for machine-specific versions of subroutine calls
993 class MachCallJavaNode : public MachCallNode {
994 protected:
995 virtual bool cmp( const Node &n ) const;
996 virtual uint size_of() const; // Size is bigger
997 public:
998 ciMethod* _method; // Method being direct called
999 bool _override_symbolic_info; // Override symbolic call site info from bytecode
1000 bool _optimized_virtual; // Tells if node is a static call or an optimized virtual
1001 bool _arg_escape; // ArgEscape in parameter list
1002 MachCallJavaNode() : MachCallNode(), _override_symbolic_info(false) {
|