Skip to content

Commit

Permalink
Merge pull request #7601 from dsouzai/aotConsolidateRecords
Browse files Browse the repository at this point in the history
Consolidate AOT Relocation Records
  • Loading branch information
mstoodle committed Apr 27, 2020
2 parents 80fe748 + 19345a1 commit a63afad
Show file tree
Hide file tree
Showing 7 changed files with 235 additions and 742 deletions.
126 changes: 0 additions & 126 deletions runtime/compiler/aarch64/codegen/J9AheadOfTimeCompile.cpp
Expand Up @@ -299,45 +299,6 @@ uint8_t *J9::ARM64::AheadOfTimeCompile::initializeAOTRelocationHeader(TR::Iterat
}
break;

case TR_MethodPointer:
{
TR::Node *aconstNode = (TR::Node *) relocation->getTargetAddress();
uintptr_t inlinedSiteIndex = (uintptr_t)aconstNode->getInlinedSiteIndex();
*(uintptr_t *)cursor = inlinedSiteIndex;
cursor += SIZEPOINTER;

TR_OpaqueMethodBlock *j9method = (TR_OpaqueMethodBlock *) aconstNode->getAddress();
TR_OpaqueClassBlock *j9class = fej9->getClassFromMethodBlock(j9method);

uintptr_t classChainOffsetInSharedCache = sharedCache->getClassChainOffsetOfIdentifyingLoaderForClazzInSharedCache(j9class);
*(uintptr_t *)cursor = classChainOffsetInSharedCache;
cursor += SIZEPOINTER;

cursor = self()->emitClassChainOffset(cursor, j9class);

uintptr_t vTableOffset = (uintptr_t) fej9->getInterpreterVTableSlot(j9method, j9class);
*(uintptr_t *)cursor = vTableOffset;
cursor += SIZEPOINTER;
}
break;

case TR_ClassPointer:
{
TR::Node *aconstNode = (TR::Node *) relocation->getTargetAddress();
uintptr_t inlinedSiteIndex = (uintptr_t)aconstNode->getInlinedSiteIndex();
*(uintptr_t *)cursor = inlinedSiteIndex;
cursor += SIZEPOINTER;

TR_OpaqueClassBlock *j9class = (TR_OpaqueClassBlock *) aconstNode->getAddress();

uintptr_t classChainOffsetInSharedCache = sharedCache->getClassChainOffsetOfIdentifyingLoaderForClazzInSharedCache(j9class);
*(uintptr_t *)cursor = classChainOffsetInSharedCache;
cursor += SIZEPOINTER;

cursor = self()->emitClassChainOffset(cursor, j9class);
}
break;

