Monero
Loading...
Searching...
No Matches
jit_compiler_x86.cpp File Reference
#include <stdexcept>
#include <cstring>
#include <climits>
#include "jit_compiler_x86.hpp"
#include "jit_compiler_x86_static.hpp"
#include "superscalar.hpp"
#include "program.hpp"
#include "reciprocal.h"
#include "virtual_memory.h"
#include "instruction_weights.hpp"
Include dependency graph for jit_compiler_x86.cpp:

Namespaces

namespace  randomx

Macros

#define ADDR(x)
#define REP0(x)
#define REP1(x)
#define REP2(x)
#define REP3(x)
#define REP4(x)
#define REP5(x)
#define REP6(x)
#define REP7(x)
#define REP8(x)
#define REP9(x)
#define REP10(x)
#define REP11(x)
#define REP12(x)
#define REP13(x)
#define REP14(x)
#define REP15(x)
#define REP16(x)
#define REP17(x)
#define REP18(x)
#define REP19(x)
#define REP20(x)
#define REP21(x)
#define REP22(x)
#define REP23(x)
#define REP24(x)
#define REP25(x)
#define REP26(x)
#define REP27(x)
#define REP28(x)
#define REP29(x)
#define REP30(x)
#define REP31(x)
#define REP32(x)
#define REP33(x)
#define REP40(x)
#define REP64(x)
#define REP128(x)
#define REP232(x)
#define REP256(x)
#define REPNX(x, N)
#define REPN(x, N)
#define NUM(x)
#define WT(x)
#define INST_HANDLE(x)

Variables

