< prev index next >

src/hotspot/share/cds/aotClassLinker.cpp

Print this page

119   }
120 }
121 
122 // ik is a candidate for aot-linking; see if it can really work
123 // that way, and return success or failure. Not only must ik itself
124 // look like a class that can be aot-linked but its supers must also be
125 // aot-linkable.
126 bool AOTClassLinker::try_add_candidate(InstanceKlass* ik) {
127   assert(is_initialized(), "sanity");
128   assert(CDSConfig::is_dumping_aot_linked_classes(), "sanity");
129 
130   if (!SystemDictionaryShared::is_builtin(ik)) {
131     // not loaded by a class loader which we know about
132     return false;
133   }
134 
135   if (is_candidate(ik)) { // already checked.
136     return true;
137   }
138 




139   if (ik->is_hidden()) {
140     assert(!ik->defined_by_other_loaders(), "hidden classes are archived only for builtin loaders");
141     if (!CDSConfig::is_dumping_method_handles()) {
142       return false;
143     }
144     if (HeapShared::is_lambda_proxy_klass(ik)) {
145       InstanceKlass* nest_host = ik->nest_host_not_null();
146       if (!try_add_candidate(nest_host)) {
147         ResourceMark rm;
148         log_warning(aot, link)("%s cannot be aot-linked because it nest host is not aot-linked", ik->external_name());
149         return false;
150       }
151     }
152   }
153 
154   InstanceKlass* s = ik->java_super();
155   if (s != nullptr && !try_add_candidate(s)) {
156     return false;
157   }
158 

119   }
120 }
121 
122 // ik is a candidate for aot-linking; see if it can really work
123 // that way, and return success or failure. Not only must ik itself
124 // look like a class that can be aot-linked but its supers must also be
125 // aot-linkable.
126 bool AOTClassLinker::try_add_candidate(InstanceKlass* ik) {
127   assert(is_initialized(), "sanity");
128   assert(CDSConfig::is_dumping_aot_linked_classes(), "sanity");
129 
130   if (!SystemDictionaryShared::is_builtin(ik)) {
131     // not loaded by a class loader which we know about
132     return false;
133   }
134 
135   if (is_candidate(ik)) { // already checked.
136     return true;
137   }
138 
139   if (!ik->is_linked() && SystemDictionaryShared::has_class_failed_verification(ik)) {
140     return false;
141   }
142 
143   if (ik->is_hidden()) {
144     assert(!ik->defined_by_other_loaders(), "hidden classes are archived only for builtin loaders");
145     if (!CDSConfig::is_dumping_method_handles()) {
146       return false;
147     }
148     if (HeapShared::is_lambda_proxy_klass(ik)) {
149       InstanceKlass* nest_host = ik->nest_host_not_null();
150       if (!try_add_candidate(nest_host)) {
151         ResourceMark rm;
152         log_warning(aot, link)("%s cannot be aot-linked because it nest host is not aot-linked", ik->external_name());
153         return false;
154       }
155     }
156   }
157 
158   InstanceKlass* s = ik->java_super();
159   if (s != nullptr && !try_add_candidate(s)) {
160     return false;
161   }
162 
< prev index next >