NEXT CASE(BALANCE) { m_runGas = m_rev >= EVMC_TANGERINE_WHISTLE ? 400 : 20; ON_OP(); updateIOGas(); evmc_address address = toEvmC(asAddress(m_SP[0])); m_SPP[0] = fromEvmC(m_context->host->get_balance(m_context, &address)); }
NEXT CASE(EXTCODESIZE) { m_runGas = m_rev >= EVMC_TANGERINE_WHISTLE ? 700 : 20; ON_OP(); updateIOGas(); evmc_address address = toEvmC(asAddress(m_SP[0])); m_SPP[0] = m_context->host->get_code_size(m_context, &address); }
NEXT CASE(EXTCODEHASH) { ON_OP(); if (m_rev < EVMC_CONSTANTINOPLE) throwBadInstruction(); updateIOGas(); evmc_address address = toEvmC(asAddress(m_SP[0])); m_SPP[0] = fromEvmC(m_context->host->get_code_hash(m_context, &address)); }
NEXT CASE(EXTCODECOPY) { ON_OP(); m_runGas = m_rev >= EVMC_TANGERINE_WHISTLE ? 700 : 20; uint64_t copyMemSize = toInt63(m_SP[3]); m_copyMemSize = copyMemSize; updateMem(memNeed(m_SP[1], m_SP[3])); updateIOGas(); evmc_address address = toEvmC(asAddress(m_SP[0])); size_t memoryOffset = static_cast<size_t>(m_SP[1]); constexpr size_t codeOffsetMax = std::numeric_limits<size_t>::max(); size_t codeOffset = m_SP[2] > codeOffsetMax ? codeOffsetMax : static_cast<size_t>(m_SP[2]); size_t size = static_cast<size_t>(copyMemSize); size_t numCopied = m_context->host->copy_code( m_context, &address, codeOffset, &m_mem[memoryOffset], size); std::fill_n(&m_mem[memoryOffset + numCopied], size - numCopied, 0); }
inline void resetAddress() { asAddress().~Address(); value_type = Type_undefined; }