aboutsummaryrefslogtreecommitdiffstats
path: root/liblll/CodeFragment.cpp
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-06-14 20:13:22 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-06-22 04:23:39 +0800
commitbc95da354d78912f1b2d1a726f072fb855f2c219 (patch)
tree61e198302abbdabdc6c679ebed1356e50a147d5f /liblll/CodeFragment.cpp
parent3515ee98ff75a0dd60d1e481e37cb47b7ed51022 (diff)
downloaddexon-solidity-bc95da354d78912f1b2d1a726f072fb855f2c219.tar.gz
dexon-solidity-bc95da354d78912f1b2d1a726f072fb855f2c219.tar.zst
dexon-solidity-bc95da354d78912f1b2d1a726f072fb855f2c219.zip
Replace obsolete assembly code in LLL
Diffstat (limited to 'liblll/CodeFragment.cpp')
-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")
{