2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2013-12-24 11:48:39 -08:00
|
|
|
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-11-23 13:22:55 -08:00
|
|
|
#ifndef SHARE_VM_MEMORY_GENREMSET_HPP
|
|
|
|
#define SHARE_VM_MEMORY_GENREMSET_HPP
|
|
|
|
|
|
|
|
#include "oops/oop.hpp"
|
|
|
|
|
2014-01-23 14:47:23 +01:00
|
|
|
// A GenRemSet provides ways of iterating over pointers across generations.
|
2007-12-01 00:00:00 +00:00
|
|
|
// (This is especially useful for older-to-younger.)
|
|
|
|
|
|
|
|
class Generation;
|
|
|
|
class BarrierSet;
|
|
|
|
class OopsInGenClosure;
|
|
|
|
class CardTableRS;
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// Helper to remember modified oops in all klasses.
|
|
|
|
class KlassRemSet {
|
|
|
|
bool _accumulate_modified_oops;
|
|
|
|
public:
|
|
|
|
KlassRemSet() : _accumulate_modified_oops(false) {}
|
|
|
|
void set_accumulate_modified_oops(bool value) { _accumulate_modified_oops = value; }
|
|
|
|
bool accumulate_modified_oops() { return _accumulate_modified_oops; }
|
|
|
|
bool mod_union_is_clear();
|
|
|
|
void clear_mod_union();
|
|
|
|
};
|
|
|
|
|
2012-06-28 17:03:16 -04:00
|
|
|
class GenRemSet: public CHeapObj<mtGC> {
|
2007-12-01 00:00:00 +00:00
|
|
|
friend class Generation;
|
|
|
|
|
|
|
|
BarrierSet* _bs;
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
KlassRemSet _klass_rem_set;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
GenRemSet(BarrierSet * bs) : _bs(bs) {}
|
2008-06-05 15:57:56 -07:00
|
|
|
GenRemSet() : _bs(NULL) {}
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// These are for dynamic downcasts. Unfortunately that it names the
|
|
|
|
// possible subtypes (but not that they are subtypes!) Return NULL if
|
2014-01-23 14:47:23 +01:00
|
|
|
// the cast is invalid.
|
2007-12-01 00:00:00 +00:00
|
|
|
virtual CardTableRS* as_CardTableRS() { return NULL; }
|
|
|
|
|
|
|
|
// Return the barrier set associated with "this."
|
|
|
|
BarrierSet* bs() { return _bs; }
|
|
|
|
|
2008-06-05 15:57:56 -07:00
|
|
|
// Set the barrier set.
|
|
|
|
void set_bs(BarrierSet* bs) { _bs = bs; }
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
KlassRemSet* klass_rem_set() { return &_klass_rem_set; }
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// Do any (sequential) processing necessary to prepare for (possibly
|
|
|
|
// "parallel", if that arg is true) calls to younger_refs_iterate.
|
|
|
|
virtual void prepare_for_younger_refs_iterate(bool parallel) = 0;
|
|
|
|
|
|
|
|
// Apply the "do_oop" method of "blk" to (exactly) all oop locations
|
|
|
|
// 1) that are in objects allocated in "g" at the time of the last call
|
|
|
|
// to "save_Marks", and
|
|
|
|
// 2) that point to objects in younger generations.
|
|
|
|
virtual void younger_refs_iterate(Generation* g, OopsInGenClosure* blk) = 0;
|
|
|
|
|
|
|
|
virtual void younger_refs_in_space_iterate(Space* sp,
|
|
|
|
OopsInGenClosure* cl) = 0;
|
|
|
|
|
|
|
|
// This method is used to notify the remembered set that "new_val" has
|
|
|
|
// been written into "field" by the garbage collector.
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
void write_ref_field_gc(void* field, oop new_val);
|
2007-12-01 00:00:00 +00:00
|
|
|
protected:
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
virtual void write_ref_field_gc_work(void* field, oop new_val) = 0;
|
2007-12-01 00:00:00 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
// A version of the above suitable for use by parallel collectors.
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
virtual void write_ref_field_gc_par(void* field, oop new_val) = 0;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Resize one of the regions covered by the remembered set.
|
|
|
|
virtual void resize_covered_region(MemRegion new_region) = 0;
|
|
|
|
|
|
|
|
// If the rem set imposes any alignment restrictions on boundaries
|
|
|
|
// within the heap, this function tells whether they are met.
|
|
|
|
virtual bool is_aligned(HeapWord* addr) = 0;
|
|
|
|
|
2014-01-20 17:15:55 +01:00
|
|
|
// Returns any alignment constraint that the remembered set imposes upon the
|
|
|
|
// heap.
|
|
|
|
static uintx max_alignment_constraint();
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
virtual void verify() = 0;
|
|
|
|
|
|
|
|
// If appropriate, print some information about the remset on "tty".
|
|
|
|
virtual void print() {}
|
|
|
|
|
|
|
|
// Informs the RS that the given memregion contains no references to
|
|
|
|
// younger generations.
|
|
|
|
virtual void clear(MemRegion mr) = 0;
|
|
|
|
|
|
|
|
// Informs the RS that there are no references to generations
|
|
|
|
// younger than gen from generations gen and older.
|
|
|
|
// The parameter clear_perm indicates if the perm_gen's
|
|
|
|
// remembered set should also be processed/cleared.
|
2013-08-15 10:05:50 +02:00
|
|
|
virtual void clear_into_younger(Generation* old_gen) = 0;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Informs the RS that refs in the given "mr" may have changed
|
|
|
|
// arbitrarily, and therefore may contain old-to-young pointers.
|
2008-06-05 15:57:56 -07:00
|
|
|
// If "whole heap" is true, then this invalidation is part of an
|
|
|
|
// invalidation of the whole heap, which an implementation might
|
|
|
|
// handle differently than that of a sub-part of the heap.
|
|
|
|
virtual void invalidate(MemRegion mr, bool whole_heap = false) = 0;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Informs the RS that refs in this generation
|
|
|
|
// may have changed arbitrarily, and therefore may contain
|
2013-08-14 09:02:32 +02:00
|
|
|
// old-to-young pointers in arbitrary locations.
|
2013-08-15 10:05:50 +02:00
|
|
|
virtual void invalidate_or_clear(Generation* old_gen) = 0;
|
2007-12-01 00:00:00 +00:00
|
|
|
};
|
2010-11-23 13:22:55 -08:00
|
|
|
|
|
|
|
#endif // SHARE_VM_MEMORY_GENREMSET_HPP
|