Hi Dmitry,
----- Original Message -----
From: "Dmitry Stogov"
Sent: Monday, November 16, 2015
Hi Matt,
On Mon, Nov 16, 2015 at 1:30 AM, Matt Wilmas <php_li...@realplain.com>
wrote:
Hi Dmitry, Anatol, Pierre (etc.), and all,
I'm back now, I think, after a much longer (unintentional) break than I
expected. Be coming very soon with what I was doing in the summer (param
parsing stuff) -- *now* it works with MSVC too, barring any fragility, as
I
accidentally discovered last month...
I've been "discovering" a lot with the wacky Visual Studio compiler! :-)
This message is about the 2 I found today.
The first simple thing was probably just overlooked, but noticed it while
looking up __declspec. zend_never_inline has always been empty (I guess)
for MSVC, but there's actually a __declspec(noinline) that can be used
(and
works as expected). A simple and obvious change to bring it in line with
the other compilers?
Please, provide a patch for zend_portability.h
Really? :-) And that's easier than just adding
__declspec(noinline)
to line 287?
I can add it myself soon, if it's acceptable. And yes, I verified that it
does have an effect, and prevents current inlining, as you intended. (12 KB
smaller binary.)
The second "issue" is with the zend_always_inline functions, I noticed
this summer. Did anyone else know that MSVC leaves a *copy* of those
functions in the output files (DLLs)? What's the point of that? When
they've been inlined, and not referenced otherwise, there should be no
reason to emit code for a standalone function!
I remembered after seeing that behavior that a bit of my own
__forceinline'd code did NOT have extra function code, but forgot to
investigate until today. What's different about my function definition?
No "static" specifier! So that's the key. :-)
But... non-static would create duplicate symbols, I thought. But no, it
works! With just __forceinline, there's no errors. :^)
Can something be done about this? It would cut the binary size down a
bit. A zend_static macro to be used with zend_always_inline...?
zend_always inline should be always used with static keyword.
Right, that would be the standard thinking, but it makes MSVC not remove the
unreferenced standalone function like GCC/Clang... Adds almost 100 KB to
php7.dll.
But nevermind... Thanks to Anatol, it seems another compiler flag WILL
actually strip those functions, and then some! :-)
Thanks. Dmitry.
- Matt
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php