MCPcopy Create free account
hub / github.com/argotorg/solidity / opcodeCount

Method opcodeCount

libevmasm/AssemblyItem.cpp:521–539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519}
520
521size_t AssemblyItem::opcodeCount() const noexcept
522{
523 switch (m_type)
524 {
525 case AssemblyItemType::AssignImmutable:
526 // Append empty items if this AssignImmutable was referenced more than once.
527 // For n immutable occurrences the first (n - 1) occurrences will
528 // generate 5 opcodes and the last will generate 3 opcodes,
529 // because it is reusing the 2 top-most elements on the stack.
530 solAssert(m_immutableOccurrences, "");
531
532 if (m_immutableOccurrences.value() != 0)
533 return (*m_immutableOccurrences - 1) * 5 + 3;
534 else
535 return 2; // two POP's
536 default:
537 return 1;
538 }
539}
540
541std::string AssemblyItem::computeSourceMapping(
542 AssemblyItems const& _items,

Callers 1

computeSourceMappingMethod · 0.80

Calls 1

valueMethod · 0.45

Tested by

no test coverage detected