Skip to content

Commit

Permalink
Get hashCode from JLM
Browse files Browse the repository at this point in the history
Fixes: eclipse-openj9#56

Signed-off-by: Ravali Yatham <[email protected]>
  • Loading branch information
yathamravali committed May 21, 2021
1 parent 0bf87b6 commit 28d0214
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion perf-tool/src/agentOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ void modifyJLM(const std::string& function, const std::string& command)
auto javaMonitors = json::array();
auto rawMonitors = json::array();
char *crt = dump->begin + dumpOffset;
char str[32];
jint hash;
while(crt < dump->end)
{
if ((*crt) & (JVMTI_MONITOR_JAVA | JVMTI_MONITOR_RAW))
Expand Down Expand Up @@ -360,6 +362,10 @@ void modifyJLM(const std::string& function, const std::string& command)
crt += sizeof(uint64_t);
jMon["monitorName"] = crt;
crt += strlen(crt) + 1;
hash = h2n.convert(*(uint32_t*)crt);
sprintf(str, "0x%x", hash);
jMon["monitorHash"] = str;
crt += sizeof(uint32_t);
if (monType & JVMTI_MONITOR_JAVA)
javaMonitors.push_back(jMon);
else
Expand All @@ -369,7 +375,7 @@ void modifyJLM(const std::string& function, const std::string& command)
{
int monNameDistance = 2*sizeof(char) + 5*sizeof(uint32_t) + 2*sizeof(uint64_t);
char *monName = crt + monNameDistance;
crt += monNameDistance + strlen(monName) + 1;
crt += monNameDistance + strlen(monName) + 1 + sizeof(uint32_t);
}
}
jvmti->Deallocate((unsigned char*)dump);
Expand Down

0 comments on commit 28d0214

Please sign in to comment.