925 : MemBarNode(C, alias_idx, precedent) {} 926 virtual int Opcode() const; 927 }; 928 929 // Ordering within the same CPU. Used to order unsafe memory references 930 // inside the compiler when we lack alias info. Not needed "outside" the 931 // compiler because the CPU does all the ordering for us. 932 class MemBarCPUOrderNode: public MemBarNode { 933 public: 934 MemBarCPUOrderNode(Compile* C, int alias_idx, Node* precedent) 935 : MemBarNode(C, alias_idx, precedent) {} 936 virtual int Opcode() const; 937 virtual uint ideal_reg() const { return 0; } // not matched in the AD file 938 }; 939 940 // Isolation of object setup after an AllocateNode and before next safepoint. 941 // (See comment in memnode.cpp near InitializeNode::InitializeNode for semantics.) 942 class InitializeNode: public MemBarNode { 943 friend class AllocateNode; 944 945 bool _is_complete; 946 947 public: 948 enum { 949 Control = TypeFunc::Control, 950 Memory = TypeFunc::Memory, // MergeMem for states affected by this op 951 RawAddress = TypeFunc::Parms+0, // the newly-allocated raw address 952 RawStores = TypeFunc::Parms+1 // zero or more stores (or TOP) 953 }; 954 955 InitializeNode(Compile* C, int adr_type, Node* rawoop); 956 virtual int Opcode() const; 957 virtual uint size_of() const { return sizeof(*this); } 958 virtual uint ideal_reg() const { return 0; } // not matched in the AD file 959 virtual const RegMask &in_RegMask(uint) const; // mask for RawAddress 960 961 // Manage incoming memory edges via a MergeMem on in(Memory): 962 Node* memory(uint alias_idx); 963 964 // The raw memory edge coming directly from the Allocation. 965 // The contents of this memory are *always* all-zero-bits. 966 Node* zero_memory() { return memory(Compile::AliasIdxRaw); } 967 968 // Return the corresponding allocation for this initialization (or null if none). 969 // (Note: Both InitializeNode::allocation and AllocateNode::initialization 970 // are defined in graphKit.cpp, which sets up the bidirectional relation.) 971 AllocateNode* allocation(); 972 973 // Anything other than zeroing in this init? 974 bool is_non_zero(); 975 976 // An InitializeNode must completed before macro expansion is done. 977 // Completion requires that the AllocateNode must be followed by 978 // initialization of the new memory to zero, then to any initializers. 979 bool is_complete() { return _is_complete; } 980 981 // Mark complete. (Must not yet be complete.) 982 void set_complete(PhaseGVN* phase); 983 984 #ifdef ASSERT 985 // ensure all non-degenerate stores are ordered and non-overlapping 986 bool stores_are_sane(PhaseTransform* phase); 987 #endif //ASSERT 988 989 // See if this store can be captured; return offset where it initializes. 990 // Return 0 if the store cannot be moved (any sort of problem). 991 intptr_t can_capture_store(StoreNode* st, PhaseTransform* phase); 992 993 // Capture another store; reformat it to write my internal raw memory. 994 // Return the captured copy, else NULL if there is some sort of problem. 995 Node* capture_store(StoreNode* st, intptr_t start, PhaseTransform* phase); 996 997 // Find captured store which corresponds to the range [start..start+size). 998 // Return my own memory projection (meaning the initial zero bits) 999 // if there is no such store. Return NULL if there is a problem. 1000 Node* find_captured_store(intptr_t start, int size_in_bytes, PhaseTransform* phase); 1001 1002 // Called when the associated AllocateNode is expanded into CFG. | 925 : MemBarNode(C, alias_idx, precedent) {} 926 virtual int Opcode() const; 927 }; 928 929 // Ordering within the same CPU. Used to order unsafe memory references 930 // inside the compiler when we lack alias info. Not needed "outside" the 931 // compiler because the CPU does all the ordering for us. 932 class MemBarCPUOrderNode: public MemBarNode { 933 public: 934 MemBarCPUOrderNode(Compile* C, int alias_idx, Node* precedent) 935 : MemBarNode(C, alias_idx, precedent) {} 936 virtual int Opcode() const; 937 virtual uint ideal_reg() const { return 0; } // not matched in the AD file 938 }; 939 940 // Isolation of object setup after an AllocateNode and before next safepoint. 941 // (See comment in memnode.cpp near InitializeNode::InitializeNode for semantics.) 942 class InitializeNode: public MemBarNode { 943 friend class AllocateNode; 944 945 enum { 946 Incomplete = 0, 947 Complete = 1, 948 WithArraycopy = 2 949 }; 950 int _is_complete; 951 952 public: 953 enum { 954 Control = TypeFunc::Control, 955 Memory = TypeFunc::Memory, // MergeMem for states affected by this op 956 RawAddress = TypeFunc::Parms+0, // the newly-allocated raw address 957 RawStores = TypeFunc::Parms+1 // zero or more stores (or TOP) 958 }; 959 960 InitializeNode(Compile* C, int adr_type, Node* rawoop); 961 virtual int Opcode() const; 962 virtual uint size_of() const { return sizeof(*this); } 963 virtual uint ideal_reg() const { return 0; } // not matched in the AD file 964 virtual const RegMask &in_RegMask(uint) const; // mask for RawAddress 965 966 // Manage incoming memory edges via a MergeMem on in(Memory): 967 Node* memory(uint alias_idx); 968 969 // The raw memory edge coming directly from the Allocation. 970 // The contents of this memory are *always* all-zero-bits. 971 Node* zero_memory() { return memory(Compile::AliasIdxRaw); } 972 973 // Return the corresponding allocation for this initialization (or null if none). 974 // (Note: Both InitializeNode::allocation and AllocateNode::initialization 975 // are defined in graphKit.cpp, which sets up the bidirectional relation.) 976 AllocateNode* allocation(); 977 978 // Anything other than zeroing in this init? 979 bool is_non_zero(); 980 981 // An InitializeNode must completed before macro expansion is done. 982 // Completion requires that the AllocateNode must be followed by 983 // initialization of the new memory to zero, then to any initializers. 984 bool is_complete() { return _is_complete != Incomplete; } 985 bool is_complete_with_arraycopy() { return (_is_complete & WithArraycopy) != 0; } 986 987 // Mark complete. (Must not yet be complete.) 988 void set_complete(PhaseGVN* phase); 989 void set_complete_with_arraycopy() { _is_complete = Complete | WithArraycopy; } 990 991 #ifdef ASSERT 992 // ensure all non-degenerate stores are ordered and non-overlapping 993 bool stores_are_sane(PhaseTransform* phase); 994 #endif //ASSERT 995 996 // See if this store can be captured; return offset where it initializes. 997 // Return 0 if the store cannot be moved (any sort of problem). 998 intptr_t can_capture_store(StoreNode* st, PhaseTransform* phase); 999 1000 // Capture another store; reformat it to write my internal raw memory. 1001 // Return the captured copy, else NULL if there is some sort of problem. 1002 Node* capture_store(StoreNode* st, intptr_t start, PhaseTransform* phase); 1003 1004 // Find captured store which corresponds to the range [start..start+size). 1005 // Return my own memory projection (meaning the initial zero bits) 1006 // if there is no such store. Return NULL if there is a problem. 1007 Node* find_captured_store(intptr_t start, int size_in_bytes, PhaseTransform* phase); 1008 1009 // Called when the associated AllocateNode is expanded into CFG. |