Skip to content

Commit

Permalink
Merge pull request #13786 from a7ehuo/PR-use-classNameToSignature-Cla…
Browse files Browse the repository at this point in the history
…ssEnv

Replace classNameToSignature with the define in ClassEnv
  • Loading branch information
0xdaryl committed Oct 30, 2021
2 parents a1c7cdb + 6bd31a9 commit 316bdc3
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions runtime/compiler/env/VMJ9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2733,7 +2733,7 @@ TR_J9VMBase::maybeHighlyPolymorphic(TR::Compilation *comp, TR_ResolvedMethod *ca
else
{
int32_t len = callee->classNameLength();
char *s = classNameToSignature(callee->classNameChars(), len, comp);
char *s = TR::Compiler->cls.classNameToSignature(callee->classNameChars(), len, comp);
classOfMethod = getClassFromSignature(s, len, caller, true);
}
if (classOfMethod)
Expand Down Expand Up @@ -5359,7 +5359,7 @@ TR_J9VMBase::getFieldOffset(TR::Compilation * comp, TR::SymbolReference* classRe
fprintf(stderr," (len is %d)\n",len);fflush(stderr);
**/

char* classSignature = classNameToSignature((char*)u8ClassString, len, comp);
char* classSignature = TR::Compiler->cls.classNameToSignature((char*)u8ClassString, len, comp);

/**
fprintf(stderr,"classSignature is \n");
Expand Down Expand Up @@ -7820,7 +7820,7 @@ TR_J9VM::inlineNativeCall(TR::Compilation * comp, TR::TreeTop * callNodeTreeTop,
TR::SymbolReference * callerSymRef = callNode->getSymbolReference();
TR_ResolvedMethod * owningMethod = callerSymRef->getOwningMethod(comp);
int32_t len = owningMethod->classNameLength();
char * s = classNameToSignature(owningMethod->classNameChars(), len, comp);
char * s = TR::Compiler->cls.classNameToSignature(owningMethod->classNameChars(), len, comp);
TR_OpaqueClassBlock * ReferenceClass = getClassFromSignature(s, len, owningMethod);
// defect 143867, ReferenceClass == 0 and crashed later in findFieldInClass()
if (!ReferenceClass)
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/env/j9method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7064,7 +7064,7 @@ TR_ResolvedJ9Method::makeParameterList(TR::ResolvedMethodSymbol *methodSym)
parmSymbol->setOrdinal(ordinal++);

int32_t len = classNameLen; // len is passed by reference and changes during the call
char * s = classNameToSignature(className, len, methodSym->comp(), heapAlloc);
char * s = TR::Compiler->cls.classNameToSignature(className, len, methodSym->comp(), heapAlloc);

la.add(parmSymbol);
parmSymbol->setTypeSignature(s, len);
Expand Down
6 changes: 3 additions & 3 deletions runtime/compiler/il/J9SymbolReference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ SymbolReference::getTypeSignature(int32_t & len, TR_AllocationKind allocKind, bo
const char * s = TR::Compiler->cls.classNameChars(comp, classOfObject, len);
if (s && (s[0] != '['))
{
s = classNameToSignature(s, len, comp);
s = TR::Compiler->cls.classNameToSignature(s, len, comp);
}
else
{
Expand All @@ -278,7 +278,7 @@ SymbolReference::getTypeSignature(int32_t & len, TR_AllocationKind allocKind, bo
classOfObject = comp->fe()->getComponentClassFromArrayClass(classOfObject);
s = TR::Compiler->cls.classNameChars(comp, classOfObject, len);
}
s = classNameToSignature(s, len, comp);
s = TR::Compiler->cls.classNameToSignature(s, len, comp);
s = prependNumParensToSig(s, len, numParens);
}

Expand All @@ -298,7 +298,7 @@ SymbolReference::getTypeSignature(int32_t & len, TR_AllocationKind allocKind, bo
len = 18;
return "Ljava/lang/Object;";
}
return classNameToSignature(sig, len, comp, allocKind);
return TR::Compiler->cls.classNameToSignature(sig, len, comp, allocKind);
}

if (_symbol->isConstString())
Expand Down
8 changes: 4 additions & 4 deletions runtime/compiler/ilgen/Walker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1825,7 +1825,7 @@ TR_J9ByteCodeIlGenerator::loadConstantValueIfPossible(TR::Node *topNode, uintptr
classNameOfFieldOrStatic = symRef->getOwningMethod(comp())->classNameOfFieldOrStatic(symRef->getCPIndex(), len);
if (classNameOfFieldOrStatic)
{
classNameOfFieldOrStatic=classNameToSignature(classNameOfFieldOrStatic, len, comp());
classNameOfFieldOrStatic = TR::Compiler->cls.classNameToSignature(classNameOfFieldOrStatic, len, comp());
TR_OpaqueClassBlock * curClass = fej9->getClassFromSignature(classNameOfFieldOrStatic, len, symRef->getOwningMethod(comp()));
TR_OpaqueClassBlock * owningClass = comp()->getJittedMethodSymbol()->getResolvedMethod()->containingClass();
if (owningClass == curClass)
Expand Down Expand Up @@ -4170,7 +4170,7 @@ break
// Can't use recognized methods since it's not enabled on AOT
//if (symbol->getRecognizedMethod() == TR::com_ibm_rmi_io_FastPathForCollocated_isVMDeepCopySupported)
int32_t len = calledMethod->classNameLength();
char * s = classNameToSignature(calledMethod->classNameChars(), len, comp());
char * s = TR::Compiler->cls.classNameToSignature(calledMethod->classNameChars(), len, comp());

if (strstr(s, "com/ibm/rmi/io/FastPathForCollocated") &&
!strncmp(calledMethod->nameChars(), "isVMDeepCopySupported", calledMethod->nameLength()))
Expand Down Expand Up @@ -4228,7 +4228,7 @@ break
performClassLookahead(_classInfo);

int32_t len = calledMethod->classNameLength();
char * s = classNameToSignature(calledMethod->classNameChars(), len, comp());
char * s = TR::Compiler->cls.classNameToSignature(calledMethod->classNameChars(), len, comp());

TR::Node * thisObject = invokedynamicReceiver ? invokedynamicReceiver : _stack->element(_stack->topIndex() - (numArgs-1));
TR_PersistentFieldInfo * fieldInfo = _classInfo->getFieldInfo() ? _classInfo->getFieldInfo()->findFieldInfo(comp(), thisObject, false) : NULL;
Expand Down Expand Up @@ -5524,7 +5524,7 @@ TR_J9ByteCodeIlGenerator::loadStatic(int32_t cpIndex)
classNameOfFieldOrStatic = symRef->getOwningMethod(comp())->classNameOfFieldOrStatic(symRef->getCPIndex(), len);
if (classNameOfFieldOrStatic)
{
classNameOfFieldOrStatic=classNameToSignature(classNameOfFieldOrStatic, len, comp());
classNameOfFieldOrStatic = TR::Compiler->cls.classNameToSignature(classNameOfFieldOrStatic, len, comp());
TR_OpaqueClassBlock * curClass = fej9->getClassFromSignature(classNameOfFieldOrStatic, len, symRef->getOwningMethod(comp()));
TR_OpaqueClassBlock * owningClass = comp()->getJittedMethodSymbol()->getResolvedMethod()->containingClass();
if (owningClass == curClass)
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/optimizer/EscapeAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4898,7 +4898,7 @@ void TR_EscapeAnalysis::checkEscapeViaCall(TR::Node *node, TR::NodeChecklist& vi
TR::MethodSymbol *sym = symRef->getSymbol()->castToMethodSymbol();
TR::Method * originalMethod = sym->getMethod();
int32_t len = originalMethod->classNameLength();
char *s = classNameToSignature(originalMethod->classNameChars(), len, comp());
char *s = TR::Compiler->cls.classNameToSignature(originalMethod->classNameChars(), len, comp());
TR_OpaqueClassBlock *originalMethodClass = comp()->fej9()->getClassFromSignature(s, len, owningMethod);
TR_OpaqueClassBlock *thisType = (TR_OpaqueClassBlock *) candidate->_node->getFirstChild()->getSymbol()->castToStaticSymbol()->getStaticAddress();
int32_t offset = -1;
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/optimizer/InlinerTempForJ9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5699,7 +5699,7 @@ TR_PrexArgInfo* TR_PrexArgInfo::buildPrexArgInfoForMethodSymbol(TR::ResolvedMeth
static void populateClassNameSignature(TR::Method *m, TR_ResolvedMethod* caller, TR_OpaqueClassBlock* &c, char* &nc, int32_t &nl, char* &sc, int32_t &sl)
{
int32_t len = m->classNameLength();
char* cs = classNameToSignature(m->classNameChars(), len, TR::comp());
char* cs = TR::Compiler->cls.classNameToSignature(m->classNameChars(), len, TR::comp());
c = caller->fe()->getClassFromSignature(cs, len, caller);
nc = m->nameChars();
nl = m->nameLength();
Expand All @@ -5710,7 +5710,7 @@ static void populateClassNameSignature(TR::Method *m, TR_ResolvedMethod* caller,
static char* classSignature (TR::Method * m, TR::Compilation* comp) //tracer helper
{
int32_t len = m->classNameLength();
return classNameToSignature(m->classNameChars(), len /*don't care, cos this gives us a null terminated string*/, comp);
return TR::Compiler->cls.classNameToSignature(m->classNameChars(), len /*don't care, cos this gives us a null terminated string*/, comp);
}

