7023069: G1: Introduce symmetric locking in the slow allocation path

7023151: G1: refactor the code that operates on _cur_alloc_region to be re-used for allocs by the GC threads
7018286: G1: humongous allocation attempts should take the GC locker into account

First, this change replaces the asymmetric locking scheme in the G1 slow alloc path by a summetric one. Second, it factors out the code that operates on _cur_alloc_region so that it can be re-used for allocations by the GC threads in the future.

Reviewed-by: stefank, brutisso, johnc
This commit is contained in:
Antonios Printezis 2011-03-30 10:26:59 -04:00
parent 349d820dd1
commit 3e9fe24ddd
11 changed files with 920 additions and 747 deletions

View file

@ -149,6 +149,13 @@ class G1OffsetTableContigSpace: public ContiguousSpace {
G1BlockOffsetArrayContigSpace _offsets;
Mutex _par_alloc_lock;
volatile unsigned _gc_time_stamp;
// When we need to retire an allocation region, while other threads
// are also concurrently trying to allocate into it, we typically
// allocate a dummy object at the end of the region to ensure that
// no more allocations can take place in it. However, sometimes we
// want to know where the end of the last "real" object we allocated
// into the region was and this is what this keeps track.
HeapWord* _pre_dummy_top;
public:
// Constructor. If "is_zeroed" is true, the MemRegion "mr" may be
@ -163,6 +170,17 @@ class G1OffsetTableContigSpace: public ContiguousSpace {
virtual void set_saved_mark();
void reset_gc_time_stamp() { _gc_time_stamp = 0; }
// See the comment above in the declaration of _pre_dummy_top for an
// explanation of what it is.
void set_pre_dummy_top(HeapWord* pre_dummy_top) {
assert(is_in(pre_dummy_top) && pre_dummy_top <= top(), "pre-condition");
_pre_dummy_top = pre_dummy_top;
}
HeapWord* pre_dummy_top() {
return (_pre_dummy_top == NULL) ? top() : _pre_dummy_top;
}
void reset_pre_dummy_top() { _pre_dummy_top = NULL; }
virtual void initialize(MemRegion mr, bool clear_space, bool mangle_space);
virtual void clear(bool mangle_space);