3854N/A * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. 342N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 342N/A * This code is free software; you can redistribute it and/or modify it 342N/A * under the terms of the GNU General Public License version 2 only, as 342N/A * published by the Free Software Foundation. 342N/A * This code is distributed in the hope that it will be useful, but WITHOUT 342N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 342N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 342N/A * version 2 for more details (a copy is included in the LICENSE file that 342N/A * accompanied this code). 342N/A * You should have received a copy of the GNU General Public License version 342N/A * 2 along with this work; if not, write to the Free Software Foundation, 342N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 342N/A// Remembered set for a heap region. Represent a set of "cards" that 342N/A// contain pointers into the owner heap region. Cards are defined somewhat 342N/A// abstractly, in terms of what the "BlockOffsetTable" in use can parse. 2058N/A// Essentially a wrapper around SparsePRTCleanupTask. See 342N/A// The "_coarse_map" is a bitmap with one bit for each region, where set 342N/A// bits indicate that the corresponding region may contain some pointer 342N/A// into the owning region. 342N/A// The "_fine_grain_entries" array is an open hash table of PerRegionTables 342N/A// (PRTs), indicating regions for which we're keeping the RS as a set of 342N/A// cards. The strategy is to cap the size of the fine-grain table, 342N/A// deleting an entry and setting the corresponding coarse-grained bit when 342N/A// we would overflow this cap. 342N/A// We use a mixture of locking and lock-free techniques here. We allow 342N/A// threads to locate PRTs without locking, but threads attempting to alter 342N/A// a bucket list obtain a lock. This means that any failing attempt to 342N/A// find a PRT must be retried with the lock. It might seem dangerous that 342N/A// a read can find a PRT that is concurrently deleted. This is all right, 342N/A// 1) We only actually free PRT's at safe points (though we reuse them at 342N/A// 2) We find PRT's in an attempt to add entries. If a PRT is deleted, 342N/A// it's _coarse_map bit is set, so the that we were attempting to add 342N/A// is represented. If a deleted PRT is re-used, a thread adding a bit, 342N/A// thinking the PRT is for a different region, does no harm. 342N/A // These are protected by "_m". 3919N/A // The fine grain remembered sets are doubly linked together using 3919N/A // their 'next' and 'prev' fields. 3919N/A // This allows fast bulk freeing of all the fine grain remembered 3919N/A // set entries, and fast finding of all of them without iterating 3919N/A // over the _fine_grain_regions table. 3854N/A // Used to sample a subset of the fine grain PRTs to determine which 3854N/A // PRT to evict and coarsen. 342N/A // These are static after init. 342N/A // Requires "prt" to be the first element of the bucket list appropriate 342N/A // for "hr". If this list contains an entry for "hr", return it, 342N/A // otherwise return "NULL". 3854N/A // Find, delete, and return a candidate PerRegionTable, if any exists, 342N/A // adding the deleted region to the coarse bitmap. Requires the caller 342N/A // to hold _m, and the fine-grain table to be full. 342N/A // If a PRT for "hr" is in the bucket list indicated by "ind" (which must 342N/A // be the correct index for "hr"), delete it and return true; else return 342N/A // Indexed by thread X heap region, to minimize thread contention. 3919N/A // link/add the given fine grain remembered set into the "all" list 342N/A // For now. Could "expand" some tables in the future, so that this made 342N/A // Removes any entries shown by the given bitmaps to contain only dead 342N/A // Not const because it takes a lock. 342N/A // Returns size in bytes. 342N/A // Not const because it takes a lock. 342N/A // Specifically clear the from_card_cache. 342N/A // "from_hr" is being cleared; remove any entries from it. 342N/A // Declare the heap size (in # of regions) to the OtherRegionsTable. 342N/A // (Uses it to initialize from_card_cache). 342N/A // Declares that only regions i s.t. 0 <= i < new_n_regs are in use. 342N/A // Make sure any entries for higher regions are invalid. 342N/A // Unused unless G1RecordHRRSOops is true. 3854N/A // Used in the sequential case. 3854N/A // Used in the parallel case. 342N/A // Removes any entries shown by the given bitmaps to contain only dead 342N/A // The region is being reclaimed; clear its remset, and any mention of 342N/A // entries for this region in other remsets. 342N/A // Attempt to claim the region. Returns true iff this call caused an 342N/A // atomic transition from Unclaimed to Claimed. 342N/A // Sets the iteration state to "complete". 342N/A // Returns "true" iff the region's iteration is complete. 1261N/A // Support for claiming blocks of cards during iteration 1261N/A // Claim the next block of cards 342N/A // Initialize the given iterator to iterate over this rem set. 342N/A // The actual # of bytes this hr_remset takes up. 342N/A // This correction is necessary because the above includes the second 342N/A // Returns the memory occupancy of all static data structures associated 342N/A // with remembered sets. 342N/A // Returns the memory occupancy of all free_list data structures associated 342N/A // with remembered sets. 342N/A // Called during a stop-world phase to perform any deferred cleanups. 342N/A // Declare the heap size (in # of regions) to the HeapRegionRemSet(s). 342N/A // (Uses it to initialize from_card_cache). 342N/A // Declares that only regions i s.t. 0 <= i < new_n_regs are in use. 2058N/A // These are wrappers for the similarly-named methods on 342N/A // The region over which we're iterating. 342N/A // Local caching of HRRS fields. 342N/A // The number yielded since initialization. 342N/A // If true we're iterating over the coarse table; if false the fine 342N/A // In both kinds of iteration, heap offset of first card of current 342N/A // Card offset within cur region. 342N/A // Coarse table iteration fields: 342N/A // Current region index; 342N/A // Fine table iteration fields: 342N/A // Index of bucket-list we're working on. 342N/A // Per Region Table we're doing within current bucket list. 342N/A // We require an iterator to be initialized before use, so the 342N/A // constructor does little. 342N/A // If there remains one or more cards to be yielded, returns true and 342N/A // sets "card_index" to one of those cards (which is then considered 342N/A // yielded.) Otherwise, returns false (and leaves "card_index" 1879N/A#
endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONREMSET_HPP