Skip to content

Commit a843c7e

Browse files
authored
Merge pull request #20940 from babsingh/main13
Protect entryName from being collected by the GC
2 parents f86e3cb + 7a25263 commit a843c7e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

runtime/vm/bindnatv.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
#include "vm_internal.h"
2929
#include "j9cp.h"
3030
#include "j9consts.h"
31+
32+
#if JAVA_SPEC_VERSION >= 24
33+
#include "objhelp.h"
34+
#endif /* JAVA_SPEC_VERSION >= 24 */
35+
3136
#include "OutOfLineINL.hpp"
3237
#include "VMHelpers.hpp"
3338
#include "AtomicSupport.hpp"
@@ -1110,7 +1115,9 @@ lookupJNINative(J9VMThread *currentThread, J9NativeLibrary *nativeLibrary, J9Met
11101115
if (NULL != entryName) {
11111116
#if JAVA_SPEC_VERSION >= 24
11121117
J9ROMMethod *nativeROMMethod = J9_ROM_METHOD_FROM_RAM_METHOD(nativeMethod);
1118+
PUSH_OBJECT_IN_SPECIAL_FRAME(currentThread, entryName);
11131119
j9object_t javaName = mmFuncs->j9gc_createJavaLangStringWithUTFCache(currentThread, J9ROMMETHOD_NAME(nativeROMMethod));
1120+
entryName = POP_OBJECT_IN_SPECIAL_FRAME(currentThread);
11141121
if (NULL != javaName)
11151122
#endif /* JAVA_SPEC_VERSION >= 24 */
11161123
{

0 commit comments

Comments
 (0)