From 3f9f725737dd04485211fedc8533fdac983f2b04 Mon Sep 17 00:00:00 2001 From: VoR0220 Date: Fri, 18 Nov 2016 17:13:20 -0600 Subject: Fix licensing headers Signed-off-by: VoR0220 --- libsolidity/codegen/CompilerContext.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libsolidity/codegen/CompilerContext.cpp') diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index c76db2a6..b99b0548 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -1,18 +1,18 @@ /* - This file is part of cpp-ethereum. + This file is part of solidity. - cpp-ethereum is free software: you can redistribute it and/or modify + solidity is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - cpp-ethereum is distributed in the hope that it will be useful, + solidity is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see . + along with solidity. If not, see . */ /** * @author Christian -- cgit v1.2.3 From 5789eaa78d0e00f6289101e02f7de5e9decdc7e5 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 14 Nov 2016 11:46:43 +0100 Subject: Metadata stamp. --- libsolidity/codegen/CompilerContext.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libsolidity/codegen/CompilerContext.cpp') diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index b99b0548..9b921e9d 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -227,6 +227,13 @@ void CompilerContext::injectVersionStampIntoSub(size_t _subIndex) sub.injectStart(fromBigEndian(binaryVersion())); } +void CompilerContext::injectMetadataHashIntoSub(size_t _subIndex, h256 const& _metadataHash) +{ + eth::Assembly& sub = m_asm->sub(_subIndex); + sub.injectStart(Instruction::POP); + sub.injectStart(u256(_metadataHash)); +} + FunctionDefinition const& CompilerContext::resolveVirtualFunction( FunctionDefinition const& _function, vector::const_iterator _searchStart -- cgit v1.2.3 From 91ecc4533dffbe67fa27adfaff27780ddf69c21a Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 24 Nov 2016 10:32:52 +0100 Subject: Add swarm hash to the end of the bytecode. --- libsolidity/codegen/CompilerContext.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'libsolidity/codegen/CompilerContext.cpp') diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 9b921e9d..b99b0548 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -227,13 +227,6 @@ void CompilerContext::injectVersionStampIntoSub(size_t _subIndex) sub.injectStart(fromBigEndian(binaryVersion())); } -void CompilerContext::injectMetadataHashIntoSub(size_t _subIndex, h256 const& _metadataHash) -{ - eth::Assembly& sub = m_asm->sub(_subIndex); - sub.injectStart(Instruction::POP); - sub.injectStart(u256(_metadataHash)); -} - FunctionDefinition const& CompilerContext::resolveVirtualFunction( FunctionDefinition const& _function, vector::const_iterator _searchStart -- cgit v1.2.3 From 1e35526eb6a7c5af074170f6291491d3cb0bd6ba Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 24 Nov 2016 12:32:42 +0100 Subject: Fix tests. --- libsolidity/codegen/CompilerContext.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'libsolidity/codegen/CompilerContext.cpp') diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index b99b0548..2de5a3ec 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -220,13 +220,6 @@ void CompilerContext::appendInlineAssembly( solAssert(assembly::InlineAssemblyStack().parseAndAssemble(*assembly, *m_asm, identifierAccess), ""); } -void CompilerContext::injectVersionStampIntoSub(size_t _subIndex) -{ - eth::Assembly& sub = m_asm->sub(_subIndex); - sub.injectStart(Instruction::POP); - sub.injectStart(fromBigEndian(binaryVersion())); -} - FunctionDefinition const& CompilerContext::resolveVirtualFunction( FunctionDefinition const& _function, vector::const_iterator _searchStart -- cgit v1.2.3 From 4a11200a272278383a003262361d865689d1c87b Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sat, 3 Dec 2016 00:21:29 +0000 Subject: Better assert message for appendInlineAssembnly --- libsolidity/codegen/CompilerContext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libsolidity/codegen/CompilerContext.cpp') diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 2de5a3ec..3a70e523 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -217,7 +217,7 @@ void CompilerContext::appendInlineAssembly( return true; }; - solAssert(assembly::InlineAssemblyStack().parseAndAssemble(*assembly, *m_asm, identifierAccess), ""); + solAssert(assembly::InlineAssemblyStack().parseAndAssemble(*assembly, *m_asm, identifierAccess), "Failed to assemble inline assembly block."); } FunctionDefinition const& CompilerContext::resolveVirtualFunction( -- cgit v1.2.3 From efd7b4bfbb5fef99bcf4ee7c98c2ade4c1467f87 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Sat, 3 Dec 2016 00:21:46 +0000 Subject: Reset stack height after inline assembly block --- libsolidity/codegen/CompilerContext.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'libsolidity/codegen/CompilerContext.cpp') diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 3a70e523..59750504 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -218,6 +218,7 @@ void CompilerContext::appendInlineAssembly( }; solAssert(assembly::InlineAssemblyStack().parseAndAssemble(*assembly, *m_asm, identifierAccess), "Failed to assemble inline assembly block."); + setStackOffset(startStackHeight); } FunctionDefinition const& CompilerContext::resolveVirtualFunction( -- cgit v1.2.3 From 4184525d4ad7aff3acb2d521c3cdc21054e36eff Mon Sep 17 00:00:00 2001 From: chriseth Date: Sun, 11 Dec 2016 17:50:59 +0100 Subject: Fix inline assembly. --- libsolidity/codegen/CompilerContext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libsolidity/codegen/CompilerContext.cpp') diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 59750504..c14ab845 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -202,6 +202,8 @@ void CompilerContext::appendInlineAssembly( return false; unsigned stackDepth = _localVariables.end() - it; int stackDiff = _assembly.deposit() - startStackHeight + stackDepth; + if (_context == assembly::CodeGenerator::IdentifierContext::LValue) + stackDiff -= 1; if (stackDiff < 1 || stackDiff > 16) BOOST_THROW_EXCEPTION( CompilerError() << @@ -218,7 +220,6 @@ void CompilerContext::appendInlineAssembly( }; solAssert(assembly::InlineAssemblyStack().parseAndAssemble(*assembly, *m_asm, identifierAccess), "Failed to assemble inline assembly block."); - setStackOffset(startStackHeight); } FunctionDefinition const& CompilerContext::resolveVirtualFunction( -- cgit v1.2.3