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;
921
922 const TypeFunc* tf() const { return _tf; }
923 address entry_point() const { return _entry_point; }
924 float cnt() const { return _cnt; }
925
926 void set_tf(const TypeFunc* tf) { _tf = tf; }
927 void set_entry_point(address p) { _entry_point = p; }
928 void set_cnt(float c) { _cnt = c; }
929 void set_guaranteed_safepoint(bool b) { _guaranteed_safepoint = b; }
930
931 MachCallNode() : MachSafePointNode() {
932 init_class_id(Class_MachCall);
933 }
934
935 virtual const Type *bottom_type() const;
936 virtual bool pinned() const { return false; }
937 virtual const Type* Value(PhaseGVN* phase) const;
938 virtual const RegMask &in_RegMask(uint) const;
939 virtual int ret_addr_offset() { return 0; }
940
941 NOT_LP64(bool return_value_is_used() const;)
942
943 // Similar to cousin class CallNode::returns_pointer
944 bool returns_pointer() const;
945
946 bool guaranteed_safepoint() const { return _guaranteed_safepoint; }
947
948 #ifndef PRODUCT
949 virtual void dump_spec(outputStream *st) const;
950 #endif
951 };
952
953 //------------------------------MachCallJavaNode------------------------------
954 // "Base" class for machine-specific versions of subroutine calls
955 class MachCallJavaNode : public MachCallNode {
956 protected:
957 virtual bool cmp( const Node &n ) const;
958 virtual uint size_of() const; // Size is bigger
959 public:
960 ciMethod* _method; // Method being direct called
961 bool _override_symbolic_info; // Override symbolic call site info from bytecode
962 bool _optimized_virtual; // Tells if node is a static call or an optimized virtual
963 bool _arg_escape; // ArgEscape in parameter list
964 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; }
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;
957
958 const TypeFunc* tf() const { return _tf; }
959 address entry_point() const { return _entry_point; }
960 float cnt() const { return _cnt; }
961
962 void set_tf(const TypeFunc* tf) { _tf = tf; }
963 void set_entry_point(address p) { _entry_point = p; }
964 void set_cnt(float c) { _cnt = c; }
965 void set_guaranteed_safepoint(bool b) { _guaranteed_safepoint = b; }
966
967 MachCallNode() : MachSafePointNode() {
968 init_class_id(Class_MachCall);
969 }
970
971 virtual const Type *bottom_type() const;
972 virtual bool pinned() const { return false; }
973 virtual const Type* Value(PhaseGVN* phase) const;
974 virtual const RegMask &in_RegMask(uint) const;
975 virtual int ret_addr_offset() { return 0; }
976
977 bool return_value_is_used() const;
978
979 // Similar to cousin class CallNode::returns_pointer
980 bool returns_pointer() const;
981 bool returns_scalarized() const;
982
983 bool guaranteed_safepoint() const { return _guaranteed_safepoint; }
984
985 #ifndef PRODUCT
986 virtual void dump_spec(outputStream *st) const;
987 #endif
988 };
989
990 //------------------------------MachCallJavaNode------------------------------
991 // "Base" class for machine-specific versions of subroutine calls
992 class MachCallJavaNode : public MachCallNode {
993 protected:
994 virtual bool cmp( const Node &n ) const;
995 virtual uint size_of() const; // Size is bigger
996 public:
997 ciMethod* _method; // Method being direct called
998 bool _override_symbolic_info; // Override symbolic call site info from bytecode
999 bool _optimized_virtual; // Tells if node is a static call or an optimized virtual
1000 bool _arg_escape; // ArgEscape in parameter list
1001 MachCallJavaNode() : MachCallNode(), _override_symbolic_info(false) {
|