Browse Source

Extract gas pointer from RuntimeData

cl-refactor
Paweł Bylica 10 years ago
parent
commit
32515a77d3
  1. 6
      evmjit/libevmjit/RuntimeManager.cpp
  2. 1
      evmjit/libevmjit/RuntimeManager.h

6
evmjit/libevmjit/RuntimeManager.cpp

@ -101,6 +101,8 @@ RuntimeManager::RuntimeManager(llvm::IRBuilder<>& _builder, llvm::Value* _jmpBuf
auto rtPtr = getRuntimePtr();
m_dataPtr = m_builder.CreateLoad(m_builder.CreateStructGEP(rtPtr, 0), "data");
assert(m_dataPtr->getType() == Type::RuntimeDataPtr);
m_gasPtr = m_builder.CreateStructGEP(m_dataPtr, 0, "gas");
assert(m_gasPtr->getType() == Type::Gas->getPointerTo());
m_envPtr = m_builder.CreateLoad(m_builder.CreateStructGEP(rtPtr, 1), "env");
assert(m_envPtr->getType() == Type::EnvPtr);
}
@ -238,6 +240,10 @@ llvm::Value* RuntimeManager::getGas()
llvm::Value* RuntimeManager::getGasPtr()
{
if (getMainFunction())
return m_gasPtr;
// TODO: eliminated this case
return getPtr(RuntimeData::Gas);
}

1
evmjit/libevmjit/RuntimeManager.h

@ -54,6 +54,7 @@ private:
llvm::Function* m_longjmp = nullptr;
llvm::Value* const m_jmpBuf;
llvm::Value* m_dataPtr = nullptr;
llvm::Value* m_gasPtr = nullptr;
llvm::Value* m_envPtr = nullptr;
code_iterator m_codeBegin = {};

Loading…
Cancel
Save