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

Method copyContractCodeToMemory

libsolidity/codegen/CompilerUtils.cpp:1518–1539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1516}
1517
1518void CompilerUtils::copyContractCodeToMemory(ContractDefinition const& contract, bool _creation)
1519{
1520 std::string which = _creation ? "Creation" : "Runtime";
1521 m_context.callLowLevelFunction(
1522 "$copyContract" + which + "CodeToMemory_" + contract.type()->identifier(),
1523 1,
1524 1,
1525 [&contract, _creation](CompilerContext& _context)
1526 {
1527 // copy the contract's code into memory
1528 std::shared_ptr<evmasm::Assembly> assembly =
1529 _creation ?
1530 _context.compiledContract(contract) :
1531 _context.compiledContractRuntime(contract);
1532 // pushes size
1533 auto subroutine = _context.addSubroutine(assembly);
1534 _context << Instruction::DUP1 << subroutine;
1535 _context << Instruction::DUP4 << Instruction::CODECOPY;
1536 _context << Instruction::ADD;
1537 }
1538 );
1539}
1540
1541void CompilerUtils::storeStringData(bytesConstRef _data)
1542{

Callers 1

visitMethod · 0.80

Calls 6

callLowLevelFunctionMethod · 0.80
identifierMethod · 0.80
compiledContractMethod · 0.80
addSubroutineMethod · 0.80
typeMethod · 0.45

Tested by

no test coverage detected