aboutsummaryrefslogtreecommitdiffstats
path: root/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorGav Wood <i@gavwood.com>2015-01-09 22:19:01 +0800
committerGav Wood <i@gavwood.com>2015-01-09 22:19:01 +0800
commit43d79cc7305524bb8503e660cfd43c121706e1ed (patch)
treef25900a00a0a1b20998ec91d5da9730b3b78deab /ExpressionCompiler.cpp
parent875ec9d47178637bc8608204a8520c1487c064e4 (diff)
parenta60d82d12ce84c87ae28e16dcd5002643f49637b (diff)
downloaddexon-solidity-43d79cc7305524bb8503e660cfd43c121706e1ed.tar
dexon-solidity-43d79cc7305524bb8503e660cfd43c121706e1ed.tar.gz
dexon-solidity-43d79cc7305524bb8503e660cfd43c121706e1ed.tar.bz2
dexon-solidity-43d79cc7305524bb8503e660cfd43c121706e1ed.tar.lz
dexon-solidity-43d79cc7305524bb8503e660cfd43c121706e1ed.tar.xz
dexon-solidity-43d79cc7305524bb8503e660cfd43c121706e1ed.tar.zst
dexon-solidity-43d79cc7305524bb8503e660cfd43c121706e1ed.zip
Merge branch 'develop' of github.com:ethereum/cpp-ethereum into develop
Conflicts: test/SolidityOptimizer.cpp
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r--ExpressionCompiler.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp
index 8e8f492e..cf91a763 100644
--- a/ExpressionCompiler.cpp
+++ b/ExpressionCompiler.cpp
@@ -401,7 +401,7 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess)
case Type::Category::CONTRACT:
{
ContractType const& type = dynamic_cast<ContractType const&>(*_memberAccess.getExpression().getType());
- m_context << type.getFunctionIndex(member);
+ m_context << type.getFunctionIdentifier(member);
break;
}
case Type::Category::MAGIC:
@@ -663,7 +663,11 @@ void ExpressionCompiler::appendExternalFunctionCall(FunctionType const& _functio
{
solAssert(_arguments.size() == _functionType.getParameterTypes().size(), "");
- unsigned dataOffset = _options.bare ? 0 : 1; // reserve one byte for the function index
+ _options.obtainAddress();
+ if (!_options.bare)
+ CompilerUtils(m_context).storeInMemory(0, CompilerUtils::dataStartOffset);
+
+ unsigned dataOffset = _options.bare ? 0 : CompilerUtils::dataStartOffset; // reserve 4 bytes for the function's hash identifier
for (unsigned i = 0; i < _arguments.size(); ++i)
{
_arguments[i]->accept(*this);
@@ -690,12 +694,13 @@ void ExpressionCompiler::appendExternalFunctionCall(FunctionType const& _functio
_options.obtainValue();
else
m_context << u256(0);
- _options.obtainAddress();
- if (!_options.bare)
- m_context << u256(0) << eth::Instruction::MSTORE8;
+ m_context << eth::dupInstruction(6); //copy contract address
+
m_context << u256(25) << eth::Instruction::GAS << eth::Instruction::SUB
<< eth::Instruction::CALL
- << eth::Instruction::POP; // @todo do not ignore failure indicator
+ << eth::Instruction::POP // @todo do not ignore failure indicator
+ << eth::Instruction::POP; // pop contract address
+
if (retSize > 0)
{
bool const leftAligned = firstType->getCategory() == Type::Category::STRING;