diff options
author | chriseth <chris@ethereum.org> | 2018-03-06 03:13:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-06 03:13:52 +0800 |
commit | be797cb796f058c65452531755687da42867050f (patch) | |
tree | 0700972bd232ffcd7c20846190c8b11ec6f88b0b /libsolidity/codegen | |
parent | 3793aa405b9326c7269ed001344d721ae05629e8 (diff) | |
parent | 83fcf007bfdf9c9c8b595369c0542d45943ee095 (diff) | |
download | dexon-solidity-be797cb796f058c65452531755687da42867050f.tar dexon-solidity-be797cb796f058c65452531755687da42867050f.tar.gz dexon-solidity-be797cb796f058c65452531755687da42867050f.tar.bz2 dexon-solidity-be797cb796f058c65452531755687da42867050f.tar.lz dexon-solidity-be797cb796f058c65452531755687da42867050f.tar.xz dexon-solidity-be797cb796f058c65452531755687da42867050f.tar.zst dexon-solidity-be797cb796f058c65452531755687da42867050f.zip |
Merge pull request #3599 from ethereum/sendAllGasOnByzantium
Send all gas on byzantium
Diffstat (limited to 'libsolidity/codegen')
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index a56b11eb..0ce70f38 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -1679,16 +1679,19 @@ void ExpressionCompiler::appendExternalFunctionCall( utils().storeFreeMemoryPointer(); } - // Touch the end of the output area so that we do not pay for memory resize during the call - // (which we would have to subtract from the gas left) - // We could also just use MLOAD; POP right before the gas calculation, but the optimizer - // would remove that, so we use MSTORE here. - if (!_functionType.gasSet() && retSize > 0) + if (!m_context.evmVersion().canOverchargeGasForCall()) { - m_context << u256(0); - utils().fetchFreeMemoryPointer(); - // This touches too much, but that way we save some rounding arithmetics - m_context << u256(retSize) << Instruction::ADD << Instruction::MSTORE; + // Touch the end of the output area so that we do not pay for memory resize during the call + // (which we would have to subtract from the gas left) + // We could also just use MLOAD; POP right before the gas calculation, but the optimizer + // would remove that, so we use MSTORE here. + if (!_functionType.gasSet() && retSize > 0) + { + m_context << u256(0); + utils().fetchFreeMemoryPointer(); + // This touches too much, but that way we save some rounding arithmetics + m_context << u256(retSize) << Instruction::ADD << Instruction::MSTORE; + } } // Copy function identifier to memory. @@ -1757,7 +1760,7 @@ void ExpressionCompiler::appendExternalFunctionCall( if (_functionType.gasSet()) m_context << dupInstruction(m_context.baseToCurrentStackOffset(gasStackPos)); - else if (m_context.experimentalFeatureActive(ExperimentalFeature::V050)) + else if (m_context.evmVersion().canOverchargeGasForCall()) // Send all gas (requires tangerine whistle EVM) m_context << Instruction::GAS; else |