Skip to content

Commit 3d8a0bb

Browse files
authored
Merge pull request #19146 from cjjdespres/0.44-no-throw
(0.44) Do not throw in ClassLoaderTable
2 parents 0cf2644 + d373efb commit 3d8a0bb

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

runtime/compiler/env/ClassLoaderTable.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ static J9UTF8 *
7373
copyJ9UTF8(const J9UTF8 *nameStr, TR_PersistentMemory *persistentMemory)
7474
{
7575
size_t nameSize = J9UTF8_TOTAL_SIZE(nameStr);
76+
7677
void *ptr = persistentMemory->allocatePersistentMemory(nameSize);
7778
if (!ptr)
78-
throw std::bad_alloc();
79+
return NULL;
80+
7981
memcpy(ptr, nameStr, nameSize);
8082
return (J9UTF8 *)ptr;
8183
}
@@ -233,17 +235,6 @@ TR_PersistentClassLoaderTable::associateClassLoaderWithClass(J9VMThread *vmThrea
233235
}
234236
}
235237

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-
247238
J9UTF8 *nameStr = NULL;
248239
#if defined(J9VM_OPT_JITSERVER)
249240
if (useAOTCache)
@@ -252,6 +243,12 @@ TR_PersistentClassLoaderTable::associateClassLoaderWithClass(J9VMThread *vmThrea
252243
}
253244
#endif /* defined(J9VM_OPT_JITSERVER) */
254245

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+
255252
info = new (_persistentMemory) TR_ClassLoaderInfo(loader, chain, nameStr);
256253
if (!info)
257254
{
@@ -293,7 +290,7 @@ TR_PersistentClassLoaderTable::associateClassLoaderWithClass(J9VMThread *vmThrea
293290
}
294291

295292
#if defined(J9VM_OPT_JITSERVER)
296-
if (useAOTCache)
293+
if (nameStr)
297294
{
298295
// Lookup by class name and check if it was already associated with another class loader
299296
NameKey key { name, nameLength };

0 commit comments

Comments
 (0)