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;
+14 -14
View File
@@ -1060,25 +1060,25 @@ void CompilerStack::compileContract(
solAssert(false, "Optimizer exception during compilation");
}
try
{
// try
// {
// Assemble deployment (incl. runtime) object.
compiledContract.object = compiler->assembledObject();
}
catch(evmasm::AssemblyException const&)
{
solAssert(false, "Assembly exception for bytecode");
}
// }
// catch(evmasm::AssemblyException const&)
// {
// solAssert(false, "Assembly exception for bytecode");
// }
try
{
// try
// {
// Assemble runtime object.
compiledContract.runtimeObject = compiler->runtimeObject();
}
catch(evmasm::AssemblyException const&)
{
solAssert(false, "Assembly exception for deployed bytecode");
}
// }
// catch(evmasm::AssemblyException const&)
// {
// solAssert(false, "Assembly exception for deployed bytecode");
// }
// Throw a warning if EIP-170 limits are exceeded:
// If contract creation initialization returns data with length of more than 0x6000 (214 + 213) bytes,