constexpr int32_t randomx::superScalarHashOffset = RandomXCodeSize
const uint8_trandomx::codeLoopLoad = ADDR(randomx_program_loop_load)
const uint8_trandomx::codeProgamStart = ADDR(randomx_program_start)
const uint8_trandomx::codeReadDataset = ADDR(randomx_program_read_dataset)
const uint8_trandomx::codeReadDatasetLightSshInit = ADDR(randomx_program_read_dataset_sshash_init)
const uint8_trandomx::codeReadDatasetLightSshFin = ADDR(randomx_program_read_dataset_sshash_fin)
const uint8_trandomx::codeDatasetInit = ADDR(randomx_dataset_init)
const uint8_trandomx::codeLoopStore = ADDR(randomx_program_loop_store)
const uint8_trandomx::codeShhLoad = ADDR(randomx_sshash_load)
const uint8_trandomx::codeShhPrefetch = ADDR(randomx_sshash_prefetch)
const uint8_trandomx::codeShhEnd = ADDR(randomx_sshash_end)
const uint8_trandomx::codeShhInit = ADDR(randomx_sshash_init)
const int32_t randomx::prologueSize = codeLoopBegin - codePrologue
const int32_t randomx::loopLoadSize = codeProgamStart - codeLoopLoad
const int32_t randomx::readDatasetSize = codeReadDatasetLightSshInit - codeReadDataset
const int32_t randomx::readDatasetLightInitSize = codeReadDatasetLightSshFin - codeReadDatasetLightSshInit
const int32_t randomx::readDatasetLightFinSize = codeLoopStore - codeReadDatasetLightSshFin
const int32_t randomx::loopStoreSize = codeLoopEnd - codeLoopStore
const int32_t randomx::datasetInitSize = codeEpilogue - codeDatasetInit
const int32_t randomx::epilogueSize = codeShhLoad - codeEpilogue
const int32_t randomx::codeSshLoadSize = codeShhPrefetch - codeShhLoad
const int32_t randomx::codeSshPrefetchSize = codeShhEnd - codeShhPrefetch
const int32_t randomx::codeSshInitSize = codeProgramEnd - codeShhInit
const int32_t randomx::epilogueOffset = CodeSize - epilogueSize
static const uint8_t randomx::REX_ADD_RR [] = { 0x4d, 0x03 }
static const uint8_t randomx::REX_ADD_RM [] = { 0x4c, 0x03 }
static const uint8_t randomx::REX_SUB_RR [] = { 0x4d, 0x2b }
static const uint8_t randomx::REX_SUB_RM [] = { 0x4c, 0x2b }
static const uint8_t randomx::REX_MOV_RR [] = { 0x41, 0x8b }
static const uint8_t randomx::REX_MOV_RR64 [] = { 0x49, 0x8b }
static const uint8_t randomx::REX_MOV_R64R [] = { 0x4c, 0x8b }
static const uint8_t randomx::REX_IMUL_RR [] = { 0x4d, 0x0f, 0xaf }
static const uint8_t randomx::REX_IMUL_RRI [] = { 0x4d, 0x69 }
static const uint8_t randomx::REX_IMUL_RM [] = { 0x4c, 0x0f, 0xaf }
static const uint8_t randomx::REX_MUL_R [] = { 0x49, 0xf7 }
static const uint8_t randomx::REX_MUL_M [] = { 0x48, 0xf7 }
static const uint8_t randomx::REX_81 [] = { 0x49, 0x81 }
static const uint8_t randomx::AND_EAX_I = 0x25
static const uint8_t randomx::MOV_EAX_I = 0xb8
static const uint8_t randomx::MOV_RAX_I [] = { 0x48, 0xb8 }
static const uint8_t randomx::MOV_RCX_I [] = { 0x48, 0xb9 }
static const uint8_t randomx::REX_LEA [] = { 0x4f, 0x8d }
static const uint8_t randomx::REX_MUL_MEM [] = { 0x48, 0xf7, 0x24, 0x0e }
static const uint8_t randomx::REX_IMUL_MEM [] = { 0x48, 0xf7, 0x2c, 0x0e }
static const uint8_t randomx::REX_SHR_RAX [] = { 0x48, 0xc1, 0xe8 }
static const uint8_t randomx::RAX_ADD_SBB_1 [] = { 0x48, 0x83, 0xC0, 0x01, 0x48, 0x83, 0xD8, 0x00 }
static const uint8_t randomx::MUL_RCX [] = { 0x48, 0xf7, 0xe1 }
static const uint8_t randomx::REX_SHR_RDX [] = { 0x48, 0xc1, 0xea }
static const uint8_t randomx::REX_SH [] = { 0x49, 0xc1 }
static const uint8_t randomx::MOV_RCX_RAX_SAR_RCX_63 [] = { 0x48, 0x89, 0xc1, 0x48, 0xc1, 0xf9, 0x3f }
static const uint8_t randomx::AND_ECX_I [] = { 0x81, 0xe1 }
static const uint8_t randomx::ADD_RAX_RCX [] = { 0x48, 0x01, 0xC8 }
static const uint8_t randomx::SAR_RAX_I8 [] = { 0x48, 0xC1, 0xF8 }
static const uint8_t randomx::NEG_RAX [] = { 0x48, 0xF7, 0xD8 }
static const uint8_t randomx::ADD_R_RAX [] = { 0x4C, 0x03 }
static const uint8_t randomx::XOR_EAX_EAX [] = { 0x33, 0xC0 }
static const uint8_t randomx::ADD_RDX_R [] = { 0x4c, 0x01 }
static const uint8_t randomx::SUB_RDX_R [] = { 0x4c, 0x29 }
static const uint8_t randomx::SAR_RDX_I8 [] = { 0x48, 0xC1, 0xFA }
static const uint8_t randomx::TEST_RDX_RDX [] = { 0x48, 0x85, 0xD2 }
static const uint8_t randomx::SETS_AL_ADD_RDX_RAX [] = { 0x0F, 0x98, 0xC0, 0x48, 0x03, 0xD0 }
static const uint8_t randomx::REX_NEG [] = { 0x49, 0xF7 }
static const uint8_t randomx::REX_XOR_RR [] = { 0x4D, 0x33 }
static const uint8_t randomx::REX_XOR_RI [] = { 0x49, 0x81 }
static const uint8_t randomx::REX_XOR_RM [] = { 0x4c, 0x33 }
static const uint8_t randomx::REX_ROT_CL [] = { 0x49, 0xd3 }
static const uint8_t randomx::REX_ROT_I8 [] = { 0x49, 0xc1 }
static const uint8_t randomx::SHUFPD [] = { 0x66, 0x0f, 0xc6 }
static const uint8_t randomx::REX_ADDPD [] = { 0x66, 0x41, 0x0f, 0x58 }
static const uint8_t randomx::REX_CVTDQ2PD_XMM12 [] = { 0xf3, 0x44, 0x0f, 0xe6, 0x24, 0x06 }
static const uint8_t randomx::REX_SUBPD [] = { 0x66, 0x41, 0x0f, 0x5c }
static const uint8_t randomx::REX_XORPS [] = { 0x41, 0x0f, 0x57 }
static const uint8_t randomx::REX_MULPD [] = { 0x66, 0x41, 0x0f, 0x59 }
static const uint8_t randomx::REX_MAXPD [] = { 0x66, 0x41, 0x0f, 0x5f }
static const uint8_t randomx::REX_DIVPD [] = { 0x66, 0x41, 0x0f, 0x5e }
static const uint8_t randomx::SQRTPD [] = { 0x66, 0x0f, 0x51 }
static const uint8_t randomx::AND_OR_MOV_LDMXCSR [] = { 0x25, 0x00, 0x60, 0x00, 0x00, 0x0D, 0xC0, 0x9F, 0x00, 0x00, 0x50, 0x0F, 0xAE, 0x14, 0x24, 0x58 }
static const uint8_t randomx::ROL_RAX [] = { 0x48, 0xc1, 0xc0 }
static const uint8_t randomx::XOR_ECX_ECX [] = { 0x33, 0xC9 }
static const uint8_t randomx::REX_CMP_R32I [] = { 0x41, 0x81 }
static const uint8_t randomx::REX_CMP_M32I [] = { 0x81, 0x3c, 0x06 }
static const uint8_t randomx::MOVAPD [] = { 0x66, 0x0f, 0x29 }
static const uint8_t randomx::REX_MOV_MR [] = { 0x4c, 0x89 }
static const uint8_t randomx::REX_XOR_EAX [] = { 0x41, 0x33 }
static const uint8_t randomx::SUB_EBX [] = { 0x83, 0xEB, 0x01 }
static const uint8_t randomx::JNZ [] = { 0x0f, 0x85 }
static const uint8_t randomx::JMP = 0xe9
static const uint8_t randomx::REX_XOR_RAX_R64 [] = { 0x49, 0x33 }
static const uint8_t randomx::REX_XCHG [] = { 0x4d, 0x87 }
static const uint8_t randomx::REX_ANDPS_XMM12 [] = { 0x45, 0x0F, 0x54, 0xE5, 0x45, 0x0F, 0x56, 0xE6 }
static const uint8_t randomx::REX_PADD [] = { 0x66, 0x44, 0x0f }
static const uint8_t randomx::PADD_OPCODES [] = { 0xfc, 0xfd, 0xfe, 0xd4 }
static const uint8_t randomx::CALL = 0xe8
static const uint8_t randomx::REX_ADD_I [] = { 0x49, 0x81 }
static const uint8_t randomx::REX_TEST [] = { 0x49, 0xF7 }
static const uint8_t randomx::JZ [] = { 0x0f, 0x84 }
static const uint8_t randomx::RET = 0xc3
static const uint8_t randomx::LEA_32 [] = { 0x41, 0x8d }
static const uint8_t randomx::MOVNTI [] = { 0x4c, 0x0f, 0xc3 }
static const uint8_t randomx::ADD_EBX_I [] = { 0x81, 0xc3 }
static const uint8_t randomx::NOP1 [] = { 0x90 }
static const uint8_t randomx::NOP2 [] = { 0x66, 0x90 }
static const uint8_t randomx::NOP3 [] = { 0x66, 0x66, 0x90 }
static const uint8_t randomx::NOP4 [] = { 0x0F, 0x1F, 0x40, 0x00 }
static const uint8_t randomx::NOP5 [] = { 0x0F, 0x1F, 0x44, 0x00, 0x00 }
static const uint8_t randomx::NOP6 [] = { 0x66, 0x0F, 0x1F, 0x44, 0x00, 0x00 }
static const uint8_t randomx::NOP7 [] = { 0x0F, 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00 }
static const uint8_t randomx::NOP8 [] = { 0x0F, 0x1F, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 }
static const uint8_trandomx::NOPX [] = { NOP1, NOP2, NOP3, NOP4, NOP5, NOP6, NOP7, NOP8 }

