Skip to content

Commit

Permalink
eof: objectCompiler tests updating
Browse files Browse the repository at this point in the history
  • Loading branch information
rodiazet committed Dec 19, 2024
1 parent b6486db commit 466d48c
Show file tree
Hide file tree
Showing 49 changed files with 1,150 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/libyul/objectCompiler/data.yul
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ object "a" {
}
// ====
// EVMVersion: >=constantinople
// bytecodeFormat: legacy
// ----
// Assembly:
// /* "source":22:29 */
Expand Down
1 change: 1 addition & 0 deletions test/libyul/objectCompiler/datacopy.yul
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ object "a" {
}
// ====
// EVMVersion: >=shanghai
// bytecodeFormat: legacy
// ----
// Assembly:
// /* "source":77:92 */
Expand Down
1 change: 1 addition & 0 deletions test/libyul/objectCompiler/dataoffset_code.yul
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ object "a" {
}
// ====
// EVMVersion: >=shanghai
// bytecodeFormat: legacy
// ----
// Assembly:
// /* "source":44:61 */
Expand Down
1 change: 1 addition & 0 deletions test/libyul/objectCompiler/dataoffset_data.yul
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ object "a" {
}
// ====
// EVMVersion: >=shanghai
// bytecodeFormat: legacy
// ----
// Assembly:
// /* "source":56:75 */
Expand Down
1 change: 1 addition & 0 deletions test/libyul/objectCompiler/dataoffset_self.yul
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ object "a" {
}
// ====
// EVMVersion: >=shanghai
// bytecodeFormat: legacy
// ----
// Assembly:
// /* "source":44:59 */
Expand Down
1 change: 1 addition & 0 deletions test/libyul/objectCompiler/datasize_code.yul
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ object "a" {
}
// ====
// EVMVersion: >=shanghai
// bytecodeFormat: legacy
// ----
// Assembly:
// /* "source":44:59 */
Expand Down
1 change: 1 addition & 0 deletions test/libyul/objectCompiler/datasize_data.yul
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ object "a" {
}
// ====
// EVMVersion: >=shanghai
// bytecodeFormat: legacy
// ----
// Assembly:
// /* "source":44:61 */
Expand Down
1 change: 1 addition & 0 deletions test/libyul/objectCompiler/datasize_self.yul
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ object "a" {
}
// ====
// EVMVersion: >=shanghai
// bytecodeFormat: legacy
// ----
// Assembly:
// /* "source":36:49 */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// All objects have identical unoptimized code, but at 200 runs the creation objects will optimized
// differently from deployed objects.

/// @use-src 0:"A.sol"
object "A" {
code {
function load(i) -> r { r := calldataload(i) }
let x := add(shl(255, 1), shl(127, not(0)))
sstore(load(x), load(1))
}

/// @use-src 0:"B.sol"
object "B_deployed" {
code {
function load(i) -> r { r := calldataload(i) }
let x := add(shl(255, 1), shl(127, not(0)))
sstore(load(x), load(1))
}

/// @use-src 0:"A.sol"
object "A" {
code {
function load(i) -> r { r := calldataload(i) }
let x := add(shl(255, 1), shl(127, not(0)))
sstore(load(x), load(1))
}

/// @use-src 0:"B.sol"
object "B_deployed" {
code {
function load(i) -> r { r := calldataload(i) }
let x := add(shl(255, 1), shl(127, not(0)))
sstore(load(x), load(1))
}
}

/// @use-src 0:"C.sol"
object "C" {
code {
function load(i) -> r { r := calldataload(i) }
let x := add(shl(255, 1), shl(127, not(0)))
sstore(load(x), load(1))
}
}
}
}

/// @use-src 0:"C.sol"
object "C_deployed" {
code {
function load(i) -> r { r := calldataload(i) }
let x := add(shl(255, 1), shl(127, not(0)))
sstore(load(x), load(1))
}
}

/// @use-src 0:"D.sol"
object "D" {
code {
function load(i) -> r { r := calldataload(i) }
let x := add(shl(255, 1), shl(127, not(0)))
sstore(load(x), load(1))
}
}
}
// ====
// EVMVersion: >=constantinople
// bytecodeFormat: >=EOFv1
// optimizationPreset: full
// ----
// Assembly:
// sstore(calldataload(sub(shl(0xff, 0x01), shl(0x7f, 0x01))), calldataload(0x01))
// stop
// stop
//
// sub_0: assembly {
// sstore(calldataload(shl(0x7f, 0xffffffffffffffffffffffffffffffff)), calldataload(0x01))
// stop
// stop
//
// sub_0: assembly {
// sstore(calldataload(sub(shl(0xff, 0x01), shl(0x7f, 0x01))), calldataload(0x01))
// stop
// stop
//
// sub_0: assembly {
// sstore(calldataload(shl(0x7f, 0xffffffffffffffffffffffffffffffff)), calldataload(0x01))
// stop
// }
//
// sub_1: assembly {
// sstore(calldataload(sub(shl(0xff, 0x01), shl(0x7f, 0x01))), calldataload(0x01))
// stop
// }
// }
// }
//
// sub_1: assembly {
// sstore(calldataload(shl(0x7f, 0xffffffffffffffffffffffffffffffff)), calldataload(0x01))
// stop
// }
//
// sub_2: assembly {
// sstore(calldataload(sub(shl(0xff, 0x01), shl(0x7f, 0x01))), calldataload(0x01))
// stop
// }
// Bytecode: ef0001010004020001001104000000008000046001356001607f1b600160ff1b03355500
// Opcodes: 0xEF STOP ADD ADD STOP DIV MUL STOP ADD STOP GT DIV STOP STOP STOP STOP DUP1 STOP DIV PUSH1 0x1 CALLDATALOAD PUSH1 0x1 PUSH1 0x7F SHL PUSH1 0x1 PUSH1 0xFF SHL SUB CALLDATALOAD SSTORE STOP
// SourceMappings: :::-:0;;;;;;;;;;;
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// All objects have identical unoptimized code, but with different debug annotations.
// The optimized Yul will be identical only between objects that have identical debug info.

