117 ADD_EXCL("jdk/internal/module/Builder", "cachedVersion"); // D
118 ADD_EXCL("jdk/internal/module/ModuleLoaderMap$Mapper", "APP_CLASSLOADER", // A
119 "APP_LOADER_INDEX", // A
120 "PLATFORM_CLASSLOADER", // A
121 "PLATFORM_LOADER_INDEX"); // A
122 ADD_EXCL("jdk/internal/module/ServicesCatalog", "CLV"); // A
123
124 // This just points to an empty Map
125 ADD_EXCL("jdk/internal/reflect/Reflection", "methodFilterMap"); // E
126
127 // Integer for 0 and 1 are in java/lang/Integer$IntegerCache and are archived
128 ADD_EXCL("sun/invoke/util/ValueConversions", "ONE_INT", // E
129 "ZERO_INT"); // E
130
131 if (CDSConfig::is_dumping_invokedynamic()) {
132 ADD_EXCL("java/lang/invoke/InvokerBytecodeGenerator", "MEMBERNAME_FACTORY", // D
133 "CD_Object_array", // E same as <...>ConstantUtils.CD_Object_array::CD_Object
134 "INVOKER_SUPER_DESC"); // E same as java.lang.constant.ConstantDescs::CD_Object
135 }
136
137 # undef ADD_EXCL
138
139 ClassLoaderDataGraph::classes_do(this);
140 }
141
142 CDSHeapVerifier::~CDSHeapVerifier() {
143 if (_problems > 0) {
144 log_error(cds, heap)("Scanned %d objects. Found %d case(s) where "
145 "an object points to a static field that "
146 "may hold a different value at runtime.", _archived_objs, _problems);
147 MetaspaceShared::unrecoverable_writing_error();
148 }
149 }
150
151 class CDSHeapVerifier::CheckStaticFields : public FieldClosure {
152 CDSHeapVerifier* _verifier;
153 InstanceKlass* _ik; // The class whose static fields are being checked.
154 const char** _exclusions;
155 public:
156 CheckStaticFields(CDSHeapVerifier* verifier, InstanceKlass* ik)
157 : _verifier(verifier), _ik(ik) {
158 _exclusions = _verifier->find_exclusion(_ik);
159 }
160
161 void do_field(fieldDescriptor* fd) {
162 if (fd->field_type() != T_OBJECT) {
163 return;
164 }
165
166 if (fd->signature()->equals("Ljdk/internal/access/JavaLangAccess;")) {
167 // A few classes have static fields that point to SharedSecrets.getJavaLangAccess().
|
117 ADD_EXCL("jdk/internal/module/Builder", "cachedVersion"); // D
118 ADD_EXCL("jdk/internal/module/ModuleLoaderMap$Mapper", "APP_CLASSLOADER", // A
119 "APP_LOADER_INDEX", // A
120 "PLATFORM_CLASSLOADER", // A
121 "PLATFORM_LOADER_INDEX"); // A
122 ADD_EXCL("jdk/internal/module/ServicesCatalog", "CLV"); // A
123
124 // This just points to an empty Map
125 ADD_EXCL("jdk/internal/reflect/Reflection", "methodFilterMap"); // E
126
127 // Integer for 0 and 1 are in java/lang/Integer$IntegerCache and are archived
128 ADD_EXCL("sun/invoke/util/ValueConversions", "ONE_INT", // E
129 "ZERO_INT"); // E
130
131 if (CDSConfig::is_dumping_invokedynamic()) {
132 ADD_EXCL("java/lang/invoke/InvokerBytecodeGenerator", "MEMBERNAME_FACTORY", // D
133 "CD_Object_array", // E same as <...>ConstantUtils.CD_Object_array::CD_Object
134 "INVOKER_SUPER_DESC"); // E same as java.lang.constant.ConstantDescs::CD_Object
135 }
136
137 // These are used by BuiltinClassLoader::negativeLookupCache, etc but seem to be
138 // OK. TODO - we should completely disable the caching unless ArchiveLoaderLookupCache
139 // is enabled
140 ADD_EXCL("java/lang/Boolean", "TRUE", // E
141 "FALSE"); // E
142
143 # undef ADD_EXCL
144
145 ClassLoaderDataGraph::classes_do(this);
146 }
147
148 CDSHeapVerifier::~CDSHeapVerifier() {
149 if (_problems > 0) {
150 log_error(cds, heap)("Scanned %d objects. Found %d case(s) where "
151 "an object points to a static field that "
152 "may hold a different value at runtime.", _archived_objs, _problems);
153 //MetaspaceShared::unrecoverable_writing_error(); // FIXME -- leyden+JEP483 merge
154 }
155 }
156
157 class CDSHeapVerifier::CheckStaticFields : public FieldClosure {
158 CDSHeapVerifier* _verifier;
159 InstanceKlass* _ik; // The class whose static fields are being checked.
160 const char** _exclusions;
161 public:
162 CheckStaticFields(CDSHeapVerifier* verifier, InstanceKlass* ik)
163 : _verifier(verifier), _ik(ik) {
164 _exclusions = _verifier->find_exclusion(_ik);
165 }
166
167 void do_field(fieldDescriptor* fd) {
168 if (fd->field_type() != T_OBJECT) {
169 return;
170 }
171
172 if (fd->signature()->equals("Ljdk/internal/access/JavaLangAccess;")) {
173 // A few classes have static fields that point to SharedSecrets.getJavaLangAccess().
|