< prev index next >

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

Print this page
rev 58162 : 8239926: Shenandoah: Shenandoah needs to mark nmethod's metadata
   1 /*
   2  * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  47 public:
  48   ShenandoahNMethod(nmethod *nm, GrowableArray<oop*>& oops, bool has_non_immed_oops);
  49   ~ShenandoahNMethod();
  50 
  51   inline nmethod* nm() const;
  52   inline ShenandoahReentrantLock* lock();
  53   void oops_do(OopClosure* oops, bool fix_relocations = false);
  54   // Update oops when the nmethod is re-registered
  55   void update();
  56 
  57   bool has_cset_oops(ShenandoahHeap* heap);
  58 
  59   inline int oop_count() const;
  60   inline bool has_oops() const;
  61 
  62   inline void mark_unregistered();
  63   inline bool is_unregistered() const;
  64 
  65   static ShenandoahNMethod* for_nmethod(nmethod* nm);
  66   static inline ShenandoahReentrantLock* lock_for_nmethod(nmethod* nm);



  67 
  68   static void heal_nmethod(nmethod* nm);
  69   static inline void disarm_nmethod(nmethod* nm);
  70 
  71   static inline ShenandoahNMethod* gc_data(nmethod* nm);
  72   static inline void attach_gc_data(nmethod* nm, ShenandoahNMethod* gc_data);
  73 
  74   void assert_alive_and_correct() NOT_DEBUG_RETURN;
  75   void assert_same_oops(bool allow_dead = false) NOT_DEBUG_RETURN;
  76   static void assert_no_oops(nmethod* nm, bool allow_dea = false) NOT_DEBUG_RETURN;
  77 
  78 private:
  79   bool has_non_immed_oops() const { return _has_non_immed_oops; }
  80   static void detect_reloc_oops(nmethod* nm, GrowableArray<oop*>& oops, bool& _has_non_immed_oops);
  81 };
  82 
  83 class ShenandoahNMethodTable;
  84 
  85 // An opaque snapshot of current nmethod table for iteration
  86 class ShenandoahNMethodTableSnapshot : public CHeapObj<mtGC> {


   1 /*
   2  * Copyright (c) 2019, 2020, Red Hat, Inc. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  47 public:
  48   ShenandoahNMethod(nmethod *nm, GrowableArray<oop*>& oops, bool has_non_immed_oops);
  49   ~ShenandoahNMethod();
  50 
  51   inline nmethod* nm() const;
  52   inline ShenandoahReentrantLock* lock();
  53   void oops_do(OopClosure* oops, bool fix_relocations = false);
  54   // Update oops when the nmethod is re-registered
  55   void update();
  56 
  57   bool has_cset_oops(ShenandoahHeap* heap);
  58 
  59   inline int oop_count() const;
  60   inline bool has_oops() const;
  61 
  62   inline void mark_unregistered();
  63   inline bool is_unregistered() const;
  64 
  65   static ShenandoahNMethod* for_nmethod(nmethod* nm);
  66   static inline ShenandoahReentrantLock* lock_for_nmethod(nmethod* nm);
  67 
  68   // Keep nmethod's metadata alive
  69   static void keep_metadata_alive(nmethod* nm);
  70 
  71   static void heal_nmethod(nmethod* nm);
  72   static inline void disarm_nmethod(nmethod* nm);
  73 
  74   static inline ShenandoahNMethod* gc_data(nmethod* nm);
  75   static inline void attach_gc_data(nmethod* nm, ShenandoahNMethod* gc_data);
  76 
  77   void assert_alive_and_correct() NOT_DEBUG_RETURN;
  78   void assert_same_oops(bool allow_dead = false) NOT_DEBUG_RETURN;
  79   static void assert_no_oops(nmethod* nm, bool allow_dea = false) NOT_DEBUG_RETURN;
  80 
  81 private:
  82   bool has_non_immed_oops() const { return _has_non_immed_oops; }
  83   static void detect_reloc_oops(nmethod* nm, GrowableArray<oop*>& oops, bool& _has_non_immed_oops);
  84 };
  85 
  86 class ShenandoahNMethodTable;
  87 
  88 // An opaque snapshot of current nmethod table for iteration
  89 class ShenandoahNMethodTableSnapshot : public CHeapObj<mtGC> {


< prev index next >