aboutsummaryrefslogtreecommitdiffstats
path: root/Compiler.h
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-06-06 01:22:30 +0800
committerchriseth <c@ethdev.com>2015-06-06 01:22:30 +0800
commit779e793d60f2076fbd35b34f0c2073e92c058eef (patch)
tree5bde2e4f0270ed40529f9ef5e79d5ecdc14666bf /Compiler.h
parent92eb04c6eccba8b6d7c5c02e5ca2084d9e4fecf6 (diff)
parent9efd5374ed5d3e2c5abf6d85907e1e3ac5ce5b32 (diff)
downloaddexon-solidity-779e793d60f2076fbd35b34f0c2073e92c058eef.tar
dexon-solidity-779e793d60f2076fbd35b34f0c2073e92c058eef.tar.gz
dexon-solidity-779e793d60f2076fbd35b34f0c2073e92c058eef.tar.bz2
dexon-solidity-779e793d60f2076fbd35b34f0c2073e92c058eef.tar.lz
dexon-solidity-779e793d60f2076fbd35b34f0c2073e92c058eef.tar.xz
dexon-solidity-779e793d60f2076fbd35b34f0c2073e92c058eef.tar.zst
dexon-solidity-779e793d60f2076fbd35b34f0c2073e92c058eef.zip
Merge pull request #2084 from chriseth/sol_computeConstants
Compute constants
Diffstat (limited to 'Compiler.h')
-rw-r--r--Compiler.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/Compiler.h b/Compiler.h
index 13b8639d..670c7467 100644
--- a/Compiler.h
+++ b/Compiler.h
@@ -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