Insert a call to panic function in legacy codegen (and not inline it every single time)

This commit is contained in:
Alex Beregszaszi 2021-05-24 11:06:13 +01:00
parent a3634934d1
commit c436785686
2 changed files with 3 additions and 8 deletions

View File

@ -6,6 +6,8 @@ Language Features:
Compiler Features:
* Code Generator: Insert helper functions for panic codes instead of inlining unconditionally. This can reduce costs if many panics (checks) are inserted,
but can increase costs where few panics are used.
* EVM: Set the default EVM version to "Berlin".
* SMTChecker: Function definitions can be annotated with the custom Natspec tag ``custom:smtchecker abstract-function-nondet`` to be abstracted by a nondeterministic value when called.
* Standard JSON / combined JSON: New artifact "functionDebugData" that contains bytecode offsets of entry points of functions and potentially more information in the future.

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;
}