src/hotspot/share/gc/z/zNMethodTableEntry.hpp
author pliden
Mon, 18 Mar 2019 11:50:40 +0100
changeset 54167 d0d26fc836dd
parent 53890 70a6a7b15d36
child 54302 0a2d73e02076
permissions -rw-r--r--
8220592: ZGC: Move destruction of detached ZPages into ZPageAllocator Reviewed-by: stefank, eosterlund
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
/*
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
     2
 * Copyright (c) 2017, 2018, 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_ZNMETHODTABLEENTRY_HPP
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    25
#define SHARE_GC_Z_ZNMETHODTABLEENTRY_HPP
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    26
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    27
#include "gc/z/zBitField.hpp"
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
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    30
//
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    31
// NMethod table entry layout
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    32
// --------------------------
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    33
//
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    34
//   6
53890
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    35
//   3                                                                   2 1 0
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    36
//  +---------------------------------------------------------------------+-+-+
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    37
//  |11111111 11111111 11111111 11111111 11111111 11111111 11111111 111111|1|1|
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    38
//  +---------------------------------------------------------------------+-+-+
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    39
//  |                                                                     | |
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    40
//  |                                                                     | |
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    41
//  |                                                                     | |
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    42
//  |                                      1-1 Unregistered Flag (1-bits) * |
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    43
//  |                                                                       |
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    44
//  |                                          0-0 Registered Flag (1-bits) *
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    45
//  |
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    46
//  * 63-3 NMethod Address (61-bits)
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
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    49
class nmethod;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    50
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    51
class ZNMethodTableEntry : public CHeapObj<mtGC> {
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    52
private:
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    53
  typedef ZBitField<uint64_t, bool,     0,  1>    field_registered;
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    54
  typedef ZBitField<uint64_t, bool,     1,  1>    field_unregistered;
53890
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    55
  typedef ZBitField<uint64_t, nmethod*, 2, 62, 2> field_method;
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    56
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    57
  uint64_t _entry;
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
public:
52939
9a8585f60c32 8214897: ZGC: Concurrent Class Unloading
eosterlund
parents: 50525
diff changeset
    60
  explicit ZNMethodTableEntry(bool unregistered = false) :
53890
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    61
      _entry(field_registered::encode(false) |
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    62
             field_unregistered::encode(unregistered) |
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    63
             field_method::encode(NULL)) {}
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    64
53890
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    65
  explicit ZNMethodTableEntry(nmethod* method) :
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    66
      _entry(field_registered::encode(true) |
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    67
             field_unregistered::encode(false) |
70a6a7b15d36 8219464: ZGC: Move nmethod oop properties from ZNMethodTableEntry to ZNMethodData
stefank
parents: 52939
diff changeset
    68
             field_method::encode(method)) {}
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    69
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    70
  bool registered() const {
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    71
    return field_registered::decode(_entry);
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
  bool unregistered() const {
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    75
    return field_unregistered::decode(_entry);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    76
  }
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    77
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    78
  nmethod* method() const {
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    79
    return field_method::decode(_entry);
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    80
  }
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    81
};
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    82
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
diff changeset
    83
#endif // SHARE_GC_Z_ZNMETHODTABLEENTRY_HPP