Macro Definition Documentation

◆ ADDR

#define ADDR ( x)
Value:
((uint8_t*)&x)
unsigned char uint8_t
Definition stdint.h:124

◆ INST_HANDLE

#define INST_HANDLE ( x)
Value:
REPN(&JitCompilerX86::h_##x, WT(x))
#define REPN(x, N)
#define WT(x)

◆ NUM

#define NUM ( x)
Value:
x

◆ REP0

#define REP0 ( x)

◆ REP1

#define REP1 ( x)
Value:
x,

◆ REP10

#define REP10 ( x)
Value:
REP9(x) x,
#define REP9(x)

◆ REP11

#define REP11 ( x)
Value:
REP10(x) x,
#define REP10(x)

◆ REP12

#define REP12 ( x)
Value:
REP11(x) x,
#define REP11(x)

◆ REP128

#define REP128 ( x)
Value:
REP32(x) REP32(x) REP32(x) REP32(x)
#define REP32(x)

◆ REP13

#define REP13 ( x)
Value:
REP12(x) x,
#define REP12(x)

◆ REP14

#define REP14 ( x)
Value:
REP13(x) x,
#define REP13(x)

◆ REP15

#define REP15 ( x)
Value:
REP14(x) x,
#define REP14(x)

◆ REP16

#define REP16 ( x)
Value:
REP15(x) x,
#define REP15(x)

◆ REP17

#define REP17 ( x)
Value:
REP16(x) x,
#define REP16(x)

◆ REP18

#define REP18 ( x)
Value:
REP17(x) x,
#define REP17(x)

◆ REP19

#define REP19 ( x)
Value:
REP18(x) x,
#define REP18(x)

◆ REP2

#define REP2 ( x)
Value:
REP1(x) x,
#define REP1(x)

◆ REP20

#define REP20 ( x)
Value:
REP19(x) x,
#define REP19(x)

◆ REP21

#define REP21 ( x)
Value:
REP20(x) x,
#define REP20(x)

◆ REP22

#define REP22 ( x)
Value:
REP21(x) x,
#define REP21(x)

◆ REP23

#define REP23 ( x)
Value:
REP22(x) x,
#define REP22(x)

◆ REP232

#define REP232 ( x)
Value:
REP128(x) REP40(x) REP40(x) REP24(x)
#define REP128(x)
#define REP24(x)
#define REP40(x)

◆ REP24

#define REP24 ( x)
Value:
REP23(x) x,
#define REP23(x)

◆ REP25

#define REP25 ( x)
Value:
REP24(x) x,

◆ REP256

#define REP256 ( x)
Value:

◆ REP26

#define REP26 ( x)
Value:
REP25(x) x,
#define REP25(x)

◆ REP27

#define REP27 ( x)
Value:
REP26(x) x,
#define REP26(x)

◆ REP28

#define REP28 ( x)
Value:
REP27(x) x,
#define REP27(x)

◆ REP29

#define REP29 ( x)
Value:
REP28(x) x,
#define REP28(x)

◆ REP3

#define REP3 ( x)
Value:
REP2(x) x,
#define REP2(x)

◆ REP30

#define REP30 ( x)
Value:
REP29(x) x,
#define REP29(x)

◆ REP31

#define REP31 ( x)
Value:
REP30(x) x,
#define REP30(x)

◆ REP32

#define REP32 ( x)
Value:
REP31(x) x,
#define REP31(x)

◆ REP33

#define REP33 ( x)
Value:
REP32(x) x,

◆ REP4

#define REP4 ( x)
Value:
REP3(x) x,
#define REP3(x)

◆ REP40

#define REP40 ( x)
Value:
REP32(x) REP8(x)
#define REP8(x)

◆ REP5

#define REP5 ( x)
Value:
REP4(x) x,
#define REP4(x)

◆ REP6

#define REP6 ( x)
Value:
REP5(x) x,
#define REP5(x)

◆ REP64

#define REP64 ( x)
Value:
REP32(x) REP32(x)

◆ REP7

#define REP7 ( x)
Value:
REP6(x) x,
#define REP6(x)

◆ REP8

#define REP8 ( x)
Value:
REP7(x) x,
#define REP7(x)

◆ REP9

#define REP9 ( x)
Value:
REP8(x) x,

◆ REPN

#define REPN ( x,
N )
Value:
REPNX(x,N)
#define REPNX(x, N)

◆ REPNX

#define REPNX ( x,
N )
Value:
REP##N(x)

◆ WT

#define WT ( x)
Value:
NUM(RANDOMX_FREQ_##x)
#define NUM(x)