mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
Implement VMFace with jit::VM
This commit is contained in:
parent
701d99e052
commit
48108f5433
2 changed files with 9 additions and 12 deletions
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "VM.h"
|
||||
|
||||
#include <libevm/VM.h>
|
||||
#include <libevm/VMFace.h>
|
||||
|
||||
#include "ExecutionEngine.h"
|
||||
#include "Compiler.h"
|
||||
|
|
@ -13,7 +13,7 @@ namespace eth
|
|||
namespace jit
|
||||
{
|
||||
|
||||
bytes VM::go(ExtVMFace& _ext)
|
||||
bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps)
|
||||
{
|
||||
auto module = Compiler().compile(_ext.code);
|
||||
|
||||
|
|
@ -30,7 +30,8 @@ bytes VM::go(ExtVMFace& _ext)
|
|||
BOOST_THROW_EXCEPTION(StackTooSmall(1,0));
|
||||
}
|
||||
|
||||
return std::move(engine.returnData);
|
||||
m_output = std::move(engine.returnData);
|
||||
return {m_output.data(), m_output.size()}; // TODO: This all bytesConstRef stuff sucks
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <libdevcore/Common.h>
|
||||
#include <libevm/VMFace.h>
|
||||
#include <libevm/ExtVMFace.h>
|
||||
|
||||
namespace dev
|
||||
|
|
@ -11,20 +12,15 @@ namespace eth
|
|||
namespace jit
|
||||
{
|
||||
|
||||
class VM
|
||||
class VM: public VMFace
|
||||
{
|
||||
public:
|
||||
/// Construct VM object.
|
||||
explicit VM(u256 _gas = 0): m_gas(_gas) {}
|
||||
explicit VM(u256 _gas = 0): VMFace(_gas) {}
|
||||
|
||||
void reset(u256 _gas = 0) { m_gas = _gas; }
|
||||
|
||||
bytes go(ExtVMFace& _ext);
|
||||
|
||||
u256 gas() const { return m_gas; }
|
||||
virtual bytesConstRef go(ExtVMFace& _ext, OnOpFunc const& _onOp = {}, uint64_t _steps = (uint64_t)-1) final;
|
||||
|
||||
private:
|
||||
u256 m_gas = 0;
|
||||
bytes m_output;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue