diff options
author | Christian <c@ethdev.com> | 2014-12-09 05:18:19 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-12-09 05:26:22 +0800 |
commit | 35d5b28faeee5e19d0dbbeb3c75454249d636abd (patch) | |
tree | 227b04a23f5d66e442fc824e4cfcbba802989ccd /Compiler.cpp | |
parent | b7d856ed5fee1f0f918e30218e3a95fd8fc20dd3 (diff) | |
download | dexon-solidity-35d5b28faeee5e19d0dbbeb3c75454249d636abd.tar.gz dexon-solidity-35d5b28faeee5e19d0dbbeb3c75454249d636abd.tar.zst dexon-solidity-35d5b28faeee5e19d0dbbeb3c75454249d636abd.zip |
Variable-size stack elements for expression compiler.
Diffstat (limited to 'Compiler.cpp')
-rw-r--r-- | Compiler.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/Compiler.cpp b/Compiler.cpp index e7263da6..73b3e324 100644 --- a/Compiler.cpp +++ b/Compiler.cpp @@ -213,15 +213,9 @@ bool Compiler::visit(FunctionDefinition& _function) // Note that the fact that the return arguments are of increasing index is vital for this // algorithm to work. - unsigned argumentsSize = 0; - for (ASTPointer<VariableDeclaration const> const& variable: _function.getParameters()) - argumentsSize += variable->getType()->getSizeOnStack(); - unsigned returnValuesSize = 0; - for (ASTPointer<VariableDeclaration const> const& variable: _function.getReturnParameters()) - returnValuesSize += variable->getType()->getSizeOnStack(); - unsigned localVariablesSize = 0; - for (VariableDeclaration const* localVariable: _function.getLocalVariables()) - localVariablesSize += localVariable->getType()->getSizeOnStack(); + unsigned const argumentsSize = CompilerUtils::getSizeOnStack(_function.getParameters()); + unsigned const returnValuesSize = CompilerUtils::getSizeOnStack(_function.getReturnParameters()); + unsigned const localVariablesSize = CompilerUtils::getSizeOnStack(_function.getLocalVariables()); vector<int> stackLayout; stackLayout.push_back(returnValuesSize); // target of return address |