Fabcoin Core  0.16.2
P2P Digital Currency
Memory.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Array.h"
4 
5 namespace dev
6 {
7 namespace eth
8 {
9 namespace jit
10 {
11 class GasMeter;
12 
13 class Memory : public RuntimeHelper
14 {
15 public:
16  Memory(RuntimeManager& _runtimeManager, GasMeter& _gasMeter);
17 
19  void storeWord(llvm::Value* _addr, llvm::Value* _word);
20  void storeByte(llvm::Value* _addr, llvm::Value* _byte);
24  void copyBytes(llvm::Value* _srcPtr, llvm::Value* _srcSize, llvm::Value* _srcIndex,
25  llvm::Value* _destMemIdx, llvm::Value* _byteCount);
26 
28  void require(llvm::Value* _offset, llvm::Value* _size);
29 
30 private:
32 
34 
35  llvm::Function* createFunc(bool _isStore, llvm::Type* _type);
36 
37  llvm::Function* getRequireFunc();
38  llvm::Function* getLoadWordFunc();
39  llvm::Function* getStoreWordFunc();
40  llvm::Function* getStoreByteFunc();
41 
42  llvm::Function* m_require = nullptr;
43  llvm::Function* m_loadWord = nullptr;
44  llvm::Function* m_storeWord = nullptr;
45  llvm::Function* m_storeByte = nullptr;
46 };
47 
48 }
49 }
50 }
51 
llvm::Value * getBytePtr(llvm::Value *_index)
Definition: Memory.cpp:194
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
GasMeter & m_gasMeter
Definition: Memory.h:33
llvm::Function * getRequireFunc()
Definition: Memory.cpp:25
llvm::Function * m_loadWord
Definition: Memory.h:43
llvm::Function * getStoreWordFunc()
Definition: Memory.cpp:145
Memory(RuntimeManager &_runtimeManager, GasMeter &_gasMeter)
Definition: Memory.cpp:19
llvm::Value * getData()
Definition: Memory.cpp:181
llvm::Value * loadWord(llvm::Value *_addr)
Definition: Memory.cpp:162
void require(llvm::Value *_offset, llvm::Value *_size)
Requires the amount of memory to for data defined by offset and size. And counts gas fee for that mem...
Definition: Memory.cpp:199
void copyBytes(llvm::Value *_srcPtr, llvm::Value *_srcSize, llvm::Value *_srcIndex, llvm::Value *_destMemIdx, llvm::Value *_byteCount)
Definition: Memory.cpp:209
Config::Value_type Value
void storeWord(llvm::Value *_addr, llvm::Value *_word)
Definition: Memory.cpp:168
llvm::Function * createFunc(bool _isStore, llvm::Type *_type)
Definition: Memory.cpp:96
llvm::Function * getLoadWordFunc()
Definition: Memory.cpp:137
llvm::Function * getStoreByteFunc()
Definition: Memory.cpp:153
llvm::Function * m_require
Definition: Memory.h:42
llvm::Function * m_storeWord
Definition: Memory.h:44
llvm::Function * m_storeByte
Definition: Memory.h:45
Compiler helper that depends on runtime data.
llvm::Value * getSize()
Definition: Memory.cpp:189
void storeByte(llvm::Value *_addr, llvm::Value *_byte)
Definition: Memory.cpp:174