Implement subroutines for yul functions.

This commit is contained in:
chriseth
2020-07-14 18:29:37 +01:00
committed by Alex Beregszaszi
parent dca85a286d
commit cc04085b9e
22 changed files with 105 additions and 51 deletions
+1
View File
@@ -132,6 +132,7 @@ void CompilerContext::callLowLevelFunction(
*this << lowLevelFunctionTag(_name, _inArgs, _outArgs, _generator);
// TODO could use jumpsub?
appendJump(evmasm::AssemblyItem::JumpType::IntoFunction);
adjustStackOffset(static_cast<int>(_outArgs) - 1 - static_cast<int>(_inArgs));
*this << retTag.tag();
+1
View File
@@ -505,6 +505,7 @@ void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contrac
m_context << Instruction::DUP1 << Instruction::CALLDATASIZE << Instruction::SUB;
CompilerUtils(m_context).abiDecode(functionType->parameterTypes());
}
// TODO could use JUMPSUB?
m_context.appendJumpTo(
m_context.functionEntryLabel(functionType->declaration()),
evmasm::AssemblyItem::JumpType::IntoFunction
@@ -614,6 +614,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
// Extract the runtime part.
m_context << ((u256(1) << 32) - 1) << Instruction::AND;
// TODO could use jumpsub
m_context.appendJump(evmasm::AssemblyItem::JumpType::IntoFunction);
m_context << returnLabel;