Merge pull request #3462 from SChernykh/dev

RandomX: correct memcpy size for JIT initialization
This commit is contained in:
xmrig 2024-04-14 17:01:16 +07:00 committed by GitHub
commit 1efe7e9562
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 5 additions and 6 deletions

View file

@ -1078,6 +1078,6 @@ void JitCompilerA64::h_NOP(Instruction& instr, uint32_t& codePos)
{
}
InstructionGeneratorA64 JitCompilerA64::engine[257] = {};
InstructionGeneratorA64 JitCompilerA64::engine[256] = {};
}

View file

@ -74,7 +74,7 @@ namespace randomx {
void enableWriting() const;
void enableExecution() const;
static InstructionGeneratorA64 engine[257];
static InstructionGeneratorA64 engine[256];
private:
const bool hugePages;

View file

@ -1443,6 +1443,6 @@ namespace randomx {
emitByte(0x90, code, codePos);
}
alignas(64) InstructionGeneratorX86 JitCompilerX86::engine[257] = {};
alignas(64) InstructionGeneratorX86 JitCompilerX86::engine[256] = {};
}

View file

@ -81,7 +81,7 @@ namespace randomx {
void enableWriting() const;
void enableExecution() const;
alignas(64) static InstructionGeneratorX86 engine[257];
alignas(64) static InstructionGeneratorX86 engine[256];
private:
int registerUsage[RegistersCount] = {};

View file

@ -260,8 +260,7 @@ typedef void(randomx::JitCompilerX86::* InstructionGeneratorX86_2)(const randomx
#define JIT_HANDLE(x, prev) do { \
const InstructionGeneratorX86_2 p = &randomx::JitCompilerX86::h_##x; \
static_assert(sizeof(p) == sizeof(randomx::JitCompilerX86::engine[k]), "Pointer size mismatch"); \
memcpy(randomx::JitCompilerX86::engine + k, &p, sizeof(p)); \
memcpy(randomx::JitCompilerX86::engine + k, &p, sizeof(randomx::JitCompilerX86::engine[k])); \
} while (0)
#elif (XMRIG_ARM == 8)