From 5a173029ad555bd452c3a1b6f618b65b6bf51a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20Zaw=C5=82ocki?= Date: Fri, 28 Nov 2014 01:23:40 +0100 Subject: [PATCH] forgot to add new source files --- libethereum/VMFactory.cpp | 28 ++++++++++++++++++++++++++++ libethereum/VMFactory.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 libethereum/VMFactory.cpp create mode 100644 libethereum/VMFactory.h diff --git a/libethereum/VMFactory.cpp b/libethereum/VMFactory.cpp new file mode 100644 index 000000000..1c8de319b --- /dev/null +++ b/libethereum/VMFactory.cpp @@ -0,0 +1,28 @@ +#include + +#if ETH_EVMJIT + #include +#endif + +#include "VMFactory.h" + +namespace dev +{ +namespace eth +{ + +std::unique_ptr VMFactory::create(VMFactory::Kind _kind, u256 _gas) +{ +#if ETH_EVMJIT + auto vm = _kind == Kind::JIT ? static_cast(new jit::VM) + : static_cast(new VM); +#else + VMFace* vm = new VM; +#endif + + vm->reset(_gas); + return std::unique_ptr(vm); +} + +} +} diff --git a/libethereum/VMFactory.h b/libethereum/VMFactory.h new file mode 100644 index 000000000..5d8edc391 --- /dev/null +++ b/libethereum/VMFactory.h @@ -0,0 +1,28 @@ +#pragma once + +#include + +namespace dev +{ +namespace eth +{ + +/** + */ + +class VMFactory +{ +public: + enum Kind: bool { + Interpreter, +#if ETH_EVMJIT + JIT +#endif + }; + + static std::unique_ptr create(Kind, u256 _gas = 0); +}; + + +} +}