< prev index next >
src/share/vm/gc_implementation/shared/vmGCOperations.hpp
Print this page
rev 7474 : imported patch cleanup
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -36,23 +36,25 @@
// a set of operations (VM_Operation) related to GC.
//
// VM_Operation
// VM_GC_Operation
// VM_GC_HeapInspection
-// VM_GenCollectForAllocation
// VM_GenCollectFull
// VM_GenCollectFullConcurrent
-// VM_ParallelGCFailedAllocation
// VM_ParallelGCSystemGC
+// VM_CollectForAllocation
+// VM_GenCollectForAllocation
+// VM_ParallelGCFailedAllocation
// VM_GC_Operation
// - implements methods common to all classes in the hierarchy:
// prevents multiple gc requests and manages lock on heap;
//
// VM_GC_HeapInspection
// - prints class histogram on SIGBREAK if PrintClassHistogram
// is specified; and also the attach "inspectheap" operation
//
+// VM_CollectForAllocation
// VM_GenCollectForAllocation
// VM_ParallelGCFailedAllocation
// - this operation is invoked when allocation is failed;
// operation performs garbage collection and tries to
// allocate afterwards;
@@ -65,12 +67,12 @@
//
class VM_GC_Operation: public VM_Operation {
protected:
BasicLock _pending_list_basic_lock; // for refs pending list notification (PLL)
- unsigned int _gc_count_before; // gc count before acquiring PLL
- unsigned int _full_gc_count_before; // full gc count before acquiring PLL
+ uint _gc_count_before; // gc count before acquiring PLL
+ uint _full_gc_count_before; // full gc count before acquiring PLL
bool _full; // whether a "full" collection
bool _prologue_succeeded; // whether doit_prologue succeeded
GCCause::Cause _gc_cause; // the putative cause for this gc op
bool _gc_locked; // will be set if gc was locked
@@ -79,13 +81,13 @@
// java.lang.ref.Reference support
void acquire_pending_list_lock();
void release_and_notify_pending_list_lock();
public:
- VM_GC_Operation(unsigned int gc_count_before,
+ VM_GC_Operation(uint gc_count_before,
GCCause::Cause _cause,
- unsigned int full_gc_count_before = 0,
+ uint full_gc_count_before = 0,
bool full = false) {
_full = full;
_prologue_succeeded = false;
_gc_count_before = gc_count_before;
@@ -158,40 +160,45 @@
void set_columns(const char* value) {_columns = value;}
protected:
bool collect();
};
+class VM_CollectForAllocation : public VM_GC_Operation {
+ protected:
+ size_t _word_size; // Size of object to be allocated (in number of words)
+ HeapWord* _result; // Allocation result (NULL if allocation failed)
+
+ public:
+ VM_CollectForAllocation(size_t word_size, uint gc_count_before, GCCause::Cause cause);
+
+ HeapWord* result() const {
+ return _result;
+ }
+};
-class VM_GenCollectForAllocation: public VM_GC_Operation {
+class VM_GenCollectForAllocation : public VM_CollectForAllocation {
private:
- HeapWord* _res;
- size_t _size; // size of object to be allocated.
bool _tlab; // alloc is of a tlab.
public:
VM_GenCollectForAllocation(size_t size,
bool tlab,
- unsigned int gc_count_before)
- : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure),
- _size(size),
- _tlab(tlab) {
- _res = NULL;
- }
+ uint gc_count_before)
+ : VM_CollectForAllocation(size, gc_count_before, GCCause::_allocation_failure),
+ _tlab(tlab) {}
~VM_GenCollectForAllocation() {}
virtual VMOp_Type type() const { return VMOp_GenCollectForAllocation; }
virtual void doit();
- HeapWord* result() const { return _res; }
};
-
// VM operation to invoke a collection of the heap as a
// GenCollectedHeap heap.
class VM_GenCollectFull: public VM_GC_Operation {
private:
int _max_level;
public:
- VM_GenCollectFull(unsigned int gc_count_before,
- unsigned int full_gc_count_before,
+ VM_GenCollectFull(uint gc_count_before,
+ uint full_gc_count_before,
GCCause::Cause gc_cause,
int max_level)
: VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */),
_max_level(max_level) { }
~VM_GenCollectFull() {}
@@ -206,12 +213,12 @@
Metaspace::MetadataType _mdtype;
ClassLoaderData* _loader_data;
public:
VM_CollectForMetadataAllocation(ClassLoaderData* loader_data,
size_t size, Metaspace::MetadataType mdtype,
- unsigned int gc_count_before,
- unsigned int full_gc_count_before,
+ uint gc_count_before,
+ uint full_gc_count_before,
GCCause::Cause gc_cause)
: VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true),
_loader_data(loader_data), _size(size), _mdtype(mdtype), _result(NULL) {
}
virtual VMOp_Type type() const { return VMOp_CollectForMetadataAllocation; }
< prev index next >