Merge pull request #9118 from ethereum/develop

Merge develop into breaking.
This commit is contained in:
chriseth
2020-06-04 10:18:46 +02:00
committed by GitHub
44 changed files with 436 additions and 235 deletions
@@ -0,0 +1 @@
--assemble --machine ewasm
@@ -0,0 +1 @@
The selected input language is not directly supported when targeting the Ewasm machine and automatic translation is not available.
@@ -0,0 +1 @@
1
@@ -0,0 +1,3 @@
{
sstore(0, 1)
}
@@ -0,0 +1 @@
+2 -2
View File
@@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE(all_assembly_items)
// PushSubSize
auto sub = _assembly.appendSubroutine(_subAsmPtr);
// PushSub
_assembly.pushSubroutineOffset(size_t(sub.data()));
_assembly.pushSubroutineOffset(static_cast<size_t>(sub.data()));
// PushDeployTimeAddress
_assembly.append(PushDeployTimeAddress);
// AssignImmutable.
@@ -187,7 +187,7 @@ BOOST_AUTO_TEST_CASE(immutable)
_assembly.appendImmutableAssignment("someOtherImmutable");
auto sub = _assembly.appendSubroutine(_subAsmPtr);
_assembly.pushSubroutineOffset(size_t(sub.data()));
_assembly.pushSubroutineOffset(static_cast<size_t>(sub.data()));
checkCompilation(_assembly);
+5 -5
View File
@@ -1227,7 +1227,7 @@ BOOST_AUTO_TEST_CASE(jumpdest_removal_subassemblies)
sub->append(t4.pushTag());
sub->append(Instruction::JUMP);
size_t subId = size_t(main.appendSubroutine(sub).data());
size_t subId = static_cast<size_t>(main.appendSubroutine(sub).data());
main.append(t1.toSubAssemblyTag(subId));
main.append(t1.toSubAssemblyTag(subId));
main.append(u256(8));
@@ -1281,10 +1281,10 @@ BOOST_AUTO_TEST_CASE(cse_remove_redundant_shift_masking)
if (!solidity::test::CommonOptions::get().evmVersion().hasBitwiseShifting())
return;
for (int i = 1; i < 256; i++)
for (size_t i = 1; i < 256; i++)
{
checkCSE({
u256(boost::multiprecision::pow(u256(2), i)-1),
u256(boost::multiprecision::pow(u256(2), i) - 1),
Instruction::CALLVALUE,
u256(256-i),
Instruction::SHR,
@@ -1309,10 +1309,10 @@ BOOST_AUTO_TEST_CASE(cse_remove_redundant_shift_masking)
}
// Check that opt. does NOT trigger
for (int i = 1; i < 255; i++)
for (size_t i = 1; i < 255; i++)
{
checkCSE({
u256(boost::multiprecision::pow(u256(2), i)-1),
u256(boost::multiprecision::pow(u256(2), i) - 1),
Instruction::CALLVALUE,
u256(255-i),
Instruction::SHR,
@@ -0,0 +1,14 @@
contract C {
uint8[][2] public a;
constructor() public {
a[1].push(3);
a[1].push(4);
}
}
// ====
// compileViaYul: also
// ----
// a(uint256,uint256): 0, 0 -> FAILURE
// a(uint256,uint256): 1, 0 -> 3
// a(uint256,uint256): 1, 1 -> 4
// a(uint256,uint256): 2, 0 -> FAILURE
@@ -0,0 +1,11 @@
contract C {
mapping(uint => mapping(uint => uint)) public x;
constructor() public {
x[1][2] = 3;
}
}
// ====
// compileViaYul: also
// ----
// x(uint256,uint256): 1, 2 -> 3
// x(uint256,uint256): 0, 0 -> 0
@@ -0,0 +1,20 @@
contract C {
struct S {
uint8 a;
uint16 b;
uint128 c;
uint d;
}
mapping(uint => mapping(uint => S)) public x;
constructor() public {
x[1][2].a = 3;
x[1][2].b = 4;
x[1][2].c = 5;
x[1][2].d = 6;
}
}
// ====
// compileViaYul: also
// ----
// x(uint256,uint256): 1, 2 -> 3, 4, 5, 6
// x(uint256,uint256): 0, 0 -> 0x00, 0x00, 0x00, 0x00
@@ -0,0 +1,19 @@
contract C {
uint8 public a;
uint16 public b;
uint128 public c;
uint public d;
constructor() public {
a = 3;
b = 4;
c = 5;
d = 6;
}
}
// ====
// compileViaYul: also
// ----
// a() -> 3
// b() -> 4
// c() -> 5
// d() -> 6
@@ -8,8 +8,10 @@ contract test {
dynamicData[2][2] = 8;
}
}
// ====
// compileViaYul: also
// ----
// data(uint256,uint256): 2, 2 -> 8
// data(uint256,uint256): 2, 8 -> FAILURE # NB: the original code contained a bug here #
// data(uint256,uint256): 2, 8 -> FAILURE # NB: the original code contained a bug here #
// dynamicData(uint256,uint256): 2, 2 -> 8
// dynamicData(uint256,uint256): 2, 8 -> FAILURE
@@ -8,5 +8,7 @@ contract test {
data[7].d = true;
}
}
// ====
// compileViaYul: also
// ----
// data(uint256): 7 -> 1, 2, true
@@ -0,0 +1,9 @@
contract C1 {
function f() external pure returns(int) { return 42; }
}
contract C is C1 {
int override f;
}
// ----
// TypeError: (96-110): Override can only be used with public state variables.