aboutsummaryrefslogtreecommitdiffstats
path: root/libevmasm/PathGasMeter.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-05-09 16:56:48 +0800
committerGitHub <noreply@github.com>2018-05-09 16:56:48 +0800
commitc79351efb05be08f3f1797c8cf6ff50988b74763 (patch)
tree0ee137fa5a96b7b7b05ac5702dc8a386980f8fd6 /libevmasm/PathGasMeter.h
parent58c63dcc9ce61b2742a10dc337cc5d0fd8739471 (diff)
parentbbae4fb0ef41361d24eadcc0a93cf02052493d10 (diff)
downloaddexon-solidity-c79351efb05be08f3f1797c8cf6ff50988b74763.tar
dexon-solidity-c79351efb05be08f3f1797c8cf6ff50988b74763.tar.gz
dexon-solidity-c79351efb05be08f3f1797c8cf6ff50988b74763.tar.bz2
dexon-solidity-c79351efb05be08f3f1797c8cf6ff50988b74763.tar.lz
dexon-solidity-c79351efb05be08f3f1797c8cf6ff50988b74763.tar.xz
dexon-solidity-c79351efb05be08f3f1797c8cf6ff50988b74763.tar.zst
dexon-solidity-c79351efb05be08f3f1797c8cf6ff50988b74763.zip
Merge pull request #4068 from ethereum/gasEstimatorPerformance
Gas estimator performance
Diffstat (limited to 'libevmasm/PathGasMeter.h')
-rw-r--r--libevmasm/PathGasMeter.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/libevmasm/PathGasMeter.h b/libevmasm/PathGasMeter.h
index 2527d7fb..9537b176 100644
--- a/libevmasm/PathGasMeter.h
+++ b/libevmasm/PathGasMeter.h
@@ -58,9 +58,17 @@ public:
GasMeter::GasConsumption estimateMax(size_t _startIndex, std::shared_ptr<KnownState> const& _state);
private:
+ /// Adds a new path item to the queue, but only if we do not already have
+ /// a higher gas usage at that point.
+ /// This is not exact as different state might influence higher gas costs at a later
+ /// point in time, but it greatly reduces computational overhead.
+ void queue(std::unique_ptr<GasPath>&& _newPath);
GasMeter::GasConsumption handleQueueItem();
- std::vector<std::unique_ptr<GasPath>> m_queue;
+ /// Map of jumpdest -> gas path, so not really a queue. We only have one queued up
+ /// item per jumpdest, because of the behaviour of `queue` above.
+ std::map<size_t, std::unique_ptr<GasPath>> m_queue;
+ std::map<size_t, GasMeter::GasConsumption> m_highestGasUsagePerJumpdest;
std::map<u256, size_t> m_tagPositions;
AssemblyItems const& m_items;
solidity::EVMVersion m_evmVersion;