Skip to content

Commit

Permalink
AArch64: Workaround for huge methods
Browse files Browse the repository at this point in the history
This commit is a temporary workaround for huge methods.
The range of AArch64 conditional branch instruction is +/- 1MB.
This commit gives up compilation when the size of the generated code
exceeds that range.

Signed-off-by: KONNO Kazuhiro <konno@jp.ibm.com>
  • Loading branch information
knn-k committed Feb 22, 2021
1 parent e69c81f commit 6b5b6ac
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions compiler/aarch64/codegen/OMRCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,13 @@ OMR::ARM64::CodeGenerator::doBinaryEncoding()
}
}

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 6b5b6ac

Please sign in to comment.