[U-Boot] [PATCH] initcall: Move to inline function

Simon Glass sjg at chromium.org
Sat Feb 2 14:13:35 UTC 2019


Hi Alex,

On Thu, 31 Jan 2019 at 08:06, Alexander Graf <agraf at suse.de> wrote:
>
> The board_r init function was complaining that we are looping through
> an array, calling all our tiny init stubs sequentially via indirect
> function calls (which can't be speculated, so they are slow).

Is this a compiler warning? Could you let me know what this is?

>
> The solution to that is pretty easy though. All we need to do is inline
> the function that loops through the functions and the compiler will
> automatically convert almost all indirect calls into direct inlined code.

You mean it calls the functions one after the other without a
function-table array?

>
> With this patch, the overall code size drops (by 40 bytes on riscv64)
> and boot time should become measurably faster for every target.
>
> Signed-off-by: Alexander Graf <agraf at suse.de>
> ---
>  common/board_r.c   |  5 +----
>  include/initcall.h | 35 ++++++++++++++++++++++++++++++++++-
>  lib/Makefile       |  1 -
>  lib/initcall.c     | 39 ---------------------------------------
>  4 files changed, 35 insertions(+), 45 deletions(-)
>  delete mode 100644 lib/initcall.c
>

Regards,
Simon


More information about the U-Boot mailing list