Inlined code

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Aug 9 16:50:30 UTC 2018


----- Am 6. Aug 2018 um 21:14 schrieb joel joel at rtems.org:
[...]
> We looked at a lot of generated assembly. Sometimes we would see
> large methods being inlined multiple times. This would increase the overall
> size of an RTEMS application. But size is not the only impact of inlining.
> If an inlined method has one or more if's in it, then the branch paths
> it includes are introduced EVERYWHERE it is inlined. When we
> had _Thread_Dispatch_enable, I recall it was used > 100 times and
> includes a branch in it. There was a build option to not inline this
> routine to avoid needing to add over 100 test cases.
[...]

I had a look at the _Thread_Dispatch_enable() code and was a bit surprised that GCC generates a stack frame in this function.  This turned out as a bug in the function. Do you find it? I will fix it tomorrow.

Before we start to turn inline functions into non-inline functions we should create a benchmark program (or more). We should look at the overall code size changes and the local code changes.


More information about the devel mailing list