1068 class ArrayCopyNode : public CallNode { |
1068 class ArrayCopyNode : public CallNode { |
1069 private: |
1069 private: |
1070 |
1070 |
1071 // What kind of arraycopy variant is this? |
1071 // What kind of arraycopy variant is this? |
1072 enum { |
1072 enum { |
|
1073 None, // not set yet |
1073 ArrayCopy, // System.arraycopy() |
1074 ArrayCopy, // System.arraycopy() |
1074 ArrayCopyNoTest, // System.arraycopy(), all arguments validated |
|
1075 CloneBasic, // A clone that can be copied by 64 bit chunks |
1075 CloneBasic, // A clone that can be copied by 64 bit chunks |
1076 CloneOop, // An oop array clone |
1076 CloneOop, // An oop array clone |
1077 CopyOf, // Arrays.copyOf() |
1077 CopyOf, // Arrays.copyOf() |
1078 CopyOfRange // Arrays.copyOfRange() |
1078 CopyOfRange // Arrays.copyOfRange() |
1079 } _kind; |
1079 } _kind; |
1093 // parse time, it's straightforward because whatever happens after |
1093 // parse time, it's straightforward because whatever happens after |
1094 // the arraycopy is not parsed yet so doesn't exist when |
1094 // the arraycopy is not parsed yet so doesn't exist when |
1095 // LibraryCallKit::tightly_coupled_allocation() is called. |
1095 // LibraryCallKit::tightly_coupled_allocation() is called. |
1096 bool _alloc_tightly_coupled; |
1096 bool _alloc_tightly_coupled; |
1097 |
1097 |
|
1098 bool _arguments_validated; |
|
1099 |
1098 static const TypeFunc* arraycopy_type() { |
1100 static const TypeFunc* arraycopy_type() { |
1099 const Type** fields = TypeTuple::fields(ParmLimit - TypeFunc::Parms); |
1101 const Type** fields = TypeTuple::fields(ParmLimit - TypeFunc::Parms); |
1100 fields[Src] = TypeInstPtr::BOTTOM; |
1102 fields[Src] = TypeInstPtr::BOTTOM; |
1101 fields[SrcPos] = TypeInt::INT; |
1103 fields[SrcPos] = TypeInt::INT; |
1102 fields[Dest] = TypeInstPtr::BOTTOM; |
1104 fields[Dest] = TypeInstPtr::BOTTOM; |
1116 return TypeFunc::make(domain, range); |
1118 return TypeFunc::make(domain, range); |
1117 } |
1119 } |
1118 |
1120 |
1119 ArrayCopyNode(Compile* C, bool alloc_tightly_coupled); |
1121 ArrayCopyNode(Compile* C, bool alloc_tightly_coupled); |
1120 |
1122 |
|
1123 int get_count(PhaseGVN *phase) const; |
|
1124 static const TypePtr* get_address_type(PhaseGVN *phase, Node* n); |
|
1125 |
|
1126 Node* try_clone_instance(PhaseGVN *phase, bool can_reshape, int count); |
|
1127 bool finish_transform(PhaseGVN *phase, bool can_reshape, |
|
1128 Node* ctl, Node *mem); |
|
1129 |
1121 public: |
1130 public: |
1122 |
1131 |
1123 enum { |
1132 enum { |
1124 Src = TypeFunc::Parms, |
1133 Src = TypeFunc::Parms, |
1125 SrcPos, |
1134 SrcPos, |
1141 Node* src_klass = NULL, Node* dest_klass = NULL, |
1150 Node* src_klass = NULL, Node* dest_klass = NULL, |
1142 Node* src_length = NULL, Node* dest_length = NULL); |
1151 Node* src_length = NULL, Node* dest_length = NULL); |
1143 |
1152 |
1144 void connect_outputs(GraphKit* kit); |
1153 void connect_outputs(GraphKit* kit); |
1145 |
1154 |
1146 bool is_arraycopy() const { return _kind == ArrayCopy; } |
1155 bool is_arraycopy() const { assert(_kind != None, "should bet set"); return _kind == ArrayCopy; } |
1147 bool is_arraycopy_notest() const { return _kind == ArrayCopyNoTest; } |
1156 bool is_arraycopy_validated() const { assert(_kind != None, "should bet set"); return _kind == ArrayCopy && _arguments_validated; } |
1148 bool is_clonebasic() const { return _kind == CloneBasic; } |
1157 bool is_clonebasic() const { assert(_kind != None, "should bet set"); return _kind == CloneBasic; } |
1149 bool is_cloneoop() const { return _kind == CloneOop; } |
1158 bool is_cloneoop() const { assert(_kind != None, "should bet set"); return _kind == CloneOop; } |
1150 bool is_copyof() const { return _kind == CopyOf; } |
1159 bool is_copyof() const { assert(_kind != None, "should bet set"); return _kind == CopyOf; } |
1151 bool is_copyofrange() const { return _kind == CopyOfRange; } |
1160 bool is_copyofrange() const { assert(_kind != None, "should bet set"); return _kind == CopyOfRange; } |
1152 |
1161 |
1153 void set_arraycopy() { _kind = ArrayCopy; } |
1162 void set_arraycopy(bool validated) { assert(_kind == None, "shouldn't bet set yet"); _kind = ArrayCopy; _arguments_validated = validated; } |
1154 void set_arraycopy_notest() { _kind = ArrayCopyNoTest; } |
1163 void set_clonebasic() { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneBasic; } |
1155 void set_clonebasic() { _kind = CloneBasic; } |
1164 void set_cloneoop() { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneOop; } |
1156 void set_cloneoop() { _kind = CloneOop; } |
1165 void set_copyof() { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOf; _arguments_validated = false; } |
1157 void set_copyof() { _kind = CopyOf; } |
1166 void set_copyofrange() { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOfRange; _arguments_validated = false; } |
1158 void set_copyofrange() { _kind = CopyOfRange; } |
|
1159 |
1167 |
1160 virtual int Opcode() const; |
1168 virtual int Opcode() const; |
1161 virtual uint size_of() const; // Size is bigger |
1169 virtual uint size_of() const; // Size is bigger |
1162 virtual bool guaranteed_safepoint() { return false; } |
1170 virtual bool guaranteed_safepoint() { return false; } |
|
1171 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
1163 |
1172 |
1164 bool is_alloc_tightly_coupled() const { return _alloc_tightly_coupled; } |
1173 bool is_alloc_tightly_coupled() const { return _alloc_tightly_coupled; } |
1165 |
1174 |
1166 #ifndef PRODUCT |
1175 #ifndef PRODUCT |
1167 virtual void dump_spec(outputStream *st) const; |
1176 virtual void dump_spec(outputStream *st) const; |