From e2b21e1c9611fd94f8e7b91b0ecbb0ec39145758 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 28 Apr 2017 18:15:18 +0200 Subject: Refactor to abstract assembly to JULIA. --- libsolidity/codegen/CompilerContext.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'libsolidity/codegen/CompilerContext.cpp') diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 51dd9fd2..5c4f88c4 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -264,7 +264,7 @@ void CompilerContext::appendInlineAssembly( assembly = &replacedAssembly; } - unsigned startStackHeight = stackHeight(); + int startStackHeight = stackHeight(); assembly::ExternalIdentifierAccess identifierAccess; identifierAccess.resolve = [&]( @@ -278,26 +278,26 @@ void CompilerContext::appendInlineAssembly( identifierAccess.generateCode = [&]( assembly::Identifier const& _identifier, assembly::IdentifierContext _context, - eth::Assembly& _assembly + julia::AbstractAssembly& _assembly ) { auto it = std::find(_localVariables.begin(), _localVariables.end(), _identifier.name); solAssert(it != _localVariables.end(), ""); - unsigned stackDepth = _localVariables.end() - it; - int stackDiff = _assembly.deposit() - startStackHeight + stackDepth; + int stackDepth = _localVariables.end() - it; + int stackDiff = _assembly.stackHeight() - startStackHeight + stackDepth; if (_context == assembly::IdentifierContext::LValue) stackDiff -= 1; if (stackDiff < 1 || stackDiff > 16) BOOST_THROW_EXCEPTION( CompilerError() << - errinfo_comment("Stack too deep, try removing local variables.") + errinfo_comment("Stack too deep (" + to_string(stackDiff) + "), try removing local variables.") ); if (_context == assembly::IdentifierContext::RValue) - _assembly.append(dupInstruction(stackDiff)); + _assembly.appendInstruction(dupInstruction(stackDiff)); else { - _assembly.append(swapInstruction(stackDiff)); - _assembly.append(Instruction::POP); + _assembly.appendInstruction(swapInstruction(stackDiff)); + _assembly.appendInstruction(Instruction::POP); } }; -- cgit v1.2.3