Paweł Bylica
10 years ago
10 changed files with 118 additions and 66 deletions
@ -0,0 +1,36 @@ |
|||
|
|||
#include "Runtime.h" |
|||
|
|||
namespace evmcc |
|||
{ |
|||
|
|||
static Runtime* g_runtime; |
|||
|
|||
Runtime::Runtime(std::unique_ptr<dev::eth::ExtVMFace> _ext) |
|||
: m_ext(std::move(_ext)) |
|||
{ |
|||
assert(!g_runtime); |
|||
g_runtime = this; |
|||
} |
|||
|
|||
Runtime::~Runtime() |
|||
{ |
|||
g_runtime = nullptr; |
|||
} |
|||
|
|||
StackImpl& Runtime::getStack() |
|||
{ |
|||
return g_runtime->m_stack; |
|||
} |
|||
|
|||
MemoryImpl& Runtime::getMemory() |
|||
{ |
|||
return g_runtime->m_memory; |
|||
} |
|||
|
|||
dev::eth::ExtVMFace& Runtime::getExt() |
|||
{ |
|||
return *g_runtime->m_ext; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,35 @@ |
|||
|
|||
#pragma once |
|||
|
|||
#include <vector> |
|||
|
|||
#include <libevm/ExtVMFace.h> |
|||
|
|||
#include "Utils.h" |
|||
|
|||
namespace evmcc |
|||
{ |
|||
|
|||
using StackImpl = std::vector<i256>; |
|||
using MemoryImpl = dev::bytes; |
|||
|
|||
class Runtime |
|||
{ |
|||
public: |
|||
Runtime(std::unique_ptr<dev::eth::ExtVMFace> _ext); |
|||
~Runtime(); |
|||
|
|||
Runtime(const Runtime&) = delete; |
|||
void operator=(const Runtime&) = delete; |
|||
|
|||
static StackImpl& getStack(); |
|||
static MemoryImpl& getMemory(); |
|||
static dev::eth::ExtVMFace& getExt(); |
|||
|
|||
private: |
|||
StackImpl m_stack; |
|||
MemoryImpl m_memory; |
|||
std::unique_ptr<dev::eth::ExtVMFace> m_ext; |
|||
}; |
|||
|
|||
} |
Loading…
Reference in new issue