aboutsummaryrefslogtreecommitdiffstats
path: root/liblll
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-06-22 18:22:28 +0800
committerGitHub <noreply@github.com>2017-06-22 18:22:28 +0800
commit1c54ce2a2caa6c4d91091152ad8a52b7881e8b83 (patch)
tree3d4e9cc3a050f214bcd7649d0124c7c5f31582d5 /liblll
parent3094e777486c40c91c6cf3432ad60f29b9ada484 (diff)
parentbc95da354d78912f1b2d1a726f072fb855f2c219 (diff)
downloaddexon-solidity-1c54ce2a2caa6c4d91091152ad8a52b7881e8b83.tar.gz
dexon-solidity-1c54ce2a2caa6c4d91091152ad8a52b7881e8b83.tar.zst
dexon-solidity-1c54ce2a2caa6c4d91091152ad8a52b7881e8b83.zip
Merge pull request #2399 from ethereum/lll-if
LLL: Replace obsolete assembly code
Diffstat (limited to 'liblll')
-rw-r--r--liblll/CodeFragment.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp
index 9f37bc65..afef63e9 100644
--- a/liblll/CodeFragment.cpp
+++ b/liblll/CodeFragment.cpp
@@ -439,15 +439,21 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
int minDep = min(code[1].m_asm.deposit(), code[2].m_asm.deposit());
m_asm.append(code[0].m_asm);
- auto pos = m_asm.appendJumpI();
- m_asm.onePath();
+ auto mainBranch = m_asm.appendJumpI();
+
+ /// The else branch.
+ int startDeposit = m_asm.deposit();
m_asm.append(code[2].m_asm, minDep);
auto end = m_asm.appendJump();
- m_asm.otherPath();
- m_asm << pos.tag();
+ int deposit = m_asm.deposit();
+ m_asm.setDeposit(startDeposit);
+
+ /// The main branch.
+ m_asm << mainBranch.tag();
m_asm.append(code[1].m_asm, minDep);
m_asm << end.tag();
- m_asm.donePaths();
+ if (m_asm.deposit() != deposit)
+ error<InvalidDeposit>();
}
else if (us == "WHEN" || us == "UNLESS")
{
@@ -458,11 +464,8 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
if (us == "WHEN")
m_asm.append(Instruction::ISZERO);
auto end = m_asm.appendJumpI();
- m_asm.onePath();
- m_asm.otherPath();
m_asm.append(code[1].m_asm, 0);
m_asm << end.tag();
- m_asm.donePaths();
}
else if (us == "WHILE" || us == "UNTIL")
{