-
Enhancement
-
Resolution: Fixed
-
P3
-
9
-
b22
We have one start-up benchmark that runs ~10% faster with the following hack which disable loader constraints for all CDS archived classes:
diff -r 2b1c2d378b0b src/share/vm/oops/instanceKlass.cpp
--- a/src/share/vm/oops/instanceKlass.cpp Tue Mar 21 14:14:06 2017 +0100
+++ b/src/share/vm/oops/instanceKlass.cpp Fri Apr 07 05:42:16 2017 -0700
@@ -619,7 +619,7 @@
// a shared class if the class is not loaded by the NULL classloader.
ClassLoaderData * loader_data = class_loader_data();
if (!(is_shared() &&
- loader_data->is_the_null_class_loader_data())) {
+ (loader_data->is_the_null_class_loader_data() || UseNewCode))) {
ResourceMark rm(THREAD);
vtable()->initialize_vtable(true, CHECK_false);
itable()->initialize_itable(true, CHECK_false);
Original: 702ms
Disabled: 653ms = ~9.2% faster
Profiling with the Linux "perf" command shows that about 7.5% of time is spent inside the initialize_[iv]table() functions.
For shared classes, the i/v tables are already initialized at dump time; so, at run time, the initialize_[iv]table() doesn't actually initialize the i/v tables. They just discover the loader constraints and call SystemDictionary::check_signature_loaders. See:
http://hg.openjdk.java.net/jdk/jdk/file/f280911d3427/src/hotspot/share/oops/klassVtable.cpp#l491
http://hg.openjdk.java.net/jdk/jdk/file/f280911d3427/src/hotspot/share/oops/klassVtable.cpp#l1229
The proposal is to save the loader constraints during dump time, so at run time we can call SystemDictionary::check_signature_loaders without executing initialize_[iv]table().
diff -r 2b1c2d378b0b src/share/vm/oops/instanceKlass.cpp
--- a/src/share/vm/oops/instanceKlass.cpp Tue Mar 21 14:14:06 2017 +0100
+++ b/src/share/vm/oops/instanceKlass.cpp Fri Apr 07 05:42:16 2017 -0700
@@ -619,7 +619,7 @@
// a shared class if the class is not loaded by the NULL classloader.
ClassLoaderData * loader_data = class_loader_data();
if (!(is_shared() &&
- loader_data->is_the_null_class_loader_data())) {
+ (loader_data->is_the_null_class_loader_data() || UseNewCode))) {
ResourceMark rm(THREAD);
vtable()->initialize_vtable(true, CHECK_false);
itable()->initialize_itable(true, CHECK_false);
Original: 702ms
Disabled: 653ms = ~9.2% faster
Profiling with the Linux "perf" command shows that about 7.5% of time is spent inside the initialize_[iv]table() functions.
For shared classes, the i/v tables are already initialized at dump time; so, at run time, the initialize_[iv]table() doesn't actually initialize the i/v tables. They just discover the loader constraints and call SystemDictionary::check_signature_loaders. See:
http://hg.openjdk.java.net/jdk/jdk/file/f280911d3427/src/hotspot/share/oops/klassVtable.cpp#l491
http://hg.openjdk.java.net/jdk/jdk/file/f280911d3427/src/hotspot/share/oops/klassVtable.cpp#l1229
The proposal is to save the loader constraints during dump time, so at run time we can call SystemDictionary::check_signature_loaders without executing initialize_[iv]table().
- blocks
-
JDK-8221828 New Invoke Bindings
- Draft
- relates to
-
JDK-8232222 Set state to 'linked' when an archived boot class is restored at runtime
- Closed
-
JDK-8242007 Cache custom class loader constraints to avoid re-initializing itable/vtable for shared classes
- Open
-
JDK-8178350 klassVtable and klassItable should be ValueObj
- Resolved
-
JDK-8244276 Zero and minimal VM build failure after JDK-8178349 (use of undeclared identifier 'SystemDictionaryShared')
- Resolved