case TR_ArbitraryClassAddress:
{
// ExternalRelocation data is as expected for TR_ClassAddress
Expand Down Expand Up @@ -429,56 +390,6 @@ uint8_t *J9::ARM64::AheadOfTimeCompile::initializeAOTRelocationHeader(TR::Iterat
}
break;

case TR_ProfiledInlinedMethodRelocation:
case TR_ProfiledClassGuardRelocation:
case TR_ProfiledMethodGuardRelocation:
{
guard = (TR_VirtualGuard *) relocation->getTargetAddress2();

int32_t inlinedSiteIndex = guard->getCurrentInlinedSiteIndex();
*(uintptr_t *) cursor = (uintptr_t) inlinedSiteIndex;
cursor += SIZEPOINTER;

TR::SymbolReference *callSymRef = guard->getSymbolReference();
TR_ResolvedMethod *owningMethod = callSymRef->getOwningMethod(comp);

TR_InlinedCallSite & ics = comp->getInlinedCallSite(inlinedSiteIndex);
TR_ResolvedMethod *inlinedMethod = ((TR_AOTMethodInfo *)ics._methodInfo)->resolvedMethod;
TR_OpaqueClassBlock *inlinedCodeClass = reinterpret_cast<TR_OpaqueClassBlock *>(inlinedMethod->classOfMethod());

*(uintptr_t *) cursor = (uintptr_t) owningMethod->constantPool(); // record constant pool
cursor += SIZEPOINTER;

if (comp->getOption(TR_UseSymbolValidationManager))
{
uint16_t inlinedCodeClassID = symValManager->getIDFromSymbol(static_cast<void *>(inlinedCodeClass));
uintptr_t data = (uintptr_t)inlinedCodeClassID;
*(uintptr_t*)cursor = data;
}
else
{
*(uintptr_t*)cursor = (uintptr_t)callSymRef->getCPIndex(); // record cpIndex
}
cursor += SIZEPOINTER;

void *romClass = (void *) fej9->getPersistentClassPointerFromClassPointer(inlinedCodeClass);
uintptr_t romClassOffsetInSharedCache = self()->offsetInSharedCacheFromPointer(sharedCache, romClass);
traceMsg(comp, "class is %p, romclass is %p, offset is %p\n", inlinedCodeClass, romClass, romClassOffsetInSharedCache);
*(uintptr_t *) cursor = romClassOffsetInSharedCache;
cursor += SIZEPOINTER;

uintptr_t classChainOffsetInSharedCache = sharedCache->getClassChainOffsetOfIdentifyingLoaderForClazzInSharedCache(inlinedCodeClass);
*(uintptr_t *) cursor = classChainOffsetInSharedCache;
cursor += SIZEPOINTER;

cursor = self()->emitClassChainOffset(cursor, inlinedCodeClass);

uintptr_t methodIndex = fej9->getMethodIndexInClass(inlinedCodeClass, inlinedMethod->getNonPersistentIdentifier());
*(uintptr_t *)cursor = methodIndex;
cursor += SIZEPOINTER;
}
break;

case TR_GlobalValue:
{
*(uintptr_t*)cursor = (uintptr_t) relocation->getTargetAddress();
Expand Down Expand Up @@ -1025,43 +936,6 @@ uint8_t *J9::ARM64::AheadOfTimeCompile::initializeAOTRelocationHeader(TR::Iterat
}
break;

case TR_ValidateClass:
{
*(uintptr_t*)cursor = (uintptr_t)relocation->getTargetAddress(); // Inlined site index
cursor += SIZEPOINTER;

TR::AOTClassInfo *aotCI = (TR::AOTClassInfo*)relocation->getTargetAddress2();
*(uintptr_t*)cursor = (uintptr_t) aotCI->_constantPool;
cursor += SIZEPOINTER;

*(uintptr_t*)cursor = (uintptr_t) aotCI->_cpIndex;
cursor += SIZEPOINTER;

uintptr_t classChainOffsetInSharedCache = self()->offsetInSharedCacheFromPointer(sharedCache, aotCI->_classChain);
*(uintptr_t *)cursor = classChainOffsetInSharedCache;
cursor += SIZEPOINTER;
}
break;

case TR_ValidateStaticField:
{
*(uintptr_t*)cursor = (uintptr_t)relocation->getTargetAddress(); // Inlined site index
cursor += SIZEPOINTER;

TR::AOTClassInfo *aotCI = (TR::AOTClassInfo*)relocation->getTargetAddress2();
*(uintptr_t*)cursor = (uintptr_t) aotCI->_constantPool;
cursor += SIZEPOINTER;

*(uintptr_t*)cursor = (uintptr_t) aotCI->_cpIndex;
cursor += SIZEPOINTER;

void *romClass = (void *)fej9->getPersistentClassPointerFromClassPointer(aotCI->_clazz);
uintptr_t romClassOffsetInSharedCache = self()->offsetInSharedCacheFromPointer(sharedCache, romClass);
*(uintptr_t *)cursor = romClassOffsetInSharedCache;
cursor += SIZEPOINTER;
}
break;

case TR_ValidateArbitraryClass:
{
TR::AOTClassInfo *aotCI = (TR::AOTClassInfo*) relocation->getTargetAddress2();
Expand Down
118 changes: 0 additions & 118 deletions runtime/compiler/arm/codegen/J9AheadOfTimeCompile.cpp
Expand Up @@ -312,46 +312,6 @@ uint8_t *J9::ARM::AheadOfTimeCompile::initializeAOTRelocationHeader(TR::Iterated
break;
}

case TR_MethodPointer:
{
TR::Node *aconstNode = (TR::Node *) relocation->getTargetAddress();
uintptr_t inlinedSiteIndex = (uintptr_t)aconstNode->getInlinedSiteIndex();
*(uintptr_t *)cursor = inlinedSiteIndex;
cursor += SIZEPOINTER;

TR_OpaqueMethodBlock *j9method = (TR_OpaqueMethodBlock *) aconstNode->getAddress();
TR_OpaqueClassBlock *j9class = fej9->getClassFromMethodBlock(j9method);

uintptr_t classChainOffsetInSharedCache = sharedCache->getClassChainOffsetOfIdentifyingLoaderForClazzInSharedCache(j9class);
*(uintptr_t *)cursor = classChainOffsetInSharedCache;
cursor += SIZEPOINTER;

cursor = self()->emitClassChainOffset(cursor, j9class);

uintptr_t vTableOffset = (uintptr_t) fej9->getInterpreterVTableSlot(j9method, j9class);
*(uintptr_t *)cursor = vTableOffset;
cursor += SIZEPOINTER;
}
break;

case TR_ClassPointer:
{
TR::Node *aconstNode = (TR::Node *) relocation->getTargetAddress();
uintptr_t inlinedSiteIndex = (uintptr_t)aconstNode->getInlinedSiteIndex();
*(uintptr_t *)cursor = inlinedSiteIndex;
cursor += SIZEPOINTER;

TR_OpaqueClassBlock *j9class = (TR_OpaqueClassBlock *) aconstNode->getAddress();
//traceMsg(comp(),"j9class %p\n", j9class);

uintptr_t classChainOffsetInSharedCache = sharedCache->getClassChainOffsetOfIdentifyingLoaderForClazzInSharedCache(j9class);
*(uintptr_t *)cursor = classChainOffsetInSharedCache;
cursor += SIZEPOINTER;

cursor = self()->emitClassChainOffset(cursor, j9class);
}
break;

case TR_ArbitraryClassAddress:
{
// ExternalRelocation data is as expected for TR_ClassAddress
Expand Down Expand Up @@ -431,84 +391,6 @@ uint8_t *J9::ARM::AheadOfTimeCompile::initializeAOTRelocationHeader(TR::Iterated
}
break;

case TR_ProfiledInlinedMethodRelocation:
case TR_ProfiledClassGuardRelocation:
case TR_ProfiledMethodGuardRelocation:
{
guard = (TR_VirtualGuard *) relocation->getTargetAddress2();

int32_t inlinedSiteIndex = guard->getCurrentInlinedSiteIndex();
*(uintptr_t *) cursor = (uintptr_t) inlinedSiteIndex;
cursor += SIZEPOINTER;

TR::SymbolReference *callSymRef = guard->getSymbolReference();
TR_ResolvedMethod *owningMethod = callSymRef->getOwningMethod(comp);

TR_InlinedCallSite & ics = comp->getInlinedCallSite(inlinedSiteIndex);
TR_ResolvedMethod *inlinedMethod = ((TR_AOTMethodInfo *)ics._methodInfo)->resolvedMethod;
TR_OpaqueClassBlock *inlinedCodeClass = reinterpret_cast<TR_OpaqueClassBlock *>(inlinedMethod->classOfMethod());

*(uintptr_t *) cursor = (uintptr_t) owningMethod->constantPool(); // record constant pool
cursor += SIZEPOINTER;

*(uintptr_t*) cursor = (uintptr_t) callSymRef->getCPIndex(); // record cpIndex
cursor += SIZEPOINTER;

void *romClass = (void *) fej9->getPersistentClassPointerFromClassPointer(inlinedCodeClass);
uintptr_t romClassOffsetInSharedCache = self()->offsetInSharedCacheFromPointer(sharedCache, romClass);
traceMsg(comp, "class is %p, romclass is %p, offset is %p\n", inlinedCodeClass, romClass, romClassOffsetInSharedCache);
*(uintptr_t *) cursor = romClassOffsetInSharedCache;
cursor += SIZEPOINTER;

uintptr_t classChainOffsetInSharedCache = sharedCache->getClassChainOffsetOfIdentifyingLoaderForClazzInSharedCache(inlinedCodeClass);
*(uintptr_t *) cursor = classChainOffsetInSharedCache;
cursor += SIZEPOINTER;

cursor = self()->emitClassChainOffset(cursor, inlinedCodeClass);

uintptr_t methodIndex = fej9->getMethodIndexInClass(inlinedCodeClass, inlinedMethod->getNonPersistentIdentifier());
*(uintptr_t *)cursor = methodIndex;
cursor += SIZEPOINTER;
}
break;

case TR_ValidateClass:
{
*(uintptr_t*)cursor = (uintptr_t)relocation->getTargetAddress(); // Inlined site index
cursor += SIZEPOINTER;

TR::AOTClassInfo *aotCI = (TR::AOTClassInfo*)relocation->getTargetAddress2();
*(uintptr_t*)cursor = (uintptr_t) aotCI->_constantPool;
cursor += SIZEPOINTER;

*(uintptr_t*)cursor = (uintptr_t) aotCI->_cpIndex;
cursor += SIZEPOINTER;

uintptr_t classChainOffsetInSharedCache = self()->offsetInSharedCacheFromPointer(sharedCache, aotCI->_classChain);
*(uintptr_t *)cursor = classChainOffsetInSharedCache;
cursor += SIZEPOINTER;
}
break;

case TR_ValidateStaticField:
{
*(uintptr_t*)cursor = (uintptr_t)relocation->getTargetAddress(); // Inlined site index
cursor += SIZEPOINTER;

TR::AOTClassInfo *aotCI = (TR::AOTClassInfo*)relocation->getTargetAddress2();
*(uintptr_t*)cursor = (uintptr_t) aotCI->_constantPool;
cursor += SIZEPOINTER;

*(uintptr_t*)cursor = (uintptr_t) aotCI->_cpIndex;
cursor += SIZEPOINTER;

void *romClass = (void *)fej9->getPersistentClassPointerFromClassPointer(aotCI->_clazz);
uintptr_t romClassOffsetInSharedCache = self()->offsetInSharedCacheFromPointer(sharedCache, romClass);
*(uintptr_t *)cursor = romClassOffsetInSharedCache;
cursor += SIZEPOINTER;
}
break;

case TR_ValidateArbitraryClass:
{
TR::AOTClassInfo *aotCI = (TR::AOTClassInfo*) relocation->getTargetAddress2();
Expand Down

0 comments on commit a63afad

Please sign in to comment.