hotspot/src/share/vm/memory/genRemSet.hpp
author stefank
Fri, 14 Feb 2014 09:29:56 +0100
changeset 22883 5378704451dc
parent 22551 9bf46d16dcc6
child 27898 813ad96387b3
permissions -rw-r--r--
8034764: Use process_strong_roots to adjust the StringTable Reviewed-by: tschatzl, brutisso
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
22234
da823d78ad65 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 19289
diff changeset
     2
 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1388
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1388
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1388
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_MEMORY_GENREMSET_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_MEMORY_GENREMSET_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "oops/oop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
22551
9bf46d16dcc6 8025856: Fix typos in the GC code
jwilhelm
parents: 22548
diff changeset
    30
// A GenRemSet provides ways of iterating over pointers across generations.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// (This is especially useful for older-to-younger.)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
class Generation;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
class BarrierSet;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
class OopsInGenClosure;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
class CardTableRS;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    38
// Helper to remember modified oops in all klasses.
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    39
class KlassRemSet {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    40
  bool _accumulate_modified_oops;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    41
 public:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    42
  KlassRemSet() : _accumulate_modified_oops(false) {}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    43
  void set_accumulate_modified_oops(bool value) { _accumulate_modified_oops = value; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    44
  bool accumulate_modified_oops() { return _accumulate_modified_oops; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    45
  bool mod_union_is_clear();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    46
  void clear_mod_union();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    47
};
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    48
13195
be27e1b6a4b9 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 7397
diff changeset
    49
class GenRemSet: public CHeapObj<mtGC> {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  friend class Generation;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  BarrierSet* _bs;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    53
  KlassRemSet _klass_rem_set;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  GenRemSet(BarrierSet * bs) : _bs(bs) {}
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
    57
  GenRemSet() : _bs(NULL) {}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  // These are for dynamic downcasts.  Unfortunately that it names the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  // possible subtypes (but not that they are subtypes!)  Return NULL if
22551
9bf46d16dcc6 8025856: Fix typos in the GC code
jwilhelm
parents: 22548
diff changeset
    61
  // the cast is invalid.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  virtual CardTableRS* as_CardTableRS() { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  // Return the barrier set associated with "this."
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  BarrierSet* bs() { return _bs; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
    67
  // Set the barrier set.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
    68
  void set_bs(BarrierSet* bs) { _bs = bs; }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
    69
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    70
  KlassRemSet* klass_rem_set() { return &_klass_rem_set; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13195
diff changeset
    71
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  // Do any (sequential) processing necessary to prepare for (possibly
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  // "parallel", if that arg is true) calls to younger_refs_iterate.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  virtual void prepare_for_younger_refs_iterate(bool parallel) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  // Apply the "do_oop" method of "blk" to (exactly) all oop locations
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  //  1) that are in objects allocated in "g" at the time of the last call
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  //     to "save_Marks", and
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  //  2) that point to objects in younger generations.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  virtual void younger_refs_iterate(Generation* g, OopsInGenClosure* blk) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  virtual void younger_refs_in_space_iterate(Space* sp,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
                                             OopsInGenClosure* cl) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  // This method is used to notify the remembered set that "new_val" has
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  // been written into "field" by the garbage collector.
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 179
diff changeset
    87
  void write_ref_field_gc(void* field, oop new_val);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
protected:
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 179
diff changeset
    89
  virtual void write_ref_field_gc_work(void* field, oop new_val) = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  // A version of the above suitable for use by parallel collectors.
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 179
diff changeset
    93
  virtual void write_ref_field_gc_par(void* field, oop new_val) = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  // Resize one of the regions covered by the remembered set.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  virtual void resize_covered_region(MemRegion new_region) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  // If the rem set imposes any alignment restrictions on boundaries
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  // within the heap, this function tells whether they are met.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  virtual bool is_aligned(HeapWord* addr) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
22548
d54e4339811f 8031776: Remove the unnecessary enum GenRemSet::Name
ehelin
parents: 22234
diff changeset
   102
  // Returns any alignment constraint that the remembered set imposes upon the
d54e4339811f 8031776: Remove the unnecessary enum GenRemSet::Name
ehelin
parents: 22234
diff changeset
   103
  // heap.
d54e4339811f 8031776: Remove the unnecessary enum GenRemSet::Name
ehelin
parents: 22234
diff changeset
   104
  static uintx max_alignment_constraint();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  virtual void verify() = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  // Verify that the remembered set has no entries for
179
59e3abf83f72 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 1
diff changeset
   109
  // the heap interval denoted by mr.  If there are any
59e3abf83f72 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 1
diff changeset
   110
  // alignment constraints on the remembered set, only the
59e3abf83f72 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 1
diff changeset
   111
  // part of the region that is aligned is checked.
59e3abf83f72 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 1
diff changeset
   112
  //
59e3abf83f72 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 1
diff changeset
   113
  //   alignment boundaries
59e3abf83f72 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 1
diff changeset
   114
  //   +--------+-------+--------+-------+
59e3abf83f72 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 1
diff changeset
   115
  //         [ region mr              )
59e3abf83f72 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 1
diff changeset
   116
  //            [ part checked   )
59e3abf83f72 6624765: Guarantee failure "Unexpected dirty card found"
jmasa
parents: 1
diff changeset
   117
  virtual void verify_aligned_region_empty(MemRegion mr) = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  // If appropriate, print some information about the remset on "tty".
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  virtual void print() {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  // Informs the RS that the given memregion contains no references to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  // younger generations.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  virtual void clear(MemRegion mr) = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  // Informs the RS that there are no references to generations
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  // younger than gen from generations gen and older.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  // The parameter clear_perm indicates if the perm_gen's
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  // remembered set should also be processed/cleared.
19289
213031f03f61 8023021: Unnecessary clearing of the card table introduced by the fix for JDK-8023013
brutisso
parents: 19286
diff changeset
   130
  virtual void clear_into_younger(Generation* old_gen) = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  // Informs the RS that refs in the given "mr" may have changed
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  // arbitrarily, and therefore may contain old-to-young pointers.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   134
  // If "whole heap" is true, then this invalidation is part of an
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   135
  // invalidation of the whole heap, which an implementation might
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   136
  // handle differently than that of a sub-part of the heap.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 360
diff changeset
   137
  virtual void invalidate(MemRegion mr, bool whole_heap = false) = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  // Informs the RS that refs in this generation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  // may have changed arbitrarily, and therefore may contain
19286
48394008c803 8022800: Use specific generations rather than generation iteration
brutisso
parents: 13728
diff changeset
   141
  // old-to-young pointers in arbitrary locations.
19289
213031f03f61 8023021: Unnecessary clearing of the card table introduced by the fix for JDK-8023013
brutisso
parents: 19286
diff changeset
   142
  virtual void invalidate_or_clear(Generation* old_gen) = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   144
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   145
#endif // SHARE_VM_MEMORY_GENREMSET_HPP