diff options
author | chriseth <chris@ethereum.org> | 2018-08-07 19:00:34 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-07 19:00:34 +0800 |
commit | c6278fbae1e1dac33ebfad7e8d42e071c9e78914 (patch) | |
tree | d6772c27c34253ff8fc249eb1fc18f1ec2b49a4d /libsolidity/codegen/ContractCompiler.cpp | |
parent | d0bfe4b2254a9fa30429215fba8cd7e47db7a3b0 (diff) | |
parent | 71e26f6adb7d6b28400a6607570bb1e17da24feb (diff) | |
download | dexon-solidity-c6278fbae1e1dac33ebfad7e8d42e071c9e78914.tar dexon-solidity-c6278fbae1e1dac33ebfad7e8d42e071c9e78914.tar.gz dexon-solidity-c6278fbae1e1dac33ebfad7e8d42e071c9e78914.tar.bz2 dexon-solidity-c6278fbae1e1dac33ebfad7e8d42e071c9e78914.tar.lz dexon-solidity-c6278fbae1e1dac33ebfad7e8d42e071c9e78914.tar.xz dexon-solidity-c6278fbae1e1dac33ebfad7e8d42e071c9e78914.tar.zst dexon-solidity-c6278fbae1e1dac33ebfad7e8d42e071c9e78914.zip |
Merge pull request #4701 from ethereum/removeClone
Remove clone feature.
Diffstat (limited to 'libsolidity/codegen/ContractCompiler.cpp')
-rw-r--r-- | libsolidity/codegen/ContractCompiler.cpp | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index 2f15a33d..f9493d6d 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -94,27 +94,6 @@ size_t ContractCompiler::compileConstructor( } } -size_t ContractCompiler::compileClone( - ContractDefinition const& _contract, - map<ContractDefinition const*, eth::Assembly const*> const& _contracts -) -{ - initializeContext(_contract, _contracts); - - appendInitAndConstructorCode(_contract); - - //@todo determine largest return size of all runtime functions - auto runtimeSub = m_context.addSubroutine(cloneRuntime()); - - // stack contains sub size - m_context << Instruction::DUP1 << runtimeSub << u256(0) << Instruction::CODECOPY; - m_context << u256(0) << Instruction::RETURN; - - appendMissingFunctions(); - - return size_t(runtimeSub.data()); -} - void ContractCompiler::initializeContext( ContractDefinition const& _contract, map<ContractDefinition const*, eth::Assembly const*> const& _compiledContracts @@ -980,29 +959,6 @@ void ContractCompiler::compileExpression(Expression const& _expression, TypePoin CompilerUtils(m_context).convertType(*_expression.annotation().type, *_targetType); } -eth::AssemblyPointer ContractCompiler::cloneRuntime() const -{ - eth::Assembly a; - a << Instruction::CALLDATASIZE; - a << u256(0) << Instruction::DUP1 << Instruction::CALLDATACOPY; - //@todo adjust for larger return values, make this dynamic. - a << u256(0x20) << u256(0) << Instruction::CALLDATASIZE; - a << u256(0); - // this is the address which has to be substituted by the linker. - //@todo implement as special "marker" AssemblyItem. - a << u256("0xcafecafecafecafecafecafecafecafecafecafe"); - a << u256(eth::GasCosts::callGas(m_context.evmVersion()) + 10) << Instruction::GAS << Instruction::SUB; - a << Instruction::DELEGATECALL; - //Propagate error condition (if DELEGATECALL pushes 0 on stack). - a << Instruction::ISZERO; - a << Instruction::ISZERO; - eth::AssemblyItem afterTag = a.appendJumpI().tag(); - a << Instruction::INVALID << afterTag; - //@todo adjust for larger return values, make this dynamic. - a << u256(0x20) << u256(0) << Instruction::RETURN; - return make_shared<eth::Assembly>(a); -} - void ContractCompiler::popScopedVariables(ASTNode const* _node) { unsigned blockHeight = m_scopeStackHeight.at(m_modifierDepth).at(_node); |