There's a "signers" field in the VM's InstanceKlass metadata which we simply store for the JDK. This field is in all of the classes whether they have signers or not. To save space, CVM moved the signers field out to Java in a WeakHashMap. We'd like to save space in Hotspot too especially for the cases where large applications load 300K classes. Can this be done?
Mail from Jiangli Zhou:
"We do handle signer differently in CVM. We moved signer reference into java code and use WeakHeashMap to keep referece of the signers. I remember we discussed with Coleen earlier this year. Following is from you after you looked into the code:
====================================
I looked at the code some more and figured out that the WeakHashMap works the way you would want. Each entry is a weakref to the key (the Class instance), so the entry stays around as long as the key does, and goes away once the key is gc'd. This is what you want. It saves you from having to explicitly remove the key from a regular HashMap when the Class unloads.
I think this would be a good memory optimization to apply. It allows you to get rid of the signers field for each instanceKlass. You just need to make sure it really is rare that setsigners() is ever called. Otherwise you end up using more memory for the WeakHashMap approach. "
- duplicates
-
JDK-8334772 Change Class::signers to an explicit field
-
- Resolved
-
- is blocked by
-
JDK-8035288 Make jvmti report references to signers as part of java/lang/Class optional
-
- Closed
-
-
JDK-8035292 Discontinue hprof format from reporting signers and protection domains in classes
-
- Closed
-
- relates to
-
JDK-8015308 Fix SA to get protection domain and signers out of JavaMirror
-
- Closed
-
-
JDK-8268242 Deprecate JVM TI Heap functions 1.0
-
- Closed
-
-
JDK-8336804 Drop callback from class to its signers with ref kind JVMTI_HEAP_REFERENCE_SIGNERS
-
- Open
-
-
JDK-8276889 Improve compatibility discussion in instanceKlass.cpp
-
- Resolved
-