< prev index next >

src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.hpp

Print this page
rev 52371 : [mq]: lvb.patch


   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #ifndef SHARE_VM_GC_SHENANDOAH_C2_SHENANDOAHBARRIERSETC2_HPP
  25 #define SHARE_VM_GC_SHENANDOAH_C2_SHENANDOAHBARRIERSETC2_HPP
  26 
  27 #include "gc/shared/c2/barrierSetC2.hpp"
  28 
  29 class ShenandoahBarrierSetC2State : public ResourceObj {
  30 private:
  31   GrowableArray<ShenandoahWriteBarrierNode*>* _shenandoah_barriers;
  32 
  33  public:
  34   ShenandoahBarrierSetC2State(Arena* comp_arena);
  35   int shenandoah_barriers_count() const;
  36   ShenandoahWriteBarrierNode* shenandoah_barrier(int idx) const;
  37   void add_shenandoah_barrier(ShenandoahWriteBarrierNode * n);
  38   void remove_shenandoah_barrier(ShenandoahWriteBarrierNode * n);
  39 };
  40 
  41 class ShenandoahBarrierSetC2 : public BarrierSetC2 {
  42 private:
  43 
  44   void shenandoah_eliminate_wb_pre(Node* call, PhaseIterGVN* igvn) const;
  45 
  46   bool satb_can_remove_pre_barrier(GraphKit* kit, PhaseTransform* phase, Node* adr,
  47                                    BasicType bt, uint adr_idx) const;
  48   void satb_write_barrier_pre(GraphKit* kit, bool do_load,
  49                               Node* obj,
  50                               Node* adr,
  51                               uint alias_idx,
  52                               Node* val,
  53                               const TypeOopPtr* val_type,
  54                               Node* pre_val,
  55                               BasicType bt) const;
  56 
  57   void shenandoah_write_barrier_pre(GraphKit* kit,
  58                                     bool do_load,
  59                                     Node* obj,
  60                                     Node* adr,
  61                                     uint alias_idx,
  62                                     Node* val,
  63                                     const TypeOopPtr* val_type,
  64                                     Node* pre_val,
  65                                     BasicType bt) const;
  66 
  67   Node* shenandoah_enqueue_barrier(GraphKit* kit, Node* val) const;
  68   Node* shenandoah_read_barrier(GraphKit* kit, Node* obj) const;
  69   Node* shenandoah_storeval_barrier(GraphKit* kit, Node* obj) const;
  70   Node* shenandoah_write_barrier(GraphKit* kit, Node* obj) const;
  71   Node* shenandoah_read_barrier_impl(GraphKit* kit, Node* obj, bool use_ctrl, bool use_mem, bool allow_fromspace) const;
  72   Node* shenandoah_write_barrier_impl(GraphKit* kit, Node* obj) const;
  73   Node* shenandoah_write_barrier_helper(GraphKit* kit, Node* obj, const TypePtr* adr_type) const;
  74 
  75   void insert_pre_barrier(GraphKit* kit, Node* base_oop, Node* offset,
  76                           Node* pre_val, bool need_mem_bar) const;
  77 

  78 protected:
  79   virtual void resolve_address(C2Access& access) const;
  80   virtual Node* load_at_resolved(C2Access& access, const Type* val_type) const;
  81   virtual Node* store_at_resolved(C2Access& access, C2AccessValue& val) const;
  82   virtual Node* atomic_cmpxchg_val_at_resolved(C2AtomicAccess& access, Node* expected_val,
  83                                                Node* new_val, const Type* val_type) const;
  84   virtual Node* atomic_cmpxchg_bool_at_resolved(C2AtomicAccess& access, Node* expected_val,
  85                                                 Node* new_val, const Type* value_type) const;
  86   virtual Node* atomic_xchg_at_resolved(C2AtomicAccess& access, Node* new_val, const Type* val_type) const;
  87 
  88 public:
  89   static ShenandoahBarrierSetC2* bsc2();
  90 
  91   static bool is_shenandoah_wb_pre_call(Node* call);
  92   static bool is_shenandoah_marking_if(PhaseTransform *phase, Node* n);
  93   static bool is_shenandoah_state_load(Node* n);
  94   static bool has_only_shenandoah_wb_pre_uses(Node* n);
  95 
  96   ShenandoahBarrierSetC2State* state() const;
  97 
  98   Node* shenandoah_read_barrier_acmp(GraphKit* kit, Node* obj);
  99 
 100 
 101   static const TypeFunc* write_ref_field_pre_entry_Type();
 102   static const TypeFunc* shenandoah_clone_barrier_Type();
 103   static const TypeFunc* shenandoah_write_barrier_Type();
 104 
 105   // This is the entry-point for the backend to perform accesses through the Access API.
 106   virtual void clone(GraphKit* kit, Node* src, Node* dst, Node* size, bool is_array) const;
 107 
 108   virtual Node* resolve(GraphKit* kit, Node* n, DecoratorSet decorators) const;
 109 
 110   virtual void resolve_for_obj_equals(GraphKit* kit, Node*& a, Node*& b) const;
 111 
 112   // These are general helper methods used by C2
 113   virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const;
 114 
 115   // Support for GC barriers emitted during parsing
 116   virtual bool is_gc_barrier_node(Node* node) const;
 117   virtual Node* step_over_gc_barrier(Node* c) const;
 118   virtual Node* peek_thru_gc_barrier(Node* v) const;
 119 
 120   // Support for macro expanded GC barriers
 121   virtual void register_potential_barrier_node(Node* node) const;
 122   virtual void unregister_potential_barrier_node(Node* node) const;
 123   virtual void eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const;
 124   virtual void enqueue_useful_gc_barrier(Unique_Node_List &worklist, Node* node) const;
 125   virtual void eliminate_useless_gc_barriers(Unique_Node_List &useful) const;
 126   virtual void add_users_to_worklist(Unique_Node_List* worklist) const;
 127 
 128   // Allow barrier sets to have shared state that is preserved across a compilation unit.
 129   // This could for example comprise macro nodes to be expanded during macro expansion.
 130   virtual void* create_barrier_state(Arena* comp_arena) const;
 131   // If the BarrierSetC2 state has kept macro nodes in its compilation unit state to be
 132   // expanded later, then now is the time to do so.
 133   virtual bool expand_macro_nodes(PhaseMacroExpand* macro) const;
 134   virtual void verify_gc_barriers(bool post_parse) const;
 135 
 136   virtual Node* ideal_node(PhaseGVN* phase, Node* n, bool can_reshape) const;
 137 };
 138 
 139 #endif // SHARE_VM_GC_SHENANDOAH_C2_SHENANDOAHBARRIERSETC2_HPP


   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #ifndef SHARE_VM_GC_SHENANDOAH_C2_SHENANDOAHBARRIERSETC2_HPP
  25 #define SHARE_VM_GC_SHENANDOAH_C2_SHENANDOAHBARRIERSETC2_HPP
  26 
  27 #include "gc/shenandoah/c2/shenandoahBaseBarrierSetC2.hpp"

















































  28 
  29 class ShenandoahBarrierSetC2 : public ShenandoahBaseBarrierSetC2 {
  30 protected:
  31   virtual void resolve_address(C2Access& access) const;
  32   virtual Node* load_at_resolved(C2Access& access, const Type* val_type) const;
  33   virtual Node* store_at_resolved(C2Access& access, C2AccessValue& val) const;
  34   virtual Node* atomic_cmpxchg_val_at_resolved(C2AtomicAccess& access, Node* expected_val,
  35                                                Node* new_val, const Type* val_type) const;
  36   virtual Node* atomic_cmpxchg_bool_at_resolved(C2AtomicAccess& access, Node* expected_val,
  37                                                 Node* new_val, const Type* value_type) const;
  38   virtual Node* atomic_xchg_at_resolved(C2AtomicAccess& access, Node* new_val, const Type* val_type) const;
  39 
  40 public:


















  41 
  42   virtual Node* resolve(GraphKit* kit, Node* n, DecoratorSet decorators) const;
  43 
  44   virtual void resolve_for_obj_equals(GraphKit* kit, Node*& a, Node*& b) const;


























  45 };
  46 
  47 #endif // SHARE_VM_GC_SHENANDOAH_C2_SHENANDOAHBARRIERSETC2_HPP
< prev index next >