src/hotspot/share/gc/parallel/adjoiningGenerationsForHeteroHeap.hpp
author stefank
Mon, 15 Apr 2019 11:47:46 +0200
changeset 54678 93f09ca4a7f8
parent 53244 9807daeb47c4
permissions -rw-r--r--
8198505: Remove CollectorPolicy and its subclasses Reviewed-by: pliden, shade
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53117
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53117
diff changeset
     2
 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
53117
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
     4
 *
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
     7
 * published by the Free Software Foundation.
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
     8
 *
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    13
 * accompanied this code).
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    14
 *
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    18
 *
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    21
 * questions.
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    22
 *
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    23
 */
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53117
diff changeset
    25
#ifndef SHARE_GC_PARALLEL_ADJOININGGENERATIONSFORHETEROHEAP_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53117
diff changeset
    26
#define SHARE_GC_PARALLEL_ADJOININGGENERATIONSFORHETEROHEAP_HPP
53117
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    27
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    28
#include "gc/parallel/adjoiningGenerations.hpp"
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    29
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    30
class AdjoiningGenerationsForHeteroHeap : public AdjoiningGenerations {
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    31
  friend class VMStructs;
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    32
private:
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    33
  // Maximum total size of the generations. This is equal to the heap size specified by user.
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    34
  // When adjusting young and old generation sizes, we need ensure that sum of the generation sizes does not exceed this.
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    35
  size_t _total_size_limit;
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    36
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    37
  size_t total_size_limit() const {
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    38
    return _total_size_limit;
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    39
  }
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    40
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    41
  // HeteroVirtualSpaces creates non-overlapping virtual spaces. Here _low and _high do not share a reserved space, i.e. there is no boundary
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    42
  // separating the two virtual spaces.
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    43
  class HeteroVirtualSpaces : public AdjoiningVirtualSpaces {
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    44
    size_t _max_total_size;
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    45
    size_t _min_old_byte_size;
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    46
    size_t _min_young_byte_size;
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    47
    size_t _max_old_byte_size;
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    48
    size_t _max_young_byte_size;
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    49
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    50
    // Internally we access the virtual spaces using these methods. It increases readability, since we were not really
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    51
    // dealing with adjoining virtual spaces separated by a boundary as is the case in base class.
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    52
    // Externally they are accessed using low() and high() methods of base class.
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    53
    PSVirtualSpace* young_vs() { return high(); }
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    54
    PSVirtualSpace* old_vs() { return low(); }
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    55
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    56
  public:
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    57
    HeteroVirtualSpaces(ReservedSpace rs,
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    58
                        size_t min_old_byte_size,
54678
93f09ca4a7f8 8198505: Remove CollectorPolicy and its subclasses
stefank
parents: 53244
diff changeset
    59
                        size_t min_young_byte_size,
93f09ca4a7f8 8198505: Remove CollectorPolicy and its subclasses
stefank
parents: 53244
diff changeset
    60
                        size_t max_total_size);
53117
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    61
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    62
    // Increase old generation size and decrease young generation size by same amount
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    63
    bool adjust_boundary_up(size_t size_in_bytes);
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    64
    // Increase young generation size and decrease old generation size by same amount
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    65
    bool adjust_boundary_down(size_t size_in_bytes);
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    66
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    67
    size_t max_young_size() const { return _max_young_byte_size; }
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    68
    size_t max_old_size() const { return _max_old_byte_size; }
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    69
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    70
    void initialize(size_t initial_old_reserved_size, size_t init_low_byte_size,
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    71
                    size_t init_high_byte_size);
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    72
  };
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    73
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    74
public:
54678
93f09ca4a7f8 8198505: Remove CollectorPolicy and its subclasses
stefank
parents: 53244
diff changeset
    75
  AdjoiningGenerationsForHeteroHeap(ReservedSpace rs);
53117
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    76
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    77
  // Given the size policy, calculate the total amount of memory that needs to be reserved.
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    78
  // We need to reserve more memory than Xmx, since we use non-overlapping virtual spaces for the young and old generations.
54678
93f09ca4a7f8 8198505: Remove CollectorPolicy and its subclasses
stefank
parents: 53244
diff changeset
    79
  static size_t required_reserved_memory();
53117
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    80
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    81
  // Return the total byte size of the reserved space
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    82
  size_t reserved_byte_size();
37930c6ba6d7 8211424: Allocation of old generation of java heap on alternate memory devices - Parallel GC
sangheki
parents:
diff changeset
    83
};
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53117
diff changeset
    84
#endif // SHARE_GC_PARALLEL_ADJOININGGENERATIONSFORHETEROHEAP_HPP