hotspot/src/share/vm/opto/memnode.hpp
changeset 33459 9d377e6f0e4c
parent 33449 8aca535611b8
child 34157 4fde32e81092
child 33626 3c94db05e903
equal deleted inserted replaced
33456:376b324df89d 33459:9d377e6f0e4c
    37 class PhaseTransform;
    37 class PhaseTransform;
    38 
    38 
    39 //------------------------------MemNode----------------------------------------
    39 //------------------------------MemNode----------------------------------------
    40 // Load or Store, possibly throwing a NULL pointer exception
    40 // Load or Store, possibly throwing a NULL pointer exception
    41 class MemNode : public Node {
    41 class MemNode : public Node {
    42 private:
       
    43   bool _unaligned_access; // Unaligned access from unsafe
       
    44   bool _mismatched_access; // Mismatched access from unsafe: byte read in integer array for instance
       
    45 protected:
    42 protected:
    46 #ifdef ASSERT
    43 #ifdef ASSERT
    47   const TypePtr* _adr_type;     // What kind of memory is being addressed?
    44   const TypePtr* _adr_type;     // What kind of memory is being addressed?
    48 #endif
    45 #endif
    49   virtual uint size_of() const;
    46   virtual uint size_of() const; // Size is bigger (ASSERT only)
    50 public:
    47 public:
    51   enum { Control,               // When is it safe to do this load?
    48   enum { Control,               // When is it safe to do this load?
    52          Memory,                // Chunk of memory is being loaded from
    49          Memory,                // Chunk of memory is being loaded from
    53          Address,               // Actually address, derived from base
    50          Address,               // Actually address, derived from base
    54          ValueIn,               // Value to store
    51          ValueIn,               // Value to store
    58                  acquire,       // Load has to acquire or be succeeded by MemBarAcquire.
    55                  acquire,       // Load has to acquire or be succeeded by MemBarAcquire.
    59                  release        // Store has to release or be preceded by MemBarRelease.
    56                  release        // Store has to release or be preceded by MemBarRelease.
    60   } MemOrd;
    57   } MemOrd;
    61 protected:
    58 protected:
    62   MemNode( Node *c0, Node *c1, Node *c2, const TypePtr* at )
    59   MemNode( Node *c0, Node *c1, Node *c2, const TypePtr* at )
    63     : Node(c0,c1,c2   ), _unaligned_access(false), _mismatched_access(false) {
    60     : Node(c0,c1,c2   ) {
    64     init_class_id(Class_Mem);
    61     init_class_id(Class_Mem);
    65     debug_only(_adr_type=at; adr_type();)
    62     debug_only(_adr_type=at; adr_type();)
    66   }
    63   }
    67   MemNode( Node *c0, Node *c1, Node *c2, const TypePtr* at, Node *c3 )
    64   MemNode( Node *c0, Node *c1, Node *c2, const TypePtr* at, Node *c3 )
    68     : Node(c0,c1,c2,c3), _unaligned_access(false), _mismatched_access(false) {
    65     : Node(c0,c1,c2,c3) {
    69     init_class_id(Class_Mem);
    66     init_class_id(Class_Mem);
    70     debug_only(_adr_type=at; adr_type();)
    67     debug_only(_adr_type=at; adr_type();)
    71   }
    68   }
    72   MemNode( Node *c0, Node *c1, Node *c2, const TypePtr* at, Node *c3, Node *c4)
    69   MemNode( Node *c0, Node *c1, Node *c2, const TypePtr* at, Node *c3, Node *c4)
    73     : Node(c0,c1,c2,c3,c4), _unaligned_access(false), _mismatched_access(false) {
    70     : Node(c0,c1,c2,c3,c4) {
    74     init_class_id(Class_Mem);
    71     init_class_id(Class_Mem);
    75     debug_only(_adr_type=at; adr_type();)
    72     debug_only(_adr_type=at; adr_type();)
    76   }
    73   }
    77 
    74 
    78   virtual Node* find_previous_arraycopy(PhaseTransform* phase, Node* ld_alloc, Node*& mem, bool can_see_stored_value) const { return NULL; }
    75   virtual Node* find_previous_arraycopy(PhaseTransform* phase, Node* ld_alloc, Node*& mem, bool can_see_stored_value) const { return NULL; }
   127   Node* find_previous_store(PhaseTransform* phase);
   124   Node* find_previous_store(PhaseTransform* phase);
   128 
   125 
   129   // Can this node (load or store) accurately see a stored value in
   126   // Can this node (load or store) accurately see a stored value in
   130   // the given memory state?  (The state may or may not be in(Memory).)
   127   // the given memory state?  (The state may or may not be in(Memory).)
   131   Node* can_see_stored_value(Node* st, PhaseTransform* phase) const;
   128   Node* can_see_stored_value(Node* st, PhaseTransform* phase) const;
   132 
       
   133   void set_unaligned_access() { _unaligned_access = true; }
       
   134   bool is_unaligned_access() const { return _unaligned_access; }
       
   135   void set_mismatched_access() { _mismatched_access = true; }
       
   136   bool is_mismatched_access() const { return _mismatched_access; }
       
   137 
   129 
   138 #ifndef PRODUCT
   130 #ifndef PRODUCT
   139   static void dump_adr_type(const Node* mem, const TypePtr* adr_type, outputStream *st);
   131   static void dump_adr_type(const Node* mem, const TypePtr* adr_type, outputStream *st);
   140   virtual void dump_spec(outputStream *st) const;
   132   virtual void dump_spec(outputStream *st) const;
   141 #endif
   133 #endif