@@ -73,9 +73,11 @@ static J9UTF8 *
73
73
copyJ9UTF8 (const J9UTF8 *nameStr, TR_PersistentMemory *persistentMemory)
74
74
{
75
75
size_t nameSize = J9UTF8_TOTAL_SIZE (nameStr);
76
+
76
77
void *ptr = persistentMemory->allocatePersistentMemory (nameSize);
77
78
if (!ptr)
78
- throw std::bad_alloc ();
79
+ return NULL ;
80
+
79
81
memcpy (ptr, nameStr, nameSize);
80
82
return (J9UTF8 *)ptr;
81
83
}
@@ -233,17 +235,6 @@ TR_PersistentClassLoaderTable::associateClassLoaderWithClass(J9VMThread *vmThrea
233
235
}
234
236
}
235
237
236
- // If we are using the JITServer AOT cache and ignoring the local SCC, we need to remember the name of clazz
237
- // with or without chain. Otherwise (not using AOT cache or not ignoring the local SCC) there is no point in continuing
238
- // without a chain.
239
- if (!chain
240
- #if defined(J9VM_OPT_JITSERVER)
241
- && (!useAOTCache || !_persistentMemory->getPersistentInfo ()->getJITServerAOTCacheIgnoreLocalSCC ())
242
- #endif /* defined(J9VM_OPT_JITSERVER) */
243
- )
244
- return ;
245
- TR_ASSERT (!_sharedCache || !chain || _sharedCache->isPointerInSharedCache (chain), " Class chain must be in SCC" );
246
-
247
238
J9UTF8 *nameStr = NULL ;
248
239
#if defined(J9VM_OPT_JITSERVER)
249
240
if (useAOTCache)
@@ -252,6 +243,12 @@ TR_PersistentClassLoaderTable::associateClassLoaderWithClass(J9VMThread *vmThrea
252
243
}
253
244
#endif /* defined(J9VM_OPT_JITSERVER) */
254
245
246
+ // If we could not retrieve a chain for the class and could not retrieve a name for the class, then
247
+ // there is no point in continuing.
248
+ if (!chain && !nameStr)
249
+ return ;
250
+ TR_ASSERT (!_sharedCache || !chain || _sharedCache->isPointerInSharedCache (chain), " Class chain must be in SCC" );
251
+
255
252
info = new (_persistentMemory) TR_ClassLoaderInfo (loader, chain, nameStr);
256
253
if (!info)
257
254
{
@@ -293,7 +290,7 @@ TR_PersistentClassLoaderTable::associateClassLoaderWithClass(J9VMThread *vmThrea
293
290
}
294
291
295
292
#if defined(J9VM_OPT_JITSERVER)
296
- if (useAOTCache )
293
+ if (nameStr )
297
294
{
298
295
// Lookup by class name and check if it was already associated with another class loader
299
296
NameKey key { name, nameLength };
0 commit comments