Merge pull request #11433 from ethereum/panic-dedup

Insert a call to panic function in legacy codegen (and not inline it every single time)
This commit is contained in:
chriseth
2021-05-31 11:23:30 +02:00
committed by GitHub
18 changed files with 146 additions and 65 deletions
+1 -8
View File
@@ -334,14 +334,7 @@ CompilerContext& CompilerContext::appendJump(evmasm::AssemblyItem::JumpType _jum
CompilerContext& CompilerContext::appendPanic(util::PanicCode _code)
{
Whiskers templ(R"({
mstore(0, <selector>)
mstore(4, <code>)
revert(0, 0x24)
})");
templ("selector", util::selectorFromSignature("Panic(uint256)").str());
templ("code", toCompactHexWithPrefix(static_cast<unsigned>(_code)));
appendInlineAssembly(templ.render());
callYulFunction(utilFunctions().panicFunction(_code), 0, 0);
return *this;
}