2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2019-01-10 15:13:51 -05:00
|
|
|
* Copyright (c) 2001, 2019, 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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#ifndef SHARE_GC_PARALLEL_IMMUTABLESPACE_HPP
|
|
|
|
#define SHARE_GC_PARALLEL_IMMUTABLESPACE_HPP
|
2010-11-23 13:22:55 -08:00
|
|
|
|
|
|
|
#include "memory/iterator.hpp"
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// An ImmutableSpace is a viewport into a contiguous range
|
|
|
|
// (or subrange) of previously allocated objects.
|
|
|
|
|
|
|
|
// Invariant: bottom() and end() are on page_size boundaries and
|
|
|
|
// bottom() <= end()
|
|
|
|
|
2012-06-28 17:03:16 -04:00
|
|
|
class ImmutableSpace: public CHeapObj<mtGC> {
|
2007-12-01 00:00:00 +00:00
|
|
|
friend class VMStructs;
|
|
|
|
protected:
|
|
|
|
HeapWord* _bottom;
|
|
|
|
HeapWord* _end;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ImmutableSpace() { _bottom = NULL; _end = NULL; }
|
|
|
|
HeapWord* bottom() const { return _bottom; }
|
|
|
|
HeapWord* end() const { return _end; }
|
|
|
|
|
|
|
|
MemRegion region() const { return MemRegion(bottom(), end()); }
|
|
|
|
|
|
|
|
// Initialization
|
|
|
|
void initialize(MemRegion mr);
|
|
|
|
|
|
|
|
bool contains(const void* p) const { return _bottom <= p && p < _end; }
|
|
|
|
|
|
|
|
// Size computations. Sizes are in bytes.
|
|
|
|
size_t capacity_in_bytes() const { return capacity_in_words() * HeapWordSize; }
|
|
|
|
|
|
|
|
// Size computations. Sizes are in heapwords.
|
2008-09-27 00:33:13 -07:00
|
|
|
size_t capacity_in_words() const { return pointer_delta(end(), bottom()); }
|
|
|
|
virtual size_t capacity_in_words(Thread*) const { return capacity_in_words(); }
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Iteration.
|
2018-05-26 06:59:49 +02:00
|
|
|
virtual void oop_iterate(OopIterateClosure* cl);
|
2007-12-01 00:00:00 +00:00
|
|
|
virtual void object_iterate(ObjectClosure* cl);
|
|
|
|
|
|
|
|
// Debugging
|
|
|
|
virtual void print() const PRODUCT_RETURN;
|
|
|
|
virtual void print_short() const PRODUCT_RETURN;
|
2012-04-16 08:57:18 +02:00
|
|
|
virtual void verify();
|
2007-12-01 00:00:00 +00:00
|
|
|
};
|
2010-11-23 13:22:55 -08:00
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#endif // SHARE_GC_PARALLEL_IMMUTABLESPACE_HPP
|