src/hotspot/share/gc/z/zUnload.cpp
author eosterlund
Tue, 12 Nov 2019 20:14:49 +0000
changeset 59040 1251d78fafbf
parent 54623 1126f0607c70
permissions -rw-r--r--
8230661: ZGC: Stop reloading oops in load barriers Reviewed-by: pliden, stefank
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
     1
/*
54623
1126f0607c70 8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents: 54567
diff changeset
     2
 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
     4
 *
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
     8
 *
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    13
 * accompanied this code).
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    14
 *
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    18
 *
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    21
 * questions.
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    22
 */
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    23
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    24
#include "precompiled.hpp"
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    25
#include "classfile/classLoaderDataGraph.hpp"
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    26
#include "classfile/systemDictionary.hpp"
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    27
#include "code/codeBehaviours.hpp"
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    28
#include "code/codeCache.hpp"
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    29
#include "code/dependencyContext.hpp"
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    30
#include "gc/shared/gcBehaviours.hpp"
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    31
#include "gc/shared/suspendibleThreadSet.hpp"
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    32
#include "gc/z/zLock.inline.hpp"
53894
bf1133e7dfba 8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class
stefank
parents: 52939
diff changeset
    33
#include "gc/z/zNMethod.hpp"
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    34
#include "gc/z/zOopClosures.hpp"
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    35
#include "gc/z/zStat.hpp"
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    36
#include "gc/z/zUnload.hpp"
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    37
#include "oops/access.inline.hpp"
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    38
59040
1251d78fafbf 8230661: ZGC: Stop reloading oops in load barriers
eosterlund
parents: 54623
diff changeset
    39
static const ZStatSubPhase ZSubPhaseConcurrentClassesUnlink("Concurrent Classes Unlink");
1251d78fafbf 8230661: ZGC: Stop reloading oops in load barriers
eosterlund
parents: 54623
diff changeset
    40
