hotspot/src/share/vm/opto/callnode.hpp
changeset 28396 7fe4347e6792
parent 26435 b446202ac824
child 29086 74100114a95a
--- a/hotspot/src/share/vm/opto/callnode.hpp	Mon Dec 22 11:21:20 2014 +0100
+++ b/hotspot/src/share/vm/opto/callnode.hpp	Tue Dec 16 13:49:36 2014 +0100
@@ -1070,8 +1070,8 @@
 
   // What kind of arraycopy variant is this?
   enum {
+    None,            // not set yet
     ArrayCopy,       // System.arraycopy()
-    ArrayCopyNoTest, // System.arraycopy(), all arguments validated
     CloneBasic,      // A clone that can be copied by 64 bit chunks
     CloneOop,        // An oop array clone
     CopyOf,          // Arrays.copyOf()
@@ -1095,6 +1095,8 @@
   // LibraryCallKit::tightly_coupled_allocation() is called.
   bool _alloc_tightly_coupled;
 
+  bool _arguments_validated;
+
   static const TypeFunc* arraycopy_type() {
     const Type** fields = TypeTuple::fields(ParmLimit - TypeFunc::Parms);
     fields[Src]       = TypeInstPtr::BOTTOM;
@@ -1118,6 +1120,13 @@
 
   ArrayCopyNode(Compile* C, bool alloc_tightly_coupled);
 
+  int get_count(PhaseGVN *phase) const;
+  static const TypePtr* get_address_type(PhaseGVN *phase, Node* n);
+
+  Node* try_clone_instance(PhaseGVN *phase, bool can_reshape, int count);
+  bool finish_transform(PhaseGVN *phase, bool can_reshape,
+                        Node* ctl, Node *mem);
+
 public:
 
   enum {
@@ -1143,23 +1152,23 @@
 
   void connect_outputs(GraphKit* kit);
 
-  bool is_arraycopy()         const { return _kind == ArrayCopy; }
-  bool is_arraycopy_notest()  const { return _kind == ArrayCopyNoTest; }
-  bool is_clonebasic()        const { return _kind == CloneBasic; }
-  bool is_cloneoop()          const { return _kind == CloneOop; }
-  bool is_copyof()            const { return _kind == CopyOf; }
-  bool is_copyofrange()       const { return _kind == CopyOfRange; }
+  bool is_arraycopy()             const  { assert(_kind != None, "should bet set"); return _kind == ArrayCopy; }
+  bool is_arraycopy_validated()   const  { assert(_kind != None, "should bet set"); return _kind == ArrayCopy && _arguments_validated; }
+  bool is_clonebasic()            const  { assert(_kind != None, "should bet set"); return _kind == CloneBasic; }
+  bool is_cloneoop()              const  { assert(_kind != None, "should bet set"); return _kind == CloneOop; }
+  bool is_copyof()                const  { assert(_kind != None, "should bet set"); return _kind == CopyOf; }
+  bool is_copyofrange()           const  { assert(_kind != None, "should bet set"); return _kind == CopyOfRange; }
 
-  void set_arraycopy()         { _kind = ArrayCopy; }
-  void set_arraycopy_notest()  { _kind = ArrayCopyNoTest; }
-  void set_clonebasic()        { _kind = CloneBasic; }
-  void set_cloneoop()          { _kind = CloneOop; }
-  void set_copyof()            { _kind = CopyOf; }
-  void set_copyofrange()       { _kind = CopyOfRange; }
+  void set_arraycopy(bool validated)   { assert(_kind == None, "shouldn't bet set yet"); _kind = ArrayCopy; _arguments_validated = validated; }
+  void set_clonebasic()                { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneBasic; }
+  void set_cloneoop()                  { assert(_kind == None, "shouldn't bet set yet"); _kind = CloneOop; }
+  void set_copyof()                    { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOf; _arguments_validated = false; }
+  void set_copyofrange()               { assert(_kind == None, "shouldn't bet set yet"); _kind = CopyOfRange; _arguments_validated = false; }
 
   virtual int Opcode() const;
   virtual uint size_of() const; // Size is bigger
   virtual bool guaranteed_safepoint()  { return false; }
+  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 
   bool is_alloc_tightly_coupled() const { return _alloc_tightly_coupled; }