src/hotspot/share/gc/z/zNMethodTable.hpp
author stefank
Thu, 21 Feb 2019 14:24:44 +0100
changeset 53894 bf1133e7dfba
parent 53893 ad56513c7e07
child 54175 36e0665773e7
permissions -rw-r--r--
8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class Reviewed-by: pliden
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"
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    28
#include "memory/allocation.hpp"
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    29
53893
ad56513c7e07 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class
stefank
parents: 53891
diff changeset
    30
class nmethod;
53890
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 53888
diff changeset
    31
class NMethodClosure;
53894
bf1133e7dfba 8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class
stefank
parents: 53893
diff changeset
    32
class ZNMethodTableEntry;
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    33
class ZWorkers;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    34
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    35
class ZNMethodTable : public AllStatic {
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    36
private:
53893
ad56513c7e07 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class
stefank
parents: 53891
diff changeset
    37
  static ZNMethodTableEntry*    _table;
ad56513c7e07 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class
stefank
parents: 53891
diff changeset
    38
  static size_t                 _size;
ad56513c7e07 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class
stefank
parents: 53891
diff changeset
    39
  static size_t                 _nregistered;
ad56513c7e07 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class
stefank
parents: 53891
diff changeset
    40
  static size_t                 _nunregistered;
ad56513c7e07 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class
stefank
parents: 53891
diff changeset
    41
  static ZNMethodTableIteration _iteration;
ad56513c7e07 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class
stefank
parents: 53891
diff changeset
    42
ad56513c7e07 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class
stefank
parents: 53891
diff changeset
    43
  static ZNMethodTableEntry* create(size_t size);
ad56513c7e07 8219468: ZGC: Extract iteration functionality into a new ZNMethodTableIteration class
stefank
parents: 53891
diff changeset
    44
  static void destroy(ZNMethodTableEntry* table);
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    45
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    46
  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
    47
  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
    48
53890
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 53888
diff changeset
    49
  static bool register_entry(ZNMethodTableEntry* table, size_t size, nmethod* nm);
53500
f618cfbaf35b 8217309: ZGC: Fix ZNMethodTable corruption
pliden
parents: 52939
diff changeset
    50
  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
    51
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    52
  static void rebuild(size_t new_size);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    53
  static void rebuild_if_needed();
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    54
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    55
public:
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    56
  static size_t registered_nmethods();
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    57
  static size_t unregistered_nmethods();
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    58
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    59
  static void register_nmethod(nmethod* nm);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    60
  static void unregister_nmethod(nmethod* nm);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    61
53894
bf1133e7dfba 8219469: ZGC: Extract functions out from ZNMethodTable into new ZNMethod class
stefank
parents: 53893
diff changeset
    62
  static void wait_until_iteration_done();
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    63
53890
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 53888
diff changeset
    64
  static void nmethods_do_begin();
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 53888
diff changeset
    65
  static void nmethods_do_end();
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 53888
diff changeset
    66
  static void nmethods_do(NMethodClosure* cl);
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    67
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    68
  static void unlink(ZWorkers* workers, bool unloading_occurred);
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    69
  static void purge(ZWorkers* workers);
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    70
};
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    71
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    72
#endif // SHARE_GC_Z_ZNMETHODTABLE_HPP