@@ -3036,7 +3036,7 @@ void AdapterHandlerLibrary::link_aot_adapters() {
30363036 * result in collision of adapter ids between AOT stored handlers and runtime generated handlers.
30373037 * To avoid such situation, initialize the _id_counter with the largest adapter id among the AOT stored handlers.
30383038 */
3039- _aot_adapter_handler_table.iterate ([&](AdapterHandlerEntry* entry) {
3039+ _aot_adapter_handler_table.iterate_all ([&](AdapterHandlerEntry* entry) {
30403040 assert (!entry->is_linked (), " AdapterHandlerEntry is already linked!" );
30413041 entry->link ();
30423042 max_id = MAX2 (max_id, entry->id ());
@@ -3388,34 +3388,44 @@ JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
33883388 FREE_C_HEAP_ARRAY (intptr_t , buf);
33893389JRT_END
33903390
3391+ const char * AdapterHandlerLibrary::name (AdapterHandlerEntry* handler) {
3392+ return handler->fingerprint ()->as_basic_args_string ();
3393+ }
3394+
3395+ uint32_t AdapterHandlerLibrary::id (AdapterHandlerEntry* handler) {
3396+ return handler->id ();
3397+ }
3398+
33913399bool AdapterHandlerLibrary::contains (const CodeBlob* b) {
33923400 bool found = false ;
33933401#if INCLUDE_CDS
33943402 if (AOTCodeCache::is_using_adapter ()) {
33953403 auto findblob_archived_table = [&] (AdapterHandlerEntry* handler) {
3396- return (found = (b == CodeCache::find_blob (handler->get_i2c_entry ())));
3404+ if (b == CodeCache::find_blob (handler->get_i2c_entry ())) {
3405+ found = true ;
3406+ return false ; // abort iteration
3407+ } else {
3408+ return true ; // keep looking
3409+ }
33973410 };
33983411 _aot_adapter_handler_table.iterate(findblob_archived_table);
33993412 }
34003413#endif // INCLUDE_CDS
34013414 if (!found) {
3402- auto findblob_runtime_table = [&] (AdapterFingerPrint* key, AdapterHandlerEntry* a) {
3403- return (found = (b == CodeCache::find_blob (a->get_i2c_entry ())));
3415+ auto findblob_runtime_table = [&] (AdapterFingerPrint* key, AdapterHandlerEntry* handler) {
3416+ if (b == CodeCache::find_blob (handler->get_i2c_entry ())) {
3417+ found = true ;
3418+ return false ; // abort iteration
3419+ } else {
3420+ return true ; // keep looking
3421+ }
34043422 };
34053423 assert_locked_or_safepoint (AdapterHandlerLibrary_lock);
34063424 _adapter_handler_table->iterate(findblob_runtime_table);
34073425 }
34083426 return found;
34093427}
34103428
3411- const char * AdapterHandlerLibrary::name (AdapterHandlerEntry* handler) {
3412- return handler->fingerprint ()->as_basic_args_string ();
3413- }
3414-
3415- uint32_t AdapterHandlerLibrary::id (AdapterHandlerEntry* handler) {
3416- return handler->id ();
3417- }
3418-
34193429void AdapterHandlerLibrary::print_handler_on (outputStream* st, const CodeBlob* b) {
34203430 bool found = false ;
34213431#if INCLUDE_CDS
@@ -3425,23 +3435,23 @@ void AdapterHandlerLibrary::print_handler_on(outputStream* st, const CodeBlob* b
34253435 found = true ;
34263436 st->print (" Adapter for signature: " );
34273437 handler->print_adapter_on (st);
3428- return true ;
3438+ return false ; // abort iteration
34293439 } else {
3430- return false ; // keep looking
3440+ return true ; // keep looking
34313441 }
34323442 };
34333443 _aot_adapter_handler_table.iterate(findblob_archived_table);
34343444 }
34353445#endif // INCLUDE_CDS
34363446 if (!found) {
3437- auto findblob_runtime_table = [&] (AdapterFingerPrint* key, AdapterHandlerEntry* a ) {
3438- if (b == CodeCache::find_blob (a ->get_i2c_entry ())) {
3447+ auto findblob_runtime_table = [&] (AdapterFingerPrint* key, AdapterHandlerEntry* handler ) {
3448+ if (b == CodeCache::find_blob (handler ->get_i2c_entry ())) {
34393449 found = true ;
34403450 st->print (" Adapter for signature: " );
3441- a ->print_adapter_on (st);
3442- return true ;
3451+ handler ->print_adapter_on (st);
3452+ return false ; // abort iteration
34433453 } else {
3444- return false ; // keep looking
3454+ return true ; // keep looking
34453455 }
34463456 };
34473457 assert_locked_or_safepoint (AdapterHandlerLibrary_lock);
0 commit comments