mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
libevmasm: add RETURNDATACOPY and RETURNDATASIZE
This commit is contained in:
parent
0c8c209194
commit
0b22154a75
@ -234,6 +234,10 @@ In the grammar, opcodes are represented as pre-defined identifiers.
|
||||
+-------------------------+------+-----------------------------------------------------------------+
|
||||
| extcodecopy(a, t, f, s) | `-` | like codecopy(t, f, s) but take code at address a |
|
||||
+-------------------------+------+-----------------------------------------------------------------+
|
||||
| returndatasize | | size of the last returndata |
|
||||
+-------------------------+------+-----------------------------------------------------------------+
|
||||
| returndatacopy(t, f, s) | `*` | copy s bytes from returndata at position f to mem at position t |
|
||||
+-------------------------+------+-----------------------------------------------------------------+
|
||||
| create(v, p, s) | | create new contract with code mem[p..(p+s)) and send v wei |
|
||||
| | | and return the new address |
|
||||
+-------------------------+------+-----------------------------------------------------------------+
|
||||
|
@ -67,6 +67,8 @@ const std::map<std::string, Instruction> dev::solidity::c_instructions =
|
||||
{ "GASPRICE", Instruction::GASPRICE },
|
||||
{ "EXTCODESIZE", Instruction::EXTCODESIZE },
|
||||
{ "EXTCODECOPY", Instruction::EXTCODECOPY },
|
||||
{ "RETURNDATASIZE", Instruction::RETURNDATASIZE },
|
||||
{ "RETURNDATACOPY", Instruction::RETURNDATACOPY },
|
||||
{ "BLOCKHASH", Instruction::BLOCKHASH },
|
||||
{ "COINBASE", Instruction::COINBASE },
|
||||
{ "TIMESTAMP", Instruction::TIMESTAMP },
|
||||
@ -203,6 +205,8 @@ static const std::map<Instruction, InstructionInfo> c_instructionInfo =
|
||||
{ Instruction::GASPRICE, { "GASPRICE", 0, 0, 1, false, Tier::Base } },
|
||||
{ Instruction::EXTCODESIZE, { "EXTCODESIZE", 0, 1, 1, false, Tier::ExtCode } },
|
||||
{ Instruction::EXTCODECOPY, { "EXTCODECOPY", 0, 4, 0, true, Tier::ExtCode } },
|
||||
{ Instruction::RETURNDATASIZE, {"RETURNDATASIZE", 0, 0, 1, false, Tier::Base } },
|
||||
{ Instruction::RETURNDATACOPY, {"RETURNDATACOPY", 0, 3, 0, true, Tier::VeryLow } },
|
||||
{ Instruction::BLOCKHASH, { "BLOCKHASH", 0, 1, 1, false, Tier::Ext } },
|
||||
{ Instruction::COINBASE, { "COINBASE", 0, 0, 1, false, Tier::Base } },
|
||||
{ Instruction::TIMESTAMP, { "TIMESTAMP", 0, 0, 1, false, Tier::Base } },
|
||||
|
@ -77,6 +77,8 @@ enum class Instruction: uint8_t
|
||||
GASPRICE, ///< get price of gas in current environment
|
||||
EXTCODESIZE, ///< get external code size (from another contract)
|
||||
EXTCODECOPY, ///< copy external code (from another contract)
|
||||
RETURNDATASIZE, ///< get size of the last return data
|
||||
RETURNDATACOPY, ///< copy last return data to memory
|
||||
|
||||
BLOCKHASH = 0x40, ///< get hash of most recent complete block
|
||||
COINBASE, ///< get the block's coinbase address
|
||||
|
@ -542,6 +542,16 @@ BOOST_AUTO_TEST_CASE(keccak256)
|
||||
BOOST_CHECK(successAssemble("{ pop(sha3(0, 0)) }"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(returndatasize)
|
||||
{
|
||||
BOOST_CHECK(successAssemble("{ let r := returndatasize }"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(returndatacopy)
|
||||
{
|
||||
BOOST_CHECK(successAssemble("{ returndatacopy(0, 32, 64) }"));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
Loading…
Reference in New Issue
Block a user