src/hotspot/share/gc/z/zNMethodData.hpp
author pliden
Mon, 18 Mar 2019 11:50:40 +0100
changeset 54167 d0d26fc836dd
parent 53921 a590b6107ab3
child 54171 07943af21b96
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:
53892
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
     1
/*
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
     2
 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
     4
 *
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
     7
 * published by the Free Software Foundation.
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
     8
 *
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    13
 * accompanied this code).
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    14
 *
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    18
 *
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    21
 * questions.
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    22
 */
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    23
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    24
#include "gc/z/zLock.hpp"
53921
a590b6107ab3 8218974: Free GC native structures in nmethod::flush
eosterlund
parents: 53892
diff changeset
    25
#include "memory/allocation.hpp"
53892
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    26
#include "oops/oopsHierarchy.hpp"
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    27
#include "utilities/globalDefinitions.hpp"
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    28
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    29
#ifndef SHARE_GC_Z_ZNMETHODDATA_HPP
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    30
#define SHARE_GC_Z_ZNMETHODDATA_HPP
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    31
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    32
class nmethod;
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    33
template <typename T> class GrowableArray;
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    34
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    35
class ZNMethodDataOops {
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    36
private:
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    37
  const size_t _nimmediates;
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    38
  bool         _has_non_immediates;
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    39
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    40
  static size_t header_size();
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    41
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    42
  ZNMethodDataOops(const GrowableArray<oop*>& immediates, bool has_non_immediates);
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    43
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    44
public:
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    45
  static ZNMethodDataOops* create(const GrowableArray<oop*>& immediates, bool has_non_immediates);
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    46
  static void destroy(ZNMethodDataOops* oops);
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    47
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    48
  size_t immediates_count() const;
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    49
  oop** immediates_begin() const;
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    50
  oop** immediates_end() const;
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    51
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    52
  bool has_non_immediates() const;
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    53
};
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    54
53921
a590b6107ab3 8218974: Free GC native structures in nmethod::flush
eosterlund
parents: 53892
diff changeset
    55
class ZNMethodData : public CHeapObj<mtGC> {
53892
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    56
private:
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    57
  ZReentrantLock             _lock;
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    58
  ZNMethodDataOops* volatile _oops;
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    59
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    60
public:
53921
a590b6107ab3 8218974: Free GC native structures in nmethod::flush
eosterlund
parents: 53892
diff changeset
    61
  ZNMethodData();
a590b6107ab3 8218974: Free GC native structures in nmethod::flush
eosterlund
parents: 53892
diff changeset
    62
  ~ZNMethodData();
53892
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    63
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    64
  ZReentrantLock* lock();
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    65
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    66
  ZNMethodDataOops* oops() const;
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    67
  ZNMethodDataOops* swap_oops(ZNMethodDataOops* oops);
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    68
};
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    69
33790c8e4647 8219467: ZGC: Move ZNMethodData to its own file
stefank
parents:
diff changeset
    70
#endif // SHARE_GC_Z_ZNMETHODDATA_HPP