src/hotspot/share/code/dependencyContext.hpp
author pliden
Mon, 14 May 2018 15:42:59 +0200
changeset 50102 454fa295105c
parent 47216 71c04702a3d5
child 51333 f6641fcf7b7e
permissions -rw-r--r--
8202976: Add C1 lea patching support for x86 Reviewed-by: kvn, neliasso
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34195
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
     1
/*
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
     4
 *
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
     8
 *
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    13
 * accompanied this code).
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    14
 *
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    18
 *
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    21
 * questions.
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    22
 *
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    23
 */
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    24
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    25
#ifndef SHARE_VM_CODE_DEPENDENCYCONTEXT_HPP
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    26
#define SHARE_VM_CODE_DEPENDENCYCONTEXT_HPP
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    27
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    28
#include "memory/allocation.hpp"
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    29
#include "oops/oop.hpp"
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    30
#include "runtime/handles.hpp"
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    31
#include "runtime/perfData.hpp"
42055
98554e5a088e 8157453: Convert DependencyContext_test to GTest
jwilhelm
parents: 34223
diff changeset
    32
#include "runtime/safepoint.hpp"
34195
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    33
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    34
class nmethod;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    35
class DepChange;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    36
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    37
//
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    38
// nmethodBucket is used to record dependent nmethods for
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    39
// deoptimization.  nmethod dependencies are actually <klass, method>
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    40
// pairs but we really only care about the klass part for purposes of
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    41
// finding nmethods which might need to be deoptimized.  Instead of
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    42
// recording the method, a count of how many times a particular nmethod
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    43
// was recorded is kept.  This ensures that any recording errors are
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    44
// noticed since an nmethod should be removed as many times are it's
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    45
// added.
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    46
//
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    47
class nmethodBucket: public CHeapObj<mtClass> {
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    48
  friend class VMStructs;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    49
 private:
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    50
  nmethod*       _nmethod;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    51
  int            _count;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    52
  nmethodBucket* _next;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    53
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    54
 public:
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    55
  nmethodBucket(nmethod* nmethod, nmethodBucket* next) :
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    56
   _nmethod(nmethod), _next(next), _count(1) {}
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    57
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    58
  int count()                             { return _count; }
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    59
  int increment()                         { _count += 1; return _count; }
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    60
  int decrement();
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    61
  nmethodBucket* next()                   { return _next; }
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    62
  void set_next(nmethodBucket* b)         { _next = b; }
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    63
  nmethod* get_nmethod()                  { return _nmethod; }
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    64
};
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    65
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    66
//
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    67
// Utility class to manipulate nmethod dependency context.
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    68
// The context consists of nmethodBucket* (a head of a linked list)
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    69
// and a boolean flag (does the list contains stale entries). The structure is
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    70
// encoded as an intptr_t: lower bit is used for the flag. It is possible since
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    71
// nmethodBucket* is aligned - the structure is malloc'ed in C heap.
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    72
// Dependency context can be attached either to an InstanceKlass (_dep_context field)
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    73
// or CallSiteContext oop for call_site_target dependencies (see javaClasses.hpp).
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    74
// DependencyContext class operates on some location which holds a intptr_t value.
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    75
//
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    76
class DependencyContext : public StackObj {
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    77
  friend class VMStructs;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    78
  friend class TestDependencyContext;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    79
 private:
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    80
  enum TagBits { _has_stale_entries_bit = 1, _has_stale_entries_mask = 1 };
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    81
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    82
  intptr_t* _dependency_context_addr;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    83
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    84
  void set_dependencies(nmethodBucket* b) {
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    85
    assert((intptr_t(b) & _has_stale_entries_mask) == 0, "should be aligned");
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    86
    if (has_stale_entries()) {
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    87
      *_dependency_context_addr = intptr_t(b) | _has_stale_entries_mask;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    88
    } else {
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    89
      *_dependency_context_addr = intptr_t(b);
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    90
    }
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    91
  }
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    92
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    93
  void set_has_stale_entries(bool x) {
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    94
    if (x) {
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    95
      *_dependency_context_addr |= _has_stale_entries_mask;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    96
    } else {
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    97
      *_dependency_context_addr &= ~_has_stale_entries_mask;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    98
    }
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
    99
  }
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   100
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   101
  nmethodBucket* dependencies() {
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   102
    intptr_t value = *_dependency_context_addr;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   103
    return (nmethodBucket*) (value & ~_has_stale_entries_mask);
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   104
  }
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   105
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   106
  bool has_stale_entries() const {
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   107
    intptr_t value = *_dependency_context_addr;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   108
    return (value & _has_stale_entries_mask) != 0;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   109
  }
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   110
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   111
  static PerfCounter* _perf_total_buckets_allocated_count;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   112
  static PerfCounter* _perf_total_buckets_deallocated_count;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   113
  static PerfCounter* _perf_total_buckets_stale_count;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   114
  static PerfCounter* _perf_total_buckets_stale_acc_count;
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   115
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   116
 public:
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   117
#ifdef ASSERT
34223
d12ad6a3a9d7 8144024: Octane fails with "memory leak: allocating handle outside HandleMark"
vlivanov
parents: 34221
diff changeset
   118
  // Safepoints are forbidden during DC lifetime. GC can invalidate
d12ad6a3a9d7 8144024: Octane fails with "memory leak: allocating handle outside HandleMark"
vlivanov
parents: 34221
diff changeset
   119
  // _dependency_context_addr if it relocates the holder
d12ad6a3a9d7 8144024: Octane fails with "memory leak: allocating handle outside HandleMark"
vlivanov
parents: 34221
diff changeset
   120
  // (e.g. CallSiteContext Java object).
d12ad6a3a9d7 8144024: Octane fails with "memory leak: allocating handle outside HandleMark"
vlivanov
parents: 34221
diff changeset
   121
  int _safepoint_counter;
34195
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   122
34223
d12ad6a3a9d7 8144024: Octane fails with "memory leak: allocating handle outside HandleMark"
vlivanov
parents: 34221
diff changeset
   123
  DependencyContext(intptr_t* addr) : _dependency_context_addr(addr),
d12ad6a3a9d7 8144024: Octane fails with "memory leak: allocating handle outside HandleMark"
vlivanov
parents: 34221
diff changeset
   124
    _safepoint_counter(SafepointSynchronize::_safepoint_counter) {}
34195
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   125
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   126
  ~DependencyContext() {
34223
d12ad6a3a9d7 8144024: Octane fails with "memory leak: allocating handle outside HandleMark"
vlivanov
parents: 34221
diff changeset
   127
    assert(_safepoint_counter == SafepointSynchronize::_safepoint_counter, "safepoint happened");
34195
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   128
  }
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   129
#else
34223
d12ad6a3a9d7 8144024: Octane fails with "memory leak: allocating handle outside HandleMark"
vlivanov
parents: 34221
diff changeset
   130
  DependencyContext(intptr_t* addr) : _dependency_context_addr(addr) {}
34195
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   131
#endif // ASSERT
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   132
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   133
  static const intptr_t EMPTY = 0; // dependencies = NULL, has_stale_entries = false
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   134
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   135
  static void init();
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   136
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   137
  int  mark_dependent_nmethods(DepChange& changes);
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   138
  void add_dependent_nmethod(nmethod* nm, bool expunge_stale_entries = false);
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   139
  void remove_dependent_nmethod(nmethod* nm, bool expunge_stale_entries = false);
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   140
  int  remove_all_dependents();
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   141
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   142
  void expunge_stale_entries();
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   143
34221
3c271ee8fb98 8143408: Crash during InstanceKlass unloading when clearing dependency context
vlivanov
parents: 34195
diff changeset
   144
  // Unsafe deallocation of nmethodBuckets. Used in IK::release_C_heap_structures
3c271ee8fb98 8143408: Crash during InstanceKlass unloading when clearing dependency context
vlivanov
parents: 34195
diff changeset
   145
  // to clean up the context possibly containing live entries pointing to unloaded nmethods.
3c271ee8fb98 8143408: Crash during InstanceKlass unloading when clearing dependency context
vlivanov
parents: 34195
diff changeset
   146
  void wipe();
3c271ee8fb98 8143408: Crash during InstanceKlass unloading when clearing dependency context
vlivanov
parents: 34195
diff changeset
   147
34195
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   148
#ifndef PRODUCT
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   149
  void print_dependent_nmethods(bool verbose);
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   150
  bool is_dependent_nmethod(nmethod* nm);
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   151
  bool find_stale_entries();
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   152
#endif //PRODUCT
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   153
};
89011d12ebd3 8139595: MethodHandles::remove_dependent_nmethod is not MT safe
vlivanov
parents:
diff changeset
   154
#endif // SHARE_VM_CODE_DEPENDENCYCONTEXT_HPP