Paweł Bylica
10 years ago
6 changed files with 64 additions and 58 deletions
@ -1,52 +1,46 @@ |
|||||
|
|
||||
#pragma once |
#pragma once |
||||
|
|
||||
#include <csetjmp> |
#include <csetjmp> |
||||
#include "RuntimeData.h" |
#include "RuntimeData.h" |
||||
|
|
||||
#ifdef _MSC_VER |
namespace dev |
||||
#define EXPORT __declspec(dllexport) |
{ |
||||
#else |
namespace eth |
||||
#define EXPORT |
{ |
||||
#endif |
namespace jit |
||||
|
{ |
||||
namespace dev |
|
||||
{ |
using StackImpl = std::vector<i256>; |
||||
namespace eth |
using MemoryImpl = bytes; |
||||
{ |
using jmp_buf_ref = decltype(&std::jmp_buf{}[0]); |
||||
namespace jit |
|
||||
{ |
class Runtime |
||||
|
{ |
||||
using StackImpl = std::vector<i256>; |
public: |
||||
using MemoryImpl = bytes; |
Runtime(RuntimeData* _data, Env* _env); |
||||
using jmp_buf_ref = decltype(&std::jmp_buf{}[0]); |
|
||||
|
Runtime(const Runtime&) = delete; |
||||
class Runtime |
Runtime& operator=(const Runtime&) = delete; |
||||
{ |
|
||||
public: |
StackImpl& getStack() { return m_stack; } |
||||
Runtime(RuntimeData* _data, Env* _env); |
MemoryImpl& getMemory() { return m_memory; } |
||||
|
Env* getEnvPtr() { return &m_env; } |
||||
Runtime(const Runtime&) = delete; |
|
||||
Runtime& operator=(const Runtime&) = delete; |
bytes_ref getReturnData() const; |
||||
|
jmp_buf_ref getJmpBuf() { return m_jmpBuf; } |
||||
StackImpl& getStack() { return m_stack; } |
|
||||
MemoryImpl& getMemory() { return m_memory; } |
private: |
||||
Env* getEnvPtr() { return &m_env; } |
RuntimeData& m_data; ///< Pointer to data. Expected by compiled contract.
|
||||
|
Env& m_env; ///< Pointer to environment proxy. Expected by compiled contract.
|
||||
bytes_ref getReturnData() const; |
jmp_buf_ref m_currJmpBuf; ///< Pointer to jump buffer. Expected by compiled contract.
|
||||
jmp_buf_ref getJmpBuf() { return m_jmpBuf; } |
byte* m_memoryData = nullptr; |
||||
|
i256 m_memorySize; |
||||
private: |
std::jmp_buf m_jmpBuf; |
||||
RuntimeData& m_data; ///< Pointer to data. Expected by compiled contract.
|
StackImpl m_stack; |
||||
Env& m_env; ///< Pointer to environment proxy. Expected by compiled contract.
|
MemoryImpl m_memory; |
||||
jmp_buf_ref m_currJmpBuf; ///< Pointer to jump buffer. Expected by compiled contract.
|
}; |
||||
byte* m_memoryData = nullptr; |
|
||||
i256 m_memorySize; |
} |
||||
std::jmp_buf m_jmpBuf; |
} |
||||
StackImpl m_stack; |
} |
||||
MemoryImpl m_memory; |
|
||||
}; |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
Loading…
Reference in new issue