Browse Source

Delete old memory pointers

cl-refactor
Paweł Bylica 10 years ago
parent
commit
3da758ccbb
  1. 2
      evmjit/libevmjit/Common.h
  2. 1
      evmjit/libevmjit/ExecStats.h
  3. 9
      evmjit/libevmjit/Runtime.h
  4. 6
      evmjit/libevmjit/RuntimeManager.cpp
  5. 3
      evmjit/libevmjit/Stack.cpp

2
evmjit/libevmjit/Common.h

@ -1,6 +1,5 @@
#pragma once
#include <vector>
#include <tuple>
#include <cstdint>
@ -18,7 +17,6 @@ namespace jit
{
using byte = uint8_t;
using bytes = std::vector<byte>;
using bytes_ref = std::tuple<byte const*, size_t>;
using code_iterator = byte const*;

1
evmjit/libevmjit/ExecStats.h

@ -1,5 +1,6 @@
#pragma once
#include <vector>
#include <string>
#include <chrono>

9
evmjit/libevmjit/Runtime.h

@ -8,7 +8,6 @@ namespace eth
{
namespace jit
{
using MemoryImpl = bytes;
class Runtime
{
@ -21,11 +20,9 @@ public:
private:
RuntimeData* m_data = nullptr; ///< Pointer to data. Expected by compiled contract.
Env* m_env = nullptr; ///< Pointer to environment proxy. Expected by compiled contract.
byte* m_memoryData = nullptr;
i256 m_memorySize;
byte* m_memData;
uint64_t m_memSize;
uint64_t m_memCap;
byte* m_memData = nullptr;
uint64_t m_memSize = 0;
uint64_t m_memCap = 0;
};
}

6
evmjit/libevmjit/RuntimeManager.cpp

@ -51,9 +51,7 @@ llvm::StructType* RuntimeManager::getRuntimeType()
{
Type::RuntimeDataPtr, // data
Type::EnvPtr, // Env*
Type::BytePtr, // memory data
Type::Word, // memory size
Array::getType()
Array::getType() // memory
};
type = llvm::StructType::create(elems, "Runtime");
}
@ -100,7 +98,7 @@ RuntimeManager::RuntimeManager(llvm::IRBuilder<>& _builder, llvm::Value* _jmpBuf
assert(m_dataPtr->getType() == Type::RuntimeDataPtr);
m_gasPtr = m_builder.CreateStructGEP(m_dataPtr, 0, "gas");
assert(m_gasPtr->getType() == Type::Gas->getPointerTo());
m_memPtr = m_builder.CreateStructGEP(rtPtr, 4, "mem");
m_memPtr = m_builder.CreateStructGEP(rtPtr, 2, "mem");
assert(m_memPtr->getType() == Array::getType()->getPointerTo());
m_envPtr = m_builder.CreateLoad(m_builder.CreateStructGEP(rtPtr, 1), "env");
assert(m_envPtr->getType() == Type::EnvPtr);

3
evmjit/libevmjit/Stack.cpp

@ -158,7 +158,6 @@ llvm::Value* Stack::get(size_t _index)
void Stack::set(size_t _index, llvm::Value* _value)
{
m_stack.set(m_builder.CreateSub(m_stack.size(), m_builder.getInt64(_index + 1)), _value);
//createCall(getSetFunc(), {m_runtimeManager.getRuntimePtr(), m_builder.getInt64(_index), _value});
}
void Stack::pop(size_t _count)
@ -166,13 +165,11 @@ void Stack::pop(size_t _count)
// FIXME: Pop does not check for stack underflow but looks like not needed
// We should place stack.require() check and begining of every BB
m_stack.pop(m_builder.getInt64(_count));
//createCall(getPopFunc(), {m_runtimeManager.getRuntimePtr(), m_builder.getInt64(_count), m_runtimeManager.getJmpBuf()});
}
void Stack::push(llvm::Value* _value)
{
m_stack.push(_value);
//createCall(getPushFunc(), {m_runtimeManager.getRuntimePtr(), _value});
}
}

Loading…
Cancel
Save