aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/ContractCompiler.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-12-07 07:55:09 +0800
committerGitHub <noreply@github.com>2018-12-07 07:55:09 +0800
commit6a9e8a6fe3a2e53c47f644748590894979a33744 (patch)
tree77f5f77e4b42c0060b1773830039d31f6c7c3ee3 /libsolidity/codegen/ContractCompiler.h
parentac9f39c80534ddc95d28ba842c4cd52ff5295f9a (diff)
parentfb805ccca6734481666d31c20777f3b637d2f170 (diff)
downloaddexon-solidity-6a9e8a6fe3a2e53c47f644748590894979a33744.tar
dexon-solidity-6a9e8a6fe3a2e53c47f644748590894979a33744.tar.gz
dexon-solidity-6a9e8a6fe3a2e53c47f644748590894979a33744.tar.bz2
dexon-solidity-6a9e8a6fe3a2e53c47f644748590894979a33744.tar.lz
dexon-solidity-6a9e8a6fe3a2e53c47f644748590894979a33744.tar.xz
dexon-solidity-6a9e8a6fe3a2e53c47f644748590894979a33744.tar.zst
dexon-solidity-6a9e8a6fe3a2e53c47f644748590894979a33744.zip
Merge pull request #4936 from ethereum/binSelect
Binary search for dispatch.
Diffstat (limited to 'libsolidity/codegen/ContractCompiler.h')
-rw-r--r--libsolidity/codegen/ContractCompiler.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/libsolidity/codegen/ContractCompiler.h b/libsolidity/codegen/ContractCompiler.h
index 001aec7c..266ace0b 100644
--- a/libsolidity/codegen/ContractCompiler.h
+++ b/libsolidity/codegen/ContractCompiler.h
@@ -38,8 +38,9 @@ namespace solidity {
class ContractCompiler: private ASTConstVisitor
{
public:
- explicit ContractCompiler(ContractCompiler* _runtimeCompiler, CompilerContext& _context, bool _optimise):
+ explicit ContractCompiler(ContractCompiler* _runtimeCompiler, CompilerContext& _context, bool _optimise, size_t _optimise_runs = 200):
m_optimise(_optimise),
+ m_optimise_runs(_optimise_runs),
m_runtimeCompiler(_runtimeCompiler),
m_context(_context)
{
@@ -81,6 +82,14 @@ private:
/// This is done by inserting a specific push constant as the first instruction
/// whose data will be modified in memory at deploy time.
void appendDelegatecallCheck();
+ /// Appends the function selector. Is called recursively to create a binary search tree.
+ /// @a _runs the number of intended executions of the contract to tune the split point.
+ void appendInternalSelector(
+ std::map<FixedHash<4>, eth::AssemblyItem const> const& _entryPoints,
+ std::vector<FixedHash<4>> const& _ids,
+ eth::AssemblyItem const& _notFoundTag,
+ size_t _runs
+ );
void appendFunctionSelector(ContractDefinition const& _contract);
void appendCallValueCheck();
void appendReturnValuePacker(TypePointers const& _typeParameters, bool _isLibrary);
@@ -122,6 +131,7 @@ private:
void storeStackHeight(ASTNode const* _node);
bool const m_optimise;
+ size_t const m_optimise_runs = 200;
/// Pointer to the runtime compiler in case this is a creation compiler.
ContractCompiler* m_runtimeCompiler = nullptr;
CompilerContext& m_context;