arm64jit: Minor cleanup.

This commit is contained in:
Unknown W. Brackets 2020-05-16 21:12:31 -07:00
parent 67ab51bb90
commit bab907f792
3 changed files with 11 additions and 14 deletions

View file

@ -278,7 +278,6 @@ static int EncodeSize(int size) {
void ARM64XEmitter::SetCodePointer(u8* ptr)
{
m_code = ptr;
m_startcode = m_code;
m_lastCacheFlushEnd = ptr;
}
@ -911,7 +910,7 @@ void ARM64XEmitter::SetJumpTarget(FixupBranch const& branch)
inst = ((branch.bit & 0x20) << 26) | (0x1B << 25) | (Not << 24) | ((branch.bit & 0x1F) << 19) | (MaskImm14(distance) << 5) | reg;
}
break;
case 5: // B (uncoditional)
case 5: // B (unconditional)
_assert_msg_(DYNA_REC, IsInRangeImm26(distance), "%s(%d): Received too large distance: %llx", __FUNCTION__, branch.type, distance);
inst = (0x5 << 26) | MaskImm26(distance);
break;

View file

@ -340,9 +340,8 @@ class ARM64XEmitter
friend class ARM64FloatEmitter;
private:
u8* m_code;
u8* m_startcode;
u8* m_lastCacheFlushEnd;
u8 *m_code = nullptr;
u8 *m_lastCacheFlushEnd = nullptr;
void EncodeCompareBranchInst(u32 op, ARM64Reg Rt, const void* ptr);
void EncodeTestBranchInst(u32 op, ARM64Reg Rt, u8 bits, const void* ptr);
@ -382,14 +381,12 @@ protected:
public:
ARM64XEmitter()
: m_code(nullptr), m_startcode(nullptr), m_lastCacheFlushEnd(nullptr)
{
}
ARM64XEmitter(u8* code_ptr) {
ARM64XEmitter(u8 *code_ptr) {
m_code = code_ptr;
m_lastCacheFlushEnd = code_ptr;
m_startcode = code_ptr;
}
virtual ~ARM64XEmitter()

View file

@ -15,7 +15,7 @@
class CodeBlockCommon {
public:
CodeBlockCommon() : region(nullptr), region_size(0) {}
CodeBlockCommon() {}
virtual ~CodeBlockCommon() {}
bool IsInSpace(const u8 *ptr) {
@ -34,8 +34,8 @@ public:
}
protected:
u8 *region;
size_t region_size;
u8 *region = nullptr;
size_t region_size = 0;
};
template<class T> class CodeBlock : public CodeBlockCommon, public T {
@ -48,14 +48,14 @@ private:
virtual void PoisonMemory(int offset) = 0;
public:
CodeBlock() : writeStart_(nullptr) {}
CodeBlock() {}
virtual ~CodeBlock() { if (region) FreeCodeSpace(); }
// Call this before you generate any code.
void AllocCodeSpace(int size) {
region_size = size;
// The protection will be set to RW if PlatformIsWXExclusive.
region = (u8*)AllocateExecutableMemory(region_size);
region = (u8 *)AllocateExecutableMemory(region_size);
T::SetCodePointer(region);
}
@ -124,6 +124,7 @@ public:
}
private:
const uint8_t *writeStart_;
// Note: this is a readable pointer.
const uint8_t *writeStart_ = nullptr;
};