diff options
author | chriseth <c@ethdev.com> | 2016-11-24 17:32:52 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-12-01 23:03:59 +0800 |
commit | 91ecc4533dffbe67fa27adfaff27780ddf69c21a (patch) | |
tree | 665bbbe1a0396e56ade492c1a544b1eb1fb4310b /libsolidity/codegen | |
parent | 36c6fe2b698b1a05cae954dcee5d9e0fcea85d05 (diff) | |
download | dexon-solidity-91ecc4533dffbe67fa27adfaff27780ddf69c21a.tar dexon-solidity-91ecc4533dffbe67fa27adfaff27780ddf69c21a.tar.gz dexon-solidity-91ecc4533dffbe67fa27adfaff27780ddf69c21a.tar.bz2 dexon-solidity-91ecc4533dffbe67fa27adfaff27780ddf69c21a.tar.lz dexon-solidity-91ecc4533dffbe67fa27adfaff27780ddf69c21a.tar.xz dexon-solidity-91ecc4533dffbe67fa27adfaff27780ddf69c21a.tar.zst dexon-solidity-91ecc4533dffbe67fa27adfaff27780ddf69c21a.zip |
Add swarm hash to the end of the bytecode.
Diffstat (limited to 'libsolidity/codegen')
-rw-r--r-- | libsolidity/codegen/Compiler.cpp | 4 | ||||
-rw-r--r-- | libsolidity/codegen/CompilerContext.cpp | 7 | ||||
-rw-r--r-- | libsolidity/codegen/CompilerContext.h | 4 |
3 files changed, 3 insertions, 12 deletions
diff --git a/libsolidity/codegen/Compiler.cpp b/libsolidity/codegen/Compiler.cpp index 168e9462..b7e0cc64 100644 --- a/libsolidity/codegen/Compiler.cpp +++ b/libsolidity/codegen/Compiler.cpp @@ -36,6 +36,7 @@ void Compiler::compileContract( { ContractCompiler runtimeCompiler(nullptr, m_runtimeContext, m_optimize); runtimeCompiler.compileContract(_contract, _contracts); + m_runtimeContext.appendAuxiliaryData(_metadataHash.asBytes()); // This might modify m_runtimeContext because it can access runtime functions at // creation time. @@ -43,9 +44,6 @@ void Compiler::compileContract( m_runtimeSub = creationCompiler.compileConstructor(_contract, _contracts); m_context.optimise(m_optimize, m_optimizeRuns); - - solAssert(m_runtimeSub != size_t(-1), ""); - m_context.injectMetadataHashIntoSub(m_runtimeSub, _metadataHash); } void Compiler::compileClone( diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 9b921e9d..b99b0548 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -227,13 +227,6 @@ void CompilerContext::injectVersionStampIntoSub(size_t _subIndex) sub.injectStart(fromBigEndian<u256>(binaryVersion())); } -void CompilerContext::injectMetadataHashIntoSub(size_t _subIndex, h256 const& _metadataHash) -{ - eth::Assembly& sub = m_asm->sub(_subIndex); - sub.injectStart(Instruction::POP); - sub.injectStart(u256(_metadataHash)); -} - FunctionDefinition const& CompilerContext::resolveVirtualFunction( FunctionDefinition const& _function, vector<ContractDefinition const*>::const_iterator _searchStart diff --git a/libsolidity/codegen/CompilerContext.h b/libsolidity/codegen/CompilerContext.h index c8a35f93..8fdb3e03 100644 --- a/libsolidity/codegen/CompilerContext.h +++ b/libsolidity/codegen/CompilerContext.h @@ -155,8 +155,8 @@ public: /// Prepends "PUSH <compiler version number> POP" void injectVersionStampIntoSub(size_t _subIndex); - /// Prepends "PUSH <metadata hash> POP" - void injectMetadataHashIntoSub(size_t _subIndex, h256 const& _metadataHash); + /// Appends arbitrary data to the end of the bytecode. + void appendAuxiliaryData(bytes const& _data) { m_asm->appendAuxiliaryDataToEnd(_data); } void optimise(bool _fullOptimsation, unsigned _runs = 200) { m_asm->optimise(_fullOptimsation, true, _runs); } |