mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Updating gas costs and cmdline tests.
This commit is contained in:
parent
047d693ac9
commit
67c92b7f6e
@ -87,18 +87,18 @@ object "C_59" {
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
function convert_t_stringliteral_6490_to_t_string() -> converted
|
||||
function copy_literal_to_memory_64902fd228f7ef267f3b474dd6ef84bae434cf5546eee948e7ca26df3eda1927() -> memPtr
|
||||
{
|
||||
let memPtr := mload(64)
|
||||
let newFreePtr := add(memPtr, 160)
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr)) { panic_error_0x41() }
|
||||
let memPtr_1 := mload(64)
|
||||
let newFreePtr := add(memPtr_1, 160)
|
||||
if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, memPtr_1)) { panic_error_0x41() }
|
||||
mstore(64, newFreePtr)
|
||||
converted := memPtr
|
||||
mstore(memPtr, 100)
|
||||
mstore(add(memPtr, 32), "longstringlongstringlongstringlo")
|
||||
mstore(add(memPtr, 64), "ngstringlongstringlongstringlong")
|
||||
mstore(add(memPtr, 96), "stringlongstringlongstringlongst")
|
||||
mstore(add(memPtr, 128), "ring")
|
||||
mstore(memPtr_1, 100)
|
||||
memPtr := memPtr_1
|
||||
mstore(add(memPtr_1, 0x20), "longstringlongstringlongstringlo")
|
||||
mstore(add(memPtr_1, 64), "ngstringlongstringlongstringlong")
|
||||
mstore(add(memPtr_1, 96), "stringlongstringlongstringlongst")
|
||||
mstore(add(memPtr_1, 128), "ring")
|
||||
}
|
||||
function extract_from_storage_value_dynamict_uint256(slot_value, offset) -> value
|
||||
{
|
||||
@ -120,7 +120,7 @@ object "C_59" {
|
||||
sstore(slot, or(and(_5, not(mask)), and(shl(shiftBits, _4), mask)))
|
||||
let _6, _7 := storage_array_index_access$_t_struct$_S_storage(0x02, vloc)
|
||||
vloc := extract_from_storage_value_dynamict_uint256(sload(_6), _7)
|
||||
vloc__27_mpos := convert_t_stringliteral_6490_to_t_string()
|
||||
vloc__27_mpos := copy_literal_to_memory_64902fd228f7ef267f3b474dd6ef84bae434cf5546eee948e7ca26df3eda1927()
|
||||
}
|
||||
function panic_error_0x32()
|
||||
{
|
||||
|
@ -75,6 +75,26 @@ object \"C_11\" {
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
|
||||
function allocate_memory_array_t_string_memory_ptr(length) -> memPtr {
|
||||
let allocSize := array_allocation_size_t_string_memory_ptr(length)
|
||||
memPtr := allocateMemory(allocSize)
|
||||
|
||||
mstore(memPtr, length)
|
||||
|
||||
}
|
||||
|
||||
function array_allocation_size_t_string_memory_ptr(length) -> size {
|
||||
// Make sure we can allocate memory without overflow
|
||||
if gt(length, 0xffffffffffffffff) { panic_error_0x41() }
|
||||
|
||||
// round up
|
||||
size := and(add(length, 0x1f), not(0x1f))
|
||||
|
||||
// add length slot
|
||||
size := add(size, 0x20)
|
||||
|
||||
}
|
||||
|
||||
function array_length_t_string_memory_ptr(value) -> length {
|
||||
|
||||
length := mload(value)
|
||||
@ -87,11 +107,12 @@ object \"C_11\" {
|
||||
}
|
||||
|
||||
function convert_t_stringliteral_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21_to_t_string_memory_ptr() -> converted {
|
||||
converted := allocateMemory(64)
|
||||
mstore(converted, 6)
|
||||
|
||||
mstore(add(converted, 32), \"abcabc\")
|
||||
converted := copy_literal_to_memory_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21()
|
||||
}
|
||||
|
||||
function copy_literal_to_memory_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21() -> memPtr {
|
||||
memPtr := allocate_memory_array_t_string_memory_ptr(6)
|
||||
store_literal_in_memory_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21(add(memPtr, 32))
|
||||
}
|
||||
|
||||
function copy_memory_to_memory(src, dst, length) {
|
||||
@ -133,6 +154,12 @@ object \"C_11\" {
|
||||
|
||||
}
|
||||
|
||||
function store_literal_in_memory_9f0adad0a59b05d2e04a1373342b10b9eb16c57c164c8a3bfcbf46dccee39a21(memPtr) {
|
||||
|
||||
mstore(add(memPtr, 0), \"abcabc\")
|
||||
|
||||
}
|
||||
|
||||
function zero_value_for_split_t_string_memory_ptr() -> ret {
|
||||
ret := 96
|
||||
}
|
||||
|
@ -75,6 +75,26 @@ object \"C_11\" {
|
||||
mstore(64, newFreePtr)
|
||||
}
|
||||
|
||||
function allocate_memory_array_t_string_memory_ptr(length) -> memPtr {
|
||||
let allocSize := array_allocation_size_t_string_memory_ptr(length)
|
||||
memPtr := allocateMemory(allocSize)
|
||||
|
||||
mstore(memPtr, length)
|
||||
|
||||
}
|
||||
|
||||
function array_allocation_size_t_string_memory_ptr(length) -> size {
|
||||
// Make sure we can allocate memory without overflow
|
||||
if gt(length, 0xffffffffffffffff) { panic_error_0x41() }
|
||||
|
||||
// round up
|
||||
size := and(add(length, 0x1f), not(0x1f))
|
||||
|
||||
// add length slot
|
||||
size := add(size, 0x20)
|
||||
|
||||
}
|
||||
|
||||
function array_length_t_string_memory_ptr(value) -> length {
|
||||
|
||||
length := mload(value)
|
||||
@ -87,15 +107,12 @@ object \"C_11\" {
|
||||
}
|
||||
|
||||
function convert_t_stringliteral_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571_to_t_string_memory_ptr() -> converted {
|
||||
converted := allocateMemory(128)
|
||||
mstore(converted, 85)
|
||||
|
||||
mstore(add(converted, 32), \"abcdabcdcafecafeabcdabcdcafecafe\")
|
||||
|
||||
mstore(add(converted, 64), \"ffffzzzzoooo0123456789,.<,>.?:;'\")
|
||||
|
||||
mstore(add(converted, 96), \"[{]}|`~!@#$%^&*()-_=+\")
|
||||
converted := copy_literal_to_memory_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571()
|
||||
}
|
||||
|
||||
function copy_literal_to_memory_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571() -> memPtr {
|
||||
memPtr := allocate_memory_array_t_string_memory_ptr(85)
|
||||
store_literal_in_memory_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571(add(memPtr, 32))
|
||||
}
|
||||
|
||||
function copy_memory_to_memory(src, dst, length) {
|
||||
@ -137,6 +154,16 @@ object \"C_11\" {
|
||||
|
||||
}
|
||||
|
||||
function store_literal_in_memory_d6604f85ac07e2b33103a620b3d3d75b0473c7214912beded67b9b624d41c571(memPtr) {
|
||||
|
||||
mstore(add(memPtr, 0), \"abcdabcdcafecafeabcdabcdcafecafe\")
|
||||
|
||||
mstore(add(memPtr, 32), \"ffffzzzzoooo0123456789,.<,>.?:;'\")
|
||||
|
||||
mstore(add(memPtr, 64), \"[{]}|`~!@#$%^&*()-_=+\")
|
||||
|
||||
}
|
||||
|
||||
function zero_value_for_split_t_string_memory_ptr() -> ret {
|
||||
ret := 96
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(string_storage)
|
||||
if (CommonOptions::get().useABIEncoderV1)
|
||||
CHECK_DEPLOY_GAS(133045, 129731, evmVersion);
|
||||
else
|
||||
CHECK_DEPLOY_GAS(152657, 135201, evmVersion);
|
||||
CHECK_DEPLOY_GAS(155553, 135201, evmVersion);
|
||||
}
|
||||
// This is only correct on >=Constantinople.
|
||||
else if (!CommonOptions::get().useABIEncoderV1)
|
||||
@ -117,9 +117,9 @@ BOOST_AUTO_TEST_CASE(string_storage)
|
||||
else
|
||||
{
|
||||
if (evmVersion < EVMVersion::istanbul())
|
||||
CHECK_DEPLOY_GAS(146671, 123969, evmVersion);
|
||||
CHECK_DEPLOY_GAS(149567, 123969, evmVersion);
|
||||
else
|
||||
CHECK_DEPLOY_GAS(131591, 110969, evmVersion);
|
||||
CHECK_DEPLOY_GAS(134123, 110969, evmVersion);
|
||||
}
|
||||
}
|
||||
else if (evmVersion < EVMVersion::istanbul())
|
||||
@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(string_storage)
|
||||
{
|
||||
callContractFunction("f()");
|
||||
if (evmVersion == EVMVersion::byzantium())
|
||||
CHECK_GAS(21712, 21555, 20);
|
||||
CHECK_GAS(21741, 21555, 20);
|
||||
// This is only correct on >=Constantinople.
|
||||
else if (!CommonOptions::get().useABIEncoderV1)
|
||||
{
|
||||
@ -145,9 +145,9 @@ BOOST_AUTO_TEST_CASE(string_storage)
|
||||
else
|
||||
{
|
||||
if (evmVersion < EVMVersion::istanbul())
|
||||
CHECK_GAS(21707, 21559, 20);
|
||||
CHECK_GAS(21736, 21559, 20);
|
||||
else
|
||||
CHECK_GAS(21499, 21351, 20);
|
||||
CHECK_GAS(21528, 21351, 20);
|
||||
}
|
||||
}
|
||||
else if (evmVersion < EVMVersion::istanbul())
|
||||
|
@ -13,8 +13,8 @@ contract C {
|
||||
}
|
||||
// ----
|
||||
// creation:
|
||||
// codeDepositCost: 376800
|
||||
// executionCost: 411
|
||||
// totalCost: 377211
|
||||
// codeDepositCost: 398400
|
||||
// executionCost: 436
|
||||
// totalCost: 398836
|
||||
// external:
|
||||
// f(): 399
|
||||
// f(): 428
|
||||
|
Loading…
Reference in New Issue
Block a user