[php-src] PR #18454: Adjust static inline functions which don't inline

From: Date: Tue, 29 Apr 2025 16:41:27 +0000
Subject: [php-src] PR #18454: Adjust static inline functions which don't inline
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-31562@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/18454 Author: morrisonlevi These are found by adding -Winline on gcc. The flag is accepted on clang for compatibility with gcc, but it doesn't do anything. Mostly, this removes inline from the declarations. For local static functions, there is no point in adding inline. This stems from either a misunderstanding of what it means, or alternatively is a holdover from ancient times where it may have meant something (note it still means something in a _header_ file, but not a source file). A compiler is free to inline a static function, and specifying inline doesn't make the compiler inline the function. It does however make it harder to due analysis of failed inlining, so I remove them. However, for select functions, this changes them zend_always_inline instead. This is because these functions didn't inline, but probably should for performance reasons. For instance, _class_exists_impl is used in multiple frameless function handlers. I think in these cases, the authors were _hoping_ they'd be inlined due to fact that are important for performance. There's also _php_search_array, which is used with constant args on a variety of functions. It fails to inline due its size, but if it _did_ inline, it would cut large amounts of code out, so forcing the inlining seemed worth it. There's also i_get_exception_base which was removed. Again, the compiler is free to inline zend_get_exception_base if it wants to, and static inline doesn't make the compiler inline it. This function often failed to inline in my -Winline report. Alternatively this could be made zend_always_inline, but since this is related to exceptions--which are supposed to be rare to begin with--it seemed more prudent to not force the compiler to inline it. ---- This work is split out from #15075, so that's why it might seem like déjà vu.

« previous php.git-pulls (#31562) next »