Initial working version of rjumps.

This commit is contained in:
Daniel Kirchner
2023-01-05 13:06:14 +01:00
parent d4314bb874
commit 0ccc3e3762
14 changed files with 249 additions and 57 deletions
+1 -1
View File
@@ -267,7 +267,7 @@ BOOST_AUTO_TEST_CASE(immutables_and_its_source_maps)
checkCompilation(assembly);
string const sourceMappings = AssemblyItem::computeSourceMapping(assembly.items(), indices);
string const sourceMappings = AssemblyItem::computeSourceMapping(assembly.codeSections().at(0).items, indices);
auto const numberOfMappings = std::count(sourceMappings.begin(), sourceMappings.end(), ';');
LinkerObject const& obj = assembly.assemble();
+2 -2
View File
@@ -1296,7 +1296,7 @@ BOOST_AUTO_TEST_CASE(jumpdest_removal_subassemblies)
u256(8)
};
BOOST_CHECK_EQUAL_COLLECTIONS(
main.items().begin(), main.items().end(),
main.codeSections().at(0).items.begin(),main.codeSections().at(0).items.end(),
expectationMain.begin(), expectationMain.end()
);
@@ -1304,7 +1304,7 @@ BOOST_AUTO_TEST_CASE(jumpdest_removal_subassemblies)
u256(1), t1.tag(), u256(2), Instruction::JUMP, t4.tag(), u256(7), t4.pushTag(), Instruction::JUMP
};
BOOST_CHECK_EQUAL_COLLECTIONS(
sub->items().begin(), sub->items().end(),
sub->codeSections().at(0).items.begin(), sub->codeSections().at(0).items.end(),
expectationSub.begin(), expectationSub.end()
);
}
+1 -1
View File
@@ -93,7 +93,7 @@ evmasm::AssemblyItems compileContract(std::shared_ptr<CharStream> _sourceCode)
);
compiler.compileContract(*contract, map<ContractDefinition const*, shared_ptr<Compiler const>>{}, bytes());
return compiler.runtimeAssembly().items();
return compiler.runtimeAssembly().codeSections().at(0).items;
}
BOOST_FAIL("No contract found in source.");
return AssemblyItems();
@@ -444,6 +444,9 @@ u256 EVMInstructionInterpreter::eval(
case Instruction::CALLF:
case Instruction::RETF:
case Instruction::JUMPF:
case Instruction::RJUMP:
case Instruction::RJUMPI:
case Instruction::RJUMPV:
{
yulAssert(false, "");
return 0;