diff options
author | chriseth <c@ethdev.com> | 2015-05-26 21:48:10 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-05-26 21:48:10 +0800 |
commit | f7e3568c6202b940394097f147e0c4e6ffe7fe9c (patch) | |
tree | 29e5fdbd8a07f5e232f1a487e6544b25c4c73e54 /CompilerStack.cpp | |
parent | b85f66060f054ecfb160314cc46e9b47bea403e3 (diff) | |
parent | 6332bff81d806b60131dbf87eddba75c88e9d42a (diff) | |
download | dexon-solidity-f7e3568c6202b940394097f147e0c4e6ffe7fe9c.tar dexon-solidity-f7e3568c6202b940394097f147e0c4e6ffe7fe9c.tar.gz dexon-solidity-f7e3568c6202b940394097f147e0c4e6ffe7fe9c.tar.bz2 dexon-solidity-f7e3568c6202b940394097f147e0c4e6ffe7fe9c.tar.lz dexon-solidity-f7e3568c6202b940394097f147e0c4e6ffe7fe9c.tar.xz dexon-solidity-f7e3568c6202b940394097f147e0c4e6ffe7fe9c.tar.zst dexon-solidity-f7e3568c6202b940394097f147e0c4e6ffe7fe9c.zip |
Merge pull request #2006 from chriseth/sol_functionalGasEstimator
Functional gas estimator
Diffstat (limited to 'CompilerStack.cpp')
-rw-r--r-- | CompilerStack.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/CompilerStack.cpp b/CompilerStack.cpp index 4f976407..ebb98876 100644 --- a/CompilerStack.cpp +++ b/CompilerStack.cpp @@ -268,6 +268,24 @@ ContractDefinition const& CompilerStack::getContractDefinition(string const& _co return *getContract(_contractName).contract; } +size_t CompilerStack::getFunctionEntryPoint( + std::string const& _contractName, + FunctionDefinition const& _function +) const +{ + shared_ptr<Compiler> const& compiler = getContract(_contractName).compiler; + if (!compiler) + return 0; + eth::AssemblyItem tag = compiler->getFunctionEntryLabel(_function); + if (tag.type() == eth::UndefinedItem) + return 0; + eth::AssemblyItems const& items = compiler->getRuntimeAssemblyItems(); + for (size_t i = 0; i < items.size(); ++i) + if (items.at(i).type() == eth::Tag && items.at(i).data() == tag.data()) + return i; + return 0; +} + bytes CompilerStack::staticCompile(std::string const& _sourceCode, bool _optimize) { CompilerStack stack; |