>
>> (2) If the number of occurrences is large, then rename the function
>> (prefix with _) and add a macro that passes TSRMLS_C
>> e.g.
>> -ZEND_API void zend_hash_destroy(HashTable *ht);
>> +ZEND_API void _zend_hash_destroy(HashTable *ht TSRMLS_DC);
>> +#define zend_hash_destroy(ht) _zend_hash_destroy((ht) TSRMLS_CC)
>

With the exception of the APIs mentioned below, I've undone this
change and instead done a global search/replace of all the functions
that needed to pass TSRMLS_C as a parameter.

The only cases that I couldn't quite do this for are:
  convert_to_long
  convert_to_double
  convert_to_null
  convert_to_boolean
  convert_to_object
  convert_to_array
in zend_operators.h

The problem is that currently convert_to_string is already a macro
that calls _convert_to_string passing 2 parameters whereas the above
are functions that take only 1 parameter. conv_object_to_type expects
all these APIs to have the same signature.


>> (4) For single argument functions that have varags, pass TSRMLS_C as
>> the first parameter
>> e.g.
>> -ZEND_API int zend_get_parameters_ex(int param_count, ...) /* {{{ */
>> +ZEND_API int zend_get_parameters_ex(TSRMLS_DC1 int param_count, ...) /* {{{ 
>> */
>>
>> where
>> +#define TSRMLS_DC1   TSRMLS_D,
>> +#define TSRMLS_CC1   TSRMLS_C,
>
> Are there more cases of this? - If zend_get_parameters is the only case
> I'd keep the TSRMLS_FETCH in it. zend_get_parameters is deprecated and
> shouldn't be used anymore. But adding a new macro makes it harder for
> new people to get started with the code.

I've backed out this change as well and instead used TSRMLS_FETCH() in
those APIs that used TSRMLS_DC1/TSRMLS_CC1 (in my previous diff). I'll
revisit those if they show up as performance hotspots.

http://bitbucket.org/arvi/arviq/src/37f1d6b045b0/svn-TSRM-patch.txt
contains the updated diff against trunk.

I've compiled and run 'make test' on this after configuring it with
the default module set and with/without --enable-maintainer-zts.

Thanks,
Arvi

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to