Skip to content

Commit

Permalink
x64Emitter: Make the Align* functions return a non-const data pointer
Browse files Browse the repository at this point in the history
There's no real requirement to make this const, and this should also
be decided by the calling code, considering we had places that would
simply cast away the const and carry on.
  • Loading branch information
lioncash committed Apr 12, 2018
1 parent bbd1bb8 commit e28d063
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Source/Core/Common/x64Emitter.cpp
Expand Up @@ -146,7 +146,7 @@ void XEmitter::ReserveCodeSpace(int bytes)
*code++ = 0xCC;
}

const u8* XEmitter::AlignCodeTo(size_t alignment)
u8* XEmitter::AlignCodeTo(size_t alignment)
{
ASSERT_MSG(DYNA_REC, alignment != 0 && (alignment & (alignment - 1)) == 0,
"Alignment must be power of two");
Expand All @@ -156,17 +156,17 @@ const u8* XEmitter::AlignCodeTo(size_t alignment)
return code;
}

const u8* XEmitter::AlignCode4()
u8* XEmitter::AlignCode4()
{
return AlignCodeTo(4);
}

const u8* XEmitter::AlignCode16()
u8* XEmitter::AlignCode16()
{
return AlignCodeTo(16);
}

const u8* XEmitter::AlignCodePage()
u8* XEmitter::AlignCodePage()
{
return AlignCodeTo(4096);
}
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/Common/x64Emitter.h
Expand Up @@ -381,10 +381,10 @@ class XEmitter
virtual ~XEmitter() = default;
void SetCodePtr(u8* ptr);
void ReserveCodeSpace(int bytes);
const u8* AlignCodeTo(size_t alignment);
const u8* AlignCode4();
const u8* AlignCode16();
const u8* AlignCodePage();
u8* AlignCodeTo(size_t alignment);
u8* AlignCode4();
u8* AlignCode16();
u8* AlignCodePage();
const u8* GetCodePtr() const;
u8* GetWritableCodePtr();

Expand Down
8 changes: 4 additions & 4 deletions Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp
Expand Up @@ -231,7 +231,7 @@ constexpr std::array<u8, 8> sizes{{32, 0, 0, 0, 8, 16, 8, 16}};
void CommonAsmRoutines::GenQuantizedStores()
{
// Aligned to 256 bytes as least significant byte needs to be zero (See: Jit64::psq_stXX).
pairedStoreQuantized = reinterpret_cast<const u8**>(const_cast<u8*>(AlignCodeTo(256)));
pairedStoreQuantized = reinterpret_cast<const u8**>(AlignCodeTo(256));
ReserveCodeSpace(8 * sizeof(u8*));

for (int type = 0; type < 8; type++)
Expand All @@ -242,7 +242,7 @@ void CommonAsmRoutines::GenQuantizedStores()
void CommonAsmRoutines::GenQuantizedSingleStores()
{
// Aligned to 256 bytes as least significant byte needs to be zero (See: Jit64::psq_stXX).
singleStoreQuantized = reinterpret_cast<const u8**>(const_cast<u8*>(AlignCodeTo(256)));
singleStoreQuantized = reinterpret_cast<const u8**>(AlignCodeTo(256));
ReserveCodeSpace(8 * sizeof(u8*));

for (int type = 0; type < 8; type++)
Expand All @@ -263,7 +263,7 @@ const u8* CommonAsmRoutines::GenQuantizedStoreRuntime(bool single, EQuantizeType
void CommonAsmRoutines::GenQuantizedLoads()
{
// Aligned to 256 bytes as least significant byte needs to be zero (See: Jit64::psq_lXX).
pairedLoadQuantized = reinterpret_cast<const u8**>(const_cast<u8*>(AlignCodeTo(256)));
pairedLoadQuantized = reinterpret_cast<const u8**>(AlignCodeTo(256));
ReserveCodeSpace(8 * sizeof(u8*));

for (int type = 0; type < 8; type++)
Expand All @@ -273,7 +273,7 @@ void CommonAsmRoutines::GenQuantizedLoads()
void CommonAsmRoutines::GenQuantizedSingleLoads()
{
// Aligned to 256 bytes as least significant byte needs to be zero (See: Jit64::psq_lXX).
singleLoadQuantized = reinterpret_cast<const u8**>(const_cast<u8*>(AlignCodeTo(256)));
singleLoadQuantized = reinterpret_cast<const u8**>(AlignCodeTo(256));
ReserveCodeSpace(8 * sizeof(u8*));

for (int type = 0; type < 8; type++)
Expand Down

0 comments on commit e28d063

Please sign in to comment.