diff --git a/libevmjit-cpp/Env.cpp b/libevmjit-cpp/Env.cpp index 2e5b94c82..5014e4947 100644 --- a/libevmjit-cpp/Env.cpp +++ b/libevmjit-cpp/Env.cpp @@ -1,6 +1,4 @@ -#include "Ext.h" - #include #include #include diff --git a/libevmjit-cpp/Ext.h b/libevmjit-cpp/Ext.h deleted file mode 100644 index d891c19c9..000000000 --- a/libevmjit-cpp/Ext.h +++ /dev/null @@ -1,17 +0,0 @@ - -#pragma once - -namespace dev -{ -namespace eth -{ -namespace jit -{ - - - - -} -} -} - diff --git a/libevmjit-cpp/Runtime.cpp b/libevmjit-cpp/Runtime.cpp deleted file mode 100644 index 3fa36253b..000000000 --- a/libevmjit-cpp/Runtime.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -#include "Runtime.h" - -#include -#include -#include - -//#include - -namespace dev -{ -namespace eth -{ -namespace jit -{ - -Runtime::Runtime(u256 _gas, ExtVMFace& _ext, jmp_buf _jmpBuf, bool _outputLogs): - m_ext(_ext), - m_outputLogs(_outputLogs) -{ - set(RuntimeData::Gas, _gas); - set(RuntimeData::Address, fromAddress(_ext.myAddress)); - set(RuntimeData::Caller, fromAddress(_ext.caller)); - set(RuntimeData::Origin, fromAddress(_ext.origin)); - set(RuntimeData::CallValue, _ext.value); - set(RuntimeData::CallDataSize, _ext.data.size()); - set(RuntimeData::GasPrice, _ext.gasPrice); - set(RuntimeData::PrevHash, _ext.previousBlock.hash); - set(RuntimeData::CoinBase, fromAddress(_ext.currentBlock.coinbaseAddress)); - set(RuntimeData::TimeStamp, _ext.currentBlock.timestamp); - set(RuntimeData::Number, _ext.currentBlock.number); - set(RuntimeData::Difficulty, _ext.currentBlock.difficulty); - set(RuntimeData::GasLimit, _ext.currentBlock.gasLimit); - set(RuntimeData::CodeSize, _ext.code.size()); // TODO: Use constant - m_data.callData = _ext.data.data(); - m_data.code = _ext.code.data(); - m_data.jmpBuf = _jmpBuf; -} - -void Runtime::set(RuntimeData::Index _index, u256 _value) -{ - m_data.elems[_index] = eth2llvm(_value); -} - -u256 Runtime::getGas() const -{ - return llvm2eth(m_data.elems[RuntimeData::Gas]); -} - -bytes Runtime::getReturnData() const // FIXME: Reconsider returning by copy -{ - // TODO: Handle large indexes - auto offset = static_cast(llvm2eth(m_data.elems[RuntimeData::ReturnDataOffset])); - auto size = static_cast(llvm2eth(m_data.elems[RuntimeData::ReturnDataSize])); - - assert(offset + size <= m_memory.size()); - // TODO: Handle invalid data access by returning empty ref - auto dataBeg = m_memory.begin() + offset; - return {dataBeg, dataBeg + size}; -} - -bool Runtime::outputLogs() const -{ - return m_outputLogs; -} - - -} -} -} diff --git a/libevmjit-cpp/Runtime.h b/libevmjit-cpp/Runtime.h deleted file mode 100644 index 1c11afc5d..000000000 --- a/libevmjit-cpp/Runtime.h +++ /dev/null @@ -1,64 +0,0 @@ - -#pragma once - -#include -#include - -//#include - -#include "Instruction.h" -#include "CompilerHelper.h" -#include "Utils.h" -#include "Type.h" -#include "RuntimeData.h" - - -#ifdef _MSC_VER - #define EXPORT __declspec(dllexport) -#else - #define EXPORT -#endif - -namespace dev -{ -namespace eth -{ -namespace jit -{ - -using StackImpl = std::vector; -using MemoryImpl = bytes; - -class Runtime -{ -public: - Runtime(u256 _gas, ExtVMFace& _ext, jmp_buf _jmpBuf, bool _outputLogs); - - Runtime(const Runtime&) = delete; - void operator=(const Runtime&) = delete; - - RuntimeData* getDataPtr() { return &m_data; } - - StackImpl& getStack() { return m_stack; } - MemoryImpl& getMemory() { return m_memory; } - ExtVMFace& getExt() { return m_ext; } - - u256 getGas() const; - bytes getReturnData() const; - decltype(&jmp_buf{}[0]) getJmpBuf() { return m_data.jmpBuf; } - bool outputLogs() const; - -private: - void set(RuntimeData::Index _index, u256 _value); - - /// @internal Must be the first element to asure Runtime* === RuntimeData* - RuntimeData m_data; - StackImpl m_stack; - MemoryImpl m_memory; - ExtVMFace& m_ext; - bool m_outputLogs; ///< write LOG statements to console -}; - -} -} -}