Paweł Bylica
10 years ago
39 changed files with 205 additions and 151 deletions
@ -0,0 +1,28 @@ |
|||
#include <libevm/VM.h> |
|||
|
|||
#if ETH_EVMJIT |
|||
#include<libevmjit/VM.h> |
|||
#endif |
|||
|
|||
#include "VMFactory.h" |
|||
|
|||
namespace dev |
|||
{ |
|||
namespace eth |
|||
{ |
|||
|
|||
std::unique_ptr<VMFace> VMFactory::create(VMFactory::Kind _kind, u256 _gas) |
|||
{ |
|||
#if ETH_EVMJIT |
|||
auto vm = _kind == Kind::JIT ? static_cast<VMFace*>(new jit::VM) |
|||
: static_cast<VMFace*>(new VM); |
|||
#else |
|||
VMFace* vm = new VM; |
|||
#endif |
|||
|
|||
vm->reset(_gas); |
|||
return std::unique_ptr<VMFace>(vm); |
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
#pragma once |
|||
|
|||
#include <libevm/VMFace.h> |
|||
|
|||
namespace dev |
|||
{ |
|||
namespace eth |
|||
{ |
|||
|
|||
/**
|
|||
*/ |
|||
|
|||
class VMFactory |
|||
{ |
|||
public: |
|||
enum Kind: bool { |
|||
Interpreter, |
|||
#if ETH_EVMJIT |
|||
JIT |
|||
#endif |
|||
}; |
|||
|
|||
static std::unique_ptr<VMFace> create(Kind, u256 _gas = 0); |
|||
}; |
|||
|
|||
|
|||
} |
|||
} |
Loading…
Reference in new issue