Skip to content

Commit 619c9d0

Browse files
committed
Refactor ARMHelperCallSnippet emitSnippetBody
A simple refactor of ARMHelperCallSnippet::emitSnippetBody to allow for the use of it in downstream project OpenJ9 Signed-off-by: Matthew Hall <[email protected]>
1 parent a8e26ed commit 619c9d0

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

compiler/aarch64/codegen/ARM64HelperCallSnippet.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,11 @@
2727
#include "ras/Logger.hpp"
2828
#include "runtime/CodeCacheManager.hpp"
2929

30-
uint8_t *TR::ARM64HelperCallSnippet::emitSnippetBody()
31-
{
32-
uint8_t *cursor = cg()->getBinaryBufferCursor();
30+
uint8_t *TR::ARM64HelperCallSnippet::emitSnippetBodyHelper(uint8_t *cursor)
31+
{
3332
intptr_t distance
3433
= (intptr_t)(getDestination()->getSymbol()->castToMethodSymbol()->getMethodAddress()) - (intptr_t)cursor;
3534

36-
getSnippetLabel()->setCodeLocation(cursor);
37-
3835
if (!constantIsSignedImm28(distance)) {
3936
distance = TR::CodeCacheManager::instance()->findHelperTrampoline(getDestination()->getReferenceNumber(),
4037
(void *)cursor)
@@ -65,6 +62,13 @@ uint8_t *TR::ARM64HelperCallSnippet::emitSnippetBody()
6562
}
6663

6764
return cursor;
65+
}
66+
67+
uint8_t *TR::ARM64HelperCallSnippet::emitSnippetBody()
68+
{
69+
uint8_t *cursor = cg()->getBinaryBufferCursor();
70+
getSnippetLabel()->setCodeLocation(cursor);
71+
return emitSnippetBodyHelper(cursor);
6872
}
6973

7074
void TR_Debug::print(OMR::Logger *log, TR::ARM64HelperCallSnippet *snippet)

compiler/aarch64/codegen/ARM64HelperCallSnippet.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ class ARM64HelperCallSnippet : public TR::Snippet {
9191
* @return Snippet length
9292
*/
9393
virtual uint32_t getLength(int32_t estimatedSnippetStart);
94+
95+
protected:
96+
uint8_t *emitSnippetBodyHelper(uint8_t *cursor);
97+
9498
};
9599

96100
} // namespace TR

0 commit comments

Comments
 (0)