src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp
author zgu
Wed, 27 Nov 2019 11:52:57 -0500
changeset 59296 9186be5c78ba
permissions -rw-r--r--
8228720: Shenandoah: Implementation of concurrent class unloading Reviewed-by: rkennke
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
59296
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
     1
/*
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
     2
 * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
     3
 *
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
     6
 * published by the Free Software Foundation.
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
     7
 *
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
     8
 * This code is distributed in the hope that it will be useful, but WITHOUT
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
     9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    10
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    11
 * version 2 for more details (a copy is included in the LICENSE file that
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    12
 * accompanied this code).
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    13
 *
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License version
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    15
 * 2 along with this work; if not, write to the Free Software Foundation,
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    16
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    17
 *
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    18
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    19
 * or visit www.oracle.com if you need additional information or have any
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    20
 * questions.
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    21
 *
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    22
 */
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    23
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    24
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHNMETHOD_HPP
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    25
#define SHARE_GC_SHENANDOAH_SHENANDOAHNMETHOD_HPP
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    26
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    27
#include "code/nmethod.hpp"
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    28
#include "gc/shenandoah/shenandoahHeap.hpp"
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    29
#include "gc/shenandoah/shenandoahLock.hpp"
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    30
#include "memory/allocation.hpp"
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    31
#include "utilities/growableArray.hpp"
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    32
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    33
// ShenandoahNMethod tuple records the internal locations of oop slots within reclocation stream in
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    34
// the nmethod. This allows us to quickly scan the oops without doing the nmethod-internal scans,
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    35
// that sometimes involves parsing the machine code. Note it does not record the oops themselves,
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    36
// because it would then require handling these tuples as the new class of roots.
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    37
class ShenandoahNMethod : public CHeapObj<mtGC> {
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    38
private:
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    39
  nmethod* const          _nm;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    40
  oop**                   _oops;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    41
  int                     _oops_count;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    42
  bool                    _has_non_immed_oops;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    43
  bool                    _unregistered;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    44
  ShenandoahReentrantLock _lock;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    45
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    46
public:
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    47
  ShenandoahNMethod(nmethod *nm, GrowableArray<oop*>& oops, bool has_non_immed_oops);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    48
  ~ShenandoahNMethod();
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    49
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    50
  inline nmethod* nm() const;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    51
  inline ShenandoahReentrantLock* lock();
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    52
  void oops_do(OopClosure* oops, bool fix_relocations = false);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    53
  // Update oops when the nmethod is re-registered
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    54
  void update();
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    55
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    56
  bool has_cset_oops(ShenandoahHeap* heap);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    57
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    58
  inline int oop_count() const;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    59
  inline bool has_oops() const;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    60
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    61
  inline void mark_unregistered();
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    62
  inline bool is_unregistered() const;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    63
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    64
  static ShenandoahNMethod* for_nmethod(nmethod* nm);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    65
  static inline ShenandoahReentrantLock* lock_for_nmethod(nmethod* nm);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    66
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    67
  static void heal_nmethod(nmethod* nm);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    68
  static inline void disarm_nmethod(nmethod* nm);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    69
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    70
  static inline ShenandoahNMethod* gc_data(nmethod* nm);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    71
  static inline void attach_gc_data(nmethod* nm, ShenandoahNMethod* gc_data);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    72
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    73
  void assert_alive_and_correct() NOT_DEBUG_RETURN;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    74
  void assert_same_oops(bool allow_dead = false) NOT_DEBUG_RETURN;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    75
  static void assert_no_oops(nmethod* nm, bool allow_dea = false) NOT_DEBUG_RETURN;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    76
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    77
private:
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    78
  bool has_non_immed_oops() const { return _has_non_immed_oops; }
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    79
  static void detect_reloc_oops(nmethod* nm, GrowableArray<oop*>& oops, bool& _has_non_immed_oops);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    80
};
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    81
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    82
class ShenandoahNMethodTable;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    83
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    84
// An opaque snapshot of current nmethod table for iteration
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    85
class ShenandoahNMethodTableSnapshot : public CHeapObj<mtGC> {
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    86
  friend class ShenandoahNMethodTable;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    87
private:
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    88
  ShenandoahHeap* const       _heap;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    89
  ShenandoahNMethodTable*     _table;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    90
  ShenandoahNMethod** const   _array;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    91
  const int                   _length;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    92
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    93
  DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile size_t));
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    94
  volatile size_t       _claimed;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    95
  DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, 0);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    96
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    97
public:
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    98
  ShenandoahNMethodTableSnapshot(ShenandoahNMethodTable* table);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
    99
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   100
  template<bool CSET_FILTER>
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   101
  void parallel_blobs_do(CodeBlobClosure *f);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   102
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   103
  void concurrent_nmethods_do(NMethodClosure* cl);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   104
};
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   105
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   106
class ShenandoahNMethodTable : public CHeapObj<mtGC> {
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   107
  friend class ShenandoahNMethodTableSnapshot;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   108
private:
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   109
  enum {
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   110
    minSize = 1024
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   111
  };
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   112
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   113
  ShenandoahHeap* const _heap;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   114
  ShenandoahNMethod**   _array;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   115
  int                   _size;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   116
  int                   _index;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   117
  ShenandoahLock        _lock;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   118
  bool                  _iteration_in_progress;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   119
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   120
public:
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   121
  ShenandoahNMethodTable();
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   122
  ~ShenandoahNMethodTable();
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   123
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   124
  void register_nmethod(nmethod* nm);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   125
  void unregister_nmethod(nmethod* nm);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   126
  void flush_nmethod(nmethod* nm);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   127
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   128
  bool contain(nmethod* nm) const;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   129
  int length() const { return _index; }
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   130
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   131
  // Table iteration support
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   132
  ShenandoahNMethodTableSnapshot* snapshot_for_iteration();
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   133
  void finish_iteration(ShenandoahNMethodTableSnapshot* snapshot);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   134
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   135
  void assert_nmethods_alive_and_correct() NOT_DEBUG_RETURN;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   136
private:
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   137
  // Rebuild table and replace current one
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   138
  void rebuild(int size);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   139
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   140
  bool is_full() const {
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   141
    assert(_index <= _size, "Sanity");
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   142
    return _index == _size;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   143
  }
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   144
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   145
  ShenandoahNMethod* at(int index) const;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   146
  int  index_of(nmethod* nm) const;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   147
  void remove(int index);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   148
  void append(ShenandoahNMethod* snm);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   149
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   150
  inline bool iteration_in_progress() const;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   151
  void wait_until_concurrent_iteration_done();
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   152
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   153
  // Logging support
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   154
  void log_register_nmethod(nmethod* nm);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   155
  void log_unregister_nmethod(nmethod* nm);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   156
  void log_flush_nmethod(nmethod* nm);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   157
};
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   158
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   159
class ShenandoahConcurrentNMethodIterator {
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   160
private:
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   161
  ShenandoahNMethodTable*         const _table;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   162
  ShenandoahNMethodTableSnapshot*       _table_snapshot;
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   163
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   164
public:
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   165
  ShenandoahConcurrentNMethodIterator(ShenandoahNMethodTable* table);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   166
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   167
  void nmethods_do_begin();
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   168
  void nmethods_do(NMethodClosure* cl);
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   169
  void nmethods_do_end();
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   170
};
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   171
9186be5c78ba 8228720: Shenandoah: Implementation of concurrent class unloading
zgu
parents:
diff changeset
   172
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHNMETHOD_HPP