diff options
author | Gav Wood <i@gavwood.com> | 2015-01-09 07:22:06 +0800 |
---|---|---|
committer | Gav Wood <i@gavwood.com> | 2015-01-09 07:22:06 +0800 |
commit | ffce12b7ee412cbd29dd0873a3e894dd7133ca4e (patch) | |
tree | 867881a37367a42b910a6182499054d8ae127170 /ExpressionCompiler.cpp | |
parent | d18fa27b6a48540298e835ad324152566586c65c (diff) | |
download | dexon-solidity-ffce12b7ee412cbd29dd0873a3e894dd7133ca4e.tar.gz dexon-solidity-ffce12b7ee412cbd29dd0873a3e894dd7133ca4e.tar.zst dexon-solidity-ffce12b7ee412cbd29dd0873a3e894dd7133ca4e.zip |
Basic logging in Solidity (though no tests yet).
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r-- | ExpressionCompiler.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp index aa740613..ec66b69a 100644 --- a/ExpressionCompiler.cpp +++ b/ExpressionCompiler.cpp @@ -256,6 +256,61 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) CompilerUtils(m_context).storeInMemory(0); m_context << u256(32) << u256(0) << eth::Instruction::SHA3; break; + case Location::LOG0: + arguments.front()->accept(*this); + appendTypeConversion(*arguments.front()->getType(), *function.getParameterTypes().front(), true); + // @todo move this once we actually use memory + CompilerUtils(m_context).storeInMemory(0); + m_context << u256(32) << u256(0) << eth::Instruction::LOG0; + break; + case Location::LOG1: + arguments[1]->accept(*this); + arguments[0]->accept(*this); + appendTypeConversion(*arguments[1]->getType(), *function.getParameterTypes()[1], true); + appendTypeConversion(*arguments[0]->getType(), *function.getParameterTypes()[0], true); + // @todo move this once we actually use memory + CompilerUtils(m_context).storeInMemory(0); + m_context << u256(32) << u256(0) << eth::Instruction::LOG1; + break; + case Location::LOG2: + arguments[2]->accept(*this); + arguments[1]->accept(*this); + arguments[0]->accept(*this); + appendTypeConversion(*arguments[2]->getType(), *function.getParameterTypes()[2], true); + appendTypeConversion(*arguments[1]->getType(), *function.getParameterTypes()[1], true); + appendTypeConversion(*arguments[0]->getType(), *function.getParameterTypes()[0], true); + // @todo move this once we actually use memory + CompilerUtils(m_context).storeInMemory(0); + m_context << u256(32) << u256(0) << eth::Instruction::LOG2; + break; + case Location::LOG3: + arguments[3]->accept(*this); + arguments[2]->accept(*this); + arguments[1]->accept(*this); + arguments[0]->accept(*this); + appendTypeConversion(*arguments[3]->getType(), *function.getParameterTypes()[3], true); + appendTypeConversion(*arguments[2]->getType(), *function.getParameterTypes()[2], true); + appendTypeConversion(*arguments[1]->getType(), *function.getParameterTypes()[1], true); + appendTypeConversion(*arguments[0]->getType(), *function.getParameterTypes()[0], true); + // @todo move this once we actually use memory + CompilerUtils(m_context).storeInMemory(0); + m_context << u256(32) << u256(0) << eth::Instruction::LOG3; + break; + case Location::LOG4: + arguments[4]->accept(*this); + arguments[3]->accept(*this); + arguments[2]->accept(*this); + arguments[1]->accept(*this); + arguments[0]->accept(*this); + appendTypeConversion(*arguments[4]->getType(), *function.getParameterTypes()[4], true); + appendTypeConversion(*arguments[3]->getType(), *function.getParameterTypes()[3], true); + appendTypeConversion(*arguments[2]->getType(), *function.getParameterTypes()[2], true); + appendTypeConversion(*arguments[1]->getType(), *function.getParameterTypes()[1], true); + appendTypeConversion(*arguments[0]->getType(), *function.getParameterTypes()[0], true); + // @todo move this once we actually use memory + CompilerUtils(m_context).storeInMemory(0); + m_context << u256(32) << u256(0) << eth::Instruction::LOG4; + break; case Location::ECRECOVER: case Location::SHA256: case Location::RIPEMD160: |