diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-14 20:13:22 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-22 04:23:39 +0800 |
commit | bc95da354d78912f1b2d1a726f072fb855f2c219 (patch) | |
tree | 61e198302abbdabdc6c679ebed1356e50a147d5f /liblll | |
parent | 3515ee98ff75a0dd60d1e481e37cb47b7ed51022 (diff) | |
download | dexon-solidity-bc95da354d78912f1b2d1a726f072fb855f2c219.tar.gz dexon-solidity-bc95da354d78912f1b2d1a726f072fb855f2c219.tar.zst dexon-solidity-bc95da354d78912f1b2d1a726f072fb855f2c219.zip |
Replace obsolete assembly code in LLL
Diffstat (limited to 'liblll')
-rw-r--r-- | liblll/CodeFragment.cpp | 19 |
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") { |