< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp

Print this page
rev 59304 : 8245124: Shenandoah: optimize code root evacuation/update during concurrent class unloading


  34 
  35 // ShenandoahNMethod tuple records the internal locations of oop slots within reclocation stream in
  36 // the nmethod. This allows us to quickly scan the oops without doing the nmethod-internal scans,
  37 // that sometimes involves parsing the machine code. Note it does not record the oops themselves,
  38 // because it would then require handling these tuples as the new class of roots.
  39 class ShenandoahNMethod : public CHeapObj<mtGC> {
  40 private:
  41   nmethod* const          _nm;
  42   oop**                   _oops;
  43   int                     _oops_count;
  44   bool                    _has_non_immed_oops;
  45   bool                    _unregistered;
  46   ShenandoahReentrantLock _lock;
  47 
  48 public:
  49   ShenandoahNMethod(nmethod *nm, GrowableArray<oop*>& oops, bool has_non_immed_oops);
  50   ~ShenandoahNMethod();
  51 
  52   inline nmethod* nm() const;
  53   inline ShenandoahReentrantLock* lock();
  54   void oops_do(OopClosure* oops, bool fix_relocations = false);
  55   // Update oops when the nmethod is re-registered
  56   void update();
  57 
  58   bool has_cset_oops(ShenandoahHeap* heap);
  59 
  60   inline int oop_count() const;
  61   inline bool has_oops() const;
  62 
  63   inline void mark_unregistered();
  64   inline bool is_unregistered() const;
  65 
  66   static ShenandoahNMethod* for_nmethod(nmethod* nm);
  67   static inline ShenandoahReentrantLock* lock_for_nmethod(nmethod* nm);
  68 
  69   static void heal_nmethod(nmethod* nm);

  70   static inline void disarm_nmethod(nmethod* nm);
  71 
  72   static inline ShenandoahNMethod* gc_data(nmethod* nm);
  73   static inline void attach_gc_data(nmethod* nm, ShenandoahNMethod* gc_data);
  74 
  75   void assert_alive_and_correct() NOT_DEBUG_RETURN;
  76   void assert_same_oops(bool allow_dead = false) NOT_DEBUG_RETURN;
  77   static void assert_no_oops(nmethod* nm, bool allow_dea = false) NOT_DEBUG_RETURN;
  78 
  79 private:
  80   bool has_non_immed_oops() const { return _has_non_immed_oops; }
  81   static void detect_reloc_oops(nmethod* nm, GrowableArray<oop*>& oops, bool& _has_non_immed_oops);
  82 };
  83 
  84 class ShenandoahNMethodTable;
  85 
  86 // ShenandoahNMethodList holds registered nmethod data. The list is reference counted.
  87 class ShenandoahNMethodList : public CHeapObj<mtGC> {
  88 private:
  89   ShenandoahNMethod** _list;




  34 
  35 // ShenandoahNMethod tuple records the internal locations of oop slots within reclocation stream in
  36 // the nmethod. This allows us to quickly scan the oops without doing the nmethod-internal scans,
  37 // that sometimes involves parsing the machine code. Note it does not record the oops themselves,
  38 // because it would then require handling these tuples as the new class of roots.
  39 class ShenandoahNMethod : public CHeapObj<mtGC> {
  40 private:
  41   nmethod* const          _nm;
  42   oop**                   _oops;
  43   int                     _oops_count;
  44   bool                    _has_non_immed_oops;
  45   bool                    _unregistered;
  46   ShenandoahReentrantLock _lock;
  47 
  48 public:
  49   ShenandoahNMethod(nmethod *nm, GrowableArray<oop*>& oops, bool has_non_immed_oops);
  50   ~ShenandoahNMethod();
  51 
  52   inline nmethod* nm() const;
  53   inline ShenandoahReentrantLock* lock();
  54   inline void oops_do(OopClosure* oops, bool fix_relocations = false);
  55   // Update oops when the nmethod is re-registered
  56   void update();
  57 
  58   bool has_cset_oops(ShenandoahHeap* heap);
  59 
  60   inline int oop_count() const;
  61   inline bool has_oops() const;
  62 
  63   inline void mark_unregistered();
  64   inline bool is_unregistered() const;
  65 
  66   static ShenandoahNMethod* for_nmethod(nmethod* nm);
  67   static inline ShenandoahReentrantLock* lock_for_nmethod(nmethod* nm);
  68 
  69   static void heal_nmethod(nmethod* nm);
  70   static inline void heal_nmethod_metadata(ShenandoahNMethod* nmethod_data);
  71   static inline void disarm_nmethod(nmethod* nm);
  72 
  73   static inline ShenandoahNMethod* gc_data(nmethod* nm);
  74   static inline void attach_gc_data(nmethod* nm, ShenandoahNMethod* gc_data);
  75 
  76   void assert_alive_and_correct() NOT_DEBUG_RETURN;
  77   void assert_same_oops(bool allow_dead = false) NOT_DEBUG_RETURN;
  78   static void assert_no_oops(nmethod* nm, bool allow_dea = false) NOT_DEBUG_RETURN;
  79 
  80 private:
  81   bool has_non_immed_oops() const { return _has_non_immed_oops; }
  82   static void detect_reloc_oops(nmethod* nm, GrowableArray<oop*>& oops, bool& _has_non_immed_oops);
  83 };
  84 
  85 class ShenandoahNMethodTable;
  86 
  87 // ShenandoahNMethodList holds registered nmethod data. The list is reference counted.
  88 class ShenandoahNMethodList : public CHeapObj<mtGC> {
  89 private:
  90   ShenandoahNMethod** _list;


< prev index next >