diff options
author | chriseth <c@ethdev.com> | 2015-05-26 17:27:59 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-05-26 17:27:59 +0800 |
commit | 6332bff81d806b60131dbf87eddba75c88e9d42a (patch) | |
tree | 5cfffa56aed003ee619e09dcf9d170e4c3ed2974 /CompilerStack.cpp | |
parent | 802d52f6a2ee64a32dd65a9ad76bdde507ef9127 (diff) | |
download | dexon-solidity-6332bff81d806b60131dbf87eddba75c88e9d42a.tar dexon-solidity-6332bff81d806b60131dbf87eddba75c88e9d42a.tar.gz dexon-solidity-6332bff81d806b60131dbf87eddba75c88e9d42a.tar.bz2 dexon-solidity-6332bff81d806b60131dbf87eddba75c88e9d42a.tar.lz dexon-solidity-6332bff81d806b60131dbf87eddba75c88e9d42a.tar.xz dexon-solidity-6332bff81d806b60131dbf87eddba75c88e9d42a.tar.zst dexon-solidity-6332bff81d806b60131dbf87eddba75c88e9d42a.zip |
Gas estimation for internal functions.
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; |