aboutsummaryrefslogtreecommitdiffstats
path: root/Assembly.h
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-06-01 18:32:59 +0800
committerchriseth <c@ethdev.com>2015-06-05 23:34:26 +0800
commit88096c2c694983da327fd0fc46c31dc6f7404f73 (patch)
treefb84765bb8ab726354bf9c4d44d152008ec2c530 /Assembly.h
parentd309c3c76827606c4cabd5660035df394a16b601 (diff)
downloaddexon-solidity-88096c2c694983da327fd0fc46c31dc6f7404f73.tar.gz
dexon-solidity-88096c2c694983da327fd0fc46c31dc6f7404f73.tar.zst
dexon-solidity-88096c2c694983da327fd0fc46c31dc6f7404f73.zip
Compute constants
Diffstat (limited to 'Assembly.h')
-rw-r--r--Assembly.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/Assembly.h b/Assembly.h
index 3c82125a..1457173b 100644
--- a/Assembly.h
+++ b/Assembly.h
@@ -49,6 +49,7 @@ public:
AssemblyItem newPushTag() { return AssemblyItem(PushTag, m_usedTags++); }
AssemblyItem newData(bytes const& _data) { h256 h = (u256)std::hash<std::string>()(asString(_data)); m_data[h] = _data; return AssemblyItem(PushData, h); }
AssemblyItem newSub(Assembly const& _sub) { m_subs.push_back(_sub); return AssemblyItem(PushSub, m_subs.size() - 1); }
+ Assembly const& getSub(size_t _sub) const { return m_subs.at(_sub); }
AssemblyItem newPushString(std::string const& _data) { h256 h = (u256)std::hash<std::string>()(_data); m_strings[h] = _data; return AssemblyItem(PushString, h); }
AssemblyItem newPushSubSize(u256 const& _subId) { return AssemblyItem(PushSubSize, _subId); }
@@ -92,7 +93,13 @@ public:
void setSourceLocation(SourceLocation const& _location) { m_currentSourceLocation = _location; }
bytes assemble() const;
- Assembly& optimise(bool _enable);
+ bytes const& data(h256 const& _i) const { return m_data[_i]; }
+
+ /// Modify (if @a _enable is set) and return the current assembly such that creation and
+ /// execution gas usage is optimised. @a _isCreation should be true for the top-level assembly.
+ /// @a _runs specifes an estimate on how often each opcode in this assembly will be executed,
+ /// i.e. use a small value to optimise for size and a large value to optimise for runtime.
+ Assembly& optimise(bool _enable, bool _isCreation = true, size_t _runs = 200);
Json::Value stream(
std::ostream& _out,
std::string const& _prefix = "",