src/hotspot/share/gc/parallel/adjoiningVirtualSpaces.hpp
author stefank
Wed, 18 Oct 2017 21:13:35 +0200
changeset 47648 226b1fc611b9
parent 47216 71c04702a3d5
child 53117 37930c6ba6d7
permissions -rw-r--r--
8189359: Move native weak oops cleaning out of ReferenceProcessor Reviewed-by: pliden, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 7397
diff changeset
     2
 * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 7397
diff changeset
    25
#ifndef SHARE_VM_GC_PARALLEL_ADJOININGVIRTUALSPACES_HPP
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 7397
diff changeset
    26
#define SHARE_VM_GC_PARALLEL_ADJOININGVIRTUALSPACES_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 7397
diff changeset
    28
#include "gc/parallel/psVirtualspace.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// Contains two virtual spaces that each can individually span
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// most of the reserved region but committed parts of which
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// cannot overlap.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
//      +-------+ <--- high_boundary for H
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
//      |       |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
//      |   H   |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
//      |       |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
//      |       |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
//      |       |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
//      --------- <--- low for H
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
//      |       |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
//      ========= <--- low_boundary for H, high_boundary for L
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
//      |       |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
//      |       |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
//      |       |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
//      --------- <--- high for L
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
//      |       |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
//      |   L   |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
//      |       |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
//      |       |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
//      |       |
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
//      +-------+ <--- low_boundary for L
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
// Each virtual space in the AdjoiningVirtualSpaces grows and shrink
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
// within its reserved region (between the low_boundary and the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
// boundary) independently.  If L want to grow above its high_boundary,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
// then the high_boundary of L and the low_boundary of H must be
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
// moved up consistently.  AdjoiningVirtualSpaces provide the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
// interfaces for moving the this boundary.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
class AdjoiningVirtualSpaces {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  // space at the high end and the low end, respectively
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  PSVirtualSpace*    _high;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  PSVirtualSpace*    _low;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  // The reserved space spanned by the two spaces.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  ReservedSpace      _reserved_space;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  // The minimum byte size for the low space.  It will not
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  // be shrunk below this value.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  size_t _min_low_byte_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  // Same for the high space
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  size_t _min_high_byte_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  const size_t _alignment;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  // Allocates two virtual spaces that will be located at the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  // high and low ends.  Does no initialization.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  AdjoiningVirtualSpaces(ReservedSpace rs,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
                         size_t min_low_byte_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
                         size_t min_high_byte_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
                         size_t alignment);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  // accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  PSVirtualSpace* high() { return _high; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  PSVirtualSpace* low()  { return _low; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  ReservedSpace reserved_space() { return _reserved_space; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  size_t min_low_byte_size() { return _min_low_byte_size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  size_t min_high_byte_size() { return _min_high_byte_size; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  size_t alignment() const { return _alignment; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  // move boundary between the two spaces up
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  bool adjust_boundary_up(size_t size_in_bytes);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  // and down
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  bool adjust_boundary_down(size_t size_in_bytes);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  // Maximum byte size for the high space.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  size_t high_byte_size_limit() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    return _reserved_space.size() - _min_low_byte_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  // Maximum byte size for the low space.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  size_t low_byte_size_limit() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    return _reserved_space.size() - _min_high_byte_size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  // Sets the boundaries for the virtual spaces and commits and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  // initial size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  void initialize(size_t max_low_byte_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
                  size_t init_low_byte_size,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
                  size_t init_high_byte_size);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   114
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 7397
diff changeset
   115
#endif // SHARE_VM_GC_PARALLEL_ADJOININGVIRTUALSPACES_HPP