Browse Source

Refactor Executive: revert "keep ExtVM by unique_ptr".

(reverted from commit cf56b9e963)
cl-refactor
Paweł Bylica 10 years ago
parent
commit
9298da010f
  1. 4
      libethereum/Executive.cpp
  2. 4
      libethereum/Executive.h

4
libethereum/Executive.cpp

@ -249,7 +249,7 @@ bool Executive::call(CallParameters const& _p, u256 const& _gasPrice, Address co
{
m_outRef = _p.out; // Save ref to expected output buffer to be used in go()
bytes const& c = m_s.code(_p.codeAddress);
m_ext.reset(new ExtVM{m_s, m_lastHashes, _p.receiveAddress, _p.senderAddress, _origin, _p.value, _gasPrice, _p.data, &c, m_depth});
m_ext = make_shared<ExtVM>(m_s, m_lastHashes, _p.receiveAddress, _p.senderAddress, _origin, _p.value, _gasPrice, _p.data, &c, m_depth);
}
}
@ -269,7 +269,7 @@ bool Executive::create(Address _sender, u256 _endowment, u256 _gasPrice, u256 _g
// Execute _init.
if (!_init.empty())
m_ext.reset(new ExtVM{m_s, m_lastHashes, m_newAddress, _sender, _origin, _endowment, _gasPrice, bytesConstRef(), _init, m_depth});
m_ext = make_shared<ExtVM>(m_s, m_lastHashes, m_newAddress, _sender, _origin, _endowment, _gasPrice, bytesConstRef(), _init, m_depth);
m_s.m_cache[m_newAddress] = Account(m_s.balance(m_newAddress), Account::ContractConception);
m_s.transferBalance(_sender, m_newAddress, _endowment);

4
libethereum/Executive.h

@ -23,7 +23,6 @@
#include <libevmcore/Instruction.h>
#include <libethcore/Common.h>
#include <libevm/VMFace.h>
#include "ExtVM.h"
#include "Transaction.h"
namespace Json
@ -38,6 +37,7 @@ namespace eth
class State;
class BlockChain;
class ExtVM;
struct Manifest;
struct VMTraceChannel: public LogChannel { static const char* name(); static const int verbosity = 11; };
@ -140,7 +140,7 @@ public:
private:
State& m_s; ///< The state to which this operation/transaction is applied.
LastHashes m_lastHashes;
std::unique_ptr<ExtVM> m_ext; ///< The VM externality object for the VM execution or null if no VM is required.
std::shared_ptr<ExtVM> m_ext; ///< The VM externality object for the VM execution or null if no VM is required. shared_ptr used only to allow ExtVM forward reference.
bytesRef m_outRef; ///< Reference to "expected output" buffer.
ExecutionResult* m_res = nullptr; ///< Optional storage for execution results.
Address m_newAddress; ///< The address of the created contract in the case of create() being called.

Loading…
Cancel
Save