From 8282e0f9e016c68a73108c98f9cbb2b4fe1c4c38 Mon Sep 17 00:00:00 2001 From: Marius Pirvu Date: Fri, 17 Jan 2025 04:31:30 -0500 Subject: [PATCH] Fixes to IProfiler fanin data collection Interpreter profiler data collection contained two bugs which are fixed by this commit. Signed-off-by: Marius Pirvu --- runtime/compiler/runtime/IProfiler.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/runtime/compiler/runtime/IProfiler.cpp b/runtime/compiler/runtime/IProfiler.cpp index af7d6c3d998..62fc21e2f7c 100644 --- a/runtime/compiler/runtime/IProfiler.cpp +++ b/runtime/compiler/runtime/IProfiler.cpp @@ -4313,18 +4313,20 @@ UDATA TR_IProfiler::parseBuffer(J9VMThread * vmThread, const U_8* dataStart, UDA if (fanInDisabled) break; J9ConstantPool* ramCP = J9_CP_FROM_METHOD(caller); - uint16_t cpIndex = readU16(pc + 1); + // Read the cpIndex (or the index into the split table) and extend it to UDATA. + // The extension is needed because J9_STATIC_SPLIT_TABLE_INDEX_FLAG and + // J9_SPECIAL_SPLIT_TABLE_INDEX_FLAG do not fit on 16 bits. + UDATA cpIndex = readU16(pc + 1); - if (JBinvokestaticsplit == cpIndex) + // For split bytecodes, the cpIndex is actually the index into the split table. + if (JBinvokestaticsplit == *pc) cpIndex |= J9_STATIC_SPLIT_TABLE_INDEX_FLAG; - if (JBinvokespecialsplit == cpIndex) + if (JBinvokespecialsplit == *pc) cpIndex |= J9_SPECIAL_SPLIT_TABLE_INDEX_FLAG; - J9Method * callee = jitGetJ9MethodUsingIndex(vmThread, ramCP, cpIndex); + J9Method *callee = jitGetJ9MethodUsingIndex(vmThread, ramCP, cpIndex); - if (callee == NULL) - { + if (!callee) break; - } uint32_t offset = (uint32_t) (pc - caller->bytecodes); findOrCreateMethodEntry(caller, callee , true ,offset);