diff options
author | chriseth <c@ethdev.com> | 2015-06-01 18:32:59 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-06-05 23:34:26 +0800 |
commit | 9efd5374ed5d3e2c5abf6d85907e1e3ac5ce5b32 (patch) | |
tree | 090d80e157083121e5df163acc4dd8ba44635255 /Compiler.h | |
parent | 4987eec3d1e87868e091850d31af58e054ab5ee5 (diff) | |
download | dexon-solidity-9efd5374ed5d3e2c5abf6d85907e1e3ac5ce5b32.tar.gz dexon-solidity-9efd5374ed5d3e2c5abf6d85907e1e3ac5ce5b32.tar.zst dexon-solidity-9efd5374ed5d3e2c5abf6d85907e1e3ac5ce5b32.zip |
Compute constants
Diffstat (limited to 'Compiler.h')
-rw-r--r-- | Compiler.h | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -34,13 +34,18 @@ namespace solidity { class Compiler: private ASTConstVisitor { public: - explicit Compiler(bool _optimize = false): m_optimize(_optimize), m_context(), - m_returnTag(m_context.newTag()) {} + explicit Compiler(bool _optimize = false, unsigned _runs = 200): + m_optimize(_optimize), + m_optimizeRuns(_runs), + m_context(), + m_returnTag(m_context.newTag()) + { + } void compileContract(ContractDefinition const& _contract, std::map<ContractDefinition const*, bytes const*> const& _contracts); - bytes getAssembledBytecode() { return m_context.getAssembledBytecode(m_optimize); } - bytes getRuntimeBytecode() { return m_runtimeContext.getAssembledBytecode(m_optimize);} + bytes getAssembledBytecode() { return m_context.getAssembledBytecode(); } + bytes getRuntimeBytecode() { return m_context.getAssembledRuntimeBytecode(m_runtimeSub); } /// @arg _sourceCodes is the map of input files to source code strings /// @arg _inJsonFromat shows whether the out should be in Json format Json::Value streamAssembly(std::ostream& _stream, StringMap const& _sourceCodes = StringMap(), bool _inJsonFormat = false) const @@ -50,7 +55,7 @@ public: /// @returns Assembly items of the normal compiler context eth::AssemblyItems const& getAssemblyItems() const { return m_context.getAssembly().getItems(); } /// @returns Assembly items of the runtime compiler context - eth::AssemblyItems const& getRuntimeAssemblyItems() const { return m_runtimeContext.getAssembly().getItems(); } + eth::AssemblyItems const& getRuntimeAssemblyItems() const { return m_context.getAssembly().getSub(m_runtimeSub).getItems(); } /// @returns the entry label of the given function. Might return an AssemblyItem of type /// UndefinedItem if it does not exist yet. @@ -93,7 +98,9 @@ private: void compileExpression(Expression const& _expression, TypePointer const& _targetType = TypePointer()); bool const m_optimize; + unsigned const m_optimizeRuns; CompilerContext m_context; + size_t m_runtimeSub = size_t(-1); ///< Identifier of the runtime sub-assembly CompilerContext m_runtimeContext; std::vector<eth::AssemblyItem> m_breakTags; ///< tag to jump to for a "break" statement std::vector<eth::AssemblyItem> m_continueTags; ///< tag to jump to for a "continue" statement |