124 }
125 }
126
127 // ik is a candidate for aot-linking; see if it can really work
128 // that way, and return success or failure. Not only must ik itself
129 // look like a class that can be aot-linked but its supers must also be
130 // aot-linkable.
131 bool AOTClassLinker::try_add_candidate(InstanceKlass* ik) {
132 assert(is_initialized(), "sanity");
133 assert(CDSConfig::is_dumping_aot_linked_classes(), "sanity");
134
135 if (!SystemDictionaryShared::is_builtin(ik)) {
136 // not loaded by a class loader which we know about
137 return false;
138 }
139
140 if (is_candidate(ik)) { // already checked.
141 return true;
142 }
143
144 if (ik->is_hidden()) {
145 assert(ik->shared_class_loader_type() != ClassLoader::OTHER, "must have been set");
146 if (!CDSConfig::is_dumping_invokedynamic()) {
147 return false;
148 }
149 if (!SystemDictionaryShared::should_hidden_class_be_archived(ik)) {
150 return false;
151 }
152 if (HeapShared::is_lambda_proxy_klass(ik)) {
153 InstanceKlass* nest_host = ik->nest_host_not_null();
154 if (!try_add_candidate(nest_host)) {
155 ResourceMark rm;
156 log_warning(cds, aot, link)("%s cannot be aot-linked because it nest host is not aot-linked", ik->external_name());
157 return false;
158 }
159 }
160 }
161
162 InstanceKlass* s = ik->java_super();
163 if (s != nullptr && !try_add_candidate(s)) {
|
124 }
125 }
126
127 // ik is a candidate for aot-linking; see if it can really work
128 // that way, and return success or failure. Not only must ik itself
129 // look like a class that can be aot-linked but its supers must also be
130 // aot-linkable.
131 bool AOTClassLinker::try_add_candidate(InstanceKlass* ik) {
132 assert(is_initialized(), "sanity");
133 assert(CDSConfig::is_dumping_aot_linked_classes(), "sanity");
134
135 if (!SystemDictionaryShared::is_builtin(ik)) {
136 // not loaded by a class loader which we know about
137 return false;
138 }
139
140 if (is_candidate(ik)) { // already checked.
141 return true;
142 }
143
144 if (!ik->is_linked() && SystemDictionaryShared::has_class_failed_verification(ik)) {
145 return false;
146 }
147
148 /* should we allow old classes to be aot-linked ??? Probably ...
149 if (!k->can_be_verified_at_dumptime()) {
150 // linking old classes
151 return false;
152 }
153 */
154
155 if (ik->is_hidden()) {
156 assert(ik->shared_class_loader_type() != ClassLoader::OTHER, "must have been set");
157 if (!CDSConfig::is_dumping_invokedynamic()) {
158 return false;
159 }
160 if (!SystemDictionaryShared::should_hidden_class_be_archived(ik)) {
161 return false;
162 }
163 if (HeapShared::is_lambda_proxy_klass(ik)) {
164 InstanceKlass* nest_host = ik->nest_host_not_null();
165 if (!try_add_candidate(nest_host)) {
166 ResourceMark rm;
167 log_warning(cds, aot, link)("%s cannot be aot-linked because it nest host is not aot-linked", ik->external_name());
168 return false;
169 }
170 }
171 }
172
173 InstanceKlass* s = ik->java_super();
174 if (s != nullptr && !try_add_candidate(s)) {
|