Skip to content

Commit

Permalink
AArch64: Consider snippets size when aborting compilation of huge met…
Browse files Browse the repository at this point in the history
…hods

A workaround for huge methods was introduced in #5819 because the range of
AArch64 conditional branch is +/- 1MB.
This commit enhances the workaround by taking into account the size of
snippets which was disregarded in #5819.

Signed-off-by: Akira Saitoh <saiaki@jp.ibm.com>
  • Loading branch information
Akira1Saitoh committed Sep 6, 2021
1 parent f747fcb commit eab73c7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions compiler/aarch64/codegen/OMRCodeGenerator.cpp
Expand Up @@ -256,6 +256,13 @@ OMR::ARM64::CodeGenerator::doBinaryEncoding()

self()->setEstimatedCodeLength(data.estimate);

if (!constantIsSignedImm21(data.estimate))
{
// Workaround for huge code
// Range of conditional branch instruction is +/- 1MB
self()->comp()->failCompilation<TR::AssertionFailure>("Generated code is too large");
}

data.cursorInstruction = self()->getFirstInstruction();
uint8_t *coldCode = NULL;
uint8_t *temp = self()->allocateCodeMemory(self()->getEstimatedCodeLength(), 0, &coldCode);
Expand Down Expand Up @@ -297,13 +304,6 @@ OMR::ARM64::CodeGenerator::doBinaryEncoding()
++oiIterator;
}

if (!constantIsSignedImm21((intptr_t)self()->getBinaryBufferCursor() - (intptr_t)self()->getBinaryBufferStart()))
{
// Workaround for huge code
// Range of conditional branch instruction is +/- 1MB
self()->comp()->failCompilation<TR::AssertionFailure>("Generated code is too large");
}

self()->getLinkage()->performPostBinaryEncoding();
}

Expand Down

0 comments on commit eab73c7

Please sign in to comment.