0N/A/*
2171N/A * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef SHARE_VM_MEMORY_BARRIERSET_HPP
1879N/A#define SHARE_VM_MEMORY_BARRIERSET_HPP
1879N/A
1879N/A#include "memory/memRegion.hpp"
1879N/A#include "oops/oopsHierarchy.hpp"
1879N/A
0N/A// This class provides the interface between a barrier implementation and
0N/A// the rest of the system.
0N/A
3863N/Aclass BarrierSet: public CHeapObj<mtGC> {
0N/A friend class VMStructs;
0N/Apublic:
0N/A enum Name {
0N/A ModRef,
0N/A CardTableModRef,
0N/A CardTableExtension,
342N/A G1SATBCT,
342N/A G1SATBCTLogging,
0N/A Other,
0N/A Uninit
0N/A };
0N/A
2171N/A enum Flags {
2171N/A None = 0,
2171N/A TargetUninitialized = 1
2171N/A };
0N/Aprotected:
0N/A int _max_covered_regions;
0N/A Name _kind;
0N/A
0N/Apublic:
0N/A
342N/A BarrierSet() { _kind = Uninit; }
0N/A // To get around prohibition on RTTI.
342N/A BarrierSet::Name kind() { return _kind; }
0N/A virtual bool is_a(BarrierSet::Name bsn) = 0;
0N/A
0N/A // These operations indicate what kind of barriers the BarrierSet has.
0N/A virtual bool has_read_ref_barrier() = 0;
0N/A virtual bool has_read_prim_barrier() = 0;
0N/A virtual bool has_write_ref_barrier() = 0;
342N/A virtual bool has_write_ref_pre_barrier() = 0;
0N/A virtual bool has_write_prim_barrier() = 0;
0N/A
0N/A // These functions indicate whether a particular access of the given
0N/A // kinds requires a barrier.
113N/A virtual bool read_ref_needs_barrier(void* field) = 0;
0N/A virtual bool read_prim_needs_barrier(HeapWord* field, size_t bytes) = 0;
113N/A virtual bool write_ref_needs_barrier(void* field, oop new_val) = 0;
342N/A virtual bool write_prim_needs_barrier(HeapWord* field, size_t bytes,
342N/A juint val1, juint val2) = 0;
0N/A
0N/A // The first four operations provide a direct implementation of the
0N/A // barrier set. An interpreter loop, for example, could call these
0N/A // directly, as appropriate.
0N/A
0N/A // Invoke the barrier, if any, necessary when reading the given ref field.
113N/A virtual void read_ref_field(void* field) = 0;
0N/A
0N/A // Invoke the barrier, if any, necessary when reading the given primitive
0N/A // "field" of "bytes" bytes in "obj".
0N/A virtual void read_prim_field(HeapWord* field, size_t bytes) = 0;
0N/A
0N/A // Invoke the barrier, if any, necessary when writing "new_val" into the
0N/A // ref field at "offset" in "obj".
0N/A // (For efficiency reasons, this operation is specialized for certain
0N/A // barrier types. Semantically, it should be thought of as a call to the
0N/A // virtual "_work" function below, which must implement the barrier.)
342N/A // First the pre-write versions...
845N/A template <class T> inline void write_ref_field_pre(T* field, oop new_val);
845N/Aprivate:
845N/A // Keep this private so as to catch violations at build time.
845N/A virtual void write_ref_field_pre_work( void* field, oop new_val) { guarantee(false, "Not needed"); };
342N/Aprotected:
845N/A virtual void write_ref_field_pre_work( oop* field, oop new_val) {};
845N/A virtual void write_ref_field_pre_work(narrowOop* field, oop new_val) {};
342N/Apublic:
342N/A
342N/A // ...then the post-write version.
113N/A inline void write_ref_field(void* field, oop new_val);
0N/Aprotected:
113N/A virtual void write_ref_field_work(void* field, oop new_val) = 0;
0N/Apublic:
0N/A
0N/A // Invoke the barrier, if any, necessary when writing the "bytes"-byte
0N/A // value(s) "val1" (and "val2") into the primitive "field".
0N/A virtual void write_prim_field(HeapWord* field, size_t bytes,
0N/A juint val1, juint val2) = 0;
0N/A
0N/A // Operations on arrays, or general regions (e.g., for "clone") may be
0N/A // optimized by some barriers.
0N/A
0N/A // The first six operations tell whether such an optimization exists for
0N/A // the particular barrier.
0N/A virtual bool has_read_ref_array_opt() = 0;
0N/A virtual bool has_read_prim_array_opt() = 0;
342N/A virtual bool has_write_ref_array_pre_opt() { return true; }
0N/A virtual bool has_write_ref_array_opt() = 0;
0N/A virtual bool has_write_prim_array_opt() = 0;
0N/A
0N/A virtual bool has_read_region_opt() = 0;
0N/A virtual bool has_write_region_opt() = 0;
0N/A
0N/A // These operations should assert false unless the correponding operation
0N/A // above returns true. Otherwise, they should perform an appropriate
0N/A // barrier for an array whose elements are all in the given memory region.
0N/A virtual void read_ref_array(MemRegion mr) = 0;
0N/A virtual void read_prim_array(MemRegion mr) = 0;
0N/A
1091N/A // Below length is the # array elements being written
2171N/A virtual void write_ref_array_pre(oop* dst, int length,
2171N/A bool dest_uninitialized = false) {}
2171N/A virtual void write_ref_array_pre(narrowOop* dst, int length,
2171N/A bool dest_uninitialized = false) {}
1091N/A // Below count is the # array elements being written, starting
1091N/A // at the address "start", which may not necessarily be HeapWord-aligned
1091N/A inline void write_ref_array(HeapWord* start, size_t count);
342N/A
1091N/A // Static versions, suitable for calling from generated code;
1091N/A // count is # array elements being written, starting with "start",
1091N/A // which may not necessarily be HeapWord-aligned.
342N/A static void static_write_ref_array_pre(HeapWord* start, size_t count);
342N/A static void static_write_ref_array_post(HeapWord* start, size_t count);
342N/A
0N/Aprotected:
0N/A virtual void write_ref_array_work(MemRegion mr) = 0;
0N/Apublic:
0N/A virtual void write_prim_array(MemRegion mr) = 0;
0N/A
0N/A virtual void read_region(MemRegion mr) = 0;
0N/A
0N/A // (For efficiency reasons, this operation is specialized for certain
0N/A // barrier types. Semantically, it should be thought of as a call to the
0N/A // virtual "_work" function below, which must implement the barrier.)
0N/A inline void write_region(MemRegion mr);
0N/Aprotected:
0N/A virtual void write_region_work(MemRegion mr) = 0;
0N/Apublic:
0N/A
0N/A // Some barrier sets create tables whose elements correspond to parts of
0N/A // the heap; the CardTableModRefBS is an example. Such barrier sets will
0N/A // normally reserve space for such tables, and commit parts of the table
0N/A // "covering" parts of the heap that are committed. The constructor is
0N/A // passed the maximum number of independently committable subregions to
0N/A // be covered, and the "resize_covoered_region" function allows the
0N/A // sub-parts of the heap to inform the barrier set of changes of their
0N/A // sizes.
0N/A BarrierSet(int max_covered_regions) :
0N/A _max_covered_regions(max_covered_regions) {}
0N/A
0N/A // Inform the BarrierSet that the the covered heap region that starts
0N/A // with "base" has been changed to have the given size (possibly from 0,
0N/A // for initialization.)
0N/A virtual void resize_covered_region(MemRegion new_region) = 0;
0N/A
0N/A // If the barrier set imposes any alignment restrictions on boundaries
0N/A // within the heap, this function tells whether they are met.
0N/A virtual bool is_aligned(HeapWord* addr) = 0; Error!

 

There was an error!

null

java.lang.NullPointerException