24 #include <boost/thread.hpp> 32 static unsigned const c_depthLimit = 1024;
35 static size_t const c_singleExecutionStackSize = 14 * 1024;
38 static size_t const c_defaultStackSize =
48 static size_t const c_entryOverhead = 128 * 1024;
51 static unsigned const c_offloadPoint = (c_defaultStackSize - c_entryOverhead) / c_singleExecutionStackSize;
56 boost::thread::attributes attrs;
57 attrs.set_stack_size((c_depthLimit - c_offloadPoint) * c_singleExecutionStackSize);
61 boost::exception_ptr exception;
62 boost::thread{attrs, [&]{
69 exception = boost::current_exception();
73 boost::rethrow_exception(exception);
83 if (_depth == c_offloadPoint)
85 cnote <<
"Stack offloading (depth: " << c_offloadPoint <<
")";
86 goOnOffloadedStack(_e, _onOp);
100 go(depth,
e, _p.
onOp);
101 e.accrueSubState(
sub);
108 return e.takeOutput();
127 e.accrueSubState(
sub);
130 return e.newAddress();
bool addressInUse(Address const &_address) const
Check if the address is in use.
u256 balance(Address const &_id) const
Get an account's balance.
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
virtual boost::optional< owning_bytes_ref > call(CallParameters &_params) overridefinal
Create a new message call. Leave _myAddressOverride as the default to use the present address as call...
State & m_s
A reference to the base state.
virtual void suicide(Address _a) overridefinal
Suicide the associated contract to the given address.
EnvInfo const & envInfo() const
Get the execution environment information.
bool go(OnOpFunc const &_onOp=OnOpFunc())
Executes (or continues execution of) the VM.
virtual h160 create(u256 _endowment, u256 &io_gas, bytesConstRef _code, OnOpFunc const &_onOp={}) overridefinal
Create a new contract.
virtual size_t codeSizeAt(Address _a) overridefinal
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
std::function< void(uint64_t, uint64_t, Instruction, bigint, bigint, bigint, VM *, ExtVMFace const *)> OnOpFunc
unsigned depth
Depth of the present call.
Message-call/contract-creation executor; useful for executing transactions.
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
SealEngineFace const & m_sealEngine
u256 gasPrice
Price of gas (that we already paid).
Address myAddress
Address associated with executing code (a contract, or contract-to-be).
void setStorage(Address const &_contract, u256 const &_location, u256 const &_value)
Set the value of a storage position of an account.
Address origin
Original transactor.
std::set< Address > deleteAddresses
virtual void transferBalance(Address const &_from, Address const &_to, u256 const &_value)
Transfers "the balance _value between two accounts.
virtual void suicide(Address)
Suicide the associated contract and give proceeds to the given address.
SubState sub
Sub-band VM state (suicides, refund counter, logs).
size_t codeSize(Address const &_contract) const
Get the byte-size of the code of an account.
virtual void setStore(u256 _n, u256 _v) overridefinal
Write a value in storage.