diff --git a/runtime/compiler/codegen/J9AheadOfTimeCompile.cpp b/runtime/compiler/codegen/J9AheadOfTimeCompile.cpp index 31ea2f0e61f..e7c383e2aa6 100644 --- a/runtime/compiler/codegen/J9AheadOfTimeCompile.cpp +++ b/runtime/compiler/codegen/J9AheadOfTimeCompile.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corp. and others + * Copyright (c) 2000, 2019 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 @@ -1459,27 +1459,6 @@ J9::AheadOfTimeCompile::dumpRelocationData() } break; - case TR_ValidateMethodByName: - { - cursor++; - if (is64BitTarget) - cursor += 4; // padding - cursor -= sizeof(TR_RelocationRecordBinaryTemplate); - TR_RelocationRecordValidateMethodByNameBinaryTemplate *binaryTemplate = - reinterpret_cast(cursor); - if (isVerbose) - { - traceMsg(self()->comp(), "\n Validate Method By Name: methodID=%d, beholderID=%d, romClassOffsetInSCC=%p romMethodOffsetInSCC=%p ", - (uint32_t)binaryTemplate->_methodID, - (uint32_t)binaryTemplate->_beholderID, - binaryTemplate->_romClassOffsetInSCC, - binaryTemplate->_romMethodOffsetInSCC); - } - cursor += sizeof(TR_RelocationRecordValidateMethodByNameBinaryTemplate); - self()->traceRelocationOffsets(cursor, offsetSize, endOfCurrentRecord, orderedPair); - } - break; - case TR_ValidateMethodFromClass: { cursor++; diff --git a/runtime/compiler/env/VMJ9.cpp b/runtime/compiler/env/VMJ9.cpp index fea563d52cb..579ceba0b74 100644 --- a/runtime/compiler/env/VMJ9.cpp +++ b/runtime/compiler/env/VMJ9.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corp. and others + * Copyright (c) 2000, 2019 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 @@ -6770,40 +6770,21 @@ TR_J9VM::getClassDepthAndFlagsValue(TR_OpaqueClassBlock * classPointer) #define LOOKUP_OPTION_NO_THROW 8192 TR_OpaqueMethodBlock * -TR_J9VM::getMethodFromName(char *className, char *methodName, char *signature, J9ConstantPool *constantPool) +TR_J9VM::getMethodFromName(char *className, char *methodName, char *signature, TR_OpaqueMethodBlock *callingMethod) { - TR::VMAccessCriticalSection getMethodFromName(this); - J9Class *methodClass = 0; - if (constantPool) - { - methodClass = jitGetClassFromUTF8(vmThread(), constantPool, className, strlen(className)); - } - if (!methodClass) // try the system class loader - { - methodClass = jitGetClassInClassloaderFromUTF8(vmThread(), - (J9ClassLoader *) vmThread()->javaVM->systemClassLoader, - className, strlen(className)); - } - TR_OpaqueMethodBlock * result = NULL; - /* - * Call the TR_J9VM version of getMethodFromClass since at this point, - * the methodClass may have never been seen before; if we call the - * TR_J9SharedCacheVM version, the validation manager could assert. - */ - if (methodClass) - result = (TR_OpaqueMethodBlock *)TR_J9VM::getMethodFromClass((TR_OpaqueClassBlock *)methodClass, methodName, signature); - return result; + return getMethodFromName(className, methodName, signature); // ignore callingMethod } TR_OpaqueMethodBlock * -TR_J9VM::getMethodFromName(char *className, char *methodName, char *signature, TR_OpaqueMethodBlock *callingMethod) +TR_J9VM::getMethodFromName(char *className, char *methodName, char *signature) { - J9ConstantPool *cp = NULL; - - if (callingMethod) - cp = (J9ConstantPool *) (J9_CP_FROM_METHOD((J9Method*)callingMethod)); + TR::VMAccessCriticalSection getMethodFromName(this); + TR_OpaqueClassBlock *methodClass = getSystemClassFromClassName(className, strlen(className), true); + TR_OpaqueMethodBlock * result = NULL; + if (methodClass) + result = (TR_OpaqueMethodBlock *)getMethodFromClass(methodClass, methodName, signature); - return getMethodFromName(className, methodName, signature, cp); + return result; } /** \brief @@ -8712,9 +8693,7 @@ TR_J9SharedCacheVM::getResolvedMethodForNameAndSignature(TR_Memory * trMemory, T TR_OpaqueMethodBlock *method = (TR_OpaqueMethodBlock *)((TR_ResolvedJ9Method *)resolvedMethod)->ramMethod(); /* * TR_J9VM::getResolvedMethodForNameAndSignature will call getMatchingMethodFromNameAndSignature - * which adds a MethodFromClassRecord. Not sure if adding a MethodByNameRecord here will do the - * right validation, since the way TR_J9VM::getResolvedMethodForNameAndSignature gets the class - * by name and signature is different than TR_J9VM::getMethodFromName... + * which adds a MethodFromClassRecord. */ validated = comp->getSymbolValidationManager()->addClassFromMethodRecord(getClassFromMethodBlock(method), method); } @@ -8729,37 +8708,6 @@ TR_J9SharedCacheVM::getResolvedMethodForNameAndSignature(TR_Memory * trMemory, T return NULL; } - -TR_OpaqueMethodBlock * -TR_J9SharedCacheVM::getMethodFromName(char *className, char *methodName, char *signature, TR_OpaqueMethodBlock *callingMethod) - { - TR_OpaqueMethodBlock *omb = this->TR_J9VM::getMethodFromName(className, methodName, signature, callingMethod); - if (omb) - { - TR::Compilation* comp = _compInfo->getCompInfoForCompOnAppThread() ? _compInfo->getCompInfoForCompOnAppThread()->getCompilation() : _compInfoPT->getCompilation(); - TR_ASSERT(comp, "Should be called only within a compilation"); - - if (comp->getOption(TR_UseSymbolValidationManager)) - { - TR::SymbolValidationManager *svm = comp->getSymbolValidationManager(); - SVM_ASSERT_ALREADY_VALIDATED(svm, callingMethod); - bool validated = svm->addMethodByNameRecord(omb, getClassFromMethodBlock(callingMethod)) && - svm->addClassFromMethodRecord(getClassFromMethodBlock(omb), omb); - - if (!validated) - omb = NULL; - } - else - { - J9Class* methodClass = (J9Class*)getClassFromMethodBlock(omb); - if (!((TR_ResolvedRelocatableJ9Method*) comp->getCurrentMethod())->validateArbitraryClass(comp, methodClass)) - omb = NULL; - } - } - - return omb; - } - bool TR_J9SharedCacheVM::isClassLibraryMethod(TR_OpaqueMethodBlock *method, bool vettedForAOT) { @@ -8783,9 +8731,7 @@ TR_J9SharedCacheVM::getMethodFromClass(TR_OpaqueClassBlock * methodClass, char * if (comp->getOption(TR_UseSymbolValidationManager)) { - bool validated = callingClass && - comp->getSymbolValidationManager()->addMethodFromClassAndSignatureRecord(omb, methodClass, callingClass); - + bool validated = comp->getSymbolValidationManager()->addMethodFromClassAndSignatureRecord(omb, methodClass, callingClass); if (!validated) omb = NULL; } diff --git a/runtime/compiler/env/VMJ9.h b/runtime/compiler/env/VMJ9.h index ca41f02ac2b..b9810b4a8ac 100644 --- a/runtime/compiler/env/VMJ9.h +++ b/runtime/compiler/env/VMJ9.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corp. and others + * Copyright (c) 2000, 2019 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 @@ -1042,8 +1042,8 @@ class TR_J9VM : public TR_J9VMBase virtual void initializeHasFixedFrameC_CallingConvention(); virtual bool isPublicClass(TR_OpaqueClassBlock *clazz); - TR_OpaqueMethodBlock * getMethodFromName(char * className, char *methodName, char *signature, J9ConstantPool *constantPool); - virtual TR_OpaqueMethodBlock *getMethodFromName(char * className, char *methodName, char *signature, TR_OpaqueMethodBlock *callingMethod=0); + virtual TR_OpaqueMethodBlock *getMethodFromName(char * className, char *methodName, char *signature, TR_OpaqueMethodBlock *callingMethod); + virtual TR_OpaqueMethodBlock *getMethodFromName(char * className, char *methodName, char *signature); virtual uintptrj_t getClassDepthAndFlagsValue(TR_OpaqueClassBlock * classPointer); virtual TR_OpaqueClassBlock * getComponentClassFromArrayClass(TR_OpaqueClassBlock * arrayClass); @@ -1165,7 +1165,6 @@ class TR_J9SharedCacheVM : public TR_J9VM virtual bool isPublicClass(TR_OpaqueClassBlock *clazz); virtual bool hasFinalizer(TR_OpaqueClassBlock * classPointer); virtual uintptrj_t getClassDepthAndFlagsValue(TR_OpaqueClassBlock * classPointer); - virtual TR_OpaqueMethodBlock * getMethodFromName(char * className, char *methodName, char *signature, TR_OpaqueMethodBlock *callingMethod=0); virtual TR_OpaqueMethodBlock * getMethodFromClass(TR_OpaqueClassBlock *, char *, char *, TR_OpaqueClassBlock * = NULL); virtual bool isPrimitiveClass(TR_OpaqueClassBlock *clazz); virtual TR_OpaqueClassBlock * getComponentClassFromArrayClass(TR_OpaqueClassBlock * arrayClass); diff --git a/runtime/compiler/env/j9method.cpp b/runtime/compiler/env/j9method.cpp index 313172570eb..4998b07c35b 100644 --- a/runtime/compiler/env/j9method.cpp +++ b/runtime/compiler/env/j9method.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corp. and others + * Copyright (c) 2000, 2019 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 @@ -6724,7 +6724,7 @@ TR_ResolvedJ9Method::getResolvedDynamicMethod(TR::Compilation * comp, I_32 callS J9ROMNameAndSignature *nameAndSig = NNSRP_GET(namesAndSigs[callSiteIndex], J9ROMNameAndSignature*); J9UTF8 *signature = J9ROMNAMEANDSIGNATURE_SIGNATURE(nameAndSig); - TR_OpaqueMethodBlock *dummyInvokeExact = _fe->getMethodFromName("java/lang/invoke/MethodHandle", "invokeExact", JSR292_invokeExactSig, getNonPersistentIdentifier()); + TR_OpaqueMethodBlock *dummyInvokeExact = _fe->getMethodFromName("java/lang/invoke/MethodHandle", "invokeExact", JSR292_invokeExactSig); result = _fe->createResolvedMethodWithSignature(comp->trMemory(), dummyInvokeExact, NULL, utf8Data(signature), J9UTF8_LENGTH(signature), this); } @@ -6757,7 +6757,7 @@ TR_ResolvedJ9Method::getResolvedHandleMethod(TR::Compilation * comp, I_32 cpInde #if defined(J9VM_OPT_REMOVE_CONSTANT_POOL_SPLITTING) if (unresolvedInCP) *unresolvedInCP = isUnresolvedMethodTypeTableEntry(cpIndex); - TR_OpaqueMethodBlock *dummyInvokeExact = _fe->getMethodFromName("java/lang/invoke/MethodHandle", "invokeExact", JSR292_invokeExactSig, getNonPersistentIdentifier()); + TR_OpaqueMethodBlock *dummyInvokeExact = _fe->getMethodFromName("java/lang/invoke/MethodHandle", "invokeExact", JSR292_invokeExactSig); J9ROMMethodRef *romMethodRef = (J9ROMMethodRef *)(cp()->romConstantPool + cpIndex); J9ROMNameAndSignature *nameAndSig = J9ROMMETHODREF_NAMEANDSIGNATURE(romMethodRef); int32_t signatureLength; @@ -6784,7 +6784,7 @@ TR_ResolvedJ9Method::getResolvedHandleMethodWithSignature(TR::Compilation * comp return 0; #else // TODO:JSR292: Dummy would be unnecessary if we could create a TR_ResolvedJ9Method without a j9method - TR_OpaqueMethodBlock *dummyInvokeExact = _fe->getMethodFromName("java/lang/invoke/MethodHandle", "invokeExact", JSR292_invokeExactSig, getNonPersistentIdentifier()); + TR_OpaqueMethodBlock *dummyInvokeExact = _fe->getMethodFromName("java/lang/invoke/MethodHandle", "invokeExact", JSR292_invokeExactSig); TR_ResolvedMethod *resolvedMethod = _fe->createResolvedMethodWithSignature(comp->trMemory(), dummyInvokeExact, NULL, signature, strlen(signature), this); return resolvedMethod; #endif diff --git a/runtime/compiler/optimizer/StringPeepholes.cpp b/runtime/compiler/optimizer/StringPeepholes.cpp index 89bcda52c83..169d76f2865 100644 --- a/runtime/compiler/optimizer/StringPeepholes.cpp +++ b/runtime/compiler/optimizer/StringPeepholes.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corp. and others + * Copyright (c) 2000, 2019 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 @@ -211,7 +211,7 @@ TR::SymbolReference* TR_StringPeepholes::MethodEnumToArgsForMethodSymRefFromName // TODO: This is a workaround as we switched to using a byte[] backing array in String*. Remove this workaround once obsolete. if (m == SPH_String_init_AIIZ) { - if (!fe()->getMethodFromName(classNames[m], methodNames[m], signatures[m], comp()->getCurrentMethod()->getNonPersistentIdentifier())) + if (!fe()->getMethodFromName(classNames[m], methodNames[m], signatures[m])) { return comp()->getSymRefTab()->methodSymRefFromName(comp()->getMethodSymbol(), classNames[m], methodNames[m], "([CIIZ)V", TR::MethodSymbol::Special); } diff --git a/runtime/compiler/runtime/RelocationRecord.cpp b/runtime/compiler/runtime/RelocationRecord.cpp index b268204861c..ea45ec33630 100644 --- a/runtime/compiler/runtime/RelocationRecord.cpp +++ b/runtime/compiler/runtime/RelocationRecord.cpp @@ -364,9 +364,6 @@ TR_RelocationRecord::create(TR_RelocationRecord *storage, TR_RelocationRuntime * case TR_ValidateClassChain: reloRecord = new (storage) TR_RelocationRecordValidateClassChain(reloRuntime, record); break; - case TR_ValidateMethodByName: - reloRecord = new (storage) TR_RelocationRecordValidateMethodByName(reloRuntime, record); - break; case TR_ValidateMethodFromClass: reloRecord = new (storage) TR_RelocationRecordValidateMethodFromClass(reloRuntime, record); break; @@ -3558,33 +3555,6 @@ TR_RelocationRecordValidateClassChain::applyRelocation(TR_RelocationRuntime *rel return compilationAotClassReloFailure; } -int32_t -TR_RelocationRecordValidateMethodByName::applyRelocation(TR_RelocationRuntime *reloRuntime, TR_RelocationTarget *reloTarget, uint8_t *reloLocation) - { - uint16_t methodID = reloTarget->loadUnsigned16b((uint8_t *) &((TR_RelocationRecordValidateMethodByNameBinaryTemplate *)_record)->_methodID); - uint16_t beholderID = reloTarget->loadUnsigned16b((uint8_t *) &((TR_RelocationRecordValidateMethodByNameBinaryTemplate *)_record)->_beholderID); - - void *romClassOffset = (void *)reloTarget->loadRelocationRecordValue((uintptrj_t *) &((TR_RelocationRecordValidateMethodByNameBinaryTemplate *)_record)->_romClassOffsetInSCC); - void *romClass = reloRuntime->fej9()->sharedCache()->pointerFromOffsetInSharedCache(romClassOffset); - - void *romMethodOffset = (void *)reloTarget->loadRelocationRecordValue((uintptrj_t *) &((TR_RelocationRecordValidateMethodByNameBinaryTemplate *)_record)->_romMethodOffsetInSCC); - void *romMethod = reloRuntime->fej9()->sharedCache()->pointerFromOffsetInSharedCache(romMethodOffset); - - if (reloRuntime->reloLogger()->logEnabled()) - { - reloRuntime->reloLogger()->printf("%s\n", name()); - reloRuntime->reloLogger()->printf("\tapplyRelocation: methodID %d\n", methodID); - reloRuntime->reloLogger()->printf("\tapplyRelocation: beholderID %d\n", beholderID); - reloRuntime->reloLogger()->printf("\tapplyRelocation: romClass %p\n", romClass); - reloRuntime->reloLogger()->printf("\tapplyRelocation: romMethod %p\n", romMethod); - } - - if (reloRuntime->comp()->getSymbolValidationManager()->validateMethodByNameRecord(methodID, beholderID, static_cast(romClass), static_cast(romMethod))) - return 0; - else - return compilationAotClassReloFailure; - } - int32_t TR_RelocationRecordValidateMethodFromClass::applyRelocation(TR_RelocationRuntime *reloRuntime, TR_RelocationTarget *reloTarget, uint8_t *reloLocation) { @@ -4547,7 +4517,7 @@ uint32_t TR_RelocationRecord::_relocationRecordHeaderSizeTable[TR_NumExternalRel 0, // TR_ValidateRomClass = 80 0, // TR_ValidatePrimitiveClass = 81 0, // TR_ValidateMethodFromInlinedSite = 82 - sizeof(TR_RelocationRecordValidateMethodByNameBinaryTemplate), // TR_ValidatedMethodByName = 83 + 0, // TR_ValidatedMethodByName = 83 sizeof(TR_RelocationRecordValidateMethodFromClassBinaryTemplate), // TR_ValidatedMethodFromClass = 84 sizeof(TR_RelocationRecordValidateStaticMethodFromCPBinaryTemplate), // TR_ValidateStaticMethodFromCP = 85 sizeof(TR_RelocationRecordValidateSpecialMethodFromCPBinaryTemplate), // TR_ValidateSpecialMethodFromCP = 86 diff --git a/runtime/compiler/runtime/RelocationRecord.hpp b/runtime/compiler/runtime/RelocationRecord.hpp index 99a383ec2c1..67c23883f7a 100644 --- a/runtime/compiler/runtime/RelocationRecord.hpp +++ b/runtime/compiler/runtime/RelocationRecord.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corp. and others + * Copyright (c) 2000, 2019 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 @@ -300,14 +300,6 @@ struct TR_RelocationRecordValidateClassChainBinaryTemplate : public TR_Relocatio UDATA _classChainOffsetInSCC; }; -struct TR_RelocationRecordValidateMethodByNameBinaryTemplate : public TR_RelocationRecordBinaryTemplate - { - uint16_t _methodID; - uint16_t _beholderID; - UDATA _romClassOffsetInSCC; - UDATA _romMethodOffsetInSCC; - }; - struct TR_RelocationRecordValidateMethodFromClassBinaryTemplate : public TR_RelocationRecordBinaryTemplate { uint16_t _methodID; @@ -1588,18 +1580,6 @@ class TR_RelocationRecordValidateClassChain : public TR_RelocationRecord virtual int32_t applyRelocation(TR_RelocationRuntime *reloRuntime, TR_RelocationTarget *reloTarget, uint8_t *reloLocation); }; -class TR_RelocationRecordValidateMethodByName : public TR_RelocationRecord - { - public: - TR_RelocationRecordValidateMethodByName() {} - TR_RelocationRecordValidateMethodByName(TR_RelocationRuntime *reloRuntime, TR_RelocationRecordBinaryTemplate *record) : TR_RelocationRecord(reloRuntime, record) {} - virtual bool isValidationRecord() { return true; } - virtual char *name() { return "TR_RelocationRecordValidateMethodByName"; } - virtual int32_t bytesInHeaderAndPayload() { return sizeof(TR_RelocationRecordValidateMethodByNameBinaryTemplate); } - virtual void preparePrivateData(TR_RelocationRuntime *reloRuntime, TR_RelocationTarget *reloTarget) {} - virtual int32_t applyRelocation(TR_RelocationRuntime *reloRuntime, TR_RelocationTarget *reloTarget, uint8_t *reloLocation); - }; - class TR_RelocationRecordValidateMethodFromClass : public TR_RelocationRecord { public: diff --git a/runtime/compiler/runtime/SymbolValidationManager.cpp b/runtime/compiler/runtime/SymbolValidationManager.cpp index c844acf97ef..682b40b9365 100644 --- a/runtime/compiler/runtime/SymbolValidationManager.cpp +++ b/runtime/compiler/runtime/SymbolValidationManager.cpp @@ -621,28 +621,6 @@ TR::SymbolValidationManager::addClassChainRecord(TR_OpaqueClassBlock *clazz, voi return storeValidationRecordIfNecessary(static_cast(clazz), record); } -bool -TR::SymbolValidationManager::addMethodByNameRecord(TR_OpaqueMethodBlock *method, TR_OpaqueClassBlock *beholder) - { - if (!method) - return false; - if (inHeuristicRegion()) - return true; - - SVM_ASSERT_ALREADY_VALIDATED(this, beholder); - - SymbolValidationRecord *record = new (_region) MethodByNameRecord(method, beholder); - bool valid = storeValidationRecordIfNecessary(static_cast(method), record); - - if (valid) - { - J9Class *methodClass = J9_CLASS_FROM_METHOD(reinterpret_cast(method)); - valid = addClassFromMethodRecord(reinterpret_cast(methodClass), method); - } - - return valid; - } - bool TR::SymbolValidationManager::addMethodFromClassRecord(TR_OpaqueMethodBlock *method, TR_OpaqueClassBlock *beholder, uint32_t index) { @@ -1301,36 +1279,6 @@ TR::SymbolValidationManager::validateClassChainRecord(uint16_t classID, void *cl return comp->fej9()->sharedCache()->classMatchesCachedVersion(definingClass, (uintptrj_t *) classChain); } -bool -TR::SymbolValidationManager::validateMethodByNameRecord(uint16_t methodID, uint16_t beholderID, J9ROMClass *romClass, J9ROMMethod *romMethod) - { - TR::Compilation* comp = TR::comp(); - J9VMThread *vmThread = comp->j9VMThread(); - TR_J9VM *fej9 = reinterpret_cast(TR_J9VMBase::get(vmThread->javaVM->jitConfig, vmThread)); - - J9Class *beholder = getJ9ClassFromID(beholderID); - J9ConstantPool *beholderCP = J9_CP_FROM_CLASS(beholder); - - J9UTF8 *methodNameData = J9ROMMETHOD_NAME(romMethod); - char *methodName = (char *)alloca(J9UTF8_LENGTH(methodNameData)+1); - strncpy(methodName, reinterpret_cast(J9UTF8_DATA(methodNameData)), J9UTF8_LENGTH(methodNameData)); - methodName[J9UTF8_LENGTH(methodNameData)] = '\0'; - - J9UTF8 *methodSigData = J9ROMMETHOD_SIGNATURE(romMethod); - char *methodSig = (char *)alloca(J9UTF8_LENGTH(methodSigData)+1); - strncpy(methodSig, reinterpret_cast(J9UTF8_DATA(methodSigData)), J9UTF8_LENGTH(methodSigData)); - methodSig[J9UTF8_LENGTH(methodSigData)] = '\0'; - - J9UTF8 * classNameData = J9ROMCLASS_CLASSNAME(romClass); - char *className = (char *)alloca(J9UTF8_LENGTH(classNameData)+1); - strncpy(className, reinterpret_cast(J9UTF8_DATA(classNameData)), J9UTF8_LENGTH(classNameData)); - className[J9UTF8_LENGTH(classNameData)] = '\0'; - - TR_OpaqueMethodBlock *method = fej9->getMethodFromName(className, methodName, methodSig, beholderCP); - - return validateSymbol(methodID, method); - } - bool TR::SymbolValidationManager::validateMethodFromClassRecord(uint16_t methodID, uint16_t beholderID, uint32_t index) { @@ -1465,7 +1413,7 @@ TR::SymbolValidationManager::validateMethodFromClassAndSignatureRecord(uint16_t TR_J9VMBase *fej9 = TR_J9VMBase::get(vmThread->javaVM->jitConfig, vmThread); TR_OpaqueClassBlock *methodClass = getClassFromID(methodClassID); - TR_OpaqueClassBlock *beholder = getClassFromID(beholderID); + TR_OpaqueClassBlock *beholder = getClassFromID(beholderID, SymOptional); J9UTF8 *methodNameData = J9ROMMETHOD_NAME(romMethod); char *methodName = (char *)alloca(J9UTF8_LENGTH(methodNameData)+1); @@ -1609,8 +1557,11 @@ TR::SymbolValidationManager::assertionsAreFatal() static void printClass(TR_OpaqueClassBlock *clazz) { - J9UTF8 *className = J9ROMCLASS_CLASSNAME(((J9Class *)clazz)->romClass); - traceMsg(TR::comp(), "\tclassName=%.*s\n", J9UTF8_LENGTH(className), J9UTF8_DATA(className)); + if (clazz != NULL) + { + J9UTF8 *className = J9ROMCLASS_CLASSNAME(((J9Class *)clazz)->romClass); + traceMsg(TR::comp(), "\tclassName=%.*s\n", J9UTF8_LENGTH(className), J9UTF8_DATA(className)); + } } void TR::ClassValidationRecord::printFields() @@ -1779,14 +1730,6 @@ void TR::ClassChainRecord::printFields() traceMsg(TR::comp(), "\t_classChain=0x%p\n", _classChain); } -void TR::MethodByNameRecord::printFields() - { - traceMsg(TR::comp(), "MethodByNameRecord\n"); - traceMsg(TR::comp(), "\t_method=0x%p\n", _method); - traceMsg(TR::comp(), "\t_beholder=0x%p\n", _beholder); - printClass(_beholder); - } - void TR::MethodFromClassRecord::printFields() { traceMsg(TR::comp(), "MethodFromClassRecord\n"); diff --git a/runtime/compiler/runtime/SymbolValidationManager.hpp b/runtime/compiler/runtime/SymbolValidationManager.hpp index 34e34690656..3ffb0aa9ad9 100644 --- a/runtime/compiler/runtime/SymbolValidationManager.hpp +++ b/runtime/compiler/runtime/SymbolValidationManager.hpp @@ -594,34 +594,6 @@ struct ClassChainRecord : public SymbolValidationRecord void *_classChain; }; -struct MethodByNameRecord : public SymbolValidationRecord - { - MethodByNameRecord(TR_OpaqueMethodBlock *method, TR_OpaqueClassBlock *beholder) - : SymbolValidationRecord(TR_ValidateMethodByName), - _method(method), - _beholder(beholder) - {} - - bool operator ==( const MethodByNameRecord &rhs) - { - if (_method == rhs._method && - _beholder == rhs._beholder) - return true; - else - return false; - } - - virtual bool isEqual(SymbolValidationRecord *other) - { - return (*this == *static_cast(other)); - } - - virtual void printFields(); - - TR_OpaqueMethodBlock *_method; - TR_OpaqueClassBlock *_beholder; - }; - struct MethodFromClassRecord : public SymbolValidationRecord { MethodFromClassRecord(TR_OpaqueMethodBlock *method, TR_OpaqueClassBlock *beholder, uint32_t index) @@ -1113,7 +1085,6 @@ class SymbolValidationManager bool addClassChainRecord(TR_OpaqueClassBlock *clazz, void *classChain); - bool addMethodByNameRecord(TR_OpaqueMethodBlock *method, TR_OpaqueClassBlock *beholder); bool addMethodFromClassRecord(TR_OpaqueMethodBlock *method, TR_OpaqueClassBlock *beholder, uint32_t index); bool addStaticMethodFromCPRecord(TR_OpaqueMethodBlock *method, J9ConstantPool *cp, int32_t cpIndex); bool addSpecialMethodFromCPRecord(TR_OpaqueMethodBlock *method, J9ConstantPool *cp, int32_t cpIndex); @@ -1159,7 +1130,6 @@ class SymbolValidationManager bool validateClassChainRecord(uint16_t classID, void *classChain); - bool validateMethodByNameRecord(uint16_t methodID, uint16_t beholderID, J9ROMClass *romClass, J9ROMMethod *romMethod); bool validateMethodFromClassRecord(uint16_t methodID, uint16_t beholderID, uint32_t index); bool validateStaticMethodFromCPRecord(uint16_t methodID, uint16_t beholderID, int32_t cpIndex); bool validateSpecialMethodFromCPRecord(uint16_t methodID, uint16_t beholderID, int32_t cpIndex); diff --git a/runtime/compiler/x/codegen/J9AheadOfTimeCompile.cpp b/runtime/compiler/x/codegen/J9AheadOfTimeCompile.cpp index f253fa31a04..e7ae18c8a12 100644 --- a/runtime/compiler/x/codegen/J9AheadOfTimeCompile.cpp +++ b/runtime/compiler/x/codegen/J9AheadOfTimeCompile.cpp @@ -878,34 +878,6 @@ uint8_t *J9::X86::AheadOfTimeCompile::initializeAOTRelocationHeader(TR::Iterated } break; - case TR_ValidateMethodByName: - { - TR::MethodByNameRecord *record = reinterpret_cast(relocation->getTargetAddress()); - - cursor -= sizeof(TR_RelocationRecordBinaryTemplate); - - TR_RelocationRecordValidateMethodByNameBinaryTemplate *binaryTemplate = - reinterpret_cast(cursor); - - // Store rom method to get name of method - J9Method *methodToValidate = reinterpret_cast(record->_method); - J9ROMMethod *romMethod = J9_ROM_METHOD_FROM_RAM_METHOD(methodToValidate); - void *romMethodOffsetInSharedCache = sharedCache->offsetInSharedCacheFromPointer(romMethod); - - // Store rom class to get name of class - TR_OpaqueClassBlock *classOfMethod = reinterpret_cast(J9_CLASS_FROM_METHOD(methodToValidate)); - void *romClass = reinterpret_cast(fej9->getPersistentClassPointerFromClassPointer(classOfMethod)); - void *romClassOffsetInSharedCache = sharedCache->offsetInSharedCacheFromPointer(romClass); - - binaryTemplate->_methodID = symValManager->getIDFromSymbol(static_cast(methodToValidate)); - binaryTemplate->_beholderID = symValManager->getIDFromSymbol(static_cast(record->_beholder)); - binaryTemplate->_romClassOffsetInSCC = reinterpret_cast(romClassOffsetInSharedCache); - binaryTemplate->_romMethodOffsetInSCC = reinterpret_cast(romMethodOffsetInSharedCache); - - cursor += sizeof(TR_RelocationRecordValidateMethodByNameBinaryTemplate); - } - break; - case TR_ValidateMethodFromClass: { TR::MethodFromClassRecord *record = reinterpret_cast(relocation->getTargetAddress()); @@ -1349,7 +1321,7 @@ uint32_t J9::X86::AheadOfTimeCompile::_relocationTargetTypeToHeaderSizeMap[TR_Nu 0, // TR_ValidateRomClass = 80, 0, // TR_ValidatePrimitiveClass = 81, 0, // TR_ValidateMethodFromInlinedSite = 82, - sizeof(TR_RelocationRecordValidateMethodByNameBinaryTemplate), // TR_ValidatedMethodByName = 83, + 0, // TR_ValidatedMethodByName = 83, sizeof(TR_RelocationRecordValidateMethodFromClassBinaryTemplate), // TR_ValidatedMethodFromClass = 84, sizeof(TR_RelocationRecordValidateStaticMethodFromCPBinaryTemplate),// TR_ValidateStaticMethodFromCP = 85, sizeof(TR_RelocationRecordValidateSpecialMethodFromCPBinaryTemplate),//TR_ValidateSpecialMethodFromCP = 86,