This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Optimized IR: | |
/*=====================================================* | |
* WARNING * | |
* Solidity to Yul compilation is still EXPERIMENTAL * | |
* It can result in LOSS OF FUNDS or worse * | |
* !USE AT YOUR OWN RISK! * | |
*=====================================================*/ | |
/// @use-src 0:"test/libsolidity/semanticTests/userDefinedValueType/calldata.sol" | |
object "C_294" { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/libyul/backends/evm/OptimizedEVMCodeTransform.cpp b/libyul/backends/evm/OptimizedEVMCodeTransform.cpp | |
index 6cd9b45cd..db0dd3007 100644 | |
--- a/libyul/backends/evm/OptimizedEVMCodeTransform.cpp | |
+++ b/libyul/backends/evm/OptimizedEVMCodeTransform.cpp | |
@@ -342,7 +342,10 @@ void OptimizedEVMCodeTransform::createStackLayout(Stack _targetStack) | |
// - the constant 0 | |
// Note: it might even make sense to introduce a specific assembly item for this, s.t. | |
// the peephole optimizer can deal with this (e.g. POP PUSHJUNK can be removed). | |
- m_assembly.appendInstruction(evmasm::Instruction::PC); | |
+ if (m_assembly.stackHeight() == 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object "C_46" { | |
code { | |
{ | |
/// @src 0:0:160 | |
let _1 := memoryguard(0x80) | |
mstore(64, _1) | |
if callvalue() { revert(0, 0) } | |
let _2 := datasize("C_46_deployed") | |
codecopy(_1, dataoffset("C_46_deployed"), _2) | |
return(_1, _2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object "object" { | |
code { | |
{ | |
let _1 := mload(sub(shl(137, 1), 1)) | |
let _2 := foo_s_107_268_512_924_1670(sub(shl(125, 1), 1), sub(shl(129, 1), 1), sub(shl(133, 1), 1), _1) | |
let _3 := mload(sub(shl(105, 1), 1)) | |
let _4 := foo_s_107_268_512_924_1670(sub(shl(101, 1), 1), _3, sub(shl(109, 1), 1), sub(shl(113, 1), 1)) | |
pop(foo_s_107_268_512_924_1670(sub(shl(97, 1), 1), not(foo_s_107_268_512_924_1670(sub(shl(97, 1), 1), not(foo_s_107_268_512_924_1670(sub(shl(97, 1), 1), not(foo_s_107_268_512_924_1670(sub(shl(97, 1), 1), not(foo_s_107_268_512_924_1670(sub(shl(97, 1), 1), not(foo_s_107_268_512_924_1670(sub(shl(97, 1), 1), foo_s_107_268_512_924_1670(sub(shl(101, 1), 1), _3, sub(shl(109, 1), 1), sub(shl(113, 1), 1)), sub(shl(117, 1), 1), addmod(sub(shl(121, 1), 1), foo_s_107_268_512_924_1670(sub(shl(125, 1), 1), sub(shl(129, 1), 1), sub(shl(133, 1), 1), _1), sub(shl(141, 1), 1)))), sub(shl(117, 1), 1), addmod(sub(shl(121, 1), 1), not(foo_s_107_268_512_924 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo '{"contracts": {"test.sol:C": {"asm": {".code": [],".data": {"0": | |
{".auxdata":"a26469706673582212205fe09eead890659ccd3f8dfd5c787234e5830f5efe2e01ab570bd5d3eb7ce18364736f6c6378263 | |
02e382e372d646576656c6f702e323032312e372e382b636f6d6d69742e30306330666361660057", | |
".code": [' > /tmp/test.asm | |
cat $1 | while read OP; do | |
if [[ $OP == PUSH* ]]; then | |
VALUE=$(echo $OP | cut -f 2 -d ' ') | |
echo "{\"begin\": 0,\"end\": 0,\"name\": \"PUSH\",\"source\": 0,\"value\": \"${VALUE}\"}," >> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// test/libsolidity/semanticTests/calldata/calldata_internal_function_pointer.sol --evm-version homestead --optimize | |
// function call to g() reverts, even though it should not | |
object "C_71" { | |
code { | |
{ | |
mstore(64, 128) | |
if callvalue() { revert(0, 0) } | |
sstore(0x00, or(and(sload(0x00), not(sub(exp(2, 64), 1))), 28)) | |
let _1 := datasize("C_71_deployed") | |
codecopy(128, dataoffset("C_71_deployed"), _1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename GetTargetPosition, typename Swap, typename Pop> | |
void permute(unsigned _n, GetTargetPosition _getTargetPosition, Swap _swap, Pop _pop) | |
{ | |
static_assert( | |
std::is_same_v<std::invoke_result_t<GetTargetPosition, unsigned>, int>, | |
"_getTargetPosition needs to have the signature int(unsigned)" | |
); | |
static_assert( | |
std::is_same_v<std::invoke_result_t<Swap, unsigned>, void>, | |
"_swap needs to have the signature void(unsigned)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Generic helper functions for handling permutations. | |
/// @a _n Specifies the size of the permutation. | |
/// @a _getTargetPosition A function that takes an offset as unsigned integer as argument and returns the desired target position | |
/// of the element at that offset as integer or -1, if the element is to be discarded. | |
/// @a _swap Takes a (zero-based) depth as unsigned integer as argument and swaps the currently last element with the | |
/// element at the given depth. | |
/// @a _pop Pops the last element. | |
template<typename GetTargetPosition, typename Swap, typename Pop> | |
void permute(unsigned _n, GetTargetPosition _getTargetPosition, Swap _swap, Pop _pop) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
mstore(0x40, memoryguard(0x0580)) | |
{ | |
function fo_0() -> x_4, _ | |
{ x_4 := mod(0x800, 0) } | |
let x_5117 | |
function foo_m_3(x_27, _288, x_9, x_290, x_291, x_292, x_23, x_294, x_295, x6, _297, x_298, x_299, _300, x_301, x_302, x_303, _304, x30, x_306, x_307, x_30, x_309, x_310, x_311, x_312) -> x_327, x_28, x_29, x_330, __1, x_332, x_, x_334, x_3, _36, x_337, x_38, x39, x0, x_31, x_342 | |
{ | |
mstore(0x0560, x_27) | |
mstore(0x0540, _288) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Optimized IR: | |
/******************************************************* | |
* WARNING * | |
* Solidity to Yul compilation is still EXPERIMENTAL * | |
* It can result in LOSS OF FUNDS or worse * | |
* !USE AT YOUR OWN RISK! * | |
*******************************************************/ | |
object "c_145" { | |
code { |
NewerOlder