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.cpp | |
parent | 4987eec3d1e87868e091850d31af58e054ab5ee5 (diff) | |
download | dexon-solidity-9efd5374ed5d3e2c5abf6d85907e1e3ac5ce5b32.tar dexon-solidity-9efd5374ed5d3e2c5abf6d85907e1e3ac5ce5b32.tar.gz dexon-solidity-9efd5374ed5d3e2c5abf6d85907e1e3ac5ce5b32.tar.bz2 dexon-solidity-9efd5374ed5d3e2c5abf6d85907e1e3ac5ce5b32.tar.lz dexon-solidity-9efd5374ed5d3e2c5abf6d85907e1e3ac5ce5b32.tar.xz dexon-solidity-9efd5374ed5d3e2c5abf6d85907e1e3ac5ce5b32.tar.zst dexon-solidity-9efd5374ed5d3e2c5abf6d85907e1e3ac5ce5b32.zip |
Compute constants
Diffstat (limited to 'Compiler.cpp')
-rw-r--r-- | Compiler.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Compiler.cpp b/Compiler.cpp index 6425367d..6dc72840 100644 --- a/Compiler.cpp +++ b/Compiler.cpp @@ -69,6 +69,8 @@ void Compiler::compileContract(ContractDefinition const& _contract, swap(m_context, m_runtimeContext); initializeContext(_contract, _contracts); packIntoContractCreator(_contract, m_runtimeContext); + if (m_optimize) + m_context.optimise(m_optimizeRuns); } eth::AssemblyItem Compiler::getFunctionEntryLabel(FunctionDefinition const& _function) const @@ -120,9 +122,11 @@ void Compiler::packIntoContractCreator(ContractDefinition const& _contract, Comp else if (auto c = m_context.getNextConstructor(_contract)) appendBaseConstructor(*c); - eth::AssemblyItem sub = m_context.addSubroutine(_runtimeContext.getAssembly()); + eth::AssemblyItem runtimeSub = m_context.addSubroutine(_runtimeContext.getAssembly()); + solAssert(runtimeSub.data() < numeric_limits<size_t>::max(), ""); + m_runtimeSub = size_t(runtimeSub.data()); // stack contains sub size - m_context << eth::Instruction::DUP1 << sub << u256(0) << eth::Instruction::CODECOPY; + m_context << eth::Instruction::DUP1 << runtimeSub << u256(0) << eth::Instruction::CODECOPY; m_context << u256(0) << eth::Instruction::RETURN; // note that we have to include the functions again because of absolute jump labels |