Merge
This commit is contained in:
commit
39154726de
@ -26,8 +26,14 @@
|
||||
#ifndef _JAVASOFT_JNI_MD_H_
|
||||
#define _JAVASOFT_JNI_MD_H_
|
||||
|
||||
#if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE)
|
||||
#if defined(_WIN32)
|
||||
#define JNIEXPORT __declspec(dllexport)
|
||||
#define JNIIMPORT __declspec(dllimport)
|
||||
#define JNICALL __stdcall
|
||||
|
||||
typedef int jint;
|
||||
typedef __int64 jlong;
|
||||
#else
|
||||
|
||||
// Note: please do not change these without also changing jni_md.h in the JDK
|
||||
// repository
|
||||
@ -50,13 +56,6 @@
|
||||
typedef long long jlong;
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define JNIEXPORT __declspec(dllexport)
|
||||
#define JNIIMPORT __declspec(dllimport)
|
||||
#define JNICALL __stdcall
|
||||
|
||||
typedef int jint;
|
||||
typedef __int64 jlong;
|
||||
#endif
|
||||
|
||||
typedef signed char jbyte;
|
||||
|
@ -158,7 +158,7 @@ void AdaptiveFreeList<Chunk>::verify_stats() const {
|
||||
" coal_deaths(" SIZE_FORMAT ")"
|
||||
" + count(" SSIZE_FORMAT ")",
|
||||
this, size(), _allocation_stats.prev_sweep(), _allocation_stats.split_births(),
|
||||
_allocation_stats.split_births(), _allocation_stats.split_deaths(),
|
||||
_allocation_stats.coal_births(), _allocation_stats.split_deaths(),
|
||||
_allocation_stats.coal_deaths(), count()));
|
||||
}
|
||||
#endif
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "memory/collectorPolicy.hpp"
|
||||
|
||||
class ConcurrentMarkSweepPolicy : public TwoGenerationCollectorPolicy {
|
||||
class ConcurrentMarkSweepPolicy : public GenCollectorPolicy {
|
||||
protected:
|
||||
void initialize_alignments();
|
||||
void initialize_generations();
|
||||
|
@ -1561,7 +1561,7 @@ bool CMSCollector::shouldConcurrentCollect() {
|
||||
// this is not likely to be productive in practice because it's probably too
|
||||
// late anyway.
|
||||
GenCollectedHeap* gch = GenCollectedHeap::heap();
|
||||
assert(gch->collector_policy()->is_two_generation_policy(),
|
||||
assert(gch->collector_policy()->is_generation_policy(),
|
||||
"You may want to check the correctness of the following");
|
||||
if (gch->incremental_collection_will_fail(true /* consult_young */)) {
|
||||
if (Verbose && PrintGCDetails) {
|
||||
@ -1965,7 +1965,7 @@ void CMSCollector::decide_foreground_collection_type(
|
||||
// has exceeded the threshold set by CMSFullGCsBeforeCompaction,
|
||||
// or if an incremental collection has failed
|
||||
GenCollectedHeap* gch = GenCollectedHeap::heap();
|
||||
assert(gch->collector_policy()->is_two_generation_policy(),
|
||||
assert(gch->collector_policy()->is_generation_policy(),
|
||||
"You may want to check the correctness of the following");
|
||||
// Inform cms gen if this was due to partial collection failing.
|
||||
// The CMS gen may use this fact to determine its expansion policy.
|
||||
|
@ -45,7 +45,7 @@ void GenerationSizer::initialize_alignments() {
|
||||
|
||||
void GenerationSizer::initialize_flags() {
|
||||
// Do basic sizing work
|
||||
TwoGenerationCollectorPolicy::initialize_flags();
|
||||
GenCollectorPolicy::initialize_flags();
|
||||
|
||||
assert(UseSerialGC ||
|
||||
!FLAG_IS_DEFAULT(ParallelGCThreads) ||
|
||||
@ -79,7 +79,7 @@ void GenerationSizer::initialize_size_info() {
|
||||
// Redo everything from the start
|
||||
initialize_flags();
|
||||
}
|
||||
TwoGenerationCollectorPolicy::initialize_size_info();
|
||||
GenCollectorPolicy::initialize_size_info();
|
||||
|
||||
trace_gen_sizes("ps heap rnd");
|
||||
}
|
||||
|
@ -28,9 +28,9 @@
|
||||
#include "memory/collectorPolicy.hpp"
|
||||
|
||||
// There is a nice batch of tested generation sizing code in
|
||||
// TwoGenerationCollectorPolicy. Lets reuse it!
|
||||
// GenCollectorPolicy. Lets reuse it!
|
||||
|
||||
class GenerationSizer : public TwoGenerationCollectorPolicy {
|
||||
class GenerationSizer : public GenCollectorPolicy {
|
||||
private:
|
||||
|
||||
void trace_gen_sizes(const char* const str);
|
||||
|
@ -200,6 +200,9 @@ GenCollectorPolicy::GenCollectorPolicy() :
|
||||
_initial_gen0_size(0),
|
||||
_max_gen0_size(0),
|
||||
_gen_alignment(0),
|
||||
_min_gen1_size(0),
|
||||
_initial_gen1_size(0),
|
||||
_max_gen1_size(0),
|
||||
_generations(NULL)
|
||||
{}
|
||||
|
||||
@ -238,10 +241,6 @@ void GenCollectorPolicy::assert_flags() {
|
||||
assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young gen and heap sizes");
|
||||
assert(NewSize % _gen_alignment == 0, "NewSize alignment");
|
||||
assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize % _gen_alignment == 0, "MaxNewSize alignment");
|
||||
}
|
||||
|
||||
void TwoGenerationCollectorPolicy::assert_flags() {
|
||||
GenCollectorPolicy::assert_flags();
|
||||
assert(OldSize + NewSize <= MaxHeapSize, "Ergonomics decided on incompatible generation and heap sizes");
|
||||
assert(OldSize % _gen_alignment == 0, "OldSize alignment");
|
||||
}
|
||||
@ -252,6 +251,7 @@ void GenCollectorPolicy::assert_size_info() {
|
||||
assert(MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young and heap sizes");
|
||||
assert(NewSize == _initial_gen0_size, "Discrepancy between NewSize flag and local storage");
|
||||
assert(MaxNewSize == _max_gen0_size, "Discrepancy between MaxNewSize flag and local storage");
|
||||
assert(OldSize == _initial_gen1_size, "Discrepancy between OldSize flag and local storage");
|
||||
assert(_min_gen0_size <= _initial_gen0_size, "Ergonomics decided on incompatible minimum and initial young gen sizes");
|
||||
assert(_initial_gen0_size <= _max_gen0_size, "Ergonomics decided on incompatible initial and maximum young gen sizes");
|
||||
assert(_min_gen0_size % _gen_alignment == 0, "_min_gen0_size alignment");
|
||||
@ -263,11 +263,6 @@ void GenCollectorPolicy::assert_size_info() {
|
||||
"Ergonomics made initial young generation larger than initial heap");
|
||||
assert(_max_gen0_size <= bound_minus_alignment(_max_gen0_size, _max_heap_byte_size),
|
||||
"Ergonomics made maximum young generation lager than maximum heap");
|
||||
}
|
||||
|
||||
void TwoGenerationCollectorPolicy::assert_size_info() {
|
||||
GenCollectorPolicy::assert_size_info();
|
||||
assert(OldSize == _initial_gen1_size, "Discrepancy between OldSize flag and local storage");
|
||||
assert(_min_gen1_size <= _initial_gen1_size, "Ergonomics decided on incompatible minimum and initial old gen sizes");
|
||||
assert(_initial_gen1_size <= _max_gen1_size, "Ergonomics decided on incompatible initial and maximum old gen sizes");
|
||||
assert(_max_gen1_size % _gen_alignment == 0, "_max_gen1_size alignment");
|
||||
@ -369,12 +364,6 @@ void GenCollectorPolicy::initialize_flags() {
|
||||
vm_exit_during_initialization("Invalid young gen ratio specified");
|
||||
}
|
||||
|
||||
DEBUG_ONLY(GenCollectorPolicy::assert_flags();)
|
||||
}
|
||||
|
||||
void TwoGenerationCollectorPolicy::initialize_flags() {
|
||||
GenCollectorPolicy::initialize_flags();
|
||||
|
||||
if (!is_size_aligned(OldSize, _gen_alignment)) {
|
||||
// Setting OldSize directly to preserve information about the possible
|
||||
// setting of OldSize on the command line.
|
||||
@ -433,7 +422,7 @@ void TwoGenerationCollectorPolicy::initialize_flags() {
|
||||
|
||||
always_do_update_barrier = UseConcMarkSweepGC;
|
||||
|
||||
DEBUG_ONLY(TwoGenerationCollectorPolicy::assert_flags();)
|
||||
DEBUG_ONLY(GenCollectorPolicy::assert_flags();)
|
||||
}
|
||||
|
||||
// Values set on the command line win over any ergonomically
|
||||
@ -445,6 +434,13 @@ void TwoGenerationCollectorPolicy::initialize_flags() {
|
||||
// themselves and with overall heap sizings.
|
||||
// In the absence of explicitly set command line flags, policies
|
||||
// such as the use of NewRatio are used to size the generation.
|
||||
|
||||
// Minimum sizes of the generations may be different than
|
||||
// the initial sizes. An inconsistency is permitted here
|
||||
// in the total size that can be specified explicitly by
|
||||
// command line specification of OldSize and NewSize and
|
||||
// also a command line specification of -Xms. Issue a warning
|
||||
// but allow the values to pass.
|
||||
void GenCollectorPolicy::initialize_size_info() {
|
||||
CollectorPolicy::initialize_size_info();
|
||||
|
||||
@ -520,19 +516,6 @@ void GenCollectorPolicy::initialize_size_info() {
|
||||
_min_gen0_size, _initial_gen0_size, _max_gen0_size);
|
||||
}
|
||||
|
||||
DEBUG_ONLY(GenCollectorPolicy::assert_size_info();)
|
||||
}
|
||||
|
||||
// Minimum sizes of the generations may be different than
|
||||
// the initial sizes. An inconsistency is permitted here
|
||||
// in the total size that can be specified explicitly by
|
||||
// command line specification of OldSize and NewSize and
|
||||
// also a command line specification of -Xms. Issue a warning
|
||||
// but allow the values to pass.
|
||||
|
||||
void TwoGenerationCollectorPolicy::initialize_size_info() {
|
||||
GenCollectorPolicy::initialize_size_info();
|
||||
|
||||
// At this point the minimum, initial and maximum sizes
|
||||
// of the overall heap and of gen0 have been determined.
|
||||
// The maximum gen1 size can be determined from the maximum gen0
|
||||
@ -625,7 +608,7 @@ void TwoGenerationCollectorPolicy::initialize_size_info() {
|
||||
_min_gen1_size, _initial_gen1_size, _max_gen1_size);
|
||||
}
|
||||
|
||||
DEBUG_ONLY(TwoGenerationCollectorPolicy::assert_size_info();)
|
||||
DEBUG_ONLY(GenCollectorPolicy::assert_size_info();)
|
||||
}
|
||||
|
||||
HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size,
|
||||
|
@ -47,7 +47,6 @@
|
||||
|
||||
// Forward declarations.
|
||||
class GenCollectorPolicy;
|
||||
class TwoGenerationCollectorPolicy;
|
||||
class AdaptiveSizePolicy;
|
||||
#if INCLUDE_ALL_GCS
|
||||
class ConcurrentMarkSweepPolicy;
|
||||
@ -114,7 +113,7 @@ class CollectorPolicy : public CHeapObj<mtGC> {
|
||||
|
||||
enum Name {
|
||||
CollectorPolicyKind,
|
||||
TwoGenerationCollectorPolicyKind,
|
||||
GenCollectorPolicyKind,
|
||||
ConcurrentMarkSweepPolicyKind,
|
||||
ASConcurrentMarkSweepPolicyKind,
|
||||
G1CollectorPolicyKind
|
||||
@ -135,7 +134,6 @@ class CollectorPolicy : public CHeapObj<mtGC> {
|
||||
|
||||
// Identification methods.
|
||||
virtual GenCollectorPolicy* as_generation_policy() { return NULL; }
|
||||
virtual TwoGenerationCollectorPolicy* as_two_generation_policy() { return NULL; }
|
||||
virtual MarkSweepPolicy* as_mark_sweep_policy() { return NULL; }
|
||||
#if INCLUDE_ALL_GCS
|
||||
virtual ConcurrentMarkSweepPolicy* as_concurrent_mark_sweep_policy() { return NULL; }
|
||||
@ -143,7 +141,6 @@ class CollectorPolicy : public CHeapObj<mtGC> {
|
||||
#endif // INCLUDE_ALL_GCS
|
||||
// Note that these are not virtual.
|
||||
bool is_generation_policy() { return as_generation_policy() != NULL; }
|
||||
bool is_two_generation_policy() { return as_two_generation_policy() != NULL; }
|
||||
bool is_mark_sweep_policy() { return as_mark_sweep_policy() != NULL; }
|
||||
#if INCLUDE_ALL_GCS
|
||||
bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; }
|
||||
@ -225,6 +222,9 @@ friend class TestGenCollectorPolicy;
|
||||
size_t _min_gen0_size;
|
||||
size_t _initial_gen0_size;
|
||||
size_t _max_gen0_size;
|
||||
size_t _min_gen1_size;
|
||||
size_t _initial_gen1_size;
|
||||
size_t _max_gen1_size;
|
||||
|
||||
// _gen_alignment and _space_alignment will have the same value most of the
|
||||
// time. When using large pages they can differ.
|
||||
@ -264,8 +264,11 @@ friend class TestGenCollectorPolicy;
|
||||
size_t initial_gen0_size() { return _initial_gen0_size; }
|
||||
size_t max_gen0_size() { return _max_gen0_size; }
|
||||
size_t gen_alignment() { return _gen_alignment; }
|
||||
size_t min_gen1_size() { return _min_gen1_size; }
|
||||
size_t initial_gen1_size() { return _initial_gen1_size; }
|
||||
size_t max_gen1_size() { return _max_gen1_size; }
|
||||
|
||||
virtual int number_of_generations() = 0;
|
||||
int number_of_generations() { return 2; }
|
||||
|
||||
virtual GenerationSpec **generations() {
|
||||
assert(_generations != NULL, "Sanity check");
|
||||
@ -297,47 +300,15 @@ friend class TestGenCollectorPolicy;
|
||||
virtual void post_heap_initialize() {
|
||||
assert(_max_gen0_size == MaxNewSize, "Should be taken care of by initialize_size_info");
|
||||
}
|
||||
};
|
||||
|
||||
// All of hotspot's current collectors are subtypes of this
|
||||
// class. Currently, these collectors all use the same gen[0],
|
||||
// but have different gen[1] types. If we add another subtype
|
||||
// of CollectorPolicy, this class should be broken out into
|
||||
// its own file.
|
||||
|
||||
class TwoGenerationCollectorPolicy : public GenCollectorPolicy {
|
||||
protected:
|
||||
size_t _min_gen1_size;
|
||||
size_t _initial_gen1_size;
|
||||
size_t _max_gen1_size;
|
||||
|
||||
void initialize_flags();
|
||||
void initialize_size_info();
|
||||
|
||||
DEBUG_ONLY(void assert_flags();)
|
||||
DEBUG_ONLY(void assert_size_info();)
|
||||
|
||||
public:
|
||||
TwoGenerationCollectorPolicy() : GenCollectorPolicy(), _min_gen1_size(0),
|
||||
_initial_gen1_size(0), _max_gen1_size(0) {}
|
||||
|
||||
// Accessors
|
||||
size_t min_gen1_size() { return _min_gen1_size; }
|
||||
size_t initial_gen1_size() { return _initial_gen1_size; }
|
||||
size_t max_gen1_size() { return _max_gen1_size; }
|
||||
|
||||
// Inherited methods
|
||||
TwoGenerationCollectorPolicy* as_two_generation_policy() { return this; }
|
||||
|
||||
int number_of_generations() { return 2; }
|
||||
BarrierSet::Name barrier_set_name() { return BarrierSet::CardTableModRef; }
|
||||
|
||||
virtual CollectorPolicy::Name kind() {
|
||||
return CollectorPolicy::TwoGenerationCollectorPolicyKind;
|
||||
return CollectorPolicy::GenCollectorPolicyKind;
|
||||
}
|
||||
};
|
||||
|
||||
class MarkSweepPolicy : public TwoGenerationCollectorPolicy {
|
||||
class MarkSweepPolicy : public GenCollectorPolicy {
|
||||
protected:
|
||||
void initialize_alignments();
|
||||
void initialize_generations();
|
||||
|
@ -197,9 +197,8 @@ char* GenCollectedHeap::allocate(size_t alignment,
|
||||
|
||||
void GenCollectedHeap::post_initialize() {
|
||||
SharedHeap::post_initialize();
|
||||
TwoGenerationCollectorPolicy *policy =
|
||||
(TwoGenerationCollectorPolicy *)collector_policy();
|
||||
guarantee(policy->is_two_generation_policy(), "Illegal policy type");
|
||||
GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy();
|
||||
guarantee(policy->is_generation_policy(), "Illegal policy type");
|
||||
DefNewGeneration* def_new_gen = (DefNewGeneration*) get_gen(0);
|
||||
assert(def_new_gen->kind() == Generation::DefNew ||
|
||||
def_new_gen->kind() == Generation::ParNew ||
|
||||
|
@ -453,7 +453,7 @@ public:
|
||||
// Assumes a 2-generation system; the first disjunct remembers if an
|
||||
// incremental collection failed, even when we thought (second disjunct)
|
||||
// that it would not.
|
||||
assert(heap()->collector_policy()->is_two_generation_policy(),
|
||||
assert(heap()->collector_policy()->is_generation_policy(),
|
||||
"the following definition may not be suitable for an n(>2)-generation system");
|
||||
return incremental_collection_failed() ||
|
||||
(consult_young && !get_gen(0)->collection_attempt_is_safe());
|
||||
|
@ -123,12 +123,12 @@ void MemoryService::set_universe_heap(CollectedHeap* heap) {
|
||||
void MemoryService::add_gen_collected_heap_info(GenCollectedHeap* heap) {
|
||||
CollectorPolicy* policy = heap->collector_policy();
|
||||
|
||||
assert(policy->is_two_generation_policy(), "Only support two generations");
|
||||
assert(policy->is_generation_policy(), "Only support two generations");
|
||||
guarantee(heap->n_gens() == 2, "Only support two-generation heap");
|
||||
|
||||
TwoGenerationCollectorPolicy* two_gen_policy = policy->as_two_generation_policy();
|
||||
if (two_gen_policy != NULL) {
|
||||
GenerationSpec** specs = two_gen_policy->generations();
|
||||
GenCollectorPolicy* gen_policy = policy->as_generation_policy();
|
||||
if (gen_policy != NULL) {
|
||||
GenerationSpec** specs = gen_policy->generations();
|
||||
Generation::Name kind = specs[0]->name();
|
||||
switch (kind) {
|
||||
case Generation::DefNew:
|
||||
|
Loading…
x
Reference in New Issue
Block a user