Skip to content

Commit e082895

Browse files
authored
Merge pull request #20720 from IBMJimmyk/fixStartPC-v0.49.0
(0.49.0) Change J9::VMMethodEnv::startPC error return value
2 parents 60a64bd + 99530d7 commit e082895

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

runtime/compiler/env/J9VMMethodEnv.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ uintptr_t
6767
J9::VMMethodEnv::startPC(TR_OpaqueMethodBlock *method)
6868
{
6969
J9Method *j9method = reinterpret_cast<J9Method *>(method);
70-
return reinterpret_cast<uintptr_t>(TR::CompilationInfo::getJ9MethodStartPC(j9method));
70+
uintptr_t returnStartPC = reinterpret_cast<uintptr_t>(TR::CompilationInfo::getJ9MethodStartPC(j9method));
71+
72+
if ((returnStartPC & J9_STARTPC_NOT_TRANSLATED) == J9_STARTPC_NOT_TRANSLATED)
73+
{
74+
returnStartPC = 0;
75+
}
76+
77+
return returnStartPC;
7178
}
7279

7380

runtime/compiler/runtime/J9CodeCache.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,8 @@ J9::CodeCache::addFreeBlock(void *voidMetaData)
552552
{
553553
// There could be several bodyInfo pointing to the same methodInfo
554554
// Prevent deallocating twice by freeing only for the last body
555-
if (TR::Compiler->mtd.startPC((TR_OpaqueMethodBlock*)metaData->ramMethod) == (uintptr_t)metaData->startPC)
555+
uintptr_t ramMethodStartPC = TR::Compiler->mtd.startPC((TR_OpaqueMethodBlock*)metaData->ramMethod);
556+
if ((ramMethodStartPC != 0) && (ramMethodStartPC == (uintptr_t)metaData->startPC))
556557
{
557558
// Clear profile info
558559
pmi->setBestProfileInfo(NULL);

0 commit comments

Comments
 (0)