Skip to content

Commit

Permalink
Merge pull request eclipse-openj9#20597 from midronij/stackwalk-fix-g…
Browse files Browse the repository at this point in the history
…cAPI

Fix stackwalker calculation of object displacement for Offheap
  • Loading branch information
zl-wang authored Nov 23, 2024
2 parents 26e4c49 + bdc9592 commit 3da9d2f
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions runtime/compiler/runtime/MethodMetaData.c
Original file line number Diff line number Diff line change
Expand Up @@ -1403,24 +1403,19 @@ void walkJITFrameSlotsForInternalPointers(J9StackWalkState * walkState, U_8 **
J9Object ** currPinningArrayCursor = (J9Object **) (((U_8 *) walkState->bp) + (offsetOfFirstInternalPtr + (((U_16) currPinningArrayIndex * sizeof(UDATA)))));
J9Object *oldPinningArrayAddress = *((J9Object **) currPinningArrayCursor);
J9Object * newPinningArrayAddress;
void *oldDataAddr = 0, *newDataAddr = 0;
if (offHeapAllocationEnabled && oldPinningArrayAddress)
oldDataAddr = walkState->walkThread->javaVM->memoryManagerFunctions->j9gc_objaccess_getArrayObjectDataAddress(walkState->walkThread, (J9IndexableObject*)oldPinningArrayAddress);
IDATA displacement = 0;


#ifdef J9VM_INTERP_STACKWALK_TRACING
swPrintf(walkState, 6, "Before object slot walk &address : %p address : %p bp %p offset of first internal ptr %d\n", currPinningArrayCursor, oldPinningArrayAddress, walkState->bp, offsetOfFirstInternalPtr);
#endif
walkState->objectSlotWalkFunction(walkState->walkThread, walkState, currPinningArrayCursor, currPinningArrayCursor);
newPinningArrayAddress = *((J9Object **) currPinningArrayCursor);
if (offHeapAllocationEnabled && newPinningArrayAddress)
{
newDataAddr = walkState->walkThread->javaVM->memoryManagerFunctions->j9gc_objaccess_getArrayObjectDataAddress(walkState->walkThread, (J9IndexableObject*)newPinningArrayAddress);
displacement = (IDATA) (((UDATA)newDataAddr) - ((UDATA)oldDataAddr));
}
else
displacement = (IDATA) (((UDATA)newPinningArrayAddress) - ((UDATA)oldPinningArrayAddress));

IDATA displacement = 0;

if (newPinningArrayAddress)
displacement = walkState->walkThread->javaVM->memoryManagerFunctions->j9gc_objaccess_indexableDataDisplacement(walkState->walkThread, (J9IndexableObject*)oldPinningArrayAddress, (J9IndexableObject*)newPinningArrayAddress);

++(walkState->slotIndex);

#ifdef J9VM_INTERP_STACKWALK_TRACING
Expand Down

0 comments on commit 3da9d2f

Please sign in to comment.