Browse Source

Merge pull request #2614 from chfast/fix_vmtrace

Fix VM tracing
cl-refactor
Gav Wood 10 years ago
parent
commit
82e950f171
  1. 3
      libethereum/Executive.cpp
  2. 17
      libethereum/State.cpp
  3. 2
      libp2p/RLPXSocketIO.cpp

3
libethereum/Executive.cpp

@ -325,7 +325,8 @@ bool Executive::go(OnOpFunc const& _onOp)
#endif #endif
try try
{ {
auto vm = VMFactory::create(); // Create VM instance. Force Interpreter if tracing requested.
auto vm = _onOp ? VMFactory::create(VMKind::Interpreter) : VMFactory::create();
if (m_isCreation) if (m_isCreation)
{ {
auto out = vm->exec(m_gas, *m_ext, _onOp); auto out = vm->exec(m_gas, *m_ext, _onOp);

17
libethereum/State.cpp

@ -1137,6 +1137,12 @@ bool State::isTrieGood(bool _enforceRefs, bool _requireNoLeftOvers) const
ExecutionResult State::execute(LastHashes const& _lh, Transaction const& _t, Permanence _p, OnOpFunc const& _onOp) ExecutionResult State::execute(LastHashes const& _lh, Transaction const& _t, Permanence _p, OnOpFunc const& _onOp)
{ {
auto onOp = _onOp;
#if ETH_VMTRACE
if (isChannelVisible<VMTraceChannel>())
onOp = Executive::simpleTrace(); // override tracer
#endif
#if ETH_PARANOIA #if ETH_PARANOIA
paranoia("start of execution.", true); paranoia("start of execution.", true);
State old(*this); State old(*this);
@ -1161,16 +1167,7 @@ ExecutionResult State::execute(LastHashes const& _lh, Transaction const& _t, Per
ctrace << toHex(e.t().rlp()); ctrace << toHex(e.t().rlp());
#endif #endif
if (!e.execute()) if (!e.execute())
#if ETH_VMTRACE e.go(onOp);
{
if (isChannelVisible<VMTraceChannel>())
e.go(e.simpleTrace());
else
e.go(_onOp);
}
#else
e.go(_onOp);
#endif
e.finalize(); e.finalize();
#if ETH_PARANOIA #if ETH_PARANOIA

2
libp2p/RLPXSocketIO.cpp

@ -34,7 +34,7 @@ RLPXSocketIO::RLPXSocketIO(unsigned _protCount, RLPXFrameCoder& _coder, bi::tcp:
m_flowControl(_flowControl), m_flowControl(_flowControl),
m_coder(_coder), m_coder(_coder),
m_socket(_socket), m_socket(_socket),
m_writers(move(writers(_protCount))), m_writers(writers(_protCount)),
m_egressCapacity(m_flowControl ? _initialCapacity : MaxPacketSize * m_writers.size()) m_egressCapacity(m_flowControl ? _initialCapacity : MaxPacketSize * m_writers.size())
{} {}

Loading…
Cancel
Save