Paweł Bylica
10 years ago
19 changed files with 138 additions and 176 deletions
@ -1,46 +0,0 @@ |
|||
#include "evmjit/JIT.h" |
|||
|
|||
#include <unordered_map> |
|||
|
|||
namespace dev |
|||
{ |
|||
namespace evmjit |
|||
{ |
|||
namespace |
|||
{ |
|||
|
|||
class JITImpl: JIT |
|||
{ |
|||
public: |
|||
std::unordered_map<h256, void*> codeMap; |
|||
|
|||
static JITImpl& instance() |
|||
{ |
|||
static JITImpl s_instance; |
|||
return s_instance; |
|||
} |
|||
}; |
|||
|
|||
} // anonymous namespace
|
|||
|
|||
bool JIT::isCodeReady(h256 _codeHash) |
|||
{ |
|||
return JITImpl::instance().codeMap.count(_codeHash) != 0; |
|||
} |
|||
|
|||
void* JIT::getCode(h256 _codeHash) |
|||
{ |
|||
auto& codeMap = JITImpl::instance().codeMap; |
|||
auto it = codeMap.find(_codeHash); |
|||
if (it != codeMap.end()) |
|||
return it->second; |
|||
return nullptr; |
|||
} |
|||
|
|||
void JIT::mapCode(h256 _codeHash, void* _funcAddr) |
|||
{ |
|||
JITImpl::instance().codeMap.insert(std::make_pair(_codeHash, _funcAddr)); |
|||
} |
|||
|
|||
} |
|||
} |
@ -1,63 +0,0 @@ |
|||
#pragma once |
|||
|
|||
#include "evmjit/DataTypes.h" |
|||
#include "Common.h" |
|||
|
|||
namespace dev |
|||
{ |
|||
namespace eth |
|||
{ |
|||
namespace jit |
|||
{ |
|||
using evmjit::i256; |
|||
using evmjit::h256; |
|||
|
|||
struct RuntimeData |
|||
{ |
|||
enum Index |
|||
{ |
|||
Gas, |
|||
GasPrice, |
|||
CallData, |
|||
CallDataSize, |
|||
Address, |
|||
Caller, |
|||
Origin, |
|||
CallValue, |
|||
CoinBase, |
|||
Difficulty, |
|||
GasLimit, |
|||
Number, |
|||
Timestamp, |
|||
Code, |
|||
CodeSize, |
|||
|
|||
SuicideDestAddress = Address, ///< Suicide balance destination address
|
|||
ReturnData = CallData, ///< Return data pointer (set only in case of RETURN)
|
|||
ReturnDataSize = CallDataSize, ///< Return data size (set only in case of RETURN)
|
|||
}; |
|||
|
|||
int64_t gas = 0; |
|||
int64_t gasPrice = 0; |
|||
byte const* callData = nullptr; |
|||
uint64_t callDataSize = 0; |
|||
i256 address; |
|||
i256 caller; |
|||
i256 origin; |
|||
i256 callValue; |
|||
i256 coinBase; |
|||
i256 difficulty; |
|||
i256 gasLimit; |
|||
uint64_t number = 0; |
|||
int64_t timestamp = 0; |
|||
byte const* code = nullptr; |
|||
uint64_t codeSize = 0; |
|||
h256 codeHash; |
|||
}; |
|||
|
|||
/// VM Environment (ExtVM) opaque type
|
|||
struct Env; |
|||
|
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue