Skip to content

Commit a4d8e29

Browse files
committed
Mark receiver objects of an instance method
Marking the receiver object of an instance method ensures that it is not collected by the garbage collector (GC) while the instance method is executing. If the receiver object is not marked, there is a risk that the GC might collect it. In such cases, finalization mechanisms, such as PhantomReferences and Cleaners, could indicate that the object has been collected while it is still in use. This issue is resolved if the receiver object is marked during the execution of its instance method. Fixes: ibmruntimes/Semeru-Runtimes#93 Signed-off-by: Babneet Singh <[email protected]>
1 parent 5e61a75 commit a4d8e29

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

runtime/stackmap/localmap.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,8 @@ j9localmap_LocalBitsForPC(J9PortLibrary * portLib, J9ROMClass * romClass, J9ROMM
478478

479479
mapAllLocals(portLib, romMethod, (PARALLEL_TYPE *) scratch, pc, resultArrayBase);
480480

481-
/* Ensure that the receiver is marked for all <init>()V methods */
482-
if ((J9_ARE_NO_BITS_SET(romMethod->modifiers, J9AccStatic)) && ('<' == J9UTF8_DATA(J9ROMMETHOD_NAME(romMethod))[0])) {
481+
/* Ensure that the receiver is marked for all instance methods. */
482+
if (J9_ARE_NO_BITS_SET(romMethod->modifiers, J9AccStatic)) {
483483
*resultArrayBase |= 1;
484484
}
485485

0 commit comments

Comments
 (0)