< prev index next >

src/hotspot/share/gc/shared/cardTable.hpp

Print this page

  1 /*
  2  * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

 88   // the first covered region.
 89   HeapWord* largest_prev_committed_end(int ind) const;
 90 
 91   // Returns the part of the region mr that doesn't intersect with
 92   // any committed region other than self.  Used to prevent uncommitting
 93   // regions that are also committed by other regions.  Also protects
 94   // against uncommitting the guard region.
 95   MemRegion committed_unique_to_self(int self, MemRegion mr) const;
 96 
 97   // Some barrier sets create tables whose elements correspond to parts of
 98   // the heap; the CardTableBarrierSet is an example.  Such barrier sets will
 99   // normally reserve space for such tables, and commit parts of the table
100   // "covering" parts of the heap that are committed. At most one covered
101   // region per generation is needed.
102   static const int _max_covered_regions = 2;
103 
104   enum CardValues {
105     clean_card                  = (CardValue)-1,
106 
107     dirty_card                  =  0,
108     precleaned_card             =  1,
109     last_card                   =  2,
110     CT_MR_BS_last_reserved      =  4
111   };
112 
113   // a word's worth (row) of clean card values
114   static const intptr_t clean_card_row = (intptr_t)(-1);
115 
116 public:
117   CardTable(MemRegion whole_heap, bool conc_scan);
118   virtual ~CardTable();
119   virtual void initialize();
120 
121   // The kinds of precision a CardTable may offer.
122   enum PrecisionStyle {
123     Precise,
124     ObjHeadPreciseArray
125   };
126 
127   // Tells what style of precision this card table offers.
128   PrecisionStyle precision() {
129     return ObjHeadPreciseArray; // Only one supported for now.
130   }

222   // Apply closure "cl" to the dirty cards containing some part of
223   // MemRegion "mr".
224   void dirty_card_iterate(MemRegion mr, MemRegionClosure* cl);
225 
226   // Return the MemRegion corresponding to the first maximal run
227   // of dirty cards lying completely within MemRegion mr.
228   // If reset is "true", then sets those card table entries to the given
229   // value.
230   MemRegion dirty_card_range_after_reset(MemRegion mr, bool reset,
231                                          int reset_val);
232 
233   // Constants
234   enum SomePublicConstants {
235     card_shift                  = 9,
236     card_size                   = 1 << card_shift,
237     card_size_in_words          = card_size / sizeof(HeapWord)
238   };
239 
240   static CardValue clean_card_val()          { return clean_card; }
241   static CardValue dirty_card_val()          { return dirty_card; }
242   static CardValue precleaned_card_val()     { return precleaned_card; }
243   static intptr_t clean_card_row_val()   { return clean_card_row; }
244 
245   // Card marking array base (adjusted for heap low boundary)
246   // This would be the 0th element of _byte_map, if the heap started at 0x0.
247   // But since the heap starts at some higher address, this points to somewhere
248   // before the beginning of the actual _byte_map.
249   CardValue* byte_map_base() const { return _byte_map_base; }
250   bool scanned_concurrently() const { return _scanned_concurrently; }
251 
252   virtual bool is_in_young(oop obj) const = 0;
253 
254   // Print a description of the memory for the card table
255   virtual void print_on(outputStream* st) const;
256 
257   void verify();
258   void verify_guard();
259 
260   // val_equals -> it will check that all cards covered by mr equal val
261   // !val_equals -> it will check that all cards covered by mr do not equal val
262   void verify_region(MemRegion mr, CardValue val, bool val_equals) PRODUCT_RETURN;

  1 /*
  2  * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *

 88   // the first covered region.
 89   HeapWord* largest_prev_committed_end(int ind) const;
 90 
 91   // Returns the part of the region mr that doesn't intersect with
 92   // any committed region other than self.  Used to prevent uncommitting
 93   // regions that are also committed by other regions.  Also protects
 94   // against uncommitting the guard region.
 95   MemRegion committed_unique_to_self(int self, MemRegion mr) const;
 96 
 97   // Some barrier sets create tables whose elements correspond to parts of
 98   // the heap; the CardTableBarrierSet is an example.  Such barrier sets will
 99   // normally reserve space for such tables, and commit parts of the table
100   // "covering" parts of the heap that are committed. At most one covered
101   // region per generation is needed.
102   static const int _max_covered_regions = 2;
103 
104   enum CardValues {
105     clean_card                  = (CardValue)-1,
106 
107     dirty_card                  =  0,
108     last_card                   =  1,
109     CT_MR_BS_last_reserved      =  2

110   };
111 
112   // a word's worth (row) of clean card values
113   static const intptr_t clean_card_row = (intptr_t)(-1);
114 
115 public:
116   CardTable(MemRegion whole_heap, bool conc_scan);
117   virtual ~CardTable();
118   virtual void initialize();
119 
120   // The kinds of precision a CardTable may offer.
121   enum PrecisionStyle {
122     Precise,
123     ObjHeadPreciseArray
124   };
125 
126   // Tells what style of precision this card table offers.
127   PrecisionStyle precision() {
128     return ObjHeadPreciseArray; // Only one supported for now.
129   }

221   // Apply closure "cl" to the dirty cards containing some part of
222   // MemRegion "mr".
223   void dirty_card_iterate(MemRegion mr, MemRegionClosure* cl);
224 
225   // Return the MemRegion corresponding to the first maximal run
226   // of dirty cards lying completely within MemRegion mr.
227   // If reset is "true", then sets those card table entries to the given
228   // value.
229   MemRegion dirty_card_range_after_reset(MemRegion mr, bool reset,
230                                          int reset_val);
231 
232   // Constants
233   enum SomePublicConstants {
234     card_shift                  = 9,
235     card_size                   = 1 << card_shift,
236     card_size_in_words          = card_size / sizeof(HeapWord)
237   };
238 
239   static CardValue clean_card_val()          { return clean_card; }
240   static CardValue dirty_card_val()          { return dirty_card; }

241   static intptr_t clean_card_row_val()   { return clean_card_row; }
242 
243   // Card marking array base (adjusted for heap low boundary)
244   // This would be the 0th element of _byte_map, if the heap started at 0x0.
245   // But since the heap starts at some higher address, this points to somewhere
246   // before the beginning of the actual _byte_map.
247   CardValue* byte_map_base() const { return _byte_map_base; }
248   bool scanned_concurrently() const { return _scanned_concurrently; }
249 
250   virtual bool is_in_young(oop obj) const = 0;
251 
252   // Print a description of the memory for the card table
253   virtual void print_on(outputStream* st) const;
254 
255   void verify();
256   void verify_guard();
257 
258   // val_equals -> it will check that all cards covered by mr equal val
259   // !val_equals -> it will check that all cards covered by mr do not equal val
260   void verify_region(MemRegion mr, CardValue val, bool val_equals) PRODUCT_RETURN;
< prev index next >