Mon, 08 Dec 2014 18:57:33 +0100
8067655: Clean up G1 remembered set oop iteration
Summary: Pass on the static type G1ParPushHeapRSClosure to allow oop_iterate devirtualization
Reviewed-by: jmasa, kbarrett
tschatzl@7051 | 1 | /* |
tschatzl@7051 | 2 | * Copyright (c) 2014, 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@7051 | 49 | size_t _commit_granularity; |
tschatzl@7051 | 50 | size_t _region_granularity; |
tschatzl@7051 | 51 | // Mapping management |
tschatzl@7051 | 52 | BitMap _commit_map; |
tschatzl@7051 | 53 | |
tschatzl@7051 | 54 | G1RegionToSpaceMapper(ReservedSpace rs, size_t commit_granularity, 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 | |
tschatzl@7051 | 60 | void set_mapping_changed_listener(G1MappingChangedListener* listener) { _listener = listener; } |
tschatzl@7051 | 61 | |
tschatzl@7051 | 62 | virtual ~G1RegionToSpaceMapper() { |
tschatzl@7051 | 63 | _commit_map.resize(0, /* in_resource_area */ false); |
tschatzl@7051 | 64 | } |
tschatzl@7051 | 65 | |
tschatzl@7051 | 66 | bool is_committed(uintptr_t idx) const { |
tschatzl@7051 | 67 | return _commit_map.at(idx); |
tschatzl@7051 | 68 | } |
tschatzl@7051 | 69 | |
tschatzl@7051 | 70 | virtual void commit_regions(uintptr_t start_idx, size_t num_regions = 1) = 0; |
tschatzl@7051 | 71 | virtual void uncommit_regions(uintptr_t start_idx, size_t num_regions = 1) = 0; |
tschatzl@7051 | 72 | |
tschatzl@7051 | 73 | // Creates an appropriate G1RegionToSpaceMapper for the given parameters. |
tschatzl@7051 | 74 | // The byte_translation_factor defines how many bytes in a region correspond to |
tschatzl@7051 | 75 | // a single byte in the data structure this mapper is for. |
tschatzl@7051 | 76 | // Eg. in the card table, this value corresponds to the size a single card |
tschatzl@7051 | 77 | // table entry corresponds to. |
tschatzl@7051 | 78 | static G1RegionToSpaceMapper* create_mapper(ReservedSpace rs, |
tschatzl@7051 | 79 | size_t os_commit_granularity, |
tschatzl@7051 | 80 | size_t region_granularity, |
tschatzl@7051 | 81 | size_t byte_translation_factor, |
tschatzl@7051 | 82 | MemoryType type); |
tschatzl@7051 | 83 | }; |
tschatzl@7051 | 84 | |
tschatzl@7051 | 85 | #endif /* SHARE_VM_GC_IMPLEMENTATION_G1_G1REGIONTOSPACEMAPPER_HPP */ |