6919886: Sweep CodeCache more aggressively to reduce its usage for CompileTheWorld
Add safepoint after CompileTheWorldSafepointInterval (100) compilations and do full sweep of CodeCache each time. Reviewed-by: never
This commit is contained in:
parent
bac125984c
commit
f557cc8bd0
@ -1249,6 +1249,7 @@ void ClassLoader::compile_the_world() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ClassLoader::_compile_the_world_counter = 0;
|
int ClassLoader::_compile_the_world_counter = 0;
|
||||||
|
static int _codecache_sweep_counter = 0;
|
||||||
|
|
||||||
void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
|
void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
|
||||||
int len = (int)strlen(name);
|
int len = (int)strlen(name);
|
||||||
@ -1293,6 +1294,13 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
|
|||||||
for (int n = 0; n < k->methods()->length(); n++) {
|
for (int n = 0; n < k->methods()->length(); n++) {
|
||||||
methodHandle m (THREAD, methodOop(k->methods()->obj_at(n)));
|
methodHandle m (THREAD, methodOop(k->methods()->obj_at(n)));
|
||||||
if (CompilationPolicy::canBeCompiled(m)) {
|
if (CompilationPolicy::canBeCompiled(m)) {
|
||||||
|
|
||||||
|
if (++_codecache_sweep_counter == CompileTheWorldSafepointInterval) {
|
||||||
|
// Give sweeper a chance to keep up with CTW
|
||||||
|
VM_ForceSafepoint op;
|
||||||
|
VMThread::execute(&op);
|
||||||
|
_codecache_sweep_counter = 0;
|
||||||
|
}
|
||||||
// Force compilation
|
// Force compilation
|
||||||
CompileBroker::compile_method(m, InvocationEntryBci,
|
CompileBroker::compile_method(m, InvocationEntryBci,
|
||||||
methodHandle(), 0, "CTW", THREAD);
|
methodHandle(), 0, "CTW", THREAD);
|
||||||
|
@ -2815,6 +2815,15 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
|
|||||||
DebugNonSafepoints = true;
|
DebugNonSafepoints = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PRODUCT
|
||||||
|
if (CompileTheWorld) {
|
||||||
|
// Force NmethodSweeper to sweep whole CodeCache each time.
|
||||||
|
if (FLAG_IS_DEFAULT(NmethodSweepFraction)) {
|
||||||
|
NmethodSweepFraction = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (PrintCommandLineFlags) {
|
if (PrintCommandLineFlags) {
|
||||||
CommandLineFlags::printSetFlags();
|
CommandLineFlags::printSetFlags();
|
||||||
}
|
}
|
||||||
|
@ -2447,6 +2447,9 @@ class CommandLineFlags {
|
|||||||
notproduct(bool, CompileTheWorldIgnoreInitErrors, false, \
|
notproduct(bool, CompileTheWorldIgnoreInitErrors, false, \
|
||||||
"Compile all methods although class initializer failed") \
|
"Compile all methods although class initializer failed") \
|
||||||
\
|
\
|
||||||
|
notproduct(intx, CompileTheWorldSafepointInterval, 100, \
|
||||||
|
"Force a safepoint every n compiles so sweeper can keep up") \
|
||||||
|
\
|
||||||
develop(bool, TraceIterativeGVN, false, \
|
develop(bool, TraceIterativeGVN, false, \
|
||||||
"Print progress during Iterative Global Value Numbering") \
|
"Print progress during Iterative Global Value Numbering") \
|
||||||
\
|
\
|
||||||
|
Loading…
x
Reference in New Issue
Block a user