Skip to content

Commit

Permalink
Update tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ekpyron committed Mar 11, 2021
1 parent c10c213 commit 55bd7b0
Show file tree
Hide file tree
Showing 43 changed files with 502 additions and 306 deletions.
22 changes: 14 additions & 8 deletions test/cmdlineTests/evm_to_wasm/output
Expand Up @@ -3,7 +3,9 @@

Pretty printed source:
object "object" {
code { { sstore(0, 1) } }
code {
{ sstore(returndatasize(), 1) }
}
}


Expand All @@ -14,9 +16,10 @@ object "object" {
code {
function main()
{
let _1 := 0
mstore_internal(0:i32, _1, _1, _1, _1)
mstore_internal(32:i32, _1, _1, _1, 1)
let _1 := i64.extend_i32_u(eth.getReturnDataSize())
let _2 := 0
mstore_internal(0:i32, _2, _2, _2, _1)
mstore_internal(32:i32, _2, _2, _2, 1)
eth.storageStore(0:i32, 32:i32)
}
function bswap16(x:i32) -> y:i32
Expand Down Expand Up @@ -45,20 +48,23 @@ object "object" {


Binary representation:
0061736d01000000011b0560000060017e017e60017f017f60057f7e7e7e7e0060027f7f0002190108657468657265756d0c73746f7261676553746f7265000403060500020201030503010001060100071102066d656d6f72790200046d61696e00010ac001052901017e0240420021004100200020002000200010054120200020002000420110054100412010000b0b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100241107421022002200041107610027221010b20010b2201027e02402000a71003ad422086210220022000422088a71003ad8421010b20010b32000240200020011004370000200041086a20021004370000200041106a20031004370000200041186a200410043700000b0b
0061736d01000000011f066000006000017f60017e017e60017f017f60057f7e7e7e7e0060027f7f0002360208657468657265756d0c73746f7261676553746f7265000508657468657265756d1167657452657475726e4461746153697a65000103060500030302040503010001060100071102066d656d6f72790200046d61696e00020ac501052e01027e02401001ad2100420021014100200120012001200010064120200120012001420110064100412010000b0b1f01017f024020004108744180fe0371200041087641ff01717221010b20010b1e01027f02402000100341107421022002200041107610037221010b20010b2201027e02402000a71004ad422086210220022000422088a71004ad8421010b20010b32000240200020011005370000200041086a20021005370000200041106a20031005370000200041186a200410053700000b0b

Text representation:
(module
(import "ethereum" "storageStore" (func $eth.storageStore (param i32 i32)))
(import "ethereum" "getReturnDataSize" (func $eth.getReturnDataSize (result i32)))
(memory $memory (export "memory") 1)
(export "main" (func $main))

(func $main
(local $_1 i64)
(local $_2 i64)
(block $label_
(local.set $_1 (i64.const 0))
(call $mstore_internal (i32.const 0) (local.get $_1) (local.get $_1) (local.get $_1) (local.get $_1))
(call $mstore_internal (i32.const 32) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 1))
(local.set $_1 (i64.extend_i32_u (call $eth.getReturnDataSize)))
(local.set $_2 (i64.const 0))
(call $mstore_internal (i32.const 0) (local.get $_2) (local.get $_2) (local.get $_2) (local.get $_1))
(call $mstore_internal (i32.const 32) (local.get $_2) (local.get $_2) (local.get $_2) (i64.const 1))
(call $eth.storageStore (i32.const 0) (i32.const 32))
)
)
Expand Down
252 changes: 150 additions & 102 deletions test/cmdlineTests/evm_to_wasm_break/output

Large diffs are not rendered by default.

22 changes: 14 additions & 8 deletions test/cmdlineTests/ir_compiler_inheritance_nosubobjects/output
Expand Up @@ -10,17 +10,20 @@ object "C_7" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue()
{
revert(returndatasize(), returndatasize())
}
let _1 := datasize("C_7_deployed")
codecopy(0, dataoffset("C_7_deployed"), _1)
return(0, _1)
codecopy(returndatasize(), dataoffset("C_7_deployed"), _1)
return(returndatasize(), _1)
}
}
object "C_7_deployed" {
code {
{
mstore(64, 128)
revert(0, 0)
revert(returndatasize(), returndatasize())
}
}
}
Expand All @@ -38,17 +41,20 @@ object "D_10" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue()
{
revert(returndatasize(), returndatasize())
}
let _1 := datasize("D_10_deployed")
codecopy(0, dataoffset("D_10_deployed"), _1)
return(0, _1)
codecopy(returndatasize(), dataoffset("D_10_deployed"), _1)
return(returndatasize(), _1)
}
}
object "D_10_deployed" {
code {
{
mstore(64, 128)
revert(0, 0)
revert(returndatasize(), returndatasize())
}
}
}
Expand Down
33 changes: 21 additions & 12 deletions test/cmdlineTests/ir_compiler_subobjects/output
Expand Up @@ -10,17 +10,20 @@ object "C_3" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue()
{
revert(returndatasize(), returndatasize())
}
let _1 := datasize("C_3_deployed")
codecopy(0, dataoffset("C_3_deployed"), _1)
return(0, _1)
codecopy(returndatasize(), dataoffset("C_3_deployed"), _1)
return(returndatasize(), _1)
}
}
object "C_3_deployed" {
code {
{
mstore(64, 128)
revert(0, 0)
revert(returndatasize(), returndatasize())
}
}
}
Expand All @@ -38,10 +41,13 @@ object "D_16" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue()
{
revert(returndatasize(), returndatasize())
}
let _1 := datasize("D_16_deployed")
codecopy(0, dataoffset("D_16_deployed"), _1)
return(0, _1)
codecopy(returndatasize(), dataoffset("D_16_deployed"), _1)
return(returndatasize(), _1)
}
}
object "D_16_deployed" {
Expand All @@ -50,7 +56,7 @@ object "D_16" {
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
let _1 := returndatasize()
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
Expand Down Expand Up @@ -87,17 +93,20 @@ object "D_16" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue()
{
revert(returndatasize(), returndatasize())
}
let _1 := datasize("C_3_deployed")
codecopy(0, dataoffset("C_3_deployed"), _1)
return(0, _1)
codecopy(returndatasize(), dataoffset("C_3_deployed"), _1)
return(returndatasize(), _1)
}
}
object "C_3_deployed" {
code {
{
mstore(64, 128)
revert(0, 0)
revert(returndatasize(), returndatasize())
}
}
}
Expand Down
Expand Up @@ -10,10 +10,13 @@ object "D_12" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue()
{
revert(returndatasize(), returndatasize())
}
let _1 := datasize("D_12_deployed")
codecopy(0, dataoffset("D_12_deployed"), _1)
return(0, _1)
codecopy(returndatasize(), dataoffset("D_12_deployed"), _1)
return(returndatasize(), _1)
}
}
object "D_12_deployed" {
Expand All @@ -22,7 +25,7 @@ object "D_12" {
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
let _1 := returndatasize()
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
Expand All @@ -31,7 +34,7 @@ object "D_12" {
return(128, _1)
}
}
revert(0, 0)
revert(returndatasize(), returndatasize())
}
}
}
Expand Down
13 changes: 8 additions & 5 deletions test/cmdlineTests/ir_with_assembly_no_memoryguard_runtime/output
Expand Up @@ -10,10 +10,13 @@ object "D_8" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue()
{
revert(returndatasize(), returndatasize())
}
let _1 := datasize("D_8_deployed")
codecopy(0, dataoffset("D_8_deployed"), _1)
return(0, _1)
codecopy(returndatasize(), dataoffset("D_8_deployed"), _1)
return(returndatasize(), _1)
}
}
object "D_8_deployed" {
Expand All @@ -22,7 +25,7 @@ object "D_8" {
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
let _1 := returndatasize()
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
Expand All @@ -31,7 +34,7 @@ object "D_8" {
return(128, _1)
}
}
revert(0, 0)
revert(returndatasize(), returndatasize())
}
}
}
Expand Down
27 changes: 15 additions & 12 deletions test/cmdlineTests/name_simplifier/output
Expand Up @@ -10,10 +10,13 @@ object "C_59" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
if callvalue()
{
revert(returndatasize(), returndatasize())
}
let _1 := datasize("C_59_deployed")
codecopy(0, dataoffset("C_59_deployed"), _1)
return(0, _1)
codecopy(returndatasize(), dataoffset("C_59_deployed"), _1)
return(returndatasize(), _1)
}
}
object "C_59_deployed" {
Expand All @@ -22,7 +25,7 @@ object "C_59" {
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
let _1 := returndatasize()
if eq(0xf8eddcc6, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
Expand Down Expand Up @@ -56,7 +59,7 @@ object "C_59" {
return(memPos, sub(abi_encode_uint256_string(memPos, ret, ret_1), memPos))
}
}
revert(0, 0)
revert(returndatasize(), returndatasize())
}
function abi_encode_uint256_string(headStart, value0, value1) -> tail
{
Expand All @@ -65,14 +68,14 @@ object "C_59" {
mstore(add(headStart, _1), 64)
let length := mload(value1)
mstore(add(headStart, 64), length)
let i := tail
let i := returndatasize()
for { } lt(i, length) { i := add(i, _1) }
{
mstore(add(add(headStart, i), 96), mload(add(add(value1, i), _1)))
}
if gt(i, length)
{
mstore(add(add(headStart, length), 96), tail)
mstore(add(add(headStart, length), 96), returndatasize())
}
tail := add(add(headStart, and(add(length, 31), not(31))), 96)
}
Expand Down Expand Up @@ -117,21 +120,21 @@ object "C_59" {
}
function panic_error_0x32()
{
mstore(0, shl(224, 0x4e487b71))
mstore(returndatasize(), shl(224, 0x4e487b71))
mstore(4, 0x32)
revert(0, 0x24)
revert(returndatasize(), 0x24)
}
function panic_error_0x41()
{
mstore(0, shl(224, 0x4e487b71))
mstore(returndatasize(), shl(224, 0x4e487b71))
mstore(4, 0x41)
revert(0, 0x24)
revert(returndatasize(), 0x24)
}
function storage_array_index_access_struct_S(array, index) -> slot, offset
{
if iszero(lt(index, 0x02)) { panic_error_0x32() }
slot := add(array, index)
offset := offset
offset := returndatasize()
}
}
}
Expand Down

0 comments on commit 55bd7b0

Please sign in to comment.