src/hotspot/share/gc/z/zNMethodTable.hpp
author eosterlund
Tue, 12 Nov 2019 20:01:23 +0000
changeset 59038 b9a42ca342db
parent 58557 cf3205fdb6dc
permissions -rw-r--r--
8233061: ZGC: Enforce memory ordering in segmented bit maps Reviewed-by: pliden, stefank
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     1
/*
53894
bf1133e7dfba 8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class
stefank
parents: 53893
diff changeset
     2
 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     4
 *
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     7
 * published by the Free Software Foundation.
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     8
 *
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    13
 * accompanied this code).
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    14
 *
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    18
 *
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    21
 * questions.
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    22
 */
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    23
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    24
#ifndef SHARE_GC_Z_ZNMETHODTABLE_HPP
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    25
#define SHARE_GC_Z_ZNMETHODTABLE_HPP
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    26
53893
ad56513c7e07 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class
stefank
parents: 53891
diff changeset
    27
#include "gc/z/zNMethodTableIteration.hpp"
54175
36e0665773e7 8220601: ZGC: Delete ZNMethodTableEntry arrays using ZSafeDelete
pliden
parents: 53894
diff changeset
    28
#include "gc/z/zSafeDelete.hpp"
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    29
#include "memory/allocation.hpp"
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    30
53893
ad56513c7e07 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class
stefank
parents: 53891
diff changeset
    31
class nmethod;
53890
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 53888
diff changeset
    32
class NMethodClosure;
53894
bf1133e7dfba 8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class
stefank
parents: 53893
diff changeset
    33
class ZNMethodTableEntry;
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    34
class ZWorkers;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    35
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    36
class ZNMethodTable : public AllStatic {
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    37
private:
58557
cf3205fdb6dc 8232116: ZGC: Remove redundant ZLock in ZNMethodTable
eosterlund
parents: 54175
diff changeset
    38
  static ZNMethodTableEntry*                     _table;
cf3205fdb6dc 8232116: ZGC: Remove redundant ZLock in ZNMethodTable
eosterlund
parents: 54175
diff changeset
    39
  static size_t                                  _size;
cf3205fdb6dc 8232116: ZGC: Remove redundant ZLock in ZNMethodTable
eosterlund
parents: 54175
diff changeset
    40
  static size_t                                  _nregistered;
cf3205fdb6dc 8232116: ZGC: Remove redundant ZLock in ZNMethodTable
eosterlund
parents: 54175
diff changeset
    41
  static size_t                                  _nunregistered;
cf3205fdb6dc 8232116: ZGC: Remove redundant ZLock in ZNMethodTable
eosterlund
parents: 54175
diff changeset
    42
  static ZNMethodTableIteration                  _iteration;
cf3205fdb6dc 8232116: ZGC: Remove redundant ZLock in ZNMethodTable
eosterlund
parents: 54175
diff changeset
    43
  static ZSafeDeleteNoLock<ZNMethodTableEntry[]> _safe_delete;
53893
ad56513c7e07 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class
stefank
parents: 53891
diff changeset
    44
ad56513c7e07 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class
stefank
parents: 53891
diff changeset
    45
  static ZNMethodTableEntry* create(size_t size);
ad56513c7e07 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class
stefank
parents: 53891
diff changeset
    46
  static void destroy(ZNMethodTableEntry* table);
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    47
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    48
  static size_t first_index(const nmethod* nm, size_t size);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    49
  static size_t next_index(size_t prev_index, size_t size);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    50
53890
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 53888
diff changeset
    51
  static bool register_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm);
53500
f618cfbaf35b 8217309: ZGC: Fix ZNMethodTable corruption
pliden
parents: 52939
diff changeset
    52
  static void unregister_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm);
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    53
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    54
  static void rebuild(size_t new_size);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    55
  static void rebuild_if_needed();
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    56
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    57
public:
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    58
  static size_t registered_nmethods();
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    59
  static size_t unregistered_nmethods();
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    60
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    61
  static void register_nmethod(nmethod* nm);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    62
  static void unregister_nmethod(nmethod* nm);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    63
53894
bf1133e7dfba 8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class
stefank
parents: 53893
diff changeset
    64
  static void wait_until_iteration_done();
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    65
53890
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 53888
diff changeset
    66
  static void nmethods_do_begin();
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 53888
diff changeset
    67
  static void nmethods_do_end();
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 53888
diff changeset
    68
  static void nmethods_do(NMethodClosure* cl);
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    69
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    70
  static void unlink(ZWorkers* workers, bool unloading_occurred);
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    71
  static void purge(ZWorkers* workers);
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    72
};
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    73
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    74
#endif // SHARE_GC_Z_ZNMETHODTABLE_HPP