1 /*
2 * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "cds/aotClassLinker.hpp"
26 #include "cds/aotConstantPoolResolver.hpp"
27 #include "cds/archiveBuilder.hpp"
28 #include "cds/cdsConfig.hpp"
29 #include "classfile/systemDictionary.hpp"
30 #include "classfile/systemDictionaryShared.hpp"
31 #include "classfile/vmClasses.hpp"
32 #include "interpreter/bytecodeStream.hpp"
33 #include "interpreter/interpreterRuntime.hpp"
34 #include "memory/resourceArea.hpp"
35 #include "oops/constantPool.inline.hpp"
36 #include "oops/instanceKlass.hpp"
37 #include "oops/klass.inline.hpp"
38 #include "runtime/handles.inline.hpp"
39
40 // Returns true if we CAN PROVE that cp_index will always resolve to
41 // the same information at both dump time and run time. This is a
42 // necessary (but not sufficient) condition for pre-resolving cp_index
43 // during CDS archive assembly.
44 bool AOTConstantPoolResolver::is_resolution_deterministic(ConstantPool* cp, int cp_index) {
45 assert(!is_in_archivebuilder_buffer(cp), "sanity");
46
47 if (cp->tag_at(cp_index).is_klass()) {
48 // We require cp_index to be already resolved. This is fine for now, are we
49 // currently archive only CP entries that are already resolved.
50 Klass* resolved_klass = cp->resolved_klass_at(cp_index);
51 return resolved_klass != nullptr && is_class_resolution_deterministic(cp->pool_holder(), resolved_klass);
52 } else if (cp->tag_at(cp_index).is_invoke_dynamic()) {
53 return is_indy_resolution_deterministic(cp, cp_index);
54 } else if (cp->tag_at(cp_index).is_field() ||
55 cp->tag_at(cp_index).is_method() ||
56 cp->tag_at(cp_index).is_interface_method()) {
57 int klass_cp_index = cp->uncached_klass_ref_index_at(cp_index);
58 if (!cp->tag_at(klass_cp_index).is_klass()) {
59 // Not yet resolved
60 return false;
61 }
62 Klass* k = cp->resolved_klass_at(klass_cp_index);
63 if (!is_class_resolution_deterministic(cp->pool_holder(), k)) {
64 return false;
65 }
66
67 if (!k->is_instance_klass()) {
68 // TODO: support non instance klasses as well.
69 return false;
70 }
71
72 // Here, We don't check if this entry can actually be resolved to a valid Field/Method.
73 // This method should be called by the ConstantPool to check Fields/Methods that
74 // have already been successfully resolved.
75 return true;
76 } else {
77 return false;
78 }
79 }
80
81 bool AOTConstantPoolResolver::is_class_resolution_deterministic(InstanceKlass* cp_holder, Klass* resolved_class) {
82 assert(!is_in_archivebuilder_buffer(cp_holder), "sanity");
83 assert(!is_in_archivebuilder_buffer(resolved_class), "sanity");
84
85 if (resolved_class->is_instance_klass()) {
86 InstanceKlass* ik = InstanceKlass::cast(resolved_class);
87
88 if (!ik->in_aot_cache() && SystemDictionaryShared::is_excluded_class(ik)) {
89 return false;
90 }
91
92 if (cp_holder->is_subtype_of(ik)) {
93 // All super types of ik will be resolved in ik->class_loader() before
94 // ik is defined in this loader, so it's safe to archive the resolved klass reference.
95 return true;
96 }
97
98 if (CDSConfig::is_dumping_aot_linked_classes()) {
99 // Need to call try_add_candidate instead of is_candidate, as this may be called
100 // before AOTClassLinker::add_candidates().
101 if (AOTClassLinker::try_add_candidate(ik)) {
102 return true;
103 } else {
104 return false;
105 }
106 } else if (AOTClassLinker::is_vm_class(ik)) {
107 if (ik->class_loader() != cp_holder->class_loader()) {
108 // At runtime, cp_holder() may not be able to resolve to the same
109 // ik. For example, a different version of ik may be defined in
110 // cp->pool_holder()'s loader using MethodHandles.Lookup.defineClass().
111 return false;
112 } else {
113 return true;
114 }
115 } else {
116 return false;
117 }
118 } else if (resolved_class->is_objArray_klass()) {
119 Klass* elem = ObjArrayKlass::cast(resolved_class)->bottom_klass();
120 if (elem->is_instance_klass()) {
121 return is_class_resolution_deterministic(cp_holder, InstanceKlass::cast(elem));
122 } else if (elem->is_typeArray_klass()) {
123 return true;
124 } else {
125 return false;
126 }
127 } else if (resolved_class->is_typeArray_klass()) {
128 return true;
129 } else {
130 return false;
131 }
132 }
133
134 void AOTConstantPoolResolver::preresolve_string_cp_entries(InstanceKlass* ik, TRAPS) {
135 if (!ik->is_linked()) {
136 // The cp->resolved_referenced() array is not ready yet, so we can't call resolve_string().
137 return;
138 }
139 constantPoolHandle cp(THREAD, ik->constants());
140 for (int cp_index = 1; cp_index < cp->length(); cp_index++) { // Index 0 is unused
141 switch (cp->tag_at(cp_index).value()) {
142 case JVM_CONSTANT_String:
143 resolve_string(cp, cp_index, CHECK); // may throw OOM when interning strings.
144 break;
145 }
146 }
147 }
148
149 // This works only for the boot/platform/app loaders
150 Klass* AOTConstantPoolResolver::find_loaded_class(Thread* current, oop class_loader, Symbol* name) {
151 HandleMark hm(current);
152 Handle h_loader(current, class_loader);
153 Klass* k = SystemDictionary::find_instance_or_array_klass(current, name, h_loader);
154 if (k != nullptr) {
155 return k;
156 }
157 if (h_loader() == SystemDictionary::java_system_loader()) {
158 return find_loaded_class(current, SystemDictionary::java_platform_loader(), name);
159 } else if (h_loader() == SystemDictionary::java_platform_loader()) {
160 return find_loaded_class(current, nullptr, name);
161 } else {
162 assert(h_loader() == nullptr, "This function only works for boot/platform/app loaders %p %p %p",
163 cast_from_oop<address>(h_loader()),
164 cast_from_oop<address>(SystemDictionary::java_system_loader()),
165 cast_from_oop<address>(SystemDictionary::java_platform_loader()));
166 }
167
168 return nullptr;
169 }
170
171 Klass* AOTConstantPoolResolver::find_loaded_class(Thread* current, ConstantPool* cp, int class_cp_index) {
172 Symbol* name = cp->klass_name_at(class_cp_index);
173 return find_loaded_class(current, cp->pool_holder()->class_loader(), name);
174 }
175
176 #if INCLUDE_CDS_JAVA_HEAP
177 void AOTConstantPoolResolver::resolve_string(constantPoolHandle cp, int cp_index, TRAPS) {
178 if (CDSConfig::is_dumping_heap()) {
179 int cache_index = cp->cp_to_object_index(cp_index);
180 ConstantPool::string_at_impl(cp, cp_index, cache_index, CHECK);
181 }
182 }
183 #endif
184
185 void AOTConstantPoolResolver::preresolve_class_cp_entries(JavaThread* current, InstanceKlass* ik, GrowableArray<bool>* preresolve_list) {
186 if (!SystemDictionaryShared::is_builtin_loader(ik->class_loader_data())) {
187 return;
188 }
189
190 JavaThread* THREAD = current;
191 constantPoolHandle cp(THREAD, ik->constants());
192 for (int cp_index = 1; cp_index < cp->length(); cp_index++) {
193 if (cp->tag_at(cp_index).value() == JVM_CONSTANT_UnresolvedClass) {
194 if (preresolve_list != nullptr && preresolve_list->at(cp_index) == false) {
195 // This class was not resolved during trial run. Don't attempt to resolve it. Otherwise
196 // the compiler may generate less efficient code.
197 continue;
198 }
199 if (find_loaded_class(current, cp(), cp_index) == nullptr) {
200 // Do not resolve any class that has not been loaded yet
201 continue;
202 }
203 Klass* resolved_klass = cp->klass_at(cp_index, THREAD);
204 if (HAS_PENDING_EXCEPTION) {
205 CLEAR_PENDING_EXCEPTION; // just ignore
206 } else {
207 log_trace(aot, resolve)("Resolved class [%3d] %s -> %s", cp_index, ik->external_name(),
208 resolved_klass->external_name());
209 }
210 }
211 }
212 }
213
214 void AOTConstantPoolResolver::preresolve_field_and_method_cp_entries(JavaThread* current, InstanceKlass* ik, GrowableArray<bool>* preresolve_list) {
215 JavaThread* THREAD = current;
216 constantPoolHandle cp(THREAD, ik->constants());
217 if (cp->cache() == nullptr) {
218 return;
219 }
220 for (int i = 0; i < ik->methods()->length(); i++) {
221 Method* m = ik->methods()->at(i);
222 BytecodeStream bcs(methodHandle(THREAD, m));
223 while (!bcs.is_last_bytecode()) {
224 bcs.next();
225 Bytecodes::Code raw_bc = bcs.raw_code();
226 switch (raw_bc) {
227 case Bytecodes::_getfield:
228 // no-fast bytecode
229 case Bytecodes::_nofast_getfield:
230 // fast bytecodes
231 case Bytecodes::_fast_agetfield:
232 case Bytecodes::_fast_bgetfield:
233 case Bytecodes::_fast_cgetfield:
234 case Bytecodes::_fast_dgetfield:
235 case Bytecodes::_fast_fgetfield:
236 case Bytecodes::_fast_igetfield:
237 case Bytecodes::_fast_lgetfield:
238 case Bytecodes::_fast_sgetfield:
239 raw_bc = Bytecodes::_getfield;
240 maybe_resolve_fmi_ref(ik, m, raw_bc, bcs.get_index_u2(), preresolve_list, THREAD);
241 if (HAS_PENDING_EXCEPTION) {
242 CLEAR_PENDING_EXCEPTION; // just ignore
243 }
244 break;
245
246 case Bytecodes::_putfield:
247 // no-fast bytecode
248 case Bytecodes::_nofast_putfield:
249 // fast bytecodes
250 case Bytecodes::_fast_aputfield:
251 case Bytecodes::_fast_bputfield:
252 case Bytecodes::_fast_zputfield:
253 case Bytecodes::_fast_cputfield:
254 case Bytecodes::_fast_dputfield:
255 case Bytecodes::_fast_fputfield:
256 case Bytecodes::_fast_iputfield:
257 case Bytecodes::_fast_lputfield:
258 case Bytecodes::_fast_sputfield:
259 raw_bc = Bytecodes::_putfield;
260 maybe_resolve_fmi_ref(ik, m, raw_bc, bcs.get_index_u2(), preresolve_list, THREAD);
261 if (HAS_PENDING_EXCEPTION) {
262 CLEAR_PENDING_EXCEPTION; // just ignore
263 }
264 break;
265 case Bytecodes::_invokehandle:
266 case Bytecodes::_invokespecial:
267 case Bytecodes::_invokevirtual:
268 case Bytecodes::_invokeinterface:
269 maybe_resolve_fmi_ref(ik, m, raw_bc, bcs.get_index_u2(), preresolve_list, THREAD);
270 if (HAS_PENDING_EXCEPTION) {
271 CLEAR_PENDING_EXCEPTION; // just ignore
272 }
273 break;
274 default:
275 break;
276 }
277 }
278 }
279 }
280
281 void AOTConstantPoolResolver::maybe_resolve_fmi_ref(InstanceKlass* ik, Method* m, Bytecodes::Code bc, int raw_index,
282 GrowableArray<bool>* preresolve_list, TRAPS) {
283 methodHandle mh(THREAD, m);
284 constantPoolHandle cp(THREAD, ik->constants());
285 HandleMark hm(THREAD);
286 int cp_index = cp->to_cp_index(raw_index, bc);
287
288 if (cp->is_resolved(raw_index, bc)) {
289 return;
290 }
291
292 if (preresolve_list != nullptr && preresolve_list->at(cp_index) == false) {
293 // This field wasn't resolved during the trial run. Don't attempt to resolve it. Otherwise
294 // the compiler may generate less efficient code.
295 return;
296 }
297
298 int klass_cp_index = cp->uncached_klass_ref_index_at(cp_index);
299 if (find_loaded_class(THREAD, cp(), klass_cp_index) == nullptr) {
300 // Do not resolve any field/methods from a class that has not been loaded yet.
301 return;
302 }
303
304 Klass* resolved_klass = cp->klass_ref_at(raw_index, bc, CHECK);
305
306 switch (bc) {
307 case Bytecodes::_getfield:
308 case Bytecodes::_putfield:
309 InterpreterRuntime::resolve_get_put(bc, raw_index, mh, cp, false /*initialize_holder*/, CHECK);
310 break;
311
312 case Bytecodes::_invokevirtual:
313 case Bytecodes::_invokespecial:
314 case Bytecodes::_invokeinterface:
315 InterpreterRuntime::cds_resolve_invoke(bc, raw_index, cp, CHECK);
316 break;
317
318 case Bytecodes::_invokehandle:
319 InterpreterRuntime::cds_resolve_invokehandle(raw_index, cp, CHECK);
320 break;
321
322 default:
323 ShouldNotReachHere();
324 }
325
326 if (log_is_enabled(Trace, aot, resolve)) {
327 ResourceMark rm(THREAD);
328 bool resolved = cp->is_resolved(raw_index, bc);
329 Symbol* name = cp->name_ref_at(raw_index, bc);
330 Symbol* signature = cp->signature_ref_at(raw_index, bc);
331 log_trace(aot, resolve)("%s %s [%3d] %s -> %s.%s:%s",
332 (resolved ? "Resolved" : "Failed to resolve"),
333 Bytecodes::name(bc), cp_index, ik->external_name(),
334 resolved_klass->external_name(),
335 name->as_C_string(), signature->as_C_string());
336 }
337 }
338
339 void AOTConstantPoolResolver::preresolve_indy_cp_entries(JavaThread* current, InstanceKlass* ik, GrowableArray<bool>* preresolve_list) {
340 JavaThread* THREAD = current;
341 constantPoolHandle cp(THREAD, ik->constants());
342 if (!CDSConfig::is_dumping_invokedynamic() || cp->cache() == nullptr) {
343 return;
344 }
345
346 assert(preresolve_list != nullptr, "preresolve_indy_cp_entries() should not be called for "
347 "regenerated LambdaForm Invoker classes, which should not have indys anyway.");
348
349 Array<ResolvedIndyEntry>* indy_entries = cp->cache()->resolved_indy_entries();
350 for (int i = 0; i < indy_entries->length(); i++) {
351 ResolvedIndyEntry* rie = indy_entries->adr_at(i);
352 int cp_index = rie->constant_pool_index();
353 if (preresolve_list->at(cp_index) == true) {
354 if (!rie->is_resolved() && is_indy_resolution_deterministic(cp(), cp_index)) {
355 InterpreterRuntime::cds_resolve_invokedynamic(i, cp, THREAD);
356 if (HAS_PENDING_EXCEPTION) {
357 CLEAR_PENDING_EXCEPTION; // just ignore
358 }
359 }
360 if (log_is_enabled(Trace, aot, resolve)) {
361 ResourceMark rm(THREAD);
362 log_trace(aot, resolve)("%s indy [%3d] %s",
363 rie->is_resolved() ? "Resolved" : "Failed to resolve",
364 cp_index, ik->external_name());
365 }
366 }
367 }
368 }
369
370 // Check the MethodType signatures used by parameters to the indy BSMs. Make sure we don't
371 // use types that have been excluded, or else we might end up creating MethodTypes that cannot be stored
372 // in the AOT cache.
373 bool AOTConstantPoolResolver::check_methodtype_signature(ConstantPool* cp, Symbol* sig, Klass** return_type_ret) {
374 ResourceMark rm;
375 for (SignatureStream ss(sig); !ss.is_done(); ss.next()) {
376 if (ss.is_reference()) {
377 Symbol* type = ss.as_symbol();
378 Klass* k = find_loaded_class(Thread::current(), cp->pool_holder()->class_loader(), type);
379 if (k == nullptr) {
380 return false;
381 }
382
383 if (SystemDictionaryShared::should_be_excluded(k)) {
384 if (log_is_enabled(Warning, aot, resolve)) {
385 ResourceMark rm;
386 log_warning(aot, resolve)("Cannot aot-resolve Lambda proxy because %s is excluded", k->external_name());
387 }
388 return false;
389 }
390
391 if (ss.at_return_type() && return_type_ret != nullptr) {
392 *return_type_ret = k;
393 }
394 }
395 }
396 return true;
397 }
398
399 bool AOTConstantPoolResolver::check_lambda_metafactory_signature(ConstantPool* cp, Symbol* sig) {
400 Klass* k;
401 if (!check_methodtype_signature(cp, sig, &k)) {
402 return false;
403 }
404
405 // <k> is the interface type implemented by the lambda proxy
406 if (!k->is_interface()) {
407 // cp->pool_holder() doesn't look like a valid class generated by javac
408 return false;
409 }
410
411
412 // The linked lambda callsite has an instance of the interface implemented by this lambda. If this
413 // interface requires its <clinit> to be executed, then we must delay the execution to the production run
414 // as <clinit> can have side effects ==> exclude such cases.
415 InstanceKlass* intf = InstanceKlass::cast(k);
416 bool exclude = intf->interface_needs_clinit_execution_as_super();
417 if (log_is_enabled(Debug, aot, resolve)) {
418 ResourceMark rm;
419 log_debug(aot, resolve)("%s aot-resolve Lambda proxy of interface type %s",
420 exclude ? "Cannot" : "Can", k->external_name());
421 }
422 return !exclude;
423 }
424
425 bool AOTConstantPoolResolver::check_lambda_metafactory_methodtype_arg(ConstantPool* cp, int bsms_attribute_index, int arg_i) {
426 int mt_index = cp->bsm_attribute_entry(bsms_attribute_index)->argument_index(arg_i);
427 if (!cp->tag_at(mt_index).is_method_type()) {
428 // malformed class?
429 return false;
430 }
431
432 Symbol* sig = cp->method_type_signature_at(mt_index);
433 if (log_is_enabled(Debug, aot, resolve)) {
434 ResourceMark rm;
435 log_debug(aot, resolve)("Checking MethodType for LambdaMetafactory BSM arg %d: %s", arg_i, sig->as_C_string());
436 }
437
438 return check_methodtype_signature(cp, sig);
439 }
440
441 bool AOTConstantPoolResolver::check_lambda_metafactory_methodhandle_arg(ConstantPool* cp, int bsms_attribute_index, int arg_i) {
442 int mh_index = cp->bsm_attribute_entry(bsms_attribute_index)->argument_index(arg_i);
443 if (!cp->tag_at(mh_index).is_method_handle()) {
444 // malformed class?
445 return false;
446 }
447
448 Symbol* sig = cp->method_handle_signature_ref_at(mh_index);
449 if (log_is_enabled(Debug, aot, resolve)) {
450 ResourceMark rm;
451 log_debug(aot, resolve)("Checking MethodType of MethodHandle for LambdaMetafactory BSM arg %d: %s", arg_i, sig->as_C_string());
452 }
453 return check_methodtype_signature(cp, sig);
454 }
455
456 bool AOTConstantPoolResolver::is_indy_resolution_deterministic(ConstantPool* cp, int cp_index) {
457 assert(cp->tag_at(cp_index).is_invoke_dynamic(), "sanity");
458 if (!CDSConfig::is_dumping_invokedynamic()) {
459 return false;
460 }
461
462 InstanceKlass* pool_holder = cp->pool_holder();
463 if (!SystemDictionaryShared::is_builtin(pool_holder)) {
464 return false;
465 }
466
467 int bsm = cp->bootstrap_method_ref_index_at(cp_index);
468 int bsm_ref = cp->method_handle_index_at(bsm);
469 Symbol* bsm_name = cp->uncached_name_ref_at(bsm_ref);
470 Symbol* bsm_signature = cp->uncached_signature_ref_at(bsm_ref);
471 Symbol* bsm_klass = cp->klass_name_at(cp->uncached_klass_ref_index_at(bsm_ref));
472
473 // We currently support only StringConcatFactory::makeConcatWithConstants() and LambdaMetafactory::metafactory()
474 // We should mark the allowed BSMs in the JDK code using a private annotation.
475 // See notes on RFE JDK-8342481.
476
477 if (bsm_klass->equals("java/lang/invoke/StringConcatFactory") &&
478 bsm_name->equals("makeConcatWithConstants") &&
479 bsm_signature->equals("(Ljava/lang/invoke/MethodHandles$Lookup;"
480 "Ljava/lang/String;"
481 "Ljava/lang/invoke/MethodType;"
482 "Ljava/lang/String;"
483 "[Ljava/lang/Object;"
484 ")Ljava/lang/invoke/CallSite;")) {
485 Symbol* factory_type_sig = cp->uncached_signature_ref_at(cp_index);
486 if (log_is_enabled(Debug, aot, resolve)) {
487 ResourceMark rm;
488 log_debug(aot, resolve)("Checking StringConcatFactory callsite signature [%d]: %s", cp_index, factory_type_sig->as_C_string());
489 }
490
491 Klass* k;
492 if (!check_methodtype_signature(cp, factory_type_sig, &k)) {
493 return false;
494 }
495 if (k != vmClasses::String_klass()) {
496 // bad class file?
497 return false;
498 }
499
500 return true;
501 }
502
503 if (bsm_klass->equals("java/lang/invoke/LambdaMetafactory") &&
504 bsm_name->equals("metafactory") &&
505 bsm_signature->equals("(Ljava/lang/invoke/MethodHandles$Lookup;"
506 "Ljava/lang/String;"
507 "Ljava/lang/invoke/MethodType;"
508 "Ljava/lang/invoke/MethodType;"
509 "Ljava/lang/invoke/MethodHandle;"
510 "Ljava/lang/invoke/MethodType;"
511 ")Ljava/lang/invoke/CallSite;")) {
512 /*
513 * An indy callsite is associated with the following MethodType and MethodHandles:
514 *
515 * https://github.com/openjdk/jdk/blob/580eb62dc097efeb51c76b095c1404106859b673/src/java.base/share/classes/java/lang/invoke/LambdaMetafactory.java#L293-L309
516 *
517 * MethodType factoryType The expected signature of the {@code CallSite}. The
518 * parameter types represent the types of capture variables;
519 * the return type is the interface to implement. When
520 * used with {@code invokedynamic}, this is provided by
521 * the {@code NameAndType} of the {@code InvokeDynamic}
522 *
523 * MethodType interfaceMethodType Signature and return type of method to be
524 * implemented by the function object.
525 *
526 * MethodHandle implementation A direct method handle describing the implementation
527 * method which should be called (with suitable adaptation
528 * of argument types and return types, and with captured
529 * arguments prepended to the invocation arguments) at
530 * invocation time.
531 *
532 * MethodType dynamicMethodType The signature and return type that should
533 * be enforced dynamically at invocation time.
534 * In simple use cases this is the same as
535 * {@code interfaceMethodType}.
536 */
537 Symbol* factory_type_sig = cp->uncached_signature_ref_at(cp_index);
538 if (log_is_enabled(Debug, aot, resolve)) {
539 ResourceMark rm;
540 log_debug(aot, resolve)("Checking lambda callsite signature [%d]: %s", cp_index, factory_type_sig->as_C_string());
541 }
542
543 if (!check_lambda_metafactory_signature(cp, factory_type_sig)) {
544 return false;
545 }
546
547 int bsms_attribute_index = cp->bootstrap_methods_attribute_index(cp_index);
548 int arg_count = cp->bsm_attribute_entry(bsms_attribute_index)->argument_count();
549 if (arg_count != 3) {
550 // Malformed class?
551 return false;
552 }
553
554 // interfaceMethodType
555 if (!check_lambda_metafactory_methodtype_arg(cp, bsms_attribute_index, 0)) {
556 return false;
557 }
558
559 // implementation
560 if (!check_lambda_metafactory_methodhandle_arg(cp, bsms_attribute_index, 1)) {
561 return false;
562 }
563
564 // dynamicMethodType
565 if (!check_lambda_metafactory_methodtype_arg(cp, bsms_attribute_index, 2)) {
566 return false;
567 }
568
569 return true;
570 }
571
572 return false;
573 }
574 #ifdef ASSERT
575 bool AOTConstantPoolResolver::is_in_archivebuilder_buffer(address p) {
576 if (!Thread::current()->is_VM_thread() || ArchiveBuilder::current() == nullptr) {
577 return false;
578 } else {
579 return ArchiveBuilder::current()->is_in_buffer_space(p);
580 }
581 }
582 #endif