src/share/vm/memory/genRemSet.hpp

Wed, 15 Feb 2012 10:12:55 -0800

author
never
date
Wed, 15 Feb 2012 10:12:55 -0800
changeset 3571
09d00c18e323
parent 2314
f95d63e2154a
child 3900
d2a62e0f25eb
permissions
-rw-r--r--

7145537: minor tweaks to LogEvents
Reviewed-by: kvn, twisti

     1 /*
     2  * Copyright (c) 2001, 2010, 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  *
    23  */
    25 #ifndef SHARE_VM_MEMORY_GENREMSET_HPP
    26 #define SHARE_VM_MEMORY_GENREMSET_HPP
    28 #include "oops/oop.hpp"
    30 // A GenRemSet provides ways of iterating over pointers accross generations.
    31 // (This is especially useful for older-to-younger.)
    33 class Generation;
    34 class BarrierSet;
    35 class OopsInGenClosure;
    36 class CardTableRS;
    38 class GenRemSet: public CHeapObj {
    39   friend class Generation;
    41   BarrierSet* _bs;
    43 public:
    44   enum Name {
    45     CardTable,
    46     Other
    47   };
    49   GenRemSet(BarrierSet * bs) : _bs(bs) {}
    50   GenRemSet() : _bs(NULL) {}
    52   virtual Name rs_kind() = 0;
    54   // These are for dynamic downcasts.  Unfortunately that it names the
    55   // possible subtypes (but not that they are subtypes!)  Return NULL if
    56   // the cast is invalide.
    57   virtual CardTableRS* as_CardTableRS() { return NULL; }
    59   // Return the barrier set associated with "this."
    60   BarrierSet* bs() { return _bs; }
    62   // Set the barrier set.
    63   void set_bs(BarrierSet* bs) { _bs = bs; }
    65   // Do any (sequential) processing necessary to prepare for (possibly
    66   // "parallel", if that arg is true) calls to younger_refs_iterate.
    67   virtual void prepare_for_younger_refs_iterate(bool parallel) = 0;
    69   // Apply the "do_oop" method of "blk" to (exactly) all oop locations
    70   //  1) that are in objects allocated in "g" at the time of the last call
    71   //     to "save_Marks", and
    72   //  2) that point to objects in younger generations.
    73   virtual void younger_refs_iterate(Generation* g, OopsInGenClosure* blk) = 0;
    75   virtual void younger_refs_in_space_iterate(Space* sp,
    76                                              OopsInGenClosure* cl) = 0;
    78   // This method is used to notify the remembered set that "new_val" has
    79   // been written into "field" by the garbage collector.
    80   void write_ref_field_gc(void* field, oop new_val);
    81 protected:
    82   virtual void write_ref_field_gc_work(void* field, oop new_val) = 0;
    83 public:
    85   // A version of the above suitable for use by parallel collectors.
    86   virtual void write_ref_field_gc_par(void* field, oop new_val) = 0;
    88   // Resize one of the regions covered by the remembered set.
    89   virtual void resize_covered_region(MemRegion new_region) = 0;
    91   // If the rem set imposes any alignment restrictions on boundaries
    92   // within the heap, this function tells whether they are met.
    93   virtual bool is_aligned(HeapWord* addr) = 0;
    95   // If the RS (or BS) imposes an aligment constraint on maximum heap size.
    96   // (This must be static, and dispatch on "nm", because it is called
    97   // before an RS is created.)
    98   static uintx max_alignment_constraint(Name nm);
   100   virtual void verify() = 0;
   102   // Verify that the remembered set has no entries for
   103   // the heap interval denoted by mr.  If there are any
   104   // alignment constraints on the remembered set, only the
   105   // part of the region that is aligned is checked.
   106   //
   107   //   alignment boundaries
   108   //   +--------+-------+--------+-------+
   109   //         [ region mr              )
   110   //            [ part checked   )
   111   virtual void verify_aligned_region_empty(MemRegion mr) = 0;
   113   // If appropriate, print some information about the remset on "tty".
   114   virtual void print() {}
   116   // Informs the RS that the given memregion contains no references to
   117   // younger generations.
   118   virtual void clear(MemRegion mr) = 0;
   120   // Informs the RS that there are no references to generations
   121   // younger than gen from generations gen and older.
   122   // The parameter clear_perm indicates if the perm_gen's
   123   // remembered set should also be processed/cleared.
   124   virtual void clear_into_younger(Generation* gen, bool clear_perm) = 0;
   126   // Informs the RS that refs in the given "mr" may have changed
   127   // arbitrarily, and therefore may contain old-to-young pointers.
   128   // If "whole heap" is true, then this invalidation is part of an
   129   // invalidation of the whole heap, which an implementation might
   130   // handle differently than that of a sub-part of the heap.
   131   virtual void invalidate(MemRegion mr, bool whole_heap = false) = 0;
   133   // Informs the RS that refs in this generation
   134   // may have changed arbitrarily, and therefore may contain
   135   // old-to-young pointers in arbitrary locations. The parameter
   136   // younger indicates if the same should be done for younger generations
   137   // as well. The parameter perm indicates if the same should be done for
   138   // perm gen as well.
   139   virtual void invalidate_or_clear(Generation* gen, bool younger, bool perm) = 0;
   140 };
   142 #endif // SHARE_VM_MEMORY_GENREMSET_HPP

mercurial