提交 2ad5a3e8 编写于 作者: I iveresov

8058564: Tiered compilation performance drop in PIT

Summary: Ensure MethodCounters are created before method is enqueued for compilation
Reviewed-by: kvn, drchase, jiangli, roland
上级 555db73d
...@@ -1175,6 +1175,12 @@ void CompileBroker::compile_method_base(methodHandle method, ...@@ -1175,6 +1175,12 @@ void CompileBroker::compile_method_base(methodHandle method,
return; return;
} }
if (TieredCompilation) {
// Tiered policy requires MethodCounters to exist before adding a method to
// the queue. Create if we don't have them yet.
method->get_method_counters(thread);
}
// Outputs from the following MutexLocker block: // Outputs from the following MutexLocker block:
CompileTask* task = NULL; CompileTask* task = NULL;
bool blocking = false; bool blocking = false;
......
...@@ -93,7 +93,7 @@ Method::Method(ConstMethod* xconst, AccessFlags access_flags, int size) { ...@@ -93,7 +93,7 @@ Method::Method(ConstMethod* xconst, AccessFlags access_flags, int size) {
set_hidden(false); set_hidden(false);
set_dont_inline(false); set_dont_inline(false);
set_method_data(NULL); set_method_data(NULL);
set_method_counters(NULL); clear_method_counters();
set_vtable_index(Method::garbage_vtable_index); set_vtable_index(Method::garbage_vtable_index);
// Fix and bury in Method* // Fix and bury in Method*
...@@ -117,7 +117,7 @@ void Method::deallocate_contents(ClassLoaderData* loader_data) { ...@@ -117,7 +117,7 @@ void Method::deallocate_contents(ClassLoaderData* loader_data) {
MetadataFactory::free_metadata(loader_data, method_data()); MetadataFactory::free_metadata(loader_data, method_data());
set_method_data(NULL); set_method_data(NULL);
MetadataFactory::free_metadata(loader_data, method_counters()); MetadataFactory::free_metadata(loader_data, method_counters());
set_method_counters(NULL); clear_method_counters();
// The nmethod will be gone when we get here. // The nmethod will be gone when we get here.
if (code() != NULL) _code = NULL; if (code() != NULL) _code = NULL;
} }
...@@ -388,9 +388,7 @@ MethodCounters* Method::build_method_counters(Method* m, TRAPS) { ...@@ -388,9 +388,7 @@ MethodCounters* Method::build_method_counters(Method* m, TRAPS) {
methodHandle mh(m); methodHandle mh(m);
ClassLoaderData* loader_data = mh->method_holder()->class_loader_data(); ClassLoaderData* loader_data = mh->method_holder()->class_loader_data();
MethodCounters* counters = MethodCounters::allocate(loader_data, CHECK_NULL); MethodCounters* counters = MethodCounters::allocate(loader_data, CHECK_NULL);
if (mh->method_counters() == NULL) { if (!mh->init_method_counters(counters)) {
mh->set_method_counters(counters);
} else {
MetadataFactory::free_metadata(loader_data, counters); MetadataFactory::free_metadata(loader_data, counters);
} }
return mh->method_counters(); return mh->method_counters();
...@@ -852,7 +850,7 @@ void Method::unlink_method() { ...@@ -852,7 +850,7 @@ void Method::unlink_method() {
assert(!DumpSharedSpaces || _method_data == NULL, "unexpected method data?"); assert(!DumpSharedSpaces || _method_data == NULL, "unexpected method data?");
set_method_data(NULL); set_method_data(NULL);
set_method_counters(NULL); clear_method_counters();
} }
// Called when the method_holder is getting linked. Setup entrypoints so the method // Called when the method_holder is getting linked. Setup entrypoints so the method
......
...@@ -365,11 +365,13 @@ class Method : public Metadata { ...@@ -365,11 +365,13 @@ class Method : public Metadata {
return _method_counters; return _method_counters;
} }
void set_method_counters(MethodCounters* counters) { void clear_method_counters() {
// The store into method must be released. On platforms without _method_counters = NULL;
// total store order (TSO) the reference may become visible before }
// the initialization of data otherwise.
OrderAccess::release_store_ptr((volatile void *)&_method_counters, counters); bool init_method_counters(MethodCounters* counters) {
// Try to install a pointer to MethodCounters, return true on success.
return Atomic::cmpxchg_ptr(counters, (volatile void*)&_method_counters, NULL) == NULL;
} }
#ifdef TIERED #ifdef TIERED
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册