--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp Fri Mar 14 10:15:46 2014 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp Mon Mar 17 10:12:21 2014 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONREMSET_HPP
#define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONREMSET_HPP
+#include "gc_implementation/g1/g1CodeCacheRemSet.hpp"
#include "gc_implementation/g1/sparsePRT.hpp"
// Remembered set for a heap region. Represent a set of "cards" that
@@ -72,7 +73,7 @@
friend class HeapRegionRemSetIterator;
G1CollectedHeap* _g1h;
- Mutex _m;
+ Mutex* _m;
HeapRegion* _hr;
// These are protected by "_m".
@@ -129,7 +130,7 @@
void unlink_from_all(PerRegionTable * prt);
public:
- OtherRegionsTable(HeapRegion* hr);
+ OtherRegionsTable(HeapRegion* hr, Mutex* m);
HeapRegion* hr() const { return _hr; }
@@ -141,7 +142,6 @@
// objects.
void scrub(CardTableModRefBS* ctbs, BitMap* region_bm, BitMap* card_bm);
- // Not const because it takes a lock.
size_t occupied() const;
size_t occ_fine() const;
size_t occ_coarse() const;
@@ -192,9 +192,11 @@
G1BlockOffsetSharedArray* _bosa;
G1BlockOffsetSharedArray* bosa() const { return _bosa; }
- // A list of code blobs (nmethods) whose code contains pointers into
+ // A set of code blobs (nmethods) whose code contains pointers into
// the region that owns this RSet.
- GrowableArray<nmethod*>* _strong_code_roots_list;
+ G1CodeRootSet _code_roots;
+
+ Mutex _m;
OtherRegionsTable _other_regions;
@@ -218,8 +220,7 @@
static void print_event(outputStream* str, Event evnt);
public:
- HeapRegionRemSet(G1BlockOffsetSharedArray* bosa,
- HeapRegion* hr);
+ HeapRegionRemSet(G1BlockOffsetSharedArray* bosa, HeapRegion* hr);
static int num_par_rem_sets();
static void setup_remset_size();
@@ -228,7 +229,11 @@
return _other_regions.hr();
}
- size_t occupied() const {
+ size_t occupied() {
+ MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
+ return occupied_locked();
+ }
+ size_t occupied_locked() {
return _other_regions.occupied();
}
size_t occ_fine() const {
@@ -260,6 +265,7 @@
// The region is being reclaimed; clear its remset, and any mention of
// entries for this region in other remsets.
void clear();
+ void clear_locked();
// Attempt to claim the region. Returns true iff this call caused an
// atomic transition from Unclaimed to Claimed.
@@ -289,6 +295,7 @@
// The actual # of bytes this hr_remset takes up.
// Note also includes the strong code root set.
size_t mem_size() {
+ MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
return _other_regions.mem_size()
// This correction is necessary because the above includes the second
// part.
@@ -299,13 +306,13 @@
// Returns the memory occupancy of all static data structures associated
// with remembered sets.
static size_t static_mem_size() {
- return OtherRegionsTable::static_mem_size();
+ return OtherRegionsTable::static_mem_size() + G1CodeRootSet::static_mem_size();
}
// Returns the memory occupancy of all free_list data structures associated
// with remembered sets.
static size_t fl_mem_size() {
- return OtherRegionsTable::fl_mem_size();
+ return OtherRegionsTable::fl_mem_size() + G1CodeRootSet::fl_mem_size();
}
bool contains_reference(OopOrNarrowOopStar from) const {
@@ -328,21 +335,21 @@
void strong_code_roots_do(CodeBlobClosure* blk) const;
// Returns the number of elements in the strong code roots list
- int strong_code_roots_list_length() {
- return _strong_code_roots_list->length();
+ size_t strong_code_roots_list_length() {
+ return _code_roots.length();
}
// Returns true if the strong code roots contains the given
// nmethod.
bool strong_code_roots_list_contains(nmethod* nm) {
- return _strong_code_roots_list->contains(nm);
+ return _code_roots.contains(nm);
}
// Returns the amount of memory, in bytes, currently
// consumed by the strong code roots.
size_t strong_code_roots_mem_size();
- void print() const;
+ void print() PRODUCT_RETURN;
// Called during a stop-world phase to perform any deferred cleanups.
static void cleanup();
@@ -350,6 +357,7 @@
// Declare the heap size (in # of regions) to the HeapRegionRemSet(s).
// (Uses it to initialize from_card_cache).
static void init_heap(uint max_regions) {
+ G1CodeRootSet::initialize();
OtherRegionsTable::init_from_card_cache((size_t) max_regions);
}
@@ -384,7 +392,7 @@
class HeapRegionRemSetIterator : public StackObj {
// The region RSet over which we're iterating.
- const HeapRegionRemSet* _hrrs;
+ HeapRegionRemSet* _hrrs;
// Local caching of HRRS fields.
const BitMap* _coarse_map;
@@ -441,7 +449,7 @@
public:
// We require an iterator to be initialized before use, so the
// constructor does little.
- HeapRegionRemSetIterator(const HeapRegionRemSet* hrrs);
+ HeapRegionRemSetIterator(HeapRegionRemSet* hrrs);
// If there remains one or more cards to be yielded, returns true and
// sets "card_index" to one of those cards (which is then considered