src/hotspot/share/gc/z/zMarkStackAllocator.hpp
author stuefe
Tue, 26 Nov 2019 16:21:29 +0100
branchstuefe-new-metaspace-branch
changeset 59272 54750b448264
parent 58811 38f4701d6587
permissions -rw-r--r--
Metadatatype back to metaspace.hpp to reduce patch size
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51395
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
     1
/*
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
     2
 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
     4
 *
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
     7
 * published by the Free Software Foundation.
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
     8
 *
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    13
 * accompanied this code).
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    14
 *
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    18
 *
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    21
 * questions.
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    22
 */
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    23
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    24
#ifndef SHARE_GC_Z_ZMARKSTACKALLOCATOR_HPP
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    25
#define SHARE_GC_Z_ZMARKSTACKALLOCATOR_HPP
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    26
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    27
#include "gc/z/zGlobals.hpp"
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    28
#include "gc/z/zLock.hpp"
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    29
#include "utilities/globalDefinitions.hpp"
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    30
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    31
class ZMarkStackSpace {
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    32
private:
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    33
  ZLock              _expand_lock;
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    34
  uintptr_t          _start;
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    35
  volatile uintptr_t _top;
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    36
  volatile uintptr_t _end;
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    37
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    38
  void expand();
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    39
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    40
  uintptr_t alloc_space(size_t size);
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    41
  uintptr_t expand_and_alloc_space(size_t size);
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    42
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    43
public:
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    44
  ZMarkStackSpace();
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    45
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    46
  bool is_initialized() const;
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    47
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    48
  uintptr_t alloc(size_t size);
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    49
};
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    50
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    51
class ZMarkStackAllocator {
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    52
private:
58811
38f4701d6587 8232648: ZGC: Move ATTRIBUTE_ALIGNED to the front of declarations
stefank
parents: 51395
diff changeset
    53
  ZCACHE_ALIGNED ZMarkStackMagazineList _freelist;
38f4701d6587 8232648: ZGC: Move ATTRIBUTE_ALIGNED to the front of declarations
stefank
parents: 51395
diff changeset
    54
  ZCACHE_ALIGNED ZMarkStackSpace        _space;
51395
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    55
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    56
  void prime_freelist();
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    57
  ZMarkStackMagazine* create_magazine_from_space(uintptr_t addr, size_t size);
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    58
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    59
public:
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    60
  ZMarkStackAllocator();
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    61
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    62
  bool is_initialized() const;
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    63
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    64
  ZMarkStackMagazine* alloc_magazine();
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    65
  void free_magazine(ZMarkStackMagazine* magazine);
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    66
};
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    67
f3cf91d5373f 8209376: ZGC: Move ZMarkStackAllocator into a separate file
pliden
parents:
diff changeset
    68
#endif // SHARE_GC_Z_ZMARKSTACKALLOCATOR_HPP