aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/ContractCompiler.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-09-10 18:09:42 +0800
committerchriseth <chris@ethereum.org>2018-12-06 20:07:14 +0800
commit7f39c3e52226e133d4224a7afb763a3c5b4c525e (patch)
tree50cb7ec16fce3a06d1b08c107d87ff61b715e112 /libsolidity/codegen/ContractCompiler.h
parent1643d63e3af1b0e3aabac2f2ded3619505d0fa8c (diff)
downloaddexon-solidity-7f39c3e52226e133d4224a7afb763a3c5b4c525e.tar.gz
dexon-solidity-7f39c3e52226e133d4224a7afb763a3c5b4c525e.tar.zst
dexon-solidity-7f39c3e52226e133d4224a7afb763a3c5b4c525e.zip
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;