Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand bytecode offset variables to 32bit #6999

Merged
merged 1 commit into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions compiler/il/OMRBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2344,7 +2344,7 @@ OMR::Block::addExceptionRangeForSnippet(uint32_t startPC, uint32_t endPC)
}

void
OMR::Block::setHandlerInfo(uint32_t c, uint8_t d, uint16_t i, TR_ResolvedMethod * m, TR::Compilation *comp)
OMR::Block::setHandlerInfo(uint32_t c, uint8_t d, int32_t i, TR_ResolvedMethod * m, TR::Compilation *comp)
{
self()->ensureCatchBlockExtensionExists(comp);
TR_CatchBlockExtension *cbe = _catchBlockExtension;
Expand All @@ -2364,7 +2364,7 @@ OMR::Block::setHandlerInfo(uint32_t c, uint8_t d, uint16_t i, TR_ResolvedMethod
}

void
OMR::Block::setHandlerInfoWithOutBCInfo(uint32_t c, uint8_t d, uint16_t i, TR_ResolvedMethod * m, TR::Compilation *comp)
OMR::Block::setHandlerInfoWithOutBCInfo(uint32_t c, uint8_t d, int32_t i, TR_ResolvedMethod * m, TR::Compilation *comp)
{
self()->ensureCatchBlockExtensionExists(comp);
TR_CatchBlockExtension *cbe = _catchBlockExtension;
Expand Down Expand Up @@ -2396,7 +2396,7 @@ OMR::Block::getInlineDepth()
return _catchBlockExtension->_inlineDepth;
}

uint16_t
int32_t
OMR::Block::getHandlerIndex()
{
TR_ASSERT(_catchBlockExtension, "catch block extension does not exist");
Expand Down
8 changes: 4 additions & 4 deletions compiler/il/OMRBlock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,21 +331,21 @@ class OMR_EXTENSIBLE Block : public TR::CFGNode
uint32_t _catchType;
TR_ResolvedMethod * _owningMethod;
TR_ByteCodeInfo _byteCodeInfo;
uint16_t _handlerIndex;
int32_t _handlerIndex;
uint8_t _inlineDepth;
bool _isSyntheticHandler; // indicate whether the exception handler is inserted by the compiler rather than existing in the source code
};

TR_CatchBlockExtension* getCatchBlockExtension() { return _catchBlockExtension; }
void setCatchBlockExtension(TR_CatchBlockExtension *extension) { _catchBlockExtension = extension; }

void setHandlerInfo(uint32_t c, uint8_t d, uint16_t i, TR_ResolvedMethod * m, TR::Compilation *comp);
void setHandlerInfoWithOutBCInfo(uint32_t c, uint8_t d, uint16_t i, TR_ResolvedMethod * m, TR::Compilation *comp); //also used for estimatecodesize dummy blocks
void setHandlerInfo(uint32_t c, uint8_t d, int32_t i, TR_ResolvedMethod * m, TR::Compilation *comp);
void setHandlerInfoWithOutBCInfo(uint32_t c, uint8_t d, int32_t i, TR_ResolvedMethod * m, TR::Compilation *comp); //also used for estimatecodesize dummy blocks

bool isCatchBlock();
uint32_t getCatchType();
uint8_t getInlineDepth();
uint16_t getHandlerIndex();
int32_t getHandlerIndex();
TR_ByteCodeInfo getByteCodeInfo();
TR_OpaqueClassBlock * getExceptionClass();
char * getExceptionClassNameChars();
Expand Down
10 changes: 5 additions & 5 deletions compiler/ilgen/ByteCodeIterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ template <typename ByteCode, typename ResolvedMethod> class TR_ByteCodeIterator
{
void *operator new(size_t s, void *p) { return p; }

TryCatchInfo(uint16_t s, uint16_t e, uint16_t h, uint32_t c) :
TryCatchInfo(int32_t s, int32_t e, int32_t h, uint32_t c) :
_startIndex(s),
_endIndex(e),
_handlerIndex(h),
Expand All @@ -57,7 +57,7 @@ template <typename ByteCode, typename ResolvedMethod> class TR_ByteCodeIterator
{
}

void initialize(uint16_t s, uint16_t e, uint16_t h, uint32_t c)
void initialize(int32_t s, int32_t e, int32_t h, uint32_t c)
{
_startIndex = s;
_endIndex = e;
Expand All @@ -70,9 +70,9 @@ template <typename ByteCode, typename ResolvedMethod> class TR_ByteCodeIterator
return _handlerIndex == o._handlerIndex && _catchType == o._catchType;
}

uint16_t _startIndex;
uint16_t _endIndex;
uint16_t _handlerIndex;
int32_t _startIndex;
int32_t _endIndex;
int32_t _handlerIndex;
uint32_t _catchType;
TR::Block * _firstBlock;
TR::Block * _lastBlock;
Expand Down
19 changes: 13 additions & 6 deletions compiler/infra/OMRCfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,14 @@ TR_OrderedExceptionHandlerIterator::TR_OrderedExceptionHandlerIterator(TR::Block
for (auto e = tryBlock->getExceptionSuccessors().begin(); e != tryBlock->getExceptionSuccessors().end(); ++e)
{
TR::Block * b = toBlock((*e)->getTo());
if (b->getHandlerIndex() >= handlerDim)
handlerDim = b->getHandlerIndex() + 1;
if (b->getInlineDepth() >= inlineDim)
inlineDim = b->getInlineDepth() + 1;
if (!b->isOSRCatchBlock())
{
TR_ASSERT(b->getHandlerIndex()!=-1, "exception handler index is not defined" );
if (b->getHandlerIndex() >= handlerDim)
handlerDim = b->getHandlerIndex() + 1;
if (b->getInlineDepth() >= inlineDim)
inlineDim = b->getInlineDepth() + 1;
}
}

_dim = handlerDim * inlineDim;
Expand All @@ -388,8 +392,11 @@ TR_OrderedExceptionHandlerIterator::TR_OrderedExceptionHandlerIterator(TR::Block
for (auto e = tryBlock->getExceptionSuccessors().begin(); e != tryBlock->getExceptionSuccessors().end(); ++e)
{
TR::Block * b = toBlock((*e)->getTo());
TR_ASSERT((_handlers[((inlineDim - b->getInlineDepth() - 1) * handlerDim) + b->getHandlerIndex()] == NULL), "handler entry is not NULL\n");
_handlers[((inlineDim - b->getInlineDepth() - 1) * handlerDim) + b->getHandlerIndex()] = b;
if (!b->isOSRCatchBlock())
{
TR_ASSERT((_handlers[((inlineDim - b->getInlineDepth() - 1) * handlerDim) + b->getHandlerIndex()] == NULL), "handler entry is not NULL\n");
_handlers[((inlineDim - b->getInlineDepth() - 1) * handlerDim) + b->getHandlerIndex()] = b;
}
}
}
}
Expand Down