static const ZStatSubPhase ZSubPhaseConcurrentClassesPurge("Concurrent Classes Purge");
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    41
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    42
class ZIsUnloadingOopClosure : public OopClosure {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    43
private:
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    44
  ZPhantomIsAliveObjectClosure _is_alive;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    45
  bool                         _is_unloading;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    46
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    47
public:
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    48
  ZIsUnloadingOopClosure() :
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    49
      _is_alive(),
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    50
      _is_unloading(false) {}
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    51
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    52
  virtual void do_oop(oop* p) {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    53
    const oop o = RawAccess<>::oop_load(p);
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    54
    if (o != NULL && !_is_alive.do_object_b(o)) {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    55
      _is_unloading = true;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    56
    }
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    57
  }
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    58
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    59
  virtual void do_oop(narrowOop* p) {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    60
    ShouldNotReachHere();
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    61
  }
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    62
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    63
  bool is_unloading() const {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    64
    return _is_unloading;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    65
  }
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    66
};
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    67
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    68
class ZIsUnloadingBehaviour : public IsUnloadingBehaviour {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    69
public:
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    70
  virtual bool is_unloading(CompiledMethod* method) const {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    71
    nmethod* const nm = method->as_nmethod();
53894
bf1133e7dfba 8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class
stefank
parents: 52939
diff changeset
    72
    ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
53921
a590b6107ab3 8218974: Free GC native structures in nmethod::flush
eosterlund
parents: 53894
diff changeset
    73
    ZLocker<ZReentrantLock> locker(lock);
a590b6107ab3 8218974: Free GC native structures in nmethod::flush
eosterlund
parents: 53894
diff changeset
    74
    ZIsUnloadingOopClosure cl;
54567
224515275cf9 8219718: ZGC: Make nmethod entry barriers and nmethod::is_unloading use ZNMethodDataOops
eosterlund
parents: 53921
diff changeset
    75
    ZNMethod::nmethod_oops_do(nm, &cl);
53921
a590b6107ab3 8218974: Free GC native structures in nmethod::flush
eosterlund
parents: 53894
diff changeset
    76
    return cl.is_unloading();
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    77
  }
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    78
};
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    79
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    80
class ZCompiledICProtectionBehaviour : public CompiledICProtectionBehaviour {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    81
public:
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    82
  virtual bool lock(CompiledMethod* method) {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    83
    nmethod* const nm = method->as_nmethod();
53894
bf1133e7dfba 8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class
stefank
parents: 52939
diff changeset
    84
    ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
53921
a590b6107ab3 8218974: Free GC native structures in nmethod::flush
eosterlund
parents: 53894
diff changeset
    85
    lock->lock();
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    86
    return true;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    87
  }
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    88
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    89
  virtual void unlock(CompiledMethod* method) {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    90
    nmethod* const nm = method->as_nmethod();
53894
bf1133e7dfba 8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class
stefank
parents: 52939
diff changeset
    91
    ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
53921
a590b6107ab3 8218974: Free GC native structures in nmethod::flush
eosterlund
parents: 53894
diff changeset
    92
    lock->unlock();
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    93
  }
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    94
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    95
  virtual bool is_safe(CompiledMethod* method) {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    96
    if (SafepointSynchronize::is_at_safepoint()) {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    97
      return true;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    98
    }
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
    99
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   100
    nmethod* const nm = method->as_nmethod();
53894
bf1133e7dfba 8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class
stefank
parents: 52939
diff changeset
   101
    ZReentrantLock* const lock = ZNMethod::lock_for_nmethod(nm);
53921
a590b6107ab3 8218974: Free GC native structures in nmethod::flush
eosterlund
parents: 53894
diff changeset
   102
    return lock->is_owned();
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   103
  }
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   104
};
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   105
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   106
ZUnload::ZUnload(ZWorkers* workers) :
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   107
    _workers(workers) {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   108
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   109
  if (!ClassUnloading) {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   110
    return;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   111
  }
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   112
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   113
  static ZIsUnloadingBehaviour is_unloading_behaviour;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   114
  IsUnloadingBehaviour::set_current(&is_unloading_behaviour);
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   115
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   116
  static ZCompiledICProtectionBehaviour ic_protection_behaviour;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   117
  CompiledICProtectionBehaviour::set_current(&ic_protection_behaviour);
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   118
}
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   119
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   120
void ZUnload::prepare() {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   121
  if (!ClassUnloading) {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   122
    return;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   123
  }
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   124
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   125
  CodeCache::increment_unloading_cycle();
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   126
  DependencyContext::cleaning_start();
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   127
}
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   128
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   129
void ZUnload::unlink() {
59040
1251d78fafbf 8230661: ZGC: Stop reloading oops in load barriers
eosterlund
parents: 54623
diff changeset
   130
  if (!ClassUnloading) {
1251d78fafbf 8230661: ZGC: Stop reloading oops in load barriers
eosterlund
parents: 54623
diff changeset
   131
    return;
1251d78fafbf 8230661: ZGC: Stop reloading oops in load barriers
eosterlund
parents: 54623
diff changeset
   132
  }
1251d78fafbf 8230661: ZGC: Stop reloading oops in load barriers
eosterlund
parents: 54623
diff changeset
   133
1251d78fafbf 8230661: ZGC: Stop reloading oops in load barriers
eosterlund
parents: 54623
diff changeset
   134
  ZStatTimer timer(ZSubPhaseConcurrentClassesUnlink);
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   135
  SuspendibleThreadSetJoiner sts;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   136
  bool unloading_occurred;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   137
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   138
  {
54623
1126f0607c70 8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents: 54567
diff changeset
   139
    MutexLocker ml(ClassLoaderDataGraph_lock);
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   140
    unloading_occurred = SystemDictionary::do_unloading(ZStatPhase::timer());
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   141
  }
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   142
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   143
  Klass::clean_weak_klass_links(unloading_occurred);
53894
bf1133e7dfba 8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class
stefank
parents: 52939
diff changeset
   144
  ZNMethod::unlink(_workers, unloading_occurred);
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   145
  DependencyContext::cleaning_end();
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   146
}
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   147
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   148
void ZUnload::purge() {
59040
1251d78fafbf 8230661: ZGC: Stop reloading oops in load barriers
eosterlund
parents: 54623
diff changeset
   149
  if (!ClassUnloading) {
1251d78fafbf 8230661: ZGC: Stop reloading oops in load barriers
eosterlund
parents: 54623
diff changeset
   150
    return;
1251d78fafbf 8230661: ZGC: Stop reloading oops in load barriers
eosterlund
parents: 54623
diff changeset
   151
  }
1251d78fafbf 8230661: ZGC: Stop reloading oops in load barriers
eosterlund
parents: 54623
diff changeset
   152
1251d78fafbf 8230661: ZGC: Stop reloading oops in load barriers
eosterlund
parents: 54623
diff changeset
   153
  ZStatTimer timer(ZSubPhaseConcurrentClassesPurge);
1251d78fafbf 8230661: ZGC: Stop reloading oops in load barriers
eosterlund
parents: 54623
diff changeset
   154
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   155
  {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   156
    SuspendibleThreadSetJoiner sts;
53894
bf1133e7dfba 8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class
stefank
parents: 52939
diff changeset
   157
    ZNMethod::purge(_workers);
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   158
  }
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   159
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   160
  ClassLoaderDataGraph::purge();
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   161
  CodeCache::purge_exception_caches();
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   162
}
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   163
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   164
void ZUnload::finish() {
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   165
  // Resize and verify metaspace
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   166
  MetaspaceGC::compute_new_size();
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   167
  MetaspaceUtils::verify_metrics();
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents:
diff changeset
   168
}