From f9cac71ca84f1e2c730a596865cbf3fb5b9b8ae9 Mon Sep 17 00:00:00 2001 From: Gita Koblents Date: Thu, 17 Oct 2024 16:05:54 -0400 Subject: [PATCH] Use node's known object index in VectorAPIExpansion --- .../compiler/optimizer/VectorAPIExpansion.cpp | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/runtime/compiler/optimizer/VectorAPIExpansion.cpp b/runtime/compiler/optimizer/VectorAPIExpansion.cpp index 6e1738bfe90..ac001e098de 100644 --- a/runtime/compiler/optimizer/VectorAPIExpansion.cpp +++ b/runtime/compiler/optimizer/VectorAPIExpansion.cpp @@ -657,20 +657,30 @@ TR_VectorAPIExpansion::getJ9ClassFromClassNode(TR::Compilation *comp, TR::Node * return NULL; TR::SymbolReference *symRef = classNode->getSymbolReference(); - if (symRef) + + TR::KnownObjectTable::Index knownObjectIndex = TR::KnownObjectTable::UNKNOWN; + + if (symRef && symRef->hasKnownObjectIndex()) { - if (symRef->hasKnownObjectIndex()) - { - TR_J9VMBase *fej9 = comp->fej9(); + knownObjectIndex = symRef->getKnownObjectIndex(); + } + else if (classNode->hasKnownObjectIndex()) + { + knownObjectIndex = classNode->getKnownObjectIndex(); + } - TR::VMAccessCriticalSection getDataTypeFromClassNodeSection(fej9); + if (knownObjectIndex != TR::KnownObjectTable::UNKNOWN) + { + TR_J9VMBase *fej9 = comp->fej9(); - uintptr_t javaLangClass = comp->getKnownObjectTable()->getPointer(symRef->getKnownObjectIndex()); - J9Class *j9class = (J9Class *)(intptr_t)fej9->getInt64Field(javaLangClass, "vmRef"); + TR::VMAccessCriticalSection getDataTypeFromClassNodeSection(fej9); - return j9class; - } + uintptr_t javaLangClass = comp->getKnownObjectTable()->getPointer(knownObjectIndex); + J9Class *j9class = (J9Class *)(intptr_t)fej9->getInt64Field(javaLangClass, "vmRef"); + + return j9class; } + return NULL; }