src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.hpp

Thu, 14 Jun 2018 09:15:08 -0700

author
kevinw
date
Thu, 14 Jun 2018 09:15:08 -0700
changeset 9327
f96fcd9e1e1b
parent 7835
e5406a79ae90
permissions
-rw-r--r--

8081202: Hotspot compile warning: "Invalid suffix on literal; C++11 requires a space between literal and identifier"
Summary: Need to add a space between macro identifier and string literal
Reviewed-by: bpittore, stefank, dholmes, kbarrett

tschatzl@7051 1 /*
azakharov@7835 2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
tschatzl@7051 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
tschatzl@7051 4 *
tschatzl@7051 5 * This code is free software; you can redistribute it and/or modify it
tschatzl@7051 6 * under the terms of the GNU General Public License version 2 only, as
tschatzl@7051 7 * published by the Free Software Foundation.
tschatzl@7051 8 *
tschatzl@7051 9 * This code is distributed in the hope that it will be useful, but WITHOUT
tschatzl@7051 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
tschatzl@7051 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
tschatzl@7051 12 * version 2 for more details (a copy is included in the LICENSE file that
tschatzl@7051 13 * accompanied this code).
tschatzl@7051 14 *
tschatzl@7051 15 * You should have received a copy of the GNU General Public License version
tschatzl@7051 16 * 2 along with this work; if not, write to the Free Software Foundation,
tschatzl@7051 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
tschatzl@7051 18 *
tschatzl@7051 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
tschatzl@7051 20 * or visit www.oracle.com if you need additional information or have any
tschatzl@7051 21 * questions.
tschatzl@7051 22 *
tschatzl@7051 23 */
tschatzl@7051 24
tschatzl@7051 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1REGIONTOSPACEMAPPER_HPP
tschatzl@7051 26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1REGIONTOSPACEMAPPER_HPP
tschatzl@7051 27
tschatzl@7051 28 #include "gc_implementation/g1/g1PageBasedVirtualSpace.hpp"
tschatzl@7053 29 #include "memory/allocation.hpp"
tschatzl@7051 30 #include "utilities/debug.hpp"
tschatzl@7051 31
tschatzl@7051 32 class G1MappingChangedListener VALUE_OBJ_CLASS_SPEC {
tschatzl@7051 33 public:
tschatzl@7051 34 // Fired after commit of the memory, i.e. the memory this listener is registered
tschatzl@7051 35 // for can be accessed.
tschatzl@7257 36 // Zero_filled indicates that the memory can be considered as filled with zero bytes
tschatzl@7257 37 // when called.
tschatzl@7257 38 virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled) = 0;
tschatzl@7051 39 };
tschatzl@7051 40
tschatzl@7051 41 // Maps region based commit/uncommit requests to the underlying page sized virtual
tschatzl@7051 42 // space.
tschatzl@7051 43 class G1RegionToSpaceMapper : public CHeapObj<mtGC> {
tschatzl@7051 44 private:
tschatzl@7051 45 G1MappingChangedListener* _listener;
tschatzl@7051 46 protected:
tschatzl@7051 47 // Backing storage.
tschatzl@7051 48 G1PageBasedVirtualSpace _storage;
tschatzl@7781 49
tschatzl@7051 50 size_t _region_granularity;
tschatzl@7051 51 // Mapping management
tschatzl@7051 52 BitMap _commit_map;
tschatzl@7051 53
tschatzl@7781 54 G1RegionToSpaceMapper(ReservedSpace rs, size_t used_size, size_t page_size, size_t region_granularity, MemoryType type);
tschatzl@7051 55
tschatzl@7257 56 void fire_on_commit(uint start_idx, size_t num_regions, bool zero_filled);
tschatzl@7051 57 public:
tschatzl@7051 58 MemRegion reserved() { return _storage.reserved(); }
tschatzl@7051 59
azakharov@7835 60 size_t reserved_size() { return _storage.reserved_size(); }
azakharov@7835 61 size_t committed_size() { return _storage.committed_size(); }
azakharov@7835 62
tschatzl@7051 63 void set_mapping_changed_listener(G1MappingChangedListener* listener) { _listener = listener; }
tschatzl@7051 64
tschatzl@7051 65 virtual ~G1RegionToSpaceMapper() {
tschatzl@7051 66 _commit_map.resize(0, /* in_resource_area */ false);
tschatzl@7051 67 }
tschatzl@7051 68
tschatzl@7051 69 bool is_committed(uintptr_t idx) const {
tschatzl@7051 70 return _commit_map.at(idx);
tschatzl@7051 71 }
tschatzl@7051 72
tschatzl@7781 73 virtual void commit_regions(uint start_idx, size_t num_regions = 1) = 0;
tschatzl@7781 74 virtual void uncommit_regions(uint start_idx, size_t num_regions = 1) = 0;
tschatzl@7051 75
tschatzl@7051 76 // Creates an appropriate G1RegionToSpaceMapper for the given parameters.
tschatzl@7781 77 // The actual space to be used within the given reservation is given by actual_size.
tschatzl@7781 78 // This is because some OSes need to round up the reservation size to guarantee
tschatzl@7781 79 // alignment of page_size.
tschatzl@7051 80 // The byte_translation_factor defines how many bytes in a region correspond to
tschatzl@7051 81 // a single byte in the data structure this mapper is for.
tschatzl@7051 82 // Eg. in the card table, this value corresponds to the size a single card
tschatzl@7781 83 // table entry corresponds to in the heap.
tschatzl@7051 84 static G1RegionToSpaceMapper* create_mapper(ReservedSpace rs,
tschatzl@7781 85 size_t actual_size,
tschatzl@7781 86 size_t page_size,
tschatzl@7051 87 size_t region_granularity,
tschatzl@7051 88 size_t byte_translation_factor,
tschatzl@7051 89 MemoryType type);
tschatzl@7051 90 };
tschatzl@7051 91
tschatzl@7051 92 #endif /* SHARE_VM_GC_IMPLEMENTATION_G1_G1REGIONTOSPACEMAPPER_HPP */

mercurial