Skip to content

Commit

Permalink
Store Debug Counter Relocation to the SCC on P
Browse files Browse the repository at this point in the history
Signed-off-by: Irwin D'Souza <[email protected]>
  • Loading branch information
Irwin D'Souza committed Jun 28, 2018
1 parent b1b948a commit 086dcc3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
32 changes: 32 additions & 0 deletions runtime/compiler/p/codegen/J9AheadOfTimeCompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "il/Node_inlines.hpp"
#include "il/SymbolReference.hpp"
#include "il/symbol/LabelSymbol.hpp"
#include "ras/DebugCounter.hpp"

J9::Power::AheadOfTimeCompile::AheadOfTimeCompile(TR::CodeGenerator *cg) :
J9::AheadOfTimeCompile(_relocationTargetTypeToHeaderSizeMap, cg->comp()),
Expand Down Expand Up @@ -801,6 +802,35 @@ uint8_t *J9::Power::AheadOfTimeCompile::initializeAOTRelocationHeader(TR::Iterat
}
break;

case TR_DebugCounter:
{
TR::DebugCounterBase *counter = (TR::DebugCounterBase *) relocation->getTargetAddress();
if (!counter || !counter->getReloData() || !counter->getName())
comp->failCompilation<TR::CompilationException>("Failed to generate debug counter relo data");

TR::DebugCounterReloData *counterReloData = counter->getReloData();

uintptrj_t offset = (uintptrj_t)fej9->sharedCache()->rememberDebugCounterName(counter->getName());

uint8_t flags = (uint8_t)counterReloData->_seqKind;
TR_ASSERT((flags & RELOCATION_CROSS_PLATFORM_FLAGS_MASK) == 0, "reloFlags bits overlap cross-platform flags bits\n");
*flagsCursor |= (flags & RELOCATION_RELOC_FLAGS_MASK);

*(uintptrj_t *)cursor = (uintptrj_t)counterReloData->_callerIndex;
cursor += SIZEPOINTER;
*(uintptrj_t *)cursor = (uintptrj_t)counterReloData->_bytecodeIndex;
cursor += SIZEPOINTER;
*(uintptrj_t *)cursor = offset;
cursor += SIZEPOINTER;
*(uintptrj_t *)cursor = (uintptrj_t)counterReloData->_delta;
cursor += SIZEPOINTER;
*(uintptrj_t *)cursor = (uintptrj_t)counterReloData->_fidelity;
cursor += SIZEPOINTER;
*(uintptrj_t *)cursor = (uintptrj_t)counterReloData->_staticDelta;
cursor += SIZEPOINTER;
}
break;

}
return cursor;
}
Expand Down Expand Up @@ -867,6 +897,7 @@ uint32_t J9::Power::AheadOfTimeCompile::_relocationTargetTypeToHeaderSizeMap[TR_
0, // TR_NativeMethodAbsolute = 56,
0, // TR_NativeMethodRelative = 57,
32, // TR_ArbitraryClassAddress = 58,
56, // TR_DebugCounter = 59
};
#else
uint32_t J9::Power::AheadOfTimeCompile::_relocationTargetTypeToHeaderSizeMap[TR_NumExternalRelocationKinds] =
Expand Down Expand Up @@ -930,6 +961,7 @@ uint32_t J9::Power::AheadOfTimeCompile::_relocationTargetTypeToHeaderSizeMap[TR_
0, // TR_NativeMethodAbsolute = 56,
0, // TR_NativeMethodRelative = 57,
16, // TR_ArbitraryClassAddress = 58,
28 // TR_DebugCounter = 59
};

#endif
Expand Down
1 change: 1 addition & 0 deletions runtime/compiler/p/runtime/PPCRelocationTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ TR_PPC32RelocationTarget::isOrderedPairRelocation(TR_RelocationRecord *reloRecor
case TR_RamMethodSequence:
case TR_BodyInfoAddressLoad:
case TR_DataAddress:
case TR_DebugCounter:
return true;
}

Expand Down

0 comments on commit 086dcc3

Please sign in to comment.