Hi Pierre,
----- Original Message -----
From: "Pierre Joye"
Sent: Thursday, August 06, 2015
On Aug 6, 2015 1:49 PM, "Matt Wilmas" <php_li...@realplain.com> wrote:
Hi Levi,
----- Original Message -----
From: "Levi Morrison"
Sent: Thursday, August 06, 2015
Don't know about Windows now... Visual Studio 2008 and 2012 (not much
difference) are NOT optimizing away the code (other times it was GCC
with
issues). :-/ Not sure why. Of course they don't support the necessary
compound literals anyway, but I was just testing a manual case... I'll
have
to try and check 2015 version soon.
VS 2015 supports compound literals, I believe.
Yes, VS 2013 added, AFAIK. But I was just talking about optimizing the
code that would use them. A compound literal (void *[]), derived from
variadic macro, is needed to transform zend_parse_parameters() into a
non-varargs inline function call (since va_arg usage prevents inlining).
The problem in the earlier VS versions, which I simulated manually
without compound literals, is that it doesn't want to optimize away all
the
inlined stuff, leaving only the result. Definitely can't have something
creating several KB of extra instructions! :-)
So unless they improved something in the newest versions, this wouldn't
be able to be used there, unless I can work around it somehow. I don't
know if macros, instead of inline functions, inside the main inline
function would help or not...
Although, it *would* simplify a couple tiny parts if didn't need to
support MSVC... First, detecting a string *literal* (99% of usage): could
just use __builtin_constant_p() instead of a macro trick.
And second, using a variable length array, with size set by, well, a
variable, which I think VS still doesn't support from C99, right? (It's
for a "variable" in this case, but always the same, so should optimize
like
a compile-time size.)
If you have a piece of self contained code to test it, we can then add it
to the VC test repo to valid what we can support with 7+.
Sure! Simply:
size_t num = 4;
char foo[num];
I wondered about emulating with _alloca(), but a quick check (in 2008!)
shows that it doesn't optimize it out even with a true constant value...
- Matt
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php