mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-30 11:17:08 -05:00
32 lines
945 B
C++
32 lines
945 B
C++
|
#include "platform_macro.h"
|
||
|
#if defined(TARGET_ARCH_ARM64)
|
||
|
|
||
|
#include "MemoryAllocator/CodeBuffer/code-buffer-arm64.h"
|
||
|
|
||
|
arm64_inst_t CodeBuffer::LoadInst(int offset) {
|
||
|
return *reinterpret_cast<int32_t *>(buffer + offset);
|
||
|
}
|
||
|
|
||
|
void CodeBuffer::FixBindLabel(int offset, arm64_inst_t instr) {
|
||
|
*reinterpret_cast<arm64_inst_t *>(buffer + offset) = instr;
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
void CodeBuffer::EmitInst(arm64_inst_t instr) {
|
||
|
DLOG(0, "[code buffer] EmitInst from arm64 with %x, cursor %x", instr, buffer_cursor);
|
||
|
ensureCapacity(getSize() + sizeof(arm64_inst_t));
|
||
|
*reinterpret_cast<arm64_inst_t *>(getCursor()) = instr;
|
||
|
buffer_cursor += sizeof(arm64_inst_t);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
void CodeBuffer::Emit64(int64_t data) {
|
||
|
DLOG(0, "[code buffer] Emit64 from arm64 with %x, cursor %x", data, buffer_cursor);
|
||
|
ensureCapacity(getSize() + sizeof(int64_t));
|
||
|
*reinterpret_cast<int64_t *>(getCursor()) = data;
|
||
|
buffer_cursor += sizeof(int64_t);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
#endif
|