Code generator fixups

- fixed a crash in Instruction::print
- new example program
- added a design note about the number of x86 instruction per VM instruction
1.1.6-wow
tevador 5 years ago
parent 77f809e8db
commit e6ba0a1b7d

@ -133,6 +133,10 @@ This section describes the design of the RandomX virtual machine (VM).
RandomX uses a fixed-length instruction encoding with 8 bytes per instruction. This allows a 32-bit immediate value to be included in the instruction word. The interpretation of the instruction word bits was chosen so that any 8-byte word is a valid instruction. This allows for very efficient random program generation (see chapter 1.1.1).
#### 2.1.1 Instruction complexity
The VM is a complex instruction set machine that allows both register and memory addressed operands. However, each RandomX instructions translates to only 1-7 x86 instructions (1.8 on average). It is important to keep the instruction complexity relatively low to minimize the efficiency advantage of specialized hardware with a tailored instruction set.
### 2.2 Program
The program executed by the VM has the form of a loop consisting of 256 random instructions.

File diff suppressed because it is too large Load Diff

@ -337,6 +337,7 @@ namespace randomx {
INST_NAME(IXOR_R)
INST_NAME(IXOR_M)
INST_NAME(IROR_R)
INST_NAME(IROL_R)
INST_NAME(ISWAP_R)
INST_NAME(FSWAP_R)
INST_NAME(FADD_R)

@ -54,7 +54,7 @@ void generateAsm(uint32_t nonce) {
fillAes1Rx4<softAes>((void*)hash, randomx::ScratchpadSize, scratchpad);
randomx::AssemblyGeneratorX86 asmX86;
randomx::Program p;
fillAes1Rx4<softAes>(hash, sizeof(p), &p);
fillAes4Rx4<softAes>(hash, sizeof(p), &p);
asmX86.generateProgram(p);
asmX86.printCode(std::cout);
}

Loading…
Cancel
Save