static bool treeMatchesCallSite(TR::TreeTop* tt, TR::ResolvedMethodSymbol* callerSymbol, TR_CallSite* callsite, TR_LogTracer* tracer)
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/optimizer/InterProceduralAnalyzer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corp. and others
* Copyright (c) 2000, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -216,7 +216,7 @@ List<OMR::RuntimeAssumption> *TR::InterProceduralAnalyzer::analyzeCallGraph(TR::
int32_t cpIndex = symRef->getCPIndex();
TR::Method * originalMethod = methodSymbol->getMethod();
int32_t len = originalMethod->classNameLength();
char *s = classNameToSignature(originalMethod->classNameChars(), len, comp());
char *s = TR::Compiler->cls.classNameToSignature(originalMethod->classNameChars(), len, comp());
clazz = fe()->getClassFromSignature(s, len, owningMethod);
if (!clazz)
{
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/optimizer/J9Inliner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ bool TR_J9InterfaceCallSite::findCallSiteTarget (TR_CallStack *callStack, TR_Inl
if (!_receiverClass)
{
int32_t len = _interfaceMethod->classNameLength();
char * s = classNameToSignature(_interfaceMethod->classNameChars(), len, comp());
char * s = TR::Compiler->cls.classNameToSignature(_interfaceMethod->classNameChars(), len, comp());
_receiverClass = comp()->fej9()->getClassFromSignature(s, len, _callerResolvedMethod, true);
}

Expand Down Expand Up @@ -690,7 +690,7 @@ bool TR_J9InterfaceCallSite::findCallSiteTarget (TR_CallStack *callStack, TR_Inl
TR_OpaqueClassBlock* TR_J9InterfaceCallSite::getClassFromMethod ()
{
int32_t len = _interfaceMethod->classNameLength();
char * s = classNameToSignature(_interfaceMethod->classNameChars(), len, comp());
char * s = TR::Compiler->cls.classNameToSignature(_interfaceMethod->classNameChars(), len, comp());
return comp()->fej9()->getClassFromSignature(s, len, _callerResolvedMethod, true);
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/optimizer/MonitorElimination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5309,7 +5309,7 @@ bool TR::CoarseningInterProceduralAnalyzer::analyzeNode(TR::Node *node, vcount_t
if (originalMethod)
{
classnameLength = originalMethod->classNameLength();
className = classNameToSignature(originalMethod->classNameChars(), classnameLength, comp());
className = TR::Compiler->cls.classNameToSignature(originalMethod->classNameChars(), classnameLength, comp());
}
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/runtime/J9Profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ void TR_ValueProfiler::modifyTrees()
TR::Method *interfaceMethod = methodSymbol->getMethod();
int32_t cpIndex = methodSymRef->getCPIndex();
int32_t len = interfaceMethod->classNameLength();
char * s = classNameToSignature(interfaceMethod->classNameChars(), len, comp());
char * s = TR::Compiler->cls.classNameToSignature(interfaceMethod->classNameChars(), len, comp());
TR_OpaqueClassBlock *thisClass = comp()->fe()->getClassFromSignature(s, len, methodSymRef->getOwningMethod(comp()));
if (thisClass)
{
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/x/codegen/X86PrivateLinkage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ TR::X86CallSite::X86CallSite(TR::Node *callNode, TR::Linkage *calleeLinkage)
//
TR::Method *interfaceMethod = getMethodSymbol()->getMethod();
int32_t len = interfaceMethod->classNameLength();
char * s = classNameToSignature(interfaceMethod->classNameChars(), len, comp());
char * s = TR::Compiler->cls.classNameToSignature(interfaceMethod->classNameChars(), len, comp());
_interfaceClassOfMethod = fej9->getClassFromSignature(s, len, getSymbolReference()->getOwningMethod(comp()));
}

Expand Down

0 comments on commit 316bdc3

Please sign in to comment.