diff options
author | Lu Guanqun <guanqun.lu@gmail.com> | 2015-12-24 00:09:29 +0800 |
---|---|---|
committer | Lu Guanqun <guanqun.lu@gmail.com> | 2016-01-23 01:14:00 +0800 |
commit | c781b130ef95c1ad841ab1b80fbc95d7c068db80 (patch) | |
tree | 77c57429be9f212876000cf1b79982aedc6d36d3 /libsolidity/codegen | |
parent | db6ce6d8a158e9c28853608794f324dc5e860822 (diff) | |
download | dexon-solidity-c781b130ef95c1ad841ab1b80fbc95d7c068db80.tar dexon-solidity-c781b130ef95c1ad841ab1b80fbc95d7c068db80.tar.gz dexon-solidity-c781b130ef95c1ad841ab1b80fbc95d7c068db80.tar.bz2 dexon-solidity-c781b130ef95c1ad841ab1b80fbc95d7c068db80.tar.lz dexon-solidity-c781b130ef95c1ad841ab1b80fbc95d7c068db80.tar.xz dexon-solidity-c781b130ef95c1ad841ab1b80fbc95d7c068db80.tar.zst dexon-solidity-c781b130ef95c1ad841ab1b80fbc95d7c068db80.zip |
[cond-expr] make the codegen one instruction less
Diffstat (limited to 'libsolidity/codegen')
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 6dd9d005..5e9c6920 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -180,13 +180,12 @@ bool ExpressionCompiler::visit(Conditional const& _condition) { CompilerContext::LocationSetter locationSetter(m_context, _condition); _condition.condition().accept(*this); - m_context << eth::Instruction::ISZERO; - eth::AssemblyItem falseTag = m_context.appendConditionalJump(); - _condition.trueExpression().accept(*this); + eth::AssemblyItem trueTag = m_context.appendConditionalJump(); + _condition.falseExpression().accept(*this); eth::AssemblyItem endTag = m_context.appendJumpToNew(); - m_context << falseTag; + m_context << trueTag; m_context.adjustStackOffset(-1); - _condition.falseExpression().accept(*this); + _condition.trueExpression().accept(*this); m_context << endTag; return false; } |