aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2019-01-09 23:51:09 +0800
committerchriseth <chris@ethereum.org>2019-01-09 23:57:33 +0800
commitd9c677366414f926a58ce644670a6006b8cfcb79 (patch)
treea3b42b5eb5dbea9464f0e71dbbc79f66c9201799
parentedda79eec546674c8c1f0128c63939921f4ff1f2 (diff)
downloaddexon-solidity-d9c677366414f926a58ce644670a6006b8cfcb79.tar.gz
dexon-solidity-d9c677366414f926a58ce644670a6006b8cfcb79.tar.zst
dexon-solidity-d9c677366414f926a58ce644670a6006b8cfcb79.zip
Adjust inlining thresholds.
-rw-r--r--libyul/optimiser/FullInliner.cpp14
-rw-r--r--libyul/optimiser/FullInliner.h2
2 files changed, 10 insertions, 6 deletions
diff --git a/libyul/optimiser/FullInliner.cpp b/libyul/optimiser/FullInliner.cpp
index 95360dc3..1f267f96 100644
--- a/libyul/optimiser/FullInliner.cpp
+++ b/libyul/optimiser/FullInliner.cpp
@@ -80,9 +80,9 @@ void FullInliner::run()
}
}
-void FullInliner::updateCodeSize(FunctionDefinition& fun)
+void FullInliner::updateCodeSize(FunctionDefinition const& _fun)
{
- m_functionSizes[fun.name] = CodeSize::codeSize(fun.body);
+ m_functionSizes[_fun.name] = CodeSize::codeSize(_fun.body);
}
void FullInliner::handleBlock(YulString _currentFunctionName, Block& _block)
@@ -100,8 +100,13 @@ bool FullInliner::shallInline(FunctionCall const& _funCall, YulString _callSite)
if (!calledFunction)
return false;
+ // Inline really, really tiny functions
+ size_t size = m_functionSizes.at(calledFunction->name);
+ if (size <= 1)
+ return true;
+
// Do not inline into already big functions.
- if (m_functionSizes.at(_callSite) > 100)
+ if (m_functionSizes.at(_callSite) > 45)
return false;
if (m_singleUse.count(calledFunction->name))
@@ -119,8 +124,7 @@ bool FullInliner::shallInline(FunctionCall const& _funCall, YulString _callSite)
break;
}
- size_t size = m_functionSizes.at(calledFunction->name);
- return (size < 10 || (constantArg && size < 30));
+ return (size < 6 || (constantArg && size < 12));
}
void FullInliner::tentativelyUpdateCodeSize(YulString _function, YulString _callSite)
diff --git a/libyul/optimiser/FullInliner.h b/libyul/optimiser/FullInliner.h
index d2dd3229..32664c96 100644
--- a/libyul/optimiser/FullInliner.h
+++ b/libyul/optimiser/FullInliner.h
@@ -91,7 +91,7 @@ public:
void tentativelyUpdateCodeSize(YulString _function, YulString _callSite);
private:
- void updateCodeSize(FunctionDefinition& fun);
+ void updateCodeSize(FunctionDefinition const& _fun);
void handleBlock(YulString _currentFunctionName, Block& _block);
/// The AST to be modified. The root block itself will not be modified, because