Browse Source

Remove terminate() function

cl-refactor
Paweł Bylica 10 years ago
parent
commit
86553cda81
  1. 23
      libevmjit/Runtime.cpp
  2. 3
      libevmjit/Runtime.h
  3. 9
      libevmjit/Utils.cpp
  4. 2
      libevmjit/Utils.h

23
libevmjit/Runtime.cpp

@ -11,29 +11,12 @@ namespace eth
{ {
namespace jit namespace jit
{ {
namespace
{
jmp_buf_ref g_currJmpBuf;
}
jmp_buf_ref Runtime::getCurrJmpBuf()
{
return g_currJmpBuf;
}
Runtime::Runtime(RuntimeData* _data, Env* _env): Runtime::Runtime(RuntimeData* _data, Env* _env) :
m_data(*_data), m_data(*_data),
m_env(*_env), m_env(*_env),
m_currJmpBuf(m_jmpBuf), m_currJmpBuf(m_jmpBuf)
m_prevJmpBuf(g_currJmpBuf) {}
{
g_currJmpBuf = m_jmpBuf;
}
Runtime::~Runtime()
{
g_currJmpBuf = m_prevJmpBuf;
}
bytes Runtime::getReturnData() const // FIXME: Reconsider returning by copy bytes Runtime::getReturnData() const // FIXME: Reconsider returning by copy
{ {

3
libevmjit/Runtime.h

@ -32,7 +32,6 @@ class Runtime
{ {
public: public:
Runtime(RuntimeData* _data, Env* _env); Runtime(RuntimeData* _data, Env* _env);
~Runtime();
Runtime(const Runtime&) = delete; Runtime(const Runtime&) = delete;
void operator=(const Runtime&) = delete; void operator=(const Runtime&) = delete;
@ -43,7 +42,6 @@ public:
bytes getReturnData() const; bytes getReturnData() const;
jmp_buf_ref getJmpBuf() { return m_jmpBuf; } jmp_buf_ref getJmpBuf() { return m_jmpBuf; }
static jmp_buf_ref getCurrJmpBuf();
private: private:
RuntimeData& m_data; ///< Pointer to data. Expected by compiled contract. RuntimeData& m_data; ///< Pointer to data. Expected by compiled contract.
@ -51,7 +49,6 @@ private:
jmp_buf_ref m_currJmpBuf; ///< Pointer to jump buffer. Expected by compiled contract. jmp_buf_ref m_currJmpBuf; ///< Pointer to jump buffer. Expected by compiled contract.
byte* m_memoryData = nullptr; byte* m_memoryData = nullptr;
i256 m_memorySize = {}; i256 m_memorySize = {};
jmp_buf_ref m_prevJmpBuf;
std::jmp_buf m_jmpBuf; std::jmp_buf m_jmpBuf;
StackImpl m_stack; StackImpl m_stack;
MemoryImpl m_memory; MemoryImpl m_memory;

9
libevmjit/Utils.cpp

@ -1,8 +1,7 @@
#include <csetjmp> #include <llvm/ADT/APInt.h>
#include "Utils.h" #include "Utils.h"
#include "Instruction.h" #include "Instruction.h"
#include "Runtime.h"
namespace dev namespace dev
{ {
@ -55,12 +54,6 @@ llvm::APInt readPushData(bytes::const_iterator& _curr, bytes::const_iterator _en
return value; return value;
} }
void terminate(ReturnCode _returnCode)
{
auto jmpBuf = Runtime::getCurrJmpBuf();
std::longjmp(jmpBuf, static_cast<int>(_returnCode));
}
} }
} }
} }

2
libevmjit/Utils.h

@ -17,8 +17,6 @@ struct JIT: public NoteChannel { static const char* name() { return "JIT"; } };
u256 llvm2eth(i256); u256 llvm2eth(i256);
i256 eth2llvm(u256); i256 eth2llvm(u256);
void terminate(ReturnCode _returnCode);
} }
} }
} }

Loading…
Cancel
Save