/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*
* 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.
*
*/
#include "memory/heapInspection.hpp"
#include "runtime/handles.hpp"
#include "runtime/jniHandles.hpp"
#include "runtime/synchronizer.hpp"
#include "runtime/vm_operations.hpp"
#include "prims/jvmtiExport.hpp"
// The following class hierarchy represents
// 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_ParallelGCFailedPermanentAllocation
// VM_ParallelGCSystemGC
// 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_GenCollectForAllocation
// VM_GenCollectForPermanentAllocation
// VM_ParallelGCFailedAllocation
// VM_ParallelGCFailedPermanentAllocation
// - this operation is invoked when allocation is failed;
// operation performs garbage collection and tries to
// allocate afterwards;
//
// VM_GenCollectFull
// VM_GenCollectFullConcurrent
// VM_ParallelGCSystemGC
// - these operations preform full collection of heaps of
// different kind
//
protected:
virtual bool skip_operation() const;
// java.lang.ref.Reference support
void acquire_pending_list_lock();
public:
unsigned int full_gc_count_before = 0,
bool full = false) {
_prologue_succeeded = false;
// A subclass constructor will likely overwrite the following
_gc_locked = false;
// In ParallelScavengeHeap::mem_allocate() collections can be
// executed within a loop and _all_soft_refs_clear can be set
// true after they have been cleared by a collection and another
// collection started so that _all_soft_refs_clear can be true
// when this collection is started. Don't assert that
// _all_soft_refs_clear have to be false here even though
// mutators have run. Soft refs will be cleared again in this
// collection.
}
~VM_GC_Operation() {
}
// Acquire the reference synchronization lock
virtual bool doit_prologue();
// Do notifyAll (if needed) and release held lock
virtual void doit_epilogue();
virtual bool allow_nested_vm_operations() const { return true; }
static void notify_gc_begin(bool full = false);
static void notify_gc_end();
};
private:
bool _full_gc;
bool _need_prologue;
public:
bool need_prologue) :
VM_GC_Operation(0 /* total collections, dummy, ignored */,
0 /* total full collections, dummy, ignored */,
}
~VM_GC_HeapInspection() {}
virtual bool skip_operation() const;
virtual bool doit_prologue();
virtual void doit();
protected:
bool collect();
};
private:
public:
bool tlab,
unsigned int gc_count_before)
}
virtual void doit();
};
// VM operation to invoke a collection of the heap as a
// GenCollectedHeap heap.
private:
int _max_level;
public:
unsigned int full_gc_count_before,
int max_level)
_max_level(max_level) { }
~VM_GenCollectFull() {}
virtual void doit();
};
private:
public:
unsigned int gc_count_before,
unsigned int full_gc_count_before,
}
virtual void doit();
};
private:
public:
}
~SvcGCMarker() {
}
};
#endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_VMGCOPERATIONS_HPP