You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
662 B
39 lines
662 B
10 years ago
|
|
||
|
#include "Runtime.h"
|
||
|
|
||
10 years ago
|
#include <llvm/IR/GlobalVariable.h>
|
||
|
#include <llvm/IR/Function.h>
|
||
10 years ago
|
#include <llvm/IR/IntrinsicInst.h>
|
||
10 years ago
|
|
||
10 years ago
|
namespace dev
|
||
|
{
|
||
|
namespace eth
|
||
|
{
|
||
|
namespace jit
|
||
10 years ago
|
{
|
||
|
|
||
10 years ago
|
Runtime::Runtime(RuntimeData* _data, Env* _env) :
|
||
10 years ago
|
m_data(*_data),
|
||
|
m_env(*_env),
|
||
10 years ago
|
m_currJmpBuf(m_jmpBuf)
|
||
|
{}
|
||
10 years ago
|
|
||
10 years ago
|
bytes_ref Runtime::getReturnData() const
|
||
10 years ago
|
{
|
||
10 years ago
|
auto data = m_data.callData;
|
||
10 years ago
|
auto size = static_cast<size_t>(m_data.callDataSize);
|
||
10 years ago
|
|
||
10 years ago
|
if (data < m_memory.data() || data >= m_memory.data() + m_memory.size() || size == 0)
|
||
|
{
|
||
|
assert(size == 0); // data can be an invalid pointer only if size is 0
|
||
10 years ago
|
m_data.callData = nullptr;
|
||
10 years ago
|
return {};
|
||
10 years ago
|
}
|
||
10 years ago
|
|
||
10 years ago
|
return bytes_ref{data, size};
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
}
|
||
|
}
|
||
|
}
|