`inline` function modifier

Hi all,
Been a long time since I’ve actively worked with Solidity and am catching up on a few years of developments.

One language feature that I’ve always missed in Solidity is the ability to specify that a simple function should be compiled as inline bytecode rather than jumped to through the stack.
I recall some historical discussion against macros due to additional preprocessing and metalanguage development…or some reason, but I don’t know if there’s been any discussion on introducing an inline function modifier

Use cases would typically be simple library functions and other simple checks (maths, explicit mutations, assembly snippets, transient memory sets/checks etc) where the generated bytecode of the logic compiles to less than jump routines and execution costs that would wrap it.

Somewhat related is the curious compilation of constants which if modified as public are referenced through their getter function rather than inlined as they are if not made public.

Anyway… requesting inline as a modifier. I don’t know how much the optimiser does to inline such code but it would be nice to have an explicit syntax

Big +1 on this. I haven’t investigated too much into when & how the IR pipeline inlines (some docs on this would be great bc I can’t really understand the C++ source). I’ve noticed personally in my optimization quests that inlining is one of the most effective optimizations. Downstream it also generally allows your code to be optimized further.

In many case I even want everything to be inlined, especially when I’m not really running into the code size limit.

1 Like