diff options
author | chriseth <chris@ethereum.org> | 2019-01-16 18:44:11 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2019-01-18 03:36:48 +0800 |
commit | 29f6aa7d560a7d82a9088489e663a079a3b41f73 (patch) | |
tree | 2ef2c682489bc68f16d600d06643f1f39ec12105 /libsolidity/codegen/CompilerContext.h | |
parent | a9fa2658d8690f18aa14c599a305cf59a5cd4e3c (diff) | |
download | dexon-solidity-29f6aa7d560a7d82a9088489e663a079a3b41f73.tar dexon-solidity-29f6aa7d560a7d82a9088489e663a079a3b41f73.tar.gz dexon-solidity-29f6aa7d560a7d82a9088489e663a079a3b41f73.tar.bz2 dexon-solidity-29f6aa7d560a7d82a9088489e663a079a3b41f73.tar.lz dexon-solidity-29f6aa7d560a7d82a9088489e663a079a3b41f73.tar.xz dexon-solidity-29f6aa7d560a7d82a9088489e663a079a3b41f73.tar.zst dexon-solidity-29f6aa7d560a7d82a9088489e663a079a3b41f73.zip |
Do not create a copy of the assembly.
Diffstat (limited to 'libsolidity/codegen/CompilerContext.h')
-rw-r--r-- | libsolidity/codegen/CompilerContext.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libsolidity/codegen/CompilerContext.h b/libsolidity/codegen/CompilerContext.h index 43e1ea77..e5ddfbc5 100644 --- a/libsolidity/codegen/CompilerContext.h +++ b/libsolidity/codegen/CompilerContext.h @@ -76,8 +76,8 @@ public: unsigned numberOfLocalVariables() const; void setOtherCompilers(std::map<ContractDefinition const*, std::shared_ptr<Compiler const>> const& _otherCompilers) { m_otherCompilers = _otherCompilers; } - eth::Assembly const& compiledContract(ContractDefinition const& _contract) const; - eth::Assembly const& compiledContractRuntime(ContractDefinition const& _contract) const; + std::shared_ptr<eth::Assembly> compiledContract(ContractDefinition const& _contract) const; + std::shared_ptr<eth::Assembly> compiledContractRuntime(ContractDefinition const& _contract) const; void setStackOffset(int _offset) { m_asm->setDeposit(_offset); } void adjustStackOffset(int _adjustment) { m_asm->adjustDeposit(_adjustment); } @@ -224,15 +224,15 @@ public: void optimise(bool _fullOptimsation, unsigned _runs = 200) { m_asm->optimise(_fullOptimsation, m_evmVersion, true, _runs); } /// @returns the runtime context if in creation mode and runtime context is set, nullptr otherwise. - CompilerContext* runtimeContext() { return m_runtimeContext; } + CompilerContext* runtimeContext() const { return m_runtimeContext; } /// @returns the identifier of the runtime subroutine. size_t runtimeSub() const { return m_runtimeSub; } /// @returns a const reference to the underlying assembly. eth::Assembly const& assembly() const { return *m_asm; } - /// @returns non-const reference to the underlying assembly. Should be avoided in favour of - /// wrappers in this class. - eth::Assembly& nonConstAssembly() { return *m_asm; } + /// @returns a shared pointer to the assembly. + /// Should be avoided except when adding sub-assemblies. + std::shared_ptr<eth::Assembly> assemblyPtr() const { return m_asm; } /// @arg _sourceCodes is the map of input files to source code strings std::string assemblyString(StringMap const& _sourceCodes = StringMap()) const |