Merge
This commit is contained in:
commit
8327c8c62e
@ -318,12 +318,18 @@ static bool setImageAndSymbolPath(JNIEnv* env, jobject obj) {
|
||||
|
||||
path = (jstring) env->GetStaticObjectField(clazz, imagePath_ID);
|
||||
CHECK_EXCEPTION_(false);
|
||||
if (path == NULL) {
|
||||
THROW_NEW_DEBUGGER_EXCEPTION_("Windbg Error: not able to get imagePath field ID!", false);
|
||||
}
|
||||
buf = env->GetStringUTFChars(path, &isCopy);
|
||||
CHECK_EXCEPTION_(false);
|
||||
AutoJavaString imagePath(env, path, buf);
|
||||
|
||||
path = (jstring) env->GetStaticObjectField(clazz, symbolPath_ID);
|
||||
CHECK_EXCEPTION_(false);
|
||||
if (path == NULL) {
|
||||
THROW_NEW_DEBUGGER_EXCEPTION_("Windbg Error: not able to get symbolPath field ID!", false);
|
||||
}
|
||||
buf = env->GetStringUTFChars(path, &isCopy);
|
||||
CHECK_EXCEPTION_(false);
|
||||
AutoJavaString symbolPath(env, path, buf);
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
// Copyright (c) 1997, 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
|
||||
@ -969,23 +969,22 @@ OperandForm *ArchDesc::constructOperand(const char *ident,
|
||||
void ArchDesc::initBaseOpTypes() {
|
||||
// Create OperandForm and assign type for each opcode.
|
||||
for (int i = 1; i < _last_machine_leaf; ++i) {
|
||||
char *ident = (char *)NodeClassNames[i];
|
||||
char *ident = (char *)NodeClassNames[i];
|
||||
constructOperand(ident, true);
|
||||
}
|
||||
// Create InstructForm and assign type for each ideal instruction.
|
||||
for ( int j = _last_machine_leaf+1; j < _last_opcode; ++j) {
|
||||
char *ident = (char *)NodeClassNames[j];
|
||||
if(!strcmp(ident, "ConI") || !strcmp(ident, "ConP") ||
|
||||
!strcmp(ident, "ConN") || !strcmp(ident, "ConNKlass") ||
|
||||
!strcmp(ident, "ConF") || !strcmp(ident, "ConD") ||
|
||||
!strcmp(ident, "ConL") || !strcmp(ident, "Con" ) ||
|
||||
!strcmp(ident, "Bool") ) {
|
||||
for (int j = _last_machine_leaf+1; j < _last_opcode; ++j) {
|
||||
char *ident = (char *)NodeClassNames[j];
|
||||
if (!strcmp(ident, "ConI") || !strcmp(ident, "ConP") ||
|
||||
!strcmp(ident, "ConN") || !strcmp(ident, "ConNKlass") ||
|
||||
!strcmp(ident, "ConF") || !strcmp(ident, "ConD") ||
|
||||
!strcmp(ident, "ConL") || !strcmp(ident, "Con" ) ||
|
||||
!strcmp(ident, "Bool")) {
|
||||
constructOperand(ident, true);
|
||||
}
|
||||
else {
|
||||
InstructForm *insForm = new InstructForm(ident, true);
|
||||
// insForm->_opcode = nextUserOpType(ident);
|
||||
_globalNames.Insert(ident,insForm);
|
||||
} else {
|
||||
InstructForm *insForm = new InstructForm(ident, true);
|
||||
// insForm->_opcode = nextUserOpType(ident);
|
||||
_globalNames.Insert(ident, insForm);
|
||||
addForm(insForm);
|
||||
}
|
||||
}
|
||||
@ -1038,6 +1037,9 @@ void ArchDesc::initBaseOpTypes() {
|
||||
ident = "TEMP";
|
||||
eForm = new Effect(ident);
|
||||
_globalNames.Insert(ident, eForm);
|
||||
ident = "TEMP_DEF";
|
||||
eForm = new Effect(ident);
|
||||
_globalNames.Insert(ident, eForm);
|
||||
ident = "CALL";
|
||||
eForm = new Effect(ident);
|
||||
_globalNames.Insert(ident, eForm);
|
||||
@ -1050,8 +1052,8 @@ void ArchDesc::initBaseOpTypes() {
|
||||
const char *idealName = NodeClassNames[idealIndex];
|
||||
_idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
|
||||
}
|
||||
for ( idealIndex = _last_machine_leaf+1;
|
||||
idealIndex < _last_opcode; ++idealIndex) {
|
||||
for (idealIndex = _last_machine_leaf+1;
|
||||
idealIndex < _last_opcode; ++idealIndex) {
|
||||
const char *idealName = NodeClassNames[idealIndex];
|
||||
_idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
|
||||
}
|
||||
|
@ -1816,15 +1816,16 @@ void InsEncode::output(FILE *fp) {
|
||||
|
||||
//------------------------------Effect-----------------------------------------
|
||||
static int effect_lookup(const char *name) {
|
||||
if(!strcmp(name, "USE")) return Component::USE;
|
||||
if(!strcmp(name, "DEF")) return Component::DEF;
|
||||
if(!strcmp(name, "USE_DEF")) return Component::USE_DEF;
|
||||
if(!strcmp(name, "KILL")) return Component::KILL;
|
||||
if(!strcmp(name, "USE_KILL")) return Component::USE_KILL;
|
||||
if(!strcmp(name, "TEMP")) return Component::TEMP;
|
||||
if(!strcmp(name, "INVALID")) return Component::INVALID;
|
||||
if(!strcmp(name, "CALL")) return Component::CALL;
|
||||
assert( false,"Invalid effect name specified\n");
|
||||
if (!strcmp(name, "USE")) return Component::USE;
|
||||
if (!strcmp(name, "DEF")) return Component::DEF;
|
||||
if (!strcmp(name, "USE_DEF")) return Component::USE_DEF;
|
||||
if (!strcmp(name, "KILL")) return Component::KILL;
|
||||
if (!strcmp(name, "USE_KILL")) return Component::USE_KILL;
|
||||
if (!strcmp(name, "TEMP")) return Component::TEMP;
|
||||
if (!strcmp(name, "TEMP_DEF")) return Component::TEMP_DEF;
|
||||
if (!strcmp(name, "INVALID")) return Component::INVALID;
|
||||
if (!strcmp(name, "CALL")) return Component::CALL;
|
||||
assert(false,"Invalid effect name specified\n");
|
||||
return Component::INVALID;
|
||||
}
|
||||
|
||||
@ -1836,6 +1837,7 @@ const char *Component::getUsedefName() {
|
||||
case Component::USE_KILL: return "USE_KILL"; break;
|
||||
case Component::KILL: return "KILL"; break;
|
||||
case Component::TEMP: return "TEMP"; break;
|
||||
case Component::TEMP_DEF: return "TEMP_DEF"; break;
|
||||
case Component::DEF: return "DEF"; break;
|
||||
case Component::CALL: return "CALL"; break;
|
||||
default: assert(false, "unknown effect");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -910,13 +910,16 @@ public:
|
||||
public:
|
||||
// Implementation depends upon working bit intersection and union.
|
||||
enum use_def_enum {
|
||||
INVALID = 0x0,
|
||||
USE = 0x1,
|
||||
DEF = 0x2, USE_DEF = 0x3,
|
||||
KILL = 0x4, USE_KILL = 0x5,
|
||||
INVALID = 0x0,
|
||||
USE = 0x1,
|
||||
DEF = 0x2,
|
||||
USE_DEF = USE | DEF,
|
||||
KILL = 0x4,
|
||||
USE_KILL = USE | KILL,
|
||||
SYNTHETIC = 0x8,
|
||||
TEMP = USE | SYNTHETIC,
|
||||
CALL = 0x10
|
||||
TEMP = USE | SYNTHETIC,
|
||||
TEMP_DEF = TEMP | DEF,
|
||||
CALL = 0x10
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -1715,13 +1715,14 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) {
|
||||
bool declared_def = false;
|
||||
bool declared_kill = false;
|
||||
|
||||
while( (comp = node->_components.iter()) != NULL ) {
|
||||
while ((comp = node->_components.iter()) != NULL) {
|
||||
// Lookup register class associated with operand type
|
||||
Form *form = (Form*)_globalNames[comp->_type];
|
||||
assert( form, "component type must be a defined form");
|
||||
OperandForm *op = form->is_operand();
|
||||
Form *form = (Form*)_globalNames[comp->_type];
|
||||
assert(form, "component type must be a defined form");
|
||||
OperandForm *op = form->is_operand();
|
||||
|
||||
if (comp->is(Component::TEMP)) {
|
||||
if (comp->is(Component::TEMP) ||
|
||||
comp->is(Component::TEMP_DEF)) {
|
||||
fprintf(fp, " // TEMP %s\n", comp->_name);
|
||||
if (!declared_def) {
|
||||
// Define the variable "def" to hold new MachProjNodes
|
||||
@ -1750,7 +1751,7 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) {
|
||||
declared_kill = true;
|
||||
}
|
||||
|
||||
assert( op, "Support additional KILLS for base operands");
|
||||
assert(op, "Support additional KILLS for base operands");
|
||||
const char *regmask = reg_mask(*op);
|
||||
const char *ideal_type = op->ideal_type(_globalNames, _register);
|
||||
|
||||
|
@ -636,6 +636,7 @@ void java_lang_Class::create_mirror(KlassHandle k, Handle class_loader,
|
||||
}
|
||||
|
||||
// set the classLoader field in the java_lang_Class instance
|
||||
assert(class_loader() == k->class_loader(), "should be same");
|
||||
set_class_loader(mirror(), class_loader());
|
||||
|
||||
// Setup indirection from klass->mirror last
|
||||
|
@ -496,77 +496,65 @@ void SymbolTable::dump(outputStream* st) {
|
||||
void SymbolTable::print_histogram() {
|
||||
MutexLocker ml(SymbolTable_lock);
|
||||
const int results_length = 100;
|
||||
int results[results_length];
|
||||
int counts[results_length];
|
||||
int sizes[results_length];
|
||||
int i,j;
|
||||
|
||||
// initialize results to zero
|
||||
for (j = 0; j < results_length; j++) {
|
||||
results[j] = 0;
|
||||
counts[j] = 0;
|
||||
sizes[j] = 0;
|
||||
}
|
||||
|
||||
int total = 0;
|
||||
int max_symbols = 0;
|
||||
int out_of_range = 0;
|
||||
int memory_total = 0;
|
||||
int count = 0;
|
||||
int total_size = 0;
|
||||
int total_count = 0;
|
||||
int total_length = 0;
|
||||
int max_length = 0;
|
||||
int out_of_range_count = 0;
|
||||
int out_of_range_size = 0;
|
||||
for (i = 0; i < the_table()->table_size(); i++) {
|
||||
HashtableEntry<Symbol*, mtSymbol>* p = the_table()->bucket(i);
|
||||
for ( ; p != NULL; p = p->next()) {
|
||||
memory_total += p->literal()->size();
|
||||
count++;
|
||||
int counter = p->literal()->utf8_length();
|
||||
total += counter;
|
||||
if (counter < results_length) {
|
||||
results[counter]++;
|
||||
int size = p->literal()->size();
|
||||
int len = p->literal()->utf8_length();
|
||||
if (len < results_length) {
|
||||
counts[len]++;
|
||||
sizes[len] += size;
|
||||
} else {
|
||||
out_of_range++;
|
||||
out_of_range_count++;
|
||||
out_of_range_size += size;
|
||||
}
|
||||
max_symbols = MAX2(max_symbols, counter);
|
||||
total_count++;
|
||||
total_size += size;
|
||||
total_length += len;
|
||||
max_length = MAX2(max_length, len);
|
||||
}
|
||||
}
|
||||
tty->print_cr("Symbol Table:");
|
||||
tty->print_cr("Total number of symbols %5d", count);
|
||||
tty->print_cr("Total size in memory %5dK",
|
||||
(memory_total*HeapWordSize)/1024);
|
||||
tty->print_cr("Total counted %5d", _symbols_counted);
|
||||
tty->print_cr("Total removed %5d", _symbols_removed);
|
||||
tty->print_cr("Symbol Table Histogram:");
|
||||
tty->print_cr(" Total number of symbols %7d", total_count);
|
||||
tty->print_cr(" Total size in memory %7dK",
|
||||
(total_size*HeapWordSize)/1024);
|
||||
tty->print_cr(" Total counted %7d", _symbols_counted);
|
||||
tty->print_cr(" Total removed %7d", _symbols_removed);
|
||||
if (_symbols_counted > 0) {
|
||||
tty->print_cr("Percent removed %3.2f",
|
||||
tty->print_cr(" Percent removed %3.2f",
|
||||
((float)_symbols_removed/(float)_symbols_counted)* 100);
|
||||
}
|
||||
tty->print_cr("Reference counts %5d", Symbol::_total_count);
|
||||
tty->print_cr("Symbol arena size %5d used %5d",
|
||||
arena()->size_in_bytes(), arena()->used());
|
||||
tty->print_cr("Histogram of symbol length:");
|
||||
tty->print_cr("%8s %5d", "Total ", total);
|
||||
tty->print_cr("%8s %5d", "Maximum", max_symbols);
|
||||
tty->print_cr("%8s %3.2f", "Average",
|
||||
((float) total / (float) the_table()->table_size()));
|
||||
tty->print_cr("%s", "Histogram:");
|
||||
tty->print_cr(" %s %29s", "Length", "Number chains that length");
|
||||
tty->print_cr(" Reference counts %7d", Symbol::_total_count);
|
||||
tty->print_cr(" Symbol arena used %7dK", arena()->used()/1024);
|
||||
tty->print_cr(" Symbol arena size %7dK", arena()->size_in_bytes()/1024);
|
||||
tty->print_cr(" Total symbol length %7d", total_length);
|
||||
tty->print_cr(" Maximum symbol length %7d", max_length);
|
||||
tty->print_cr(" Average symbol length %7.2f", ((float) total_length / (float) total_count));
|
||||
tty->print_cr(" Symbol length histogram:");
|
||||
tty->print_cr(" %6s %10s %10s", "Length", "#Symbols", "Size");
|
||||
for (i = 0; i < results_length; i++) {
|
||||
if (results[i] > 0) {
|
||||
tty->print_cr("%6d %10d", i, results[i]);
|
||||
if (counts[i] > 0) {
|
||||
tty->print_cr(" %6d %10d %10dK", i, counts[i], (sizes[i]*HeapWordSize)/1024);
|
||||
}
|
||||
}
|
||||
if (Verbose) {
|
||||
int line_length = 70;
|
||||
tty->print_cr("%s %30s", " Length", "Number chains that length");
|
||||
for (i = 0; i < results_length; i++) {
|
||||
if (results[i] > 0) {
|
||||
tty->print("%4d", i);
|
||||
for (j = 0; (j < results[i]) && (j < line_length); j++) {
|
||||
tty->print("%1s", "*");
|
||||
}
|
||||
if (j == line_length) {
|
||||
tty->print("%1s", "+");
|
||||
}
|
||||
tty->cr();
|
||||
}
|
||||
}
|
||||
}
|
||||
tty->print_cr(" %s %d: %d\n", "Number chains longer than",
|
||||
results_length, out_of_range);
|
||||
tty->print_cr(" >=%6d %10d %10dK\n", results_length,
|
||||
out_of_range_count, (out_of_range_size*HeapWordSize)/1024);
|
||||
}
|
||||
|
||||
void SymbolTable::print() {
|
||||
|
@ -406,13 +406,20 @@ class ClassVerifier : public StackObj {
|
||||
}
|
||||
|
||||
// Keep a list of temporary symbols created during verification because
|
||||
// their reference counts need to be decrememented when the verifier object
|
||||
// their reference counts need to be decremented when the verifier object
|
||||
// goes out of scope. Since these symbols escape the scope in which they're
|
||||
// created, we can't use a TempNewSymbol.
|
||||
Symbol* create_temporary_symbol(
|
||||
const Symbol* s, int begin, int end, TRAPS);
|
||||
Symbol* create_temporary_symbol(const Symbol* s, int begin, int end, TRAPS);
|
||||
Symbol* create_temporary_symbol(const char *s, int length, TRAPS);
|
||||
|
||||
Symbol* create_temporary_symbol(Symbol* s) {
|
||||
// This version just updates the reference count and saves the symbol to be
|
||||
// dereferenced later.
|
||||
s->increment_refcount();
|
||||
_symbols->push(s);
|
||||
return s;
|
||||
}
|
||||
|
||||
TypeOrigin ref_ctx(const char* str, TRAPS);
|
||||
|
||||
};
|
||||
@ -425,10 +432,8 @@ inline int ClassVerifier::change_sig_to_verificationType(
|
||||
case T_ARRAY:
|
||||
{
|
||||
Symbol* name = sig_type->as_symbol(CHECK_0);
|
||||
// Create another symbol to save as signature stream unreferences
|
||||
// this symbol.
|
||||
Symbol* name_copy =
|
||||
create_temporary_symbol(name, 0, name->utf8_length(), CHECK_0);
|
||||
// Create another symbol to save as signature stream unreferences this symbol.
|
||||
Symbol* name_copy = create_temporary_symbol(name);
|
||||
assert(name_copy == name, "symbols don't match");
|
||||
*inference_type =
|
||||
VerificationType::reference_type(name_copy);
|
||||
|
@ -128,9 +128,7 @@ void ConcurrentG1Refine::worker_threads_do(ThreadClosure * tc) {
|
||||
}
|
||||
|
||||
uint ConcurrentG1Refine::thread_num() {
|
||||
uint n_threads = (G1ConcRefinementThreads > 0) ? G1ConcRefinementThreads
|
||||
: ParallelGCThreads;
|
||||
return MAX2<uint>(n_threads, 1);
|
||||
return G1ConcRefinementThreads;
|
||||
}
|
||||
|
||||
void ConcurrentG1Refine::print_worker_threads_on(outputStream* st) const {
|
||||
|
@ -262,12 +262,12 @@
|
||||
"Percentage (0-100) of the heap size to use as default " \
|
||||
" maximum young gen size.") \
|
||||
\
|
||||
experimental(uintx, G1MixedGCLiveThresholdPercent, 65, \
|
||||
experimental(uintx, G1MixedGCLiveThresholdPercent, 85, \
|
||||
"Threshold for regions to be considered for inclusion in the " \
|
||||
"collection set of mixed GCs. " \
|
||||
"Regions with live bytes exceeding this will not be collected.") \
|
||||
\
|
||||
product(uintx, G1HeapWastePercent, 10, \
|
||||
product(uintx, G1HeapWastePercent, 5, \
|
||||
"Amount of space, expressed as a percentage of the heap size, " \
|
||||
"that G1 is willing not to collect to avoid expensive GCs.") \
|
||||
\
|
||||
|
@ -817,7 +817,11 @@ MetaWord* CollectorPolicy::satisfy_failed_metadata_allocation(
|
||||
assert(!Heap_lock->owned_by_self(), "Should not be holding the Heap_lock");
|
||||
|
||||
do {
|
||||
MetaWord* result = NULL;
|
||||
MetaWord* result = loader_data->metaspace_non_null()->allocate(word_size, mdtype);
|
||||
if (result != NULL) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (GC_locker::is_active_and_needs_gc()) {
|
||||
// If the GC_locker is active, just expand and allocate.
|
||||
// If that does not succeed, wait if this thread is not
|
||||
|
@ -1415,10 +1415,31 @@ size_t MetaspaceGC::capacity_until_GC() {
|
||||
return value;
|
||||
}
|
||||
|
||||
size_t MetaspaceGC::inc_capacity_until_GC(size_t v) {
|
||||
bool MetaspaceGC::inc_capacity_until_GC(size_t v, size_t* new_cap_until_GC, size_t* old_cap_until_GC) {
|
||||
assert_is_size_aligned(v, Metaspace::commit_alignment());
|
||||
|
||||
return (size_t)Atomic::add_ptr(v, &_capacity_until_GC);
|
||||
size_t capacity_until_GC = (size_t) _capacity_until_GC;
|
||||
size_t new_value = capacity_until_GC + v;
|
||||
|
||||
if (new_value < capacity_until_GC) {
|
||||
// The addition wrapped around, set new_value to aligned max value.
|
||||
new_value = align_size_down(max_uintx, Metaspace::commit_alignment());
|
||||
}
|
||||
|
||||
intptr_t expected = (intptr_t) capacity_until_GC;
|
||||
intptr_t actual = Atomic::cmpxchg_ptr((intptr_t) new_value, &_capacity_until_GC, expected);
|
||||
|
||||
if (expected != actual) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (new_cap_until_GC != NULL) {
|
||||
*new_cap_until_GC = new_value;
|
||||
}
|
||||
if (old_cap_until_GC != NULL) {
|
||||
*old_cap_until_GC = capacity_until_GC;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t MetaspaceGC::dec_capacity_until_GC(size_t v) {
|
||||
@ -1518,7 +1539,10 @@ void MetaspaceGC::compute_new_size() {
|
||||
expand_bytes = align_size_up(expand_bytes, Metaspace::commit_alignment());
|
||||
// Don't expand unless it's significant
|
||||
if (expand_bytes >= MinMetaspaceExpansion) {
|
||||
size_t new_capacity_until_GC = MetaspaceGC::inc_capacity_until_GC(expand_bytes);
|
||||
size_t new_capacity_until_GC = 0;
|
||||
bool succeeded = MetaspaceGC::inc_capacity_until_GC(expand_bytes, &new_capacity_until_GC);
|
||||
assert(succeeded, "Should always succesfully increment HWM when at safepoint");
|
||||
|
||||
Metaspace::tracer()->report_gc_threshold(capacity_until_GC,
|
||||
new_capacity_until_GC,
|
||||
MetaspaceGCThresholdUpdater::ComputeNewSize);
|
||||
@ -3321,19 +3345,29 @@ MetaWord* Metaspace::expand_and_allocate(size_t word_size, MetadataType mdtype)
|
||||
size_t delta_bytes = MetaspaceGC::delta_capacity_until_GC(word_size * BytesPerWord);
|
||||
assert(delta_bytes > 0, "Must be");
|
||||
|
||||
size_t after_inc = MetaspaceGC::inc_capacity_until_GC(delta_bytes);
|
||||
size_t before = 0;
|
||||
size_t after = 0;
|
||||
MetaWord* res;
|
||||
bool incremented;
|
||||
|
||||
// capacity_until_GC might be updated concurrently, must calculate previous value.
|
||||
size_t before_inc = after_inc - delta_bytes;
|
||||
// Each thread increments the HWM at most once. Even if the thread fails to increment
|
||||
// the HWM, an allocation is still attempted. This is because another thread must then
|
||||
// have incremented the HWM and therefore the allocation might still succeed.
|
||||
do {
|
||||
incremented = MetaspaceGC::inc_capacity_until_GC(delta_bytes, &after, &before);
|
||||
res = allocate(word_size, mdtype);
|
||||
} while (!incremented && res == NULL);
|
||||
|
||||
tracer()->report_gc_threshold(before_inc, after_inc,
|
||||
MetaspaceGCThresholdUpdater::ExpandAndAllocate);
|
||||
if (PrintGCDetails && Verbose) {
|
||||
gclog_or_tty->print_cr("Increase capacity to GC from " SIZE_FORMAT
|
||||
" to " SIZE_FORMAT, before_inc, after_inc);
|
||||
if (incremented) {
|
||||
tracer()->report_gc_threshold(before, after,
|
||||
MetaspaceGCThresholdUpdater::ExpandAndAllocate);
|
||||
if (PrintGCDetails && Verbose) {
|
||||
gclog_or_tty->print_cr("Increase capacity to GC from " SIZE_FORMAT
|
||||
" to " SIZE_FORMAT, before, after);
|
||||
}
|
||||
}
|
||||
|
||||
return allocate(word_size, mdtype);
|
||||
return res;
|
||||
}
|
||||
|
||||
// Space allocated in the Metaspace. This may
|
||||
|
@ -87,6 +87,7 @@ class Metaspace : public CHeapObj<mtClass> {
|
||||
friend class VM_CollectForMetadataAllocation;
|
||||
friend class MetaspaceGC;
|
||||
friend class MetaspaceAux;
|
||||
friend class CollectorPolicy;
|
||||
|
||||
public:
|
||||
enum MetadataType {
|
||||
@ -144,6 +145,8 @@ class Metaspace : public CHeapObj<mtClass> {
|
||||
// allocate(ClassLoaderData*, size_t, bool, MetadataType, TRAPS)
|
||||
MetaWord* allocate(size_t word_size, MetadataType mdtype);
|
||||
|
||||
MetaWord* expand_and_allocate(size_t size, MetadataType mdtype);
|
||||
|
||||
// Virtual Space lists for both classes and other metadata
|
||||
static VirtualSpaceList* _space_list;
|
||||
static VirtualSpaceList* _class_space_list;
|
||||
@ -234,9 +237,6 @@ class Metaspace : public CHeapObj<mtClass> {
|
||||
bool read_only, MetaspaceObj::Type type, TRAPS);
|
||||
void deallocate(MetaWord* ptr, size_t byte_size, bool is_class);
|
||||
|
||||
MetaWord* expand_and_allocate(size_t size,
|
||||
MetadataType mdtype);
|
||||
|
||||
static bool contains(const void* ptr);
|
||||
|
||||
void dump(outputStream* const out) const;
|
||||
@ -407,7 +407,9 @@ class MetaspaceGC : AllStatic {
|
||||
static void post_initialize();
|
||||
|
||||
static size_t capacity_until_GC();
|
||||
static size_t inc_capacity_until_GC(size_t v);
|
||||
static bool inc_capacity_until_GC(size_t v,
|
||||
size_t* new_cap_until_GC = NULL,
|
||||
size_t* old_cap_until_GC = NULL);
|
||||
static size_t dec_capacity_until_GC(size_t v);
|
||||
|
||||
static bool should_concurrent_collect() { return _should_concurrent_collect; }
|
||||
|
@ -92,7 +92,7 @@ void ArrayKlass::complete_create_array_klass(ArrayKlass* k, KlassHandle super_kl
|
||||
ResourceMark rm(THREAD);
|
||||
k->initialize_supers(super_klass(), CHECK);
|
||||
k->vtable()->initialize_vtable(false, CHECK);
|
||||
java_lang_Class::create_mirror(k, Handle(NULL), Handle(NULL), CHECK);
|
||||
java_lang_Class::create_mirror(k, Handle(THREAD, k->class_loader()), Handle(NULL), CHECK);
|
||||
}
|
||||
|
||||
GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots) {
|
||||
|
@ -820,6 +820,33 @@ WB_ENTRY(void, WB_FreeMetaspace(JNIEnv* env, jobject wb, jobject class_loader, j
|
||||
MetadataFactory::free_array(cld, (Array<u1>*)(uintptr_t)addr);
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(jlong, WB_IncMetaspaceCapacityUntilGC(JNIEnv* env, jobject wb, jlong inc))
|
||||
if (inc < 0) {
|
||||
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
err_msg("WB_IncMetaspaceCapacityUntilGC: inc is negative: " JLONG_FORMAT, inc));
|
||||
}
|
||||
|
||||
jlong max_size_t = (jlong) ((size_t) -1);
|
||||
if (inc > max_size_t) {
|
||||
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
|
||||
err_msg("WB_IncMetaspaceCapacityUntilGC: inc does not fit in size_t: " JLONG_FORMAT, inc));
|
||||
}
|
||||
|
||||
size_t new_cap_until_GC = 0;
|
||||
size_t aligned_inc = align_size_down((size_t) inc, Metaspace::commit_alignment());
|
||||
bool success = MetaspaceGC::inc_capacity_until_GC(aligned_inc, &new_cap_until_GC);
|
||||
if (!success) {
|
||||
THROW_MSG_0(vmSymbols::java_lang_IllegalStateException(),
|
||||
"WB_IncMetaspaceCapacityUntilGC: could not increase capacity until GC "
|
||||
"due to contention with another thread");
|
||||
}
|
||||
return (jlong) new_cap_until_GC;
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(jlong, WB_MetaspaceCapacityUntilGC(JNIEnv* env, jobject wb))
|
||||
return (jlong) MetaspaceGC::capacity_until_GC();
|
||||
WB_END
|
||||
|
||||
//Some convenience methods to deal with objects from java
|
||||
int WhiteBox::offset_for_field(const char* field_name, oop object,
|
||||
Symbol* signature_symbol) {
|
||||
@ -991,6 +1018,8 @@ static JNINativeMethod methods[] = {
|
||||
CC"(Ljava/lang/ClassLoader;J)J", (void*)&WB_AllocateMetaspace },
|
||||
{CC"freeMetaspace",
|
||||
CC"(Ljava/lang/ClassLoader;JJ)V", (void*)&WB_FreeMetaspace },
|
||||
{CC"incMetaspaceCapacityUntilGC", CC"(J)J", (void*)&WB_IncMetaspaceCapacityUntilGC },
|
||||
{CC"metaspaceCapacityUntilGC", CC"()J", (void*)&WB_MetaspaceCapacityUntilGC },
|
||||
{CC"getCPUFeatures", CC"()Ljava/lang/String;", (void*)&WB_GetCPUFeatures },
|
||||
{CC"getNMethod", CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
|
||||
(void*)&WB_GetNMethod },
|
||||
|
@ -1152,20 +1152,22 @@ void Arguments::set_tiered_flags() {
|
||||
if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M) {
|
||||
FLAG_SET_ERGO(bool, SegmentedCodeCache, true);
|
||||
|
||||
// Multiply sizes by 5 but fix NonNMethodCodeHeapSize (distribute among non-profiled and profiled code heap)
|
||||
if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {
|
||||
FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, ProfiledCodeHeapSize * 5 + NonNMethodCodeHeapSize * 2);
|
||||
}
|
||||
if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {
|
||||
FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, NonProfiledCodeHeapSize * 5 + NonNMethodCodeHeapSize * 2);
|
||||
}
|
||||
// Check consistency of code heap sizes
|
||||
if ((NonNMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
"Invalid code heap sizes: NonNMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
|
||||
NonNMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
|
||||
(NonNMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
|
||||
vm_exit(1);
|
||||
if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
|
||||
// Multiply sizes by 5 but fix NonNMethodCodeHeapSize (distribute among non-profiled and profiled code heap)
|
||||
if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {
|
||||
FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, ProfiledCodeHeapSize * 5 + NonNMethodCodeHeapSize * 2);
|
||||
}
|
||||
if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {
|
||||
FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, NonProfiledCodeHeapSize * 5 + NonNMethodCodeHeapSize * 2);
|
||||
}
|
||||
// Check consistency of code heap sizes
|
||||
if ((NonNMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
"Invalid code heap sizes: NonNMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
|
||||
NonNMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
|
||||
(NonNMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
|
||||
vm_exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!UseInterpreter) { // -Xcomp
|
||||
@ -1690,13 +1692,18 @@ void Arguments::set_g1_gc_flags() {
|
||||
#ifdef COMPILER1
|
||||
FastTLABRefill = false;
|
||||
#endif
|
||||
FLAG_SET_DEFAULT(ParallelGCThreads,
|
||||
Abstract_VM_Version::parallel_worker_threads());
|
||||
FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
|
||||
if (ParallelGCThreads == 0) {
|
||||
FLAG_SET_DEFAULT(ParallelGCThreads,
|
||||
Abstract_VM_Version::parallel_worker_threads());
|
||||
assert(!FLAG_IS_DEFAULT(ParallelGCThreads), "The default value for ParallelGCThreads should not be 0.");
|
||||
vm_exit_during_initialization("The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0", NULL);
|
||||
}
|
||||
|
||||
#if INCLUDE_ALL_GCS
|
||||
if (G1ConcRefinementThreads == 0) {
|
||||
FLAG_SET_DEFAULT(G1ConcRefinementThreads, ParallelGCThreads);
|
||||
}
|
||||
#endif
|
||||
|
||||
// MarkStackSize will be set (if it hasn't been set by the user)
|
||||
// when concurrent marking is initialized.
|
||||
// Its value will be based upon the number of parallel marking threads.
|
||||
|
@ -140,11 +140,6 @@ void* MallocTracker::record_malloc(void* malloc_base, size_t size, MEMFLAGS flag
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Check malloc size, size has to <= MAX_MALLOC_SIZE. This is only possible on 32-bit
|
||||
// systems, when malloc size >= 1GB, but is is safe to assume it won't happen.
|
||||
if (size > MAX_MALLOC_SIZE) {
|
||||
fatal("Should not use malloc for big memory block, use virtual memory instead");
|
||||
}
|
||||
// Uses placement global new operator to initialize malloc header
|
||||
switch(level) {
|
||||
case NMT_off:
|
||||
@ -154,10 +149,12 @@ void* MallocTracker::record_malloc(void* malloc_base, size_t size, MEMFLAGS flag
|
||||
break;
|
||||
}
|
||||
case NMT_summary: {
|
||||
assert(size <= MAX_MALLOC_SIZE, "malloc size overrun for NMT");
|
||||
header = ::new (malloc_base) MallocHeader(size, flags);
|
||||
break;
|
||||
}
|
||||
case NMT_detail: {
|
||||
assert(size <= MAX_MALLOC_SIZE, "malloc size overrun for NMT");
|
||||
header = ::new (malloc_base) MallocHeader(size, flags, stack);
|
||||
break;
|
||||
}
|
||||
|
@ -342,9 +342,9 @@ bool BitMap::set_union_with_result(BitMap other) {
|
||||
bm_word_t* other_map = other.map();
|
||||
idx_t size = size_in_words();
|
||||
for (idx_t index = 0; index < size; index++) {
|
||||
idx_t temp = map(index) | other_map[index];
|
||||
changed = changed || (temp != map(index));
|
||||
map()[index] = temp;
|
||||
idx_t temp = dest_map[index] | other_map[index];
|
||||
changed = changed || (temp != dest_map[index]);
|
||||
dest_map[index] = temp;
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
@ -407,10 +407,10 @@ bool BitMap::is_full() const {
|
||||
bm_word_t* word = map();
|
||||
idx_t rest = size();
|
||||
for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) {
|
||||
if (*word != (bm_word_t) AllBits) return false;
|
||||
if (*word != ~(bm_word_t)0) return false;
|
||||
word++;
|
||||
}
|
||||
return rest == 0 || (*word | ~right_n_bits((int)rest)) == (bm_word_t) AllBits;
|
||||
return rest == 0 || (*word | ~right_n_bits((int)rest)) == ~(bm_word_t)0;
|
||||
}
|
||||
|
||||
|
||||
@ -418,10 +418,10 @@ bool BitMap::is_empty() const {
|
||||
bm_word_t* word = map();
|
||||
idx_t rest = size();
|
||||
for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) {
|
||||
if (*word != (bm_word_t) NoBits) return false;
|
||||
if (*word != 0) return false;
|
||||
word++;
|
||||
}
|
||||
return rest == 0 || (*word & right_n_bits((int)rest)) == (bm_word_t) NoBits;
|
||||
return rest == 0 || (*word & right_n_bits((int)rest)) == 0;
|
||||
}
|
||||
|
||||
void BitMap::clear_large() {
|
||||
@ -441,7 +441,7 @@ bool BitMap::iterate(BitMapClosure* blk, idx_t leftOffset, idx_t rightOffset) {
|
||||
offset < rightOffset && index < endIndex;
|
||||
offset = (++index) << LogBitsPerWord) {
|
||||
idx_t rest = map(index) >> (offset & (BitsPerWord - 1));
|
||||
for (; offset < rightOffset && rest != (bm_word_t)NoBits; offset++) {
|
||||
for (; offset < rightOffset && rest != 0; offset++) {
|
||||
if (rest & 1) {
|
||||
if (!blk->do_bit(offset)) return false;
|
||||
// resample at each closure application
|
||||
@ -468,7 +468,7 @@ void BitMap::init_pop_count_table() {
|
||||
(intptr_t) NULL_WORD);
|
||||
if (res != NULL_WORD) {
|
||||
guarantee( _pop_count_table == (void*) res, "invariant" );
|
||||
FREE_C_HEAP_ARRAY(bm_word_t, table, mtInternal);
|
||||
FREE_C_HEAP_ARRAY(idx_t, table, mtInternal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ class BitMap VALUE_OBJ_CLASS_SPEC {
|
||||
|
||||
// Set a word to a specified value or to all ones; clear a word.
|
||||
void set_word (idx_t word, bm_word_t val) { _map[word] = val; }
|
||||
void set_word (idx_t word) { set_word(word, ~(uintptr_t)0); }
|
||||
void set_word (idx_t word) { set_word(word, ~(bm_word_t)0); }
|
||||
void clear_word(idx_t word) { _map[word] = 0; }
|
||||
|
||||
// Utilities for ranges of bits. Ranges are half-open [beg, end).
|
||||
|
@ -130,7 +130,7 @@ inline void BitMap::par_set_range(idx_t beg, idx_t end, RangeSizeHint hint) {
|
||||
|
||||
inline void BitMap::set_range_of_words(idx_t beg, idx_t end) {
|
||||
bm_word_t* map = _map;
|
||||
for (idx_t i = beg; i < end; ++i) map[i] = ~(uintptr_t)0;
|
||||
for (idx_t i = beg; i < end; ++i) map[i] = ~(bm_word_t)0;
|
||||
}
|
||||
|
||||
|
||||
@ -172,8 +172,8 @@ BitMap::get_next_one_offset_inline(idx_t l_offset, idx_t r_offset) const {
|
||||
|
||||
// check bits including and to the _left_ of offset's position
|
||||
idx_t pos = bit_in_word(res_offset);
|
||||
idx_t res = map(index) >> pos;
|
||||
if (res != (uintptr_t)NoBits) {
|
||||
bm_word_t res = map(index) >> pos;
|
||||
if (res != 0) {
|
||||
// find the position of the 1-bit
|
||||
for (; !(res & 1); res_offset++) {
|
||||
res = res >> 1;
|
||||
@ -207,7 +207,7 @@ BitMap::get_next_one_offset_inline(idx_t l_offset, idx_t r_offset) const {
|
||||
// skip over all word length 0-bit runs
|
||||
for (index++; index < r_index; index++) {
|
||||
res = map(index);
|
||||
if (res != (uintptr_t)NoBits) {
|
||||
if (res != 0) {
|
||||
// found a 1, return the offset
|
||||
for (res_offset = bit_index(index); !(res & 1); res_offset++) {
|
||||
res = res >> 1;
|
||||
@ -235,9 +235,9 @@ BitMap::get_next_zero_offset_inline(idx_t l_offset, idx_t r_offset) const {
|
||||
|
||||
// check bits including and to the _left_ of offset's position
|
||||
idx_t pos = res_offset & (BitsPerWord - 1);
|
||||
idx_t res = (map(index) >> pos) | left_n_bits((int)pos);
|
||||
bm_word_t res = (map(index) >> pos) | left_n_bits((int)pos);
|
||||
|
||||
if (res != (uintptr_t)AllBits) {
|
||||
if (res != ~(bm_word_t)0) {
|
||||
// find the position of the 0-bit
|
||||
for (; res & 1; res_offset++) {
|
||||
res = res >> 1;
|
||||
@ -248,7 +248,7 @@ BitMap::get_next_zero_offset_inline(idx_t l_offset, idx_t r_offset) const {
|
||||
// skip over all word length 1-bit runs
|
||||
for (index++; index < r_index; index++) {
|
||||
res = map(index);
|
||||
if (res != (uintptr_t)AllBits) {
|
||||
if (res != ~(bm_word_t)0) {
|
||||
// found a 0, return the offset
|
||||
for (res_offset = index << LogBitsPerWord; res & 1;
|
||||
res_offset++) {
|
||||
@ -277,8 +277,8 @@ BitMap::get_next_one_offset_inline_aligned_right(idx_t l_offset,
|
||||
idx_t res_offset = l_offset;
|
||||
|
||||
// check bits including and to the _left_ of offset's position
|
||||
idx_t res = map(index) >> bit_in_word(res_offset);
|
||||
if (res != (uintptr_t)NoBits) {
|
||||
bm_word_t res = map(index) >> bit_in_word(res_offset);
|
||||
if (res != 0) {
|
||||
// find the position of the 1-bit
|
||||
for (; !(res & 1); res_offset++) {
|
||||
res = res >> 1;
|
||||
@ -290,7 +290,7 @@ BitMap::get_next_one_offset_inline_aligned_right(idx_t l_offset,
|
||||
// skip over all word length 0-bit runs
|
||||
for (index++; index < r_index; index++) {
|
||||
res = map(index);
|
||||
if (res != (uintptr_t)NoBits) {
|
||||
if (res != 0) {
|
||||
// found a 1, return the offset
|
||||
for (res_offset = bit_index(index); !(res & 1); res_offset++) {
|
||||
res = res >> 1;
|
||||
@ -321,11 +321,11 @@ BitMap::inverted_bit_mask_for_range(idx_t beg, idx_t end) const {
|
||||
}
|
||||
|
||||
inline void BitMap::set_large_range_of_words(idx_t beg, idx_t end) {
|
||||
memset(_map + beg, ~(unsigned char)0, (end - beg) * sizeof(uintptr_t));
|
||||
memset(_map + beg, ~(unsigned char)0, (end - beg) * sizeof(bm_word_t));
|
||||
}
|
||||
|
||||
inline void BitMap::clear_large_range_of_words(idx_t beg, idx_t end) {
|
||||
memset(_map + beg, 0, (end - beg) * sizeof(uintptr_t));
|
||||
memset(_map + beg, 0, (end - beg) * sizeof(bm_word_t));
|
||||
}
|
||||
|
||||
inline BitMap::idx_t BitMap::word_index_round_up(idx_t bit) const {
|
||||
|
@ -259,8 +259,8 @@ ifdef CONCURRENCY
|
||||
EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
|
||||
endif
|
||||
|
||||
# Default JTREG to run (win32 script works for everybody)
|
||||
JTREG = $(JT_HOME)/win32/bin/jtreg
|
||||
# Default JTREG to run
|
||||
JTREG = $(JT_HOME)/bin/jtreg
|
||||
|
||||
# Only run automatic tests
|
||||
JTREG_BASIC_OPTIONS += -a
|
||||
@ -321,6 +321,17 @@ PHONY_LIST += hotspot_clienttest clienttest
|
||||
|
||||
################################################################
|
||||
|
||||
# minimaltest (make sure various basic java minimal options work)
|
||||
|
||||
hotspot_minimaltest minimaltest: prep $(PRODUCT_HOME)
|
||||
$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version
|
||||
$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help
|
||||
$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X
|
||||
|
||||
PHONY_LIST += hotspot_minimaltest minimaltest
|
||||
|
||||
################################################################
|
||||
|
||||
# servertest (make sure various basic java server options work)
|
||||
|
||||
hotspot_servertest servertest: prep $(PRODUCT_HOME)
|
||||
|
@ -61,7 +61,6 @@ jdk = \
|
||||
# can be resolved in some cases by using tools from the compile-jdk.
|
||||
#
|
||||
needs_jdk = \
|
||||
gc/TestG1ZeroPGCTJcmdThreadPrint.java \
|
||||
gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java \
|
||||
gc/metaspace/TestMetaspacePerfCounters.java \
|
||||
gc/metaspace/TestPerfCountersAndMemoryPools.java \
|
||||
@ -134,6 +133,13 @@ needs_compact3 = \
|
||||
gc/metaspace/TestMetaspaceMemoryPool.java \
|
||||
gc/arguments/TestDynMinHeapFreeRatio.java \
|
||||
gc/arguments/TestDynMaxHeapFreeRatio.java \
|
||||
gc/g1/TestShrinkAuxiliaryData00.java \
|
||||
gc/g1/TestShrinkAuxiliaryData05.java \
|
||||
gc/g1/TestShrinkAuxiliaryData10.java \
|
||||
gc/g1/TestShrinkAuxiliaryData15.java \
|
||||
gc/g1/TestShrinkAuxiliaryData20.java \
|
||||
gc/g1/TestShrinkAuxiliaryData25.java \
|
||||
gc/g1/TestShrinkAuxiliaryData30.java \
|
||||
runtime/InternalApi/ThreadCpuTimesDeadlock.java \
|
||||
serviceability/threads/TestFalseDeadLock.java \
|
||||
|
||||
@ -213,14 +219,13 @@ compact1_minimal = \
|
||||
#
|
||||
needs_g1gc = \
|
||||
compiler/regalloc/C1ObjectSpillInLogicOp.java \
|
||||
gc/8000311/Test8000311.java \
|
||||
gc/TestG1ZeroPGCTJcmdThreadPrint.java \
|
||||
gc/TestSystemGC.java \
|
||||
gc/arguments/TestAlignmentToUseLargePages.java \
|
||||
gc/arguments/TestG1HeapRegionSize.java \
|
||||
gc/arguments/TestG1HeapSizeFlags.java \
|
||||
gc/arguments/TestMaxHeapSizeTools.java \
|
||||
gc/arguments/TestMaxNewSize.java \
|
||||
gc/arguments/TestParallelGCThreads.java \
|
||||
gc/arguments/TestUseCompressedOopsErgo.java \
|
||||
gc/class_unloading/TestG1ClassUnloadingHWM.java \
|
||||
gc/g1/ \
|
||||
@ -248,6 +253,7 @@ needs_parallelgc = \
|
||||
gc/arguments/TestAlignmentToUseLargePages.java \
|
||||
gc/arguments/TestMaxNewSize.java \
|
||||
gc/arguments/TestMinInitialErgonomics.java \
|
||||
gc/arguments/TestParallelGCThreads.java \
|
||||
gc/arguments/TestUseCompressedOopsErgo.java \
|
||||
gc/metaspace/TestMetaspacePerfCounters.java \
|
||||
gc/parallelScavenge/ \
|
||||
@ -262,6 +268,7 @@ needs_cmsgc = \
|
||||
gc/arguments/TestAlignmentToUseLargePages.java \
|
||||
gc/arguments/TestCMSHeapSizeFlags.java \
|
||||
gc/arguments/TestMaxNewSize.java \
|
||||
gc/arguments/TestParallelGCThreads.java \
|
||||
gc/arguments/TestUseCompressedOopsErgo.java \
|
||||
gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java \
|
||||
gc/concurrentMarkSweep/ \
|
||||
|
97
hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java
Normal file
97
hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test TestG1ConcRefinementThreads
|
||||
* @key gc
|
||||
* @bug 8047976
|
||||
* @summary Tests argument processing for G1ConcRefinementThreads
|
||||
* @library /testlibrary
|
||||
*/
|
||||
|
||||
import com.oracle.java.testlibrary.*;
|
||||
import java.util.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class TestG1ConcRefinementThreads {
|
||||
|
||||
static final int AUTO_SELECT_THREADS_COUNT = 0;
|
||||
static final int PASSED_THREADS_COUNT = 11;
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
// default case
|
||||
runG1ConcRefinementThreadsTest(
|
||||
new String[]{}, // automatically selected
|
||||
AUTO_SELECT_THREADS_COUNT /* use default setting */);
|
||||
|
||||
// zero setting case
|
||||
runG1ConcRefinementThreadsTest(
|
||||
new String[]{"-XX:G1ConcRefinementThreads=0"}, // automatically selected
|
||||
AUTO_SELECT_THREADS_COUNT /* set to zero */);
|
||||
|
||||
// non-zero sestting case
|
||||
runG1ConcRefinementThreadsTest(
|
||||
new String[]{"-XX:G1ConcRefinementThreads="+Integer.toString(PASSED_THREADS_COUNT)},
|
||||
PASSED_THREADS_COUNT);
|
||||
}
|
||||
|
||||
private static void runG1ConcRefinementThreadsTest(String[] passedOpts,
|
||||
int expectedValue) throws Exception {
|
||||
List<String> vmOpts = new ArrayList<>();
|
||||
if (passedOpts.length > 0) {
|
||||
Collections.addAll(vmOpts, passedOpts);
|
||||
}
|
||||
Collections.addAll(vmOpts, "-XX:+UseG1GC", "-XX:+PrintFlagsFinal", "-version");
|
||||
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()]));
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
|
||||
output.shouldHaveExitValue(0);
|
||||
String stdout = output.getStdout();
|
||||
checkG1ConcRefinementThreadsConsistency(stdout, expectedValue);
|
||||
}
|
||||
|
||||
private static void checkG1ConcRefinementThreadsConsistency(String output, int expectedValue) {
|
||||
int actualValue = getIntValue("G1ConcRefinementThreads", output);
|
||||
|
||||
if (expectedValue == 0) {
|
||||
// If expectedValue is automatically selected, set it same as ParallelGCThreads.
|
||||
expectedValue = getIntValue("ParallelGCThreads", output);
|
||||
}
|
||||
|
||||
if (expectedValue != actualValue) {
|
||||
throw new RuntimeException(
|
||||
"Actual G1ConcRefinementThreads(" + Integer.toString(actualValue)
|
||||
+ ") is not equal to expected value(" + Integer.toString(expectedValue) + ")");
|
||||
}
|
||||
}
|
||||
|
||||
public static int getIntValue(String flag, String where) {
|
||||
Matcher m = Pattern.compile(flag + "\\s+:?=\\s+\\d+").matcher(where);
|
||||
if (!m.find()) {
|
||||
throw new RuntimeException("Could not find value for flag " + flag + " in output string");
|
||||
}
|
||||
String match = m.group();
|
||||
return Integer.parseInt(match.substring(match.lastIndexOf(" ") + 1, match.length()));
|
||||
}
|
||||
}
|
64
hotspot/test/gc/arguments/TestParallelGCThreads.java
Normal file
64
hotspot/test/gc/arguments/TestParallelGCThreads.java
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test TestParallelGCThreads
|
||||
* @key gc
|
||||
* @bug 8059527
|
||||
* @summary Tests argument processing for ParallelGCThreads
|
||||
* @library /testlibrary
|
||||
* @run driver TestParallelGCThreads
|
||||
*/
|
||||
|
||||
import com.oracle.java.testlibrary.*;
|
||||
|
||||
public class TestParallelGCThreads {
|
||||
|
||||
public static void main(String args[]) throws Exception {
|
||||
|
||||
// For each parallel collector (G1, Parallel, ParNew/CMS)
|
||||
for (String gc : new String[] {"G1", "Parallel", "ConcMarkSweep"}) {
|
||||
|
||||
// Make sure the VM does not allow ParallelGCThreads set to 0
|
||||
String[] flags = new String[] {"-XX:+Use" + gc + "GC", "-XX:ParallelGCThreads=0", "-XX:+PrintFlagsFinal", "-version"};
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flags);
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldHaveExitValue(1);
|
||||
|
||||
// Do some basic testing to ensure the flag updates the count
|
||||
for (long i = 1; i <= 3; i++) {
|
||||
flags = new String[] {"-XX:+Use" + gc + "GC", "-XX:ParallelGCThreads=" + i, "-XX:+PrintFlagsFinal", "-version"};
|
||||
long count = getParallelGCThreadCount(flags);
|
||||
Asserts.assertEQ(count, i, "Specifying ParallelGCThreads=" + i + " for " + gc + "GC does not set the thread count properly!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static long getParallelGCThreadCount(String flags[]) throws Exception {
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flags);
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldHaveExitValue(0);
|
||||
String stdout = output.getStdout();
|
||||
return FlagsValue.getFlagLongValue("ParallelGCThreads", stdout);
|
||||
}
|
||||
}
|
286
hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
Normal file
286
hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
Normal file
@ -0,0 +1,286 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import static com.oracle.java.testlibrary.Asserts.assertLessThanOrEqual;
|
||||
import com.oracle.java.testlibrary.OutputAnalyzer;
|
||||
import com.oracle.java.testlibrary.Platform;
|
||||
import com.oracle.java.testlibrary.ProcessTools;
|
||||
import com.oracle.java.testlibrary.Utils;
|
||||
import java.io.IOException;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.management.MemoryUsage;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import sun.misc.Unsafe;
|
||||
|
||||
public class TestShrinkAuxiliaryData {
|
||||
|
||||
private final static String[] initialOpts = new String[]{
|
||||
"-XX:MinHeapFreeRatio=10",
|
||||
"-XX:MaxHeapFreeRatio=11",
|
||||
"-XX:+UseG1GC",
|
||||
"-XX:G1HeapRegionSize=1m",
|
||||
"-XX:+PrintGCDetails"
|
||||
};
|
||||
|
||||
private final int RSetCacheSize;
|
||||
|
||||
protected TestShrinkAuxiliaryData(int RSetCacheSize) {
|
||||
this.RSetCacheSize = RSetCacheSize;
|
||||
}
|
||||
|
||||
protected void test() throws Exception {
|
||||
ArrayList<String> vmOpts = new ArrayList();
|
||||
Collections.addAll(vmOpts, initialOpts);
|
||||
|
||||
int maxCacheSize = Math.max(0, Math.min(31, getMaxCacheSize()));
|
||||
if (maxCacheSize < RSetCacheSize) {
|
||||
System.out.format("Skiping test for %d cache size due max cache size %d",
|
||||
RSetCacheSize, maxCacheSize
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
printTestInfo(maxCacheSize);
|
||||
|
||||
vmOpts.add("-XX:G1ConcRSLogCacheSize=" + RSetCacheSize);
|
||||
|
||||
vmOpts.addAll(Arrays.asList(Utils.getFilteredTestJavaOpts(
|
||||
ShrinkAuxiliaryDataTest.prohibitedVmOptions)));
|
||||
|
||||
// for 32 bits ObjectAlignmentInBytes is not a option
|
||||
if (Platform.is32bit()) {
|
||||
ArrayList<String> vmOptsWithoutAlign = new ArrayList(vmOpts);
|
||||
vmOptsWithoutAlign.add(ShrinkAuxiliaryDataTest.class.getName());
|
||||
performTest(vmOptsWithoutAlign);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int alignment = 3; alignment <= 8; alignment++) {
|
||||
ArrayList<String> vmOptsWithAlign = new ArrayList(vmOpts);
|
||||
vmOptsWithAlign.add("-XX:ObjectAlignmentInBytes="
|
||||
+ (int) Math.pow(2, alignment));
|
||||
vmOptsWithAlign.add(ShrinkAuxiliaryDataTest.class.getName());
|
||||
|
||||
performTest(vmOptsWithAlign);
|
||||
}
|
||||
}
|
||||
|
||||
private void performTest(List<String> opts) throws Exception {
|
||||
ProcessBuilder pb
|
||||
= ProcessTools.createJavaProcessBuilder(
|
||||
opts.toArray(new String[opts.size()])
|
||||
);
|
||||
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
|
||||
private void printTestInfo(int maxCacheSize) {
|
||||
|
||||
DecimalFormat grouped = new DecimalFormat("000,000");
|
||||
DecimalFormatSymbols formatSymbols = grouped.getDecimalFormatSymbols();
|
||||
formatSymbols.setGroupingSeparator(' ');
|
||||
grouped.setDecimalFormatSymbols(formatSymbols);
|
||||
|
||||
System.out.format("Test will use %s bytes of memory of %s available%n"
|
||||
+ "Available memory is %s with %d bytes pointer size - can save %s pointers%n"
|
||||
+ "Max cache size: 2^%d = %s elements%n",
|
||||
grouped.format(ShrinkAuxiliaryDataTest.getMemoryUsedByTest()),
|
||||
grouped.format(Runtime.getRuntime().freeMemory()),
|
||||
grouped.format(Runtime.getRuntime().freeMemory()
|
||||
- ShrinkAuxiliaryDataTest.getMemoryUsedByTest()),
|
||||
Unsafe.ADDRESS_SIZE,
|
||||
grouped.format((Runtime.getRuntime().freeMemory()
|
||||
- ShrinkAuxiliaryDataTest.getMemoryUsedByTest())
|
||||
/ Unsafe.ADDRESS_SIZE),
|
||||
maxCacheSize,
|
||||
grouped.format((int) Math.pow(2, maxCacheSize))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects maximum possible size of G1ConcRSLogCacheSize available for
|
||||
* current process based on maximum available process memory size
|
||||
*
|
||||
* @return power of two
|
||||
*/
|
||||
private static int getMaxCacheSize() {
|
||||
long availableMemory = Runtime.getRuntime().freeMemory()
|
||||
- ShrinkAuxiliaryDataTest.getMemoryUsedByTest() - 1l;
|
||||
if (availableMemory <= 0) {
|
||||
return 0;
|
||||
}
|
||||
long availablePointersCount = availableMemory / Unsafe.ADDRESS_SIZE;
|
||||
return (63 - (int) Long.numberOfLeadingZeros(availablePointersCount));
|
||||
}
|
||||
|
||||
static class ShrinkAuxiliaryDataTest {
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
int iterateCount = DEFAULT_ITERATION_COUNT;
|
||||
|
||||
if (args.length > 0) {
|
||||
try {
|
||||
iterateCount = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException e) {
|
||||
//num_iterate remains default
|
||||
}
|
||||
}
|
||||
|
||||
new ShrinkAuxiliaryDataTest().test(iterateCount);
|
||||
}
|
||||
|
||||
class GarbageObject {
|
||||
|
||||
private final List<byte[]> payload = new ArrayList();
|
||||
private final List<GarbageObject> ref = new LinkedList();
|
||||
|
||||
public GarbageObject(int size) {
|
||||
payload.add(new byte[size]);
|
||||
}
|
||||
|
||||
public void addRef(GarbageObject g) {
|
||||
ref.add(g);
|
||||
}
|
||||
|
||||
public void mutate() {
|
||||
if (!payload.isEmpty() && payload.get(0).length > 0) {
|
||||
payload.get(0)[0] = (byte) (Math.random() * Byte.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final List<GarbageObject> garbage = new ArrayList();
|
||||
|
||||
public void test(int num_iterate) throws IOException {
|
||||
|
||||
allocate();
|
||||
link();
|
||||
mutate();
|
||||
deallocate();
|
||||
|
||||
MemoryUsage muBeforeHeap
|
||||
= ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
|
||||
MemoryUsage muBeforeNonHeap
|
||||
= ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();
|
||||
|
||||
for (int i = 0; i < num_iterate; i++) {
|
||||
allocate();
|
||||
link();
|
||||
mutate();
|
||||
deallocate();
|
||||
}
|
||||
|
||||
System.gc();
|
||||
MemoryUsage muAfterHeap
|
||||
= ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
|
||||
MemoryUsage muAfterNonHeap
|
||||
= ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();
|
||||
|
||||
assertLessThanOrEqual(muAfterHeap.getCommitted(), muBeforeHeap.getCommitted(),
|
||||
String.format("heap decommit failed - after > before: %d > %d",
|
||||
muAfterHeap.getCommitted(), muBeforeHeap.getCommitted()
|
||||
)
|
||||
);
|
||||
|
||||
if (muAfterHeap.getCommitted() < muBeforeHeap.getCommitted()) {
|
||||
assertLessThanOrEqual(muAfterNonHeap.getCommitted(), muBeforeNonHeap.getCommitted(),
|
||||
String.format("non-heap decommit failed - after > before: %d > %d",
|
||||
muAfterNonHeap.getCommitted(), muBeforeNonHeap.getCommitted()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void allocate() {
|
||||
for (int r = 0; r < REGIONS_TO_ALLOCATE; r++) {
|
||||
for (int i = 0; i < NUM_OBJECTS_PER_REGION; i++) {
|
||||
GarbageObject g = new GarbageObject(REGION_SIZE
|
||||
/ NUM_OBJECTS_PER_REGION);
|
||||
garbage.add(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterate through all allocated objects, and link to objects in another
|
||||
* regions
|
||||
*/
|
||||
private void link() {
|
||||
for (int ig = 0; ig < garbage.size(); ig++) {
|
||||
int regionNumber = ig / NUM_OBJECTS_PER_REGION;
|
||||
|
||||
for (int i = 0; i < NUM_LINKS; i++) {
|
||||
int regionToLink;
|
||||
do {
|
||||
regionToLink = (int) (Math.random()
|
||||
* REGIONS_TO_ALLOCATE);
|
||||
} while (regionToLink == regionNumber);
|
||||
|
||||
// get random garbage object from random region
|
||||
garbage.get(ig).addRef(garbage.get(regionToLink
|
||||
* NUM_OBJECTS_PER_REGION + (int) (Math.random()
|
||||
* NUM_OBJECTS_PER_REGION)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void mutate() {
|
||||
for (int ig = 0; ig < garbage.size(); ig++) {
|
||||
garbage.get(ig).mutate();
|
||||
}
|
||||
}
|
||||
|
||||
private void deallocate() {
|
||||
garbage.clear();
|
||||
System.gc();
|
||||
}
|
||||
|
||||
static long getMemoryUsedByTest() {
|
||||
return REGIONS_TO_ALLOCATE * REGION_SIZE;
|
||||
}
|
||||
|
||||
private static final int REGION_SIZE = 1024 * 1024;
|
||||
private static final int DEFAULT_ITERATION_COUNT = 1; // iterate main scenario
|
||||
private static final int REGIONS_TO_ALLOCATE = 5;
|
||||
private static final int NUM_OBJECTS_PER_REGION = 10;
|
||||
private static final int NUM_LINKS = 20; // how many links create for each object
|
||||
|
||||
private static final String[] prohibitedVmOptions = {
|
||||
// remove this when @requires option will be on duty
|
||||
"-XX:\\+UseParallelGC",
|
||||
"-XX:\\+UseSerialGC",
|
||||
"-XX:\\+UseConcMarkSweepGC",
|
||||
"-XX:\\+UseParallelOldGC",
|
||||
"-XX:\\+UseParNewGC",
|
||||
"-Xconcgc",
|
||||
"-Xincgc"
|
||||
};
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 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
|
||||
@ -22,21 +22,17 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test Test8000311
|
||||
* @key gc
|
||||
* @bug 8000311
|
||||
* @summary G1: ParallelGCThreads==0 broken
|
||||
* @run main/othervm -XX:+UseG1GC -XX:ParallelGCThreads=0 -XX:+ResizePLAB -XX:+ExplicitGCInvokesConcurrent Test8000311
|
||||
* @author filipp.zhinkin@oracle.com
|
||||
* @test TestShrinkAuxiliaryData00
|
||||
* @bug 8038423
|
||||
* @summary Checks that decommitment occurs for JVM with different
|
||||
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
|
||||
* @library /testlibrary /testlibrary/whitebox
|
||||
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData00
|
||||
* @run driver/timeout=720 TestShrinkAuxiliaryData00
|
||||
*/
|
||||
public class TestShrinkAuxiliaryData00 {
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Test8000311 {
|
||||
public static void main(String args[]) {
|
||||
for(int i = 0; i<100; i++) {
|
||||
byte[] garbage = new byte[1000];
|
||||
System.gc();
|
||||
public static void main(String[] args) throws Exception {
|
||||
new TestShrinkAuxiliaryData(0).test();
|
||||
}
|
||||
}
|
||||
}
|
38
hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java
Normal file
38
hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test TestShrinkAuxiliaryData05
|
||||
* @bug 8038423
|
||||
* @summary Checks that decommitment occurs for JVM with different
|
||||
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
|
||||
* @library /testlibrary /testlibrary/whitebox
|
||||
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData05
|
||||
* @run driver/timeout=720 TestShrinkAuxiliaryData05
|
||||
*/
|
||||
public class TestShrinkAuxiliaryData05 {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new TestShrinkAuxiliaryData(5).test();
|
||||
}
|
||||
}
|
38
hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java
Normal file
38
hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test TestShrinkAuxiliaryData10
|
||||
* @bug 8038423
|
||||
* @summary Checks that decommitment occurs for JVM with different
|
||||
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
|
||||
* @library /testlibrary /testlibrary/whitebox
|
||||
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData10
|
||||
* @run driver/timeout=720 TestShrinkAuxiliaryData10
|
||||
*/
|
||||
public class TestShrinkAuxiliaryData10 {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new TestShrinkAuxiliaryData(10).test();
|
||||
}
|
||||
}
|
38
hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java
Normal file
38
hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test TestShrinkAuxiliaryData15
|
||||
* @bug 8038423
|
||||
* @summary Checks that decommitment occurs for JVM with different
|
||||
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
|
||||
* @library /testlibrary /testlibrary/whitebox
|
||||
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData15
|
||||
* @run driver/timeout=720 TestShrinkAuxiliaryData15
|
||||
*/
|
||||
public class TestShrinkAuxiliaryData15 {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new TestShrinkAuxiliaryData(15).test();
|
||||
}
|
||||
}
|
38
hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java
Normal file
38
hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test TestShrinkAuxiliaryData20
|
||||
* @bug 8038423
|
||||
* @summary Checks that decommitment occurs for JVM with different
|
||||
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
|
||||
* @library /testlibrary /testlibrary/whitebox
|
||||
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData20
|
||||
* @run driver/timeout=720 TestShrinkAuxiliaryData20
|
||||
*/
|
||||
public class TestShrinkAuxiliaryData20 {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new TestShrinkAuxiliaryData(20).test();
|
||||
}
|
||||
}
|
38
hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java
Normal file
38
hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test TestShrinkAuxiliaryData25
|
||||
* @bug 8038423
|
||||
* @summary Checks that decommitment occurs for JVM with different
|
||||
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
|
||||
* @library /testlibrary /testlibrary/whitebox
|
||||
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData25
|
||||
* @run driver/timeout=720 TestShrinkAuxiliaryData25
|
||||
*/
|
||||
public class TestShrinkAuxiliaryData25 {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new TestShrinkAuxiliaryData(25).test();
|
||||
}
|
||||
}
|
38
hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java
Normal file
38
hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test TestShrinkAuxiliaryData30
|
||||
* @bug 8038423
|
||||
* @summary Checks that decommitment occurs for JVM with different
|
||||
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
|
||||
* @library /testlibrary /testlibrary/whitebox
|
||||
* @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData30
|
||||
* @run driver/timeout=720 TestShrinkAuxiliaryData30
|
||||
*/
|
||||
public class TestShrinkAuxiliaryData30 {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
new TestShrinkAuxiliaryData(30).test();
|
||||
}
|
||||
}
|
59
hotspot/test/gc/metaspace/TestCapacityUntilGCWrapAround.java
Normal file
59
hotspot/test/gc/metaspace/TestCapacityUntilGCWrapAround.java
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key gc
|
||||
* @bug 8049831
|
||||
* @library /testlibrary /testlibrary/whitebox
|
||||
* @build TestCapacityUntilGCWrapAround
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestCapacityUntilGCWrapAround
|
||||
*/
|
||||
|
||||
import sun.hotspot.WhiteBox;
|
||||
|
||||
import com.oracle.java.testlibrary.Asserts;
|
||||
import com.oracle.java.testlibrary.Platform;
|
||||
|
||||
public class TestCapacityUntilGCWrapAround {
|
||||
private static long MB = 1024 * 1024;
|
||||
private static long GB = 1024 * MB;
|
||||
private static long MAX_UINT = 4 * GB - 1; // On 32-bit platforms
|
||||
|
||||
public static void main(String[] args) {
|
||||
if (Platform.is32bit()) {
|
||||
WhiteBox wb = WhiteBox.getWhiteBox();
|
||||
|
||||
long before = wb.metaspaceCapacityUntilGC();
|
||||
// Now force possible overflow of capacity_until_GC.
|
||||
long after = wb.incMetaspaceCapacityUntilGC(MAX_UINT);
|
||||
|
||||
Asserts.assertGTE(after, before,
|
||||
"Increasing with MAX_UINT should not cause wrap around: " + after + " < " + before);
|
||||
Asserts.assertLTE(after, MAX_UINT,
|
||||
"Increasing with MAX_UINT should not cause value larger than MAX_UINT:" + after);
|
||||
}
|
||||
}
|
||||
}
|
45
hotspot/test/runtime/LoadClass/ShowClassLoader.java
Normal file
45
hotspot/test/runtime/LoadClass/ShowClassLoader.java
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key regression
|
||||
* @bug 8058927
|
||||
* @summary Make sure array class has the right class loader
|
||||
* @run main ShowClassLoader
|
||||
*/
|
||||
|
||||
public class ShowClassLoader {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Object[] oa = new Object[0];
|
||||
ShowClassLoader[] sa = new ShowClassLoader[0];
|
||||
|
||||
System.out.println("Classloader for Object[] is " + oa.getClass().getClassLoader());
|
||||
System.out.println("Classloader for SCL[] is " + sa.getClass().getClassLoader() );
|
||||
|
||||
if (sa.getClass().getClassLoader() == null) {
|
||||
throw new RuntimeException("Wrong class loader");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 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
|
||||
@ -21,34 +21,34 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/* @test TestG1ZeroPGCTJcmdThreadPrint
|
||||
* @key gc
|
||||
* @bug 8005875
|
||||
* @summary Use jcmd to generate a thread dump of a Java program being run with PGCT=0 to verify 8005875
|
||||
/*
|
||||
* @test
|
||||
* @bug 8058818
|
||||
* @library /testlibrary
|
||||
* @run main/othervm -XX:+UseG1GC -XX:ParallelGCThreads=0 -XX:+IgnoreUnrecognizedVMOptions TestG1ZeroPGCTJcmdThreadPrint
|
||||
* @build UnsafeMallocLimit2
|
||||
* @run main/othervm -Xmx32m -XX:NativeMemoryTracking=off UnsafeMallocLimit2
|
||||
*/
|
||||
|
||||
import com.oracle.java.testlibrary.*;
|
||||
import sun.misc.Unsafe;
|
||||
|
||||
public class TestG1ZeroPGCTJcmdThreadPrint {
|
||||
public static void main(String args[]) throws Exception {
|
||||
public class UnsafeMallocLimit2 {
|
||||
|
||||
// Grab the pid from the current java process
|
||||
String pid = Integer.toString(ProcessTools.getProcessId());
|
||||
|
||||
// Create a ProcessBuilder
|
||||
ProcessBuilder pb = new ProcessBuilder();
|
||||
|
||||
// Run jcmd <pid> Thread.print
|
||||
pb.command(JDKToolFinder.getJDKTool("jcmd"), pid, "Thread.print");
|
||||
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
|
||||
// There shouldn't be a work gang for concurrent marking.
|
||||
output.shouldNotContain("G1 Parallel Marking Threads");
|
||||
|
||||
// Make sure we didn't crash
|
||||
output.shouldHaveExitValue(0);
|
||||
}
|
||||
public static void main(String args[]) throws Exception {
|
||||
if (Platform.is32bit()) {
|
||||
Unsafe unsafe = Utils.getUnsafe();
|
||||
try {
|
||||
// Allocate greater than MALLOC_MAX and likely won't fail to allocate,
|
||||
// so it hits the NMT code that asserted.
|
||||
// Test that this doesn't cause an assertion with NMT off.
|
||||
// The option above overrides if all the tests are run with NMT on.
|
||||
unsafe.allocateMemory(0x40000000);
|
||||
System.out.println("Allocation succeeded");
|
||||
} catch (OutOfMemoryError e) {
|
||||
System.out.println("Allocation failed");
|
||||
}
|
||||
} else {
|
||||
System.out.println("Test only valid on 32-bit platforms");
|
||||
}
|
||||
}
|
||||
}
|
@ -152,6 +152,8 @@ public class WhiteBox {
|
||||
public native void readReservedMemory();
|
||||
public native long allocateMetaspace(ClassLoader classLoader, long size);
|
||||
public native void freeMetaspace(ClassLoader classLoader, long addr, long size);
|
||||
public native long incMetaspaceCapacityUntilGC(long increment);
|
||||
public native long metaspaceCapacityUntilGC();
|
||||
|
||||
// force Young GC
|
||||
public native void youngGC();
|
||||
|
Loading…
x
Reference in New Issue
Block a user