/// @use-src 0:"A.sol"
object "A" {
code {
function load(i) -> r { r := calldataload(i) }
/// @src 0:10:20
sstore(load(0), load(1))
}

/// @use-src 0:"B.sol"
object "B" {
code {
function load(i) -> r { r := calldataload(i) }
/// @src 0:10:20
sstore(load(0), load(1))
}

/// @use-src 0:"A.sol"
object "A" {
code {
function load(i) -> r { r := calldataload(i) }
/// @src 0:10:20
sstore(load(0), load(1))
}

/// @use-src 0:"B.sol"
object "B" {
code {
function load(i) -> r { r := calldataload(i) }
/// @src 0:10:20
sstore(load(0), load(1))
}
}

/// @use-src 0:"C.sol"
object "C" {
code {
function load(i) -> r { r := calldataload(i) }
/// @src 0:10:20
sstore(load(0), load(1))
}
}
}
}

/// @use-src 0:"C.sol"
object "C" {
code {
function load(i) -> r { r := calldataload(i) }
/// @src 0:10:20
sstore(load(0), load(1))
}
}

/// @use-src 0:"D.sol"
object "D" {
code {
function load(i) -> r { r := calldataload(i) }
/// @src 0:10:20
sstore(load(0), load(1))
}
}
}
// ====
// EVMVersion: >=shanghai
// bytecodeFormat: >=EOFv1
// optimizationPreset: full
// ----
// Assembly:
// /* "A.sol":10:20 */
// sstore(calldataload(0x00), calldataload(0x01))
// stop
// stop
//
// sub_0: assembly {
// /* "B.sol":10:20 */
// sstore(calldataload(0x00), calldataload(0x01))
// stop
// stop
//
// sub_0: assembly {
// /* "A.sol":10:20 */
// sstore(calldataload(0x00), calldataload(0x01))
// stop
// stop
//
// sub_0: assembly {
// /* "B.sol":10:20 */
// sstore(calldataload(0x00), calldataload(0x01))
// stop
// }
//
// sub_1: assembly {
// /* "C.sol":10:20 */
// sstore(calldataload(0x00), calldataload(0x01))
// stop
// }
// }
// }
//
// sub_1: assembly {
// /* "C.sol":10:20 */
// sstore(calldataload(0x00), calldataload(0x01))
// stop
// }
//
// sub_2: assembly {
// /* "D.sol":10:20 */
// sstore(calldataload(0x00), calldataload(0x01))
// stop
// }
// Bytecode: ef0001010004020001000704000000008000026001355f355500
// Opcodes: 0xEF STOP ADD ADD STOP DIV MUL STOP ADD STOP SMOD DIV STOP STOP STOP STOP DUP1 STOP MUL PUSH1 0x1 CALLDATALOAD PUSH0 CALLDATALOAD SSTORE STOP
// SourceMappings: 10:10::-:0;-1:-1;10:10;-1:-1;10:10;-1:-1
Loading

0 comments on commit 466d48c

Please sign in to comment.