Skip to content

Commit

Permalink
Store Debug Counter Relocation to the SCC on Z
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 086dcc3 commit c070460
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
28 changes: 28 additions & 0 deletions runtime/compiler/z/codegen/J9AheadOfTimeCompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,32 @@ uint8_t *J9::Z::AheadOfTimeCompile::initializeAOTRelocationHeader(TR::IteratedEx
#endif
}
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());

*(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 @@ -986,6 +1012,7 @@ uint32_t J9::Z::AheadOfTimeCompile::_relocationTargetTypeToHeaderSizeMap[TR_NumE
0, // TR_NativeMethodAbsolute = 56,
0, // TR_NativeMethodRelative = 57,
32, // TR_ArbitraryClassAddress = 58,
56, // TR_DebugCounter = 59
};

#else
Expand Down Expand Up @@ -1051,6 +1078,7 @@ uint32_t J9::Z::AheadOfTimeCompile::_relocationTargetTypeToHeaderSizeMap[TR_NumE
0, // TR_NativeMethodAbsolute = 56,
0, // TR_NativeMethodRelative = 57,
16, // TR_ArbitraryClassAddress = 58,
28 // TR_DebugCounter = 59
};

#endif
Expand Down
15 changes: 14 additions & 1 deletion runtime/compiler/z/codegen/S390AOTRelocation.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2016 IBM Corp. and others
* Copyright (c) 2000, 2018 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 @@ -27,6 +27,7 @@
#include "env/jittypes.h"
#include "il/Node.hpp"
#include "il/Node_inlines.hpp"
#include "il/symbol/StaticSymbol.hpp"
#include "z/codegen/S390Instruction.hpp"
#include "env/VMJ9.h"

Expand Down Expand Up @@ -124,6 +125,18 @@ void TR::S390EncodingRelocation::addRelocation(TR::CodeGenerator *cg, uint8_t *c
file, line, node);
}
}
else if (_reloType==TR_DebugCounter)
{
TR::DebugCounterBase *counter = cg->comp()->getCounterFromStaticAddress(_symbolReference);
if (counter == NULL)
{
cg->comp()->failCompilation<TR::CompilationException>("Could not generate relocation for debug counter in TR::S390EncodingRelocation::addRelocation\n");
}
TR::DebugCounter::generateRelocation(cg->comp(),
cursor,
node,
counter);
}
else
{
TR_ASSERT(0,"relocation type [%d] not handled yet", _reloType);
Expand Down

0 comments on commit c070460

Please sign in to comment.