Monero
jit_compiler_rv64.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2023 tevador <tevador@gmail.com>
3 
4 All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8  * Redistributions of source code must retain the above copyright
9  notice, this list of conditions and the following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright
11  notice, this list of conditions and the following disclaimer in the
12  documentation and/or other materials provided with the distribution.
13  * Neither the name of the copyright holder nor the
14  names of its contributors may be used to endorse or promote products
15  derived from this software without specific prior written permission.
16 
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 
29 #pragma once
30 
31 #include <cstdint>
32 #include <cstring>
33 #include <vector>
34 #include "jit_compiler.hpp"
35 
36 namespace randomx {
37 
38  class Program;
39  struct ProgramConfiguration;
40  class SuperscalarProgram;
41  class Instruction;
42 
44  public:
49  void generateSuperscalarHash(SuperscalarProgram programs[RANDOMX_CACHE_ACCESSES], std::vector<uint64_t>&);
52  return (ProgramFunc*)entryProgram;
53  }
56  }
58  return state.code;
59  }
60  size_t getCodeSize();
61  void enableWriting();
62  void enableExecution();
63  void enableAll();
64  private:
67  void* entryProgram;
68  };
69 }
void enableWriting()
Definition: jit_compiler_rv64.cpp:618
Definition: allocator.cpp:35
#define RANDOMX_CACHE_ACCESSES
Definition: configuration.h:44
void() ProgramFunc(RegisterFile &, MemoryRegisters &, uint8_t *, uint64_t)
Definition: common.hpp:188
void() DatasetInitFunc(randomx_cache *cache, uint8_t *dataset, uint32_t startBlock, uint32_t endBlock)
Definition: common.hpp:189
void enableAll()
Definition: jit_compiler_rv64.cpp:614
CompilerState state
Definition: jit_compiler_rv64.hpp:65
Definition: superscalar_program.hpp:37
ProgramFunc * getProgramFunc()
Definition: jit_compiler_rv64.hpp:51
JitCompilerRV64()
Definition: jit_compiler_rv64.cpp:598
~JitCompilerRV64()
Definition: jit_compiler_rv64.cpp:610
unsigned char uint8_t
Definition: stdint.h:124
void generateProgramLight(Program &, ProgramConfiguration &, uint32_t)
Definition: jit_compiler_rv64.cpp:636
uint8_t * getCode()
Definition: jit_compiler_rv64.hpp:57
Definition: program.hpp:39
unsigned int uint32_t
Definition: stdint.h:126
void * entryDataInit
Definition: jit_compiler_rv64.hpp:66
Definition: program.hpp:44
Definition: jit_compiler.hpp:61
Definition: jit_compiler_rv64.hpp:43
Definition: blake256.h:36
size_t getCodeSize()
Definition: jit_compiler_rv64.cpp:594
void generateSuperscalarHash(SuperscalarProgram programs[RANDOMX_CACHE_ACCESSES], std::vector< uint64_t > &)
Definition: jit_compiler_rv64.cpp:656
void generateProgram(Program &, ProgramConfiguration &)
Definition: jit_compiler_rv64.cpp:626
void enableExecution()
Definition: jit_compiler_rv64.cpp:622
void * entryProgram
Definition: jit_compiler_rv64.hpp:67
void generateDatasetInitCode()
Definition: jit_compiler_rv64.hpp:50
DatasetInitFunc * getDatasetInitFunc()
Definition: jit_compiler_rv64.hpp:54