| 445 | } |
| 446 | |
| 447 | void Assembly::assemblyStream( |
| 448 | std::ostream& _out, |
| 449 | DebugInfoSelection const& _debugInfoSelection, |
| 450 | std::string const& _prefix, |
| 451 | StringMap const& _sourceCodes |
| 452 | ) const |
| 453 | { |
| 454 | Functionalizer f(_out, _prefix, _sourceCodes, *this); |
| 455 | |
| 456 | for (auto const& i: m_codeSections.front().items) |
| 457 | f.feed(i, _debugInfoSelection); |
| 458 | f.flush(); |
| 459 | |
| 460 | for (size_t i = 1; i < m_codeSections.size(); ++i) |
| 461 | { |
| 462 | _out << std::endl << _prefix << "code_section_" << i << ": assembly {\n"; |
| 463 | Functionalizer codeSectionF(_out, _prefix + " ", _sourceCodes, *this); |
| 464 | for (auto const& item: m_codeSections[i].items) |
| 465 | codeSectionF.feed(item, _debugInfoSelection); |
| 466 | codeSectionF.flush(); |
| 467 | _out << _prefix << "}" << std::endl; |
| 468 | } |
| 469 | |
| 470 | if (!m_data.empty() || !m_subs.empty()) |
| 471 | { |
| 472 | _out << _prefix << "stop" << std::endl; |
| 473 | for (auto const& i: m_data) |
| 474 | if (u256(i.first) >= m_subs.size()) |
| 475 | _out << _prefix << "data_" << toHex(u256(i.first)) << " " << util::toHex(i.second) << std::endl; |
| 476 | |
| 477 | for (size_t i = 0; i < m_subs.size(); ++i) |
| 478 | { |
| 479 | _out << std::endl << _prefix << "sub_" << i << ": assembly {\n"; |
| 480 | m_subs[i]->assemblyStream(_out, _debugInfoSelection, _prefix + " ", _sourceCodes); |
| 481 | _out << _prefix << "}" << std::endl; |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | if (m_auxiliaryData.size() > 0) |
| 486 | _out << std::endl << _prefix << "auxdata: 0x" << util::toHex(m_auxiliaryData) << std::endl; |
| 487 | } |
| 488 | |
| 489 | std::string Assembly::assemblyString( |
| 490 | DebugInfoSelection const& _debugInfoSelection, |