From 086dcc3451c0d06e6484152a2721f3f7da3f0d60 Mon Sep 17 00:00:00 2001 From: Irwin D'Souza Date: Fri, 6 Apr 2018 11:29:12 -0400 Subject: [PATCH] Store Debug Counter Relocation to the SCC on P Signed-off-by: Irwin D'Souza --- .../p/codegen/J9AheadOfTimeCompile.cpp | 32 +++++++++++++++++++ .../p/runtime/PPCRelocationTarget.cpp | 1 + 2 files changed, 33 insertions(+) diff --git a/runtime/compiler/p/codegen/J9AheadOfTimeCompile.cpp b/runtime/compiler/p/codegen/J9AheadOfTimeCompile.cpp index e888c257832..8493a93a243 100644 --- a/runtime/compiler/p/codegen/J9AheadOfTimeCompile.cpp +++ b/runtime/compiler/p/codegen/J9AheadOfTimeCompile.cpp @@ -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()), @@ -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("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; } @@ -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] = @@ -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 diff --git a/runtime/compiler/p/runtime/PPCRelocationTarget.cpp b/runtime/compiler/p/runtime/PPCRelocationTarget.cpp index f14c2114df5..a3014491f71 100644 --- a/runtime/compiler/p/runtime/PPCRelocationTarget.cpp +++ b/runtime/compiler/p/runtime/PPCRelocationTarget.cpp @@ -315,6 +315,7 @@ TR_PPC32RelocationTarget::isOrderedPairRelocation(TR_RelocationRecord *reloRecor case TR_RamMethodSequence: case TR_BodyInfoAddressLoad: case TR_DataAddress: + case TR_DebugCounter: return true; }