src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp

changeset 0
f90c822e73f8
child 1
2d8a650513c2
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,113 @@
     1.4 +/*
     1.5 + * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP
    1.29 +#define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP
    1.30 +
    1.31 +#include "memory/cardTableModRefBS.hpp"
    1.32 +
    1.33 +class MutableSpace;
    1.34 +class ObjectStartArray;
    1.35 +class PSPromotionManager;
    1.36 +class GCTaskQueue;
    1.37 +
    1.38 +class CardTableExtension : public CardTableModRefBS {
    1.39 + private:
    1.40 +  // Support methods for resizing the card table.
    1.41 +  // resize_commit_uncommit() returns true if the pages were committed or
    1.42 +  // uncommitted
    1.43 +  bool resize_commit_uncommit(int changed_region, MemRegion new_region);
    1.44 +  void resize_update_card_table_entries(int changed_region,
    1.45 +                                        MemRegion new_region);
    1.46 +  void resize_update_committed_table(int changed_region, MemRegion new_region);
    1.47 +  void resize_update_covered_table(int changed_region, MemRegion new_region);
    1.48 +
    1.49 + protected:
    1.50 +
    1.51 +  static void verify_all_young_refs_precise_helper(MemRegion mr);
    1.52 +
    1.53 + public:
    1.54 +  enum ExtendedCardValue {
    1.55 +    youngergen_card   = CardTableModRefBS::CT_MR_BS_last_reserved + 1,
    1.56 +    verify_card       = CardTableModRefBS::CT_MR_BS_last_reserved + 5
    1.57 +  };
    1.58 +
    1.59 +  CardTableExtension(MemRegion whole_heap, int max_covered_regions) :
    1.60 +    CardTableModRefBS(whole_heap, max_covered_regions) { }
    1.61 +
    1.62 +  // Too risky for the 4/10/02 putback
    1.63 +  // BarrierSet::Name kind() { return BarrierSet::CardTableExtension; }
    1.64 +
    1.65 +  // Scavenge support
    1.66 +  void scavenge_contents_parallel(ObjectStartArray* start_array,
    1.67 +                                  MutableSpace* sp,
    1.68 +                                  HeapWord* space_top,
    1.69 +                                  PSPromotionManager* pm,
    1.70 +                                  uint stripe_number,
    1.71 +                                  uint stripe_total);
    1.72 +
    1.73 +  // Verification
    1.74 +  static void verify_all_young_refs_imprecise();
    1.75 +  static void verify_all_young_refs_precise();
    1.76 +
    1.77 +  bool addr_is_marked_imprecise(void *addr);
    1.78 +  bool addr_is_marked_precise(void *addr);
    1.79 +
    1.80 +  void set_card_newgen(void* addr)   { jbyte* p = byte_for(addr); *p = verify_card; }
    1.81 +
    1.82 +  // Testers for entries
    1.83 +  static bool card_is_dirty(int value)      { return value == dirty_card; }
    1.84 +  static bool card_is_newgen(int value)     { return value == youngergen_card; }
    1.85 +  static bool card_is_clean(int value)      { return value == clean_card; }
    1.86 +  static bool card_is_verify(int value)     { return value == verify_card; }
    1.87 +
    1.88 +  // Card marking
    1.89 +  void inline_write_ref_field_gc(void* field, oop new_val) {
    1.90 +    jbyte* byte = byte_for(field);
    1.91 +    *byte = youngergen_card;
    1.92 +  }
    1.93 +
    1.94 +  // Adaptive size policy support
    1.95 +  // Allows adjustment of the base and size of the covered regions
    1.96 +  void resize_covered_region(MemRegion new_region);
    1.97 +  // Finds the covered region to resize based on the start address
    1.98 +  // of the covered regions.
    1.99 +  void resize_covered_region_by_start(MemRegion new_region);
   1.100 +  // Finds the covered region to resize based on the end address
   1.101 +  // of the covered regions.
   1.102 +  void resize_covered_region_by_end(int changed_region, MemRegion new_region);
   1.103 +  // Finds the lowest start address of a covered region that is
   1.104 +  // previous (i.e., lower index) to the covered region with index "ind".
   1.105 +  HeapWord* lowest_prev_committed_start(int ind) const;
   1.106 +
   1.107 +#ifdef ASSERT
   1.108 +
   1.109 +  bool is_valid_card_address(jbyte* addr) {
   1.110 +    return (addr >= _byte_map) && (addr < _byte_map + _byte_map_size);
   1.111 +  }
   1.112 +
   1.113 +#endif // ASSERT
   1.114 +};
   1.115 +
   1.116 +#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_CARDTABLEEXTENSION_HPP

mercurial