mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #11331 from ethereum/respectMemoryModelForwardingRevert
Respect memory model forwarding revert
This commit is contained in:
		
						commit
						1814cad4f2
					
				| @ -3792,11 +3792,13 @@ string YulUtilFunctions::forwardingRevertFunction() | |||||||
| 		if (forward) | 		if (forward) | ||||||
| 			return Whiskers(R"( | 			return Whiskers(R"( | ||||||
| 				function <functionName>() { | 				function <functionName>() { | ||||||
| 					returndatacopy(0, 0, returndatasize()) | 					let pos := <allocateUnbounded>() | ||||||
| 					revert(0, returndatasize()) | 					returndatacopy(pos, 0, returndatasize()) | ||||||
|  | 					revert(pos, returndatasize()) | ||||||
| 				} | 				} | ||||||
| 			)") | 			)") | ||||||
| 			("functionName", functionName) | 			("functionName", functionName) | ||||||
|  | 			("allocateUnbounded", allocateUnboundedFunction()) | ||||||
| 			.render(); | 			.render(); | ||||||
| 		else | 		else | ||||||
| 			return Whiskers(R"( | 			return Whiskers(R"( | ||||||
|  | |||||||
| @ -66,8 +66,9 @@ object "D_16" { | |||||||
|                         datacopy(128, dataoffset("C_3"), _2) |                         datacopy(128, dataoffset("C_3"), _2) | ||||||
|                         if iszero(create(_1, 128, _2)) |                         if iszero(create(_1, 128, _2)) | ||||||
|                         { |                         { | ||||||
|                             returndatacopy(_1, _1, returndatasize()) |                             let pos := mload(64) | ||||||
|                             revert(_1, returndatasize()) |                             returndatacopy(pos, _1, returndatasize()) | ||||||
|  |                             revert(pos, returndatasize()) | ||||||
|                         } |                         } | ||||||
|                         return(mload(64), _1) |                         return(mload(64), _1) | ||||||
|                     } |                     } | ||||||
|  | |||||||
| @ -136,8 +136,9 @@ object \"D_16\" { | |||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             function revert_forward_1() { |             function revert_forward_1() { | ||||||
|                 returndatacopy(0, 0, returndatasize()) |                 let pos := allocate_unbounded() | ||||||
|                 revert(0, returndatasize()) |                 returndatacopy(pos, 0, returndatasize()) | ||||||
|  |                 revert(pos, returndatasize()) | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             function shift_right_224_unsigned(value) -> newValue { |             function shift_right_224_unsigned(value) -> newValue { | ||||||
|  | |||||||
| @ -35,9 +35,9 @@ object "C_3" { | |||||||
| 
 | 
 | ||||||
| ======= viair_subobjects/input.sol:D ======= | ======= viair_subobjects/input.sol:D ======= | ||||||
| Binary: | Binary: | ||||||
| 608060405234156100105760006000fd5b60b680610020600039806000f350fe60806040526004361015156087576000803560e01c6326121ff0141560855734156027578081fd5b80600319360112156036578081fd5b6028806080016080811067ffffffffffffffff82111715606457634e487b7160e01b83526041600452602483fd5b508061008e60803980608083f01515607e573d82833e3d82fd5b5080604051f35b505b60006000fdfe60806040523415600f5760006000fd5b600a80601e600039806000f350fe608060405260006000fd | 608060405234156100105760006000fd5b60ba80610020600039806000f350fe6080604052600436101515608b576000803560e01c6326121ff0141560895734156027578081fd5b80600319360112156036578081fd5b6028806080016080811067ffffffffffffffff82111715606457634e487b7160e01b83526041600452602483fd5b508061009260803980608083f015156082576040513d83823e3d81fd505b5080604051f35b505b60006000fdfe60806040523415600f5760006000fd5b600a80601e600039806000f350fe608060405260006000fd | ||||||
| Binary of the runtime part: | Binary of the runtime part: | ||||||
| 60806040526004361015156087576000803560e01c6326121ff0141560855734156027578081fd5b80600319360112156036578081fd5b6028806080016080811067ffffffffffffffff82111715606457634e487b7160e01b83526041600452602483fd5b508061008e60803980608083f01515607e573d82833e3d82fd5b5080604051f35b505b60006000fdfe60806040523415600f5760006000fd5b600a80601e600039806000f350fe608060405260006000fd | 6080604052600436101515608b576000803560e01c6326121ff0141560895734156027578081fd5b80600319360112156036578081fd5b6028806080016080811067ffffffffffffffff82111715606457634e487b7160e01b83526041600452602483fd5b508061009260803980608083f015156082576040513d83823e3d81fd505b5080604051f35b505b60006000fdfe60806040523415600f5760006000fd5b600a80601e600039806000f350fe608060405260006000fd | ||||||
| Optimized IR: | Optimized IR: | ||||||
| /******************************************************* | /******************************************************* | ||||||
|  *                       WARNING                       * |  *                       WARNING                       * | ||||||
| @ -78,8 +78,9 @@ object "D_16" { | |||||||
|                         datacopy(128, dataoffset("C_3"), _2) |                         datacopy(128, dataoffset("C_3"), _2) | ||||||
|                         if iszero(create(_1, 128, _2)) |                         if iszero(create(_1, 128, _2)) | ||||||
|                         { |                         { | ||||||
|                             returndatacopy(_1, _1, returndatasize()) |                             let pos := mload(64) | ||||||
|                             revert(_1, returndatasize()) |                             returndatacopy(pos, _1, returndatasize()) | ||||||
|  |                             revert(pos, returndatasize()) | ||||||
|                         } |                         } | ||||||
|                         return(mload(64), _1) |                         return(mload(64), _1) | ||||||
|                     } |                     } | ||||||
|  | |||||||
| @ -45,6 +45,6 @@ contract C { | |||||||
| // compileViaYul: also | // compileViaYul: also | ||||||
| // ---- | // ---- | ||||||
| // test() -> 5, 6, 7 | // test() -> 5, 6, 7 | ||||||
| // gas irOptimized: 345542 | // gas irOptimized: 345942 | ||||||
| // gas legacy: 500424 | // gas legacy: 500424 | ||||||
| // gas legacyOptimized: 309013 | // gas legacyOptimized: 309013 | ||||||
|  | |||||||
| @ -18,15 +18,15 @@ contract C { | |||||||
| // compileViaYul: also | // compileViaYul: also | ||||||
| // ---- | // ---- | ||||||
| // constructor(), 20 wei | // constructor(), 20 wei | ||||||
| // gas irOptimized: 265125 | // gas irOptimized: 255579 | ||||||
| // gas legacy: 285485 | // gas legacy: 285485 | ||||||
| // gas legacyOptimized: 177957 | // gas legacyOptimized: 177933 | ||||||
| // f(uint256): 20 -> 1370859564726510389319704988634906228201275401179 | // f(uint256): 20 -> 1370859564726510389319704988634906228201275401179 | ||||||
| // x() -> 1 | // x() -> 1 | ||||||
| // f(uint256): 20 -> FAILURE | // f(uint256): 20 -> FAILURE | ||||||
| // x() -> 1 | // x() -> 1 | ||||||
| // stack(uint256): 1023 -> FAILURE | // stack(uint256): 1023 -> FAILURE | ||||||
| // gas irOptimized: 853785 | // gas irOptimized: 856335 | ||||||
| // gas legacy: 981671 | // gas legacy: 981671 | ||||||
| // gas legacyOptimized: 824895 | // gas legacyOptimized: 824895 | ||||||
| // x() -> 1 | // x() -> 1 | ||||||
|  | |||||||
| @ -28,6 +28,6 @@ contract C { | |||||||
| // compileViaYul: also | // compileViaYul: also | ||||||
| // ---- | // ---- | ||||||
| // t() -> 9 | // t() -> 9 | ||||||
| // gas irOptimized: 103946 | // gas irOptimized: 103941 | ||||||
| // gas legacy: 161097 | // gas legacy: 161097 | ||||||
| // gas legacyOptimized: 112116 | // gas legacyOptimized: 112116 | ||||||
|  | |||||||
| @ -22,6 +22,6 @@ contract A { | |||||||
| // ---- | // ---- | ||||||
| // different_salt() -> true | // different_salt() -> true | ||||||
| // same_salt() -> true | // same_salt() -> true | ||||||
| // gas irOptimized: 98438968 | // gas irOptimized: 98438966 | ||||||
| // gas legacy: 98439116 | // gas legacy: 98439116 | ||||||
| // gas legacyOptimized: 98438970 | // gas legacyOptimized: 98438970 | ||||||
|  | |||||||
| @ -38,10 +38,10 @@ contract D { | |||||||
| // f() -> 0x1 # This should work, next should throw # | // f() -> 0x1 # This should work, next should throw # | ||||||
| // gas legacy: 102944 | // gas legacy: 102944 | ||||||
| // fview() -> FAILURE | // fview() -> FAILURE | ||||||
| // gas irOptimized: 98438658 | // gas irOptimized: 98438664 | ||||||
| // gas legacy: 98438822 | // gas legacy: 98438822 | ||||||
| // gas legacyOptimized: 98438615 | // gas legacyOptimized: 98438615 | ||||||
| // fpure() -> FAILURE | // fpure() -> FAILURE | ||||||
| // gas irOptimized: 98438658 | // gas irOptimized: 98438664 | ||||||
| // gas legacy: 98438822 | // gas legacy: 98438822 | ||||||
| // gas legacyOptimized: 98438616 | // gas legacyOptimized: 98438616 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user