Patch for macros for tracking refcount and is_ref

php.internals

David

19 years ago
Hi, This is another shot at a patch to manage refcount and is_ref of zvals with macros. The macros are implemented with inline functions that are forcibly inlined (so they will behave the same as macros). This will make it possible to put multiple statements in each macro later on for garbage collection purposes. One thing to note is that I removed the existing ZVAL_ADDREF and ZVAL_DELREF in favor of Z_ADDREF_P and Z_DELREF_P that do the same thing. The original duo acted on zval pointers contrary to standard form for macro names. The patch is probably too large to fit as an attachment, so here's a URL: http://zoo.cs.yale.edu/~yw226/macros.diff.txt Comments?

Paweł Stradomski

19 years ago
W liście David Wang z dnia wtorek, 4 września 2007 16:24:
> http://zoo.cs.yale.edu/~yw226/macros.diff.txt > > Comments?
+#define always_inline inlinue Shouldn't that be +#define always_inline inline ? (in zend.h)
-- Paweł Stradomski

David

19 years ago
> Shouldn't that be > > +#define always_inline inline > > ?
Yes, sorry, I just fixed that a moment ago (and the file the link is pointing to should be correct).

Nuno Lopes

19 years ago
I think this is a pretty good idea. It can also have some use if we decide to investigate the usage of an off-the-shelf (conservative) garbage collector such as Boehm's (maybe in next year's SoC). About the patch, the zval_*_p() functions don't really need to exist.. they can be macros as well. (and the online keyword is also handled by the Zend engine) Nuno

David

19 years ago
> About the patch, the zval_*_p() functions don't really need to exist.. > they can be macros as well.
As I said, if those were macros, it would be very difficult to squeeze more than one statement into them. Consider the usage in Zend/zend_execute.c: if (!Z_DELREF_P(z)) { Z_SET_REFCOUNT_P(z, 1); Suppose I wanted to do the following in Z_DELREF_P(z): "some_function(z); z->refcount--;" Defining the macro as that would break that section of the code. Also, suppose I have code like this: if(some_condition) { Z_DELREF_P(z); Having multiple statements in Z_DELREF_P will also break that code. It seems to me inline functions are the best solution (the second best solution would be to put braces around the statements in the define, but then no return value would be possible).
> (and the online keyword is also handled by > the Zend engine)
Do you mean ZEND_VM_ALWAYS_INLINE? There is a ZEND_VM_ALWAYS_INLINE #define that does something similar to my "always_inline". However, it doesn't work for Microsoft compilers, and since it doesn't include the "inline" keyword within its definition, I'd have to change the meaning of it in order to fix that. As far as I can tell, it's not referenced by any code at all, but that still might be a bad idea.

Nuno Lopes

19 years ago
>> About the patch, the zval_*_p() functions don't really need to exist.. >> they can be macros as well. > > As I said, if those were macros, it would be very difficult to squeeze > more than one statement into them. > > Having multiple statements in Z_DELREF_P will also break that code. It > seems to me inline functions are the best solution (the second best > solution would be to put braces around the statements in the define, > but then no return value would be possible).
currently you only have one statement in each of those functions.. anyway it's not critical to have static inline functions.
>> (and the online keyword is also handled by >> the Zend engine) > > Do you mean ZEND_VM_ALWAYS_INLINE? There is a ZEND_VM_ALWAYS_INLINE > #define that does something similar to my "always_inline". However, it > doesn't work for Microsoft compilers, and since it doesn't include the > "inline" keyword within its definition, I'd have to change the meaning > of it in order to fix that. As far as I can tell, it's not referenced > by any code at all, but that still might be a bad idea.
nops. The Zend engine redefines the inline keyword itself somewhere. Nuno

David

19 years ago
> currently you only have one statement in each of those functions.. > anyway it's not critical to have static inline functions.
I will need to have them (multiple statements) for the cycle collection code, and I don't think there are many situations involving changing the way reference counting is done where only one statement is sufficient. In any case, it's good future-proofing.
> nops. The Zend engine redefines the inline keyword itself somewhere.
Hmm. I did not know that. Where? A quick grep doesn't seem to show anything significant. And I do know (experimentally) that a vast number of supposed "inline" functions aren't actually inlined currently because the compiler decides it doesn't want to do it. It gave me a lot of problems when I was trying to optimize my gc code.

David

19 years ago
On 9/4/07, Nuno Lopes <nlopess@php.net> wrote:
> It can also have some use if we > decide to investigate the usage of an off-the-shelf (conservative) > garbage collector such as Boehm's (maybe in next year's SoC). >
As an aside, I was also thinking about this throughout the course of the project. It's said that reference counting is the slowest form of garbage collection since the reference counts must constantly be maintained. Changing to a tracing garbage collector won't require these macros, because reference counts would be eliminated altogether. However, it would be sort of a big pain to implement Off the shelf garbage collectors such as BDW would be inappropriate because we use some weird kinds of "pointers" (such as object handles) stored in weird kinds of ways (such as a zend_hash object). I think it would be pretty inefficient, since those implementations just scan the stack, registers and heap and we're trying to do GC not for the PHP interpreter, but for the code the PHP interpreter is running. I have a certain suspicion that a traditional mark-and-sweep collector might be faster if just on the virtue of eliminating the refcount field and getting rid of tons of cache misses that way. For just displaying page, there wouldn't be much memory used and that's all freed at the end of a request anyway: all of that reference counting overhead would just disappear. For larger scripts that use a lot of memory, the only problem would be pause times but in most real life cases, it seems the total time would be shorter than reference counting. However, I'm not sure if that would be the case in PHP: rummaging through objects scattered all over memory would result in a lot of cache misses. The question is whether that is greater than all the misses we're currently having just managing the refcount. However, answering that question would require implementing the thing, and that honestly seems like it would be a bit of a nightmare. Roots would include zvals linked to PHP variables, the stack of the running PHP code, and the stack and heap of the PHP interpreter itself. It would've been far easier if PHP had been designed from the ground up to use some sane way of managing memory, but with the current situation, with extensions depending on reference counting, it's pretty difficult. If ever a version of this patch is committed, you'll be able to see that the cycle collector touches the whole reference counting mess extremely minimally, which is why it was relatively safe to implement.

Nuno Lopes

19 years ago
> Off the shelf garbage collectors such as BDW would be inappropriate > because we use some weird kinds of "pointers" (such as object handles) > stored in weird kinds of ways (such as a zend_hash object). I think it > would be pretty inefficient, since those implementations just scan the > stack, registers and heap and we're trying to do GC not for the PHP > interpreter, but for the code the PHP interpreter is running.
surely it wouldn't be the top performance GC, but I think it worths a try. And it doesn't seem difficult to use that GC (after your patch specially).
> For just > displaying page, there wouldn't be much memory used and that's all > freed at the end of a request anyway: all of that reference counting > overhead would just disappear. For larger scripts that use a lot of > memory, the only problem would be pause times but in most real life > cases, it seems the total time would be shorter than reference > counting. However, I'm not sure if that would be the case in PHP: > rummaging through objects scattered all over memory would result in a > lot of cache misses. The question is whether that is greater than all > the misses we're currently having just managing the refcount.
exactly. for most PHP requests the GC wouldn't even run. The garbage would be collected after the request, thus reducing the latency of the request (for Gopal pleasure :)
> However, answering that question would require implementing the thing, > and that honestly seems like it would be a bit of a nightmare. Roots > would include zvals linked to PHP variables, the stack of the running > PHP code, and the stack and heap of the PHP interpreter itself. It > would've been far easier if PHP had been designed from the ground up > to use some sane way of managing memory, but with the current > situation, with extensions depending on reference counting, it's > pretty difficult.
implementing a GC from scratch is a difficult job, yes and hence my idea to try an existenting GC. But if we look to the GCs used by e.g. the Common Lisp implementations, we see that they have highly-tuned and highly-performant GC implementations that take advantage of how the internal structures are implemented. And I suspect Java does that, too. Well, maybe we can find some crazy student next year to do it *hint* :). Or maybe I get crazy too one of these days ;) (well I still have to pick something to do for the master thesis..) Nuno

Andi Gutmans

19 years ago
See below:
> -----Original Message----- > From: Nuno Lopes [mailto:nlopess@php.net] > Sent: Tuesday, September 04, 2007 11:35 AM > To: David Wang > Cc: internals@lists.php.net; andi@php.net; dmitry@php.net > Subject: Re: Re: [PHP-DEV] Patch for macros for tracking refcount > andis_ref > > > Off the shelf garbage collectors such as BDW would be inappropriate > > because we use some weird kinds of "pointers" (such as object > handles) > > stored in weird kinds of ways (such as a zend_hash object). I think > it > > would be pretty inefficient, since those implementations just scan > the > > stack, registers and heap and we're trying to do GC not for the PHP > > interpreter, but for the code the PHP interpreter is running. > > surely it wouldn't be the top performance GC, but I think it worths a > try. And it doesn't seem difficult to use that GC (after your patch > specially).
Figuring out the roots is *very* hard with PHP because of all the extensions managing their own zvals. I don't think it's feasible nor will it be very beneficial.
> > For just > > displaying page, there wouldn't be much memory used and that's all > > freed at the end of a request anyway: all of that reference counting > > overhead would just disappear. For larger scripts that use a lot of > > memory, the only problem would be pause times but in most real life > > cases, it seems the total time would be shorter than reference > > counting. However, I'm not sure if that would be the case in PHP: > > rummaging through objects scattered all over memory would result in
a
> > lot of cache misses. The question is whether that is greater than
all
> > the misses we're currently having just managing the refcount. > > exactly. for most PHP requests the GC wouldn't even run. The garbage > would be collected after the request, thus reducing the latency of the > request (for Gopal pleasure :)
Probably not. Executing PHP scripts is very heap intensive and if you didn't run the GC during execution you would be eating up *lots* of memory even for relatively short requests. This would have a significant impact on the # of Apache processes you can run on a given box. So I think it actually wouldn't work well for us.
> > However, answering that question would require implementing the > thing, > > and that honestly seems like it would be a bit of a nightmare. Roots > > would include zvals linked to PHP variables, the stack of the
running
> > PHP code, and the stack and heap of the PHP interpreter itself. It > > would've been far easier if PHP had been designed from the ground up > > to use some sane way of managing memory, but with the current > > situation, with extensions depending on reference counting, it's > > pretty difficult. > > implementing a GC from scratch is a difficult job, yes and hence my > idea to try an existenting GC. But if we look to the GCs used by e.g. > the Common Lisp implementations, we see that they have highly-tuned > and highly-performant GC implementations that take advantage of how > the internal structures are implemented. And I suspect Java does that, > too. > > Well, maybe we can find some crazy student next year to do it *hint* > :). Or maybe I get crazy too one of these days ;) (well I still have > to pick something to do for the master thesis..)
Not that I think these kind of GCs are always a bad idea but they don't come without their own baggage and set of problems. Andi

Andi Gutmans

19 years ago
Yes I agree that a more traditional mark-and-sweep collector would not be suitable for PHP, and as many have experienced with Java it comes with its own set of baggage. Actually I think the deterministic nature of refcounting is more suitable to Web requests esp. for sites who want to consistently serve below a certain threshold (150ms and so). Python takes the same approach btw and also has a hybrid of reference counting and then detecting cycles. Btw, I also prefer using inline functions over pure macros as it's easier to debug. The patch looks OK but I'd like to wait another 1-2 days to give others who got back from the long weekend here to review and comment on it. Andi

Andi Gutmans

19 years ago
Btw, when can you make a PHP 5.2.x version of the patch available so that we can start playing around with it and test it?

Derick Rethans

19 years ago
On Tue, 4 Sep 2007, Andi Gutmans wrote:
> Btw, when can you make a PHP 5.2.x version of the patch available so > that we can start playing around with it and test it?
THis is the 5.2 version... it still needs to be ported to HEAD. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Andi Gutmans

19 years ago
> -----Original Message----- > From: Derick Rethans [mailto:derick@php.net] > Sent: Tuesday, September 04, 2007 11:57 AM > To: Andi Gutmans > Cc: David Wang; Nuno Lopes; internals@lists.php.net; andi@php.net; > dmitry@php.net > Subject: RE: [PHP-DEV] Patch for macros for tracking refcount and > is_ref > > On Tue, 4 Sep 2007, Andi Gutmans wrote: > > > Btw, when can you make a PHP 5.2.x version of the patch available so > > that we can start playing around with it and test it? > > THis is the 5.2 version... it still needs to be ported to HEAD.
Sorry I meant of the whole GC patch. This one is just the piece which adds macros. Or do you prefer to send that out once we finalize the macros patch so that it's a cleaner patch? Andi

Derick Rethans

19 years ago
On Tue, 4 Sep 2007, Andi Gutmans wrote:
> On Tuesday, September 04, 2007 11:57 AM, Derick Rethans wrote: > > > > On Tue, 4 Sep 2007, Andi Gutmans wrote: > > > > > Btw, when can you make a PHP 5.2.x version of the patch available so > > > that we can start playing around with it and test it? > > > > THis is the 5.2 version... it still needs to be ported to HEAD. > > Sorry I meant of the whole GC patch. This one is just the piece which > adds macros. Or do you prefer to send that out once we finalize the > macros patch so that it's a cleaner patch?
Yeah, that's the idea :) regards, Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Marcus Börger

19 years ago
Hello Andi, Tuesday, September 4, 2007, 9:46:22 PM, you wrote:
>> -----Original Message----- >> From: Derick Rethans [mailto:derick@php.net] >> Sent: Tuesday, September 04, 2007 11:57 AM >> To: Andi Gutmans >> Cc: David Wang; Nuno Lopes; internals@lists.php.net; andi@php.net; >> dmitry@php.net >> Subject: RE: [PHP-DEV] Patch for macros for tracking refcount and >> is_ref >> >> On Tue, 4 Sep 2007, Andi Gutmans wrote: >> >> > Btw, when can you make a PHP 5.2.x version of the patch available so >> > that we can start playing around with it and test it? >> >> THis is the 5.2 version... it still needs to be ported to HEAD.
> Sorry I meant of the whole GC patch. This one is just the piece which > adds macros. Or do you prefer to send that out once we finalize the macros patch so that it's a cleaner patch?
I think this is a good approach and cleaning those macros doesn't hurt. It might actually make our code base cleaner whether we are going the full way or not. Best regards, Marcus

Andi Gutmans

19 years ago
> -----Original Message----- > From: Marcus Boerger [mailto:helly@php.net] > Sent: Tuesday, September 04, 2007 2:12 PM > To: Andi Gutmans > Cc: Derick Rethans; David Wang; Nuno Lopes; internals@lists.php.net; > andi@php.net; dmitry@php.net > Subject: Re: [PHP-DEV] Patch for macros for tracking refcount and > is_ref > > Hello Andi, > > Tuesday, September 4, 2007, 9:46:22 PM, you wrote: > > I think this is a good approach and cleaning those macros doesn't
hurt.
> It > might actually make our code base cleaner whether we are going the
full
> way > or not.
Yes I agree. I just want to give another day chance for others to review it. Btw, we may also want to think of a way for maintenance mode to not build if the macros aren't being used... Andi

Marcus Börger

19 years ago
Hello David, Tuesday, September 4, 2007, 6:38:17 PM, you wrote:
> On 9/4/07, Nuno Lopes <nlopess@php.net> wrote: >> It can also have some use if we >> decide to investigate the usage of an off-the-shelf (conservative) >> garbage collector such as Boehm's (maybe in next year's SoC). >>
> As an aside, I was also thinking about this throughout the course of > the project. It's said that reference counting is the slowest form of > garbage collection since the reference counts must constantly be > maintained. Changing to a tracing garbage collector won't require > these macros, because reference counts would be eliminated altogether. > However, it would be sort of a big pain to implement
What is the problem with those objects? Basically there are at least three seperated memory areas involved. First the zend_object container, the real object and one or several zvals. The gc would simply have to decrease refcount on zend_objects if their zval gets down to zero and then leave zend_object gc'ing to the object storage.
> Off the shelf garbage collectors such as BDW would be inappropriate > because we use some weird kinds of "pointers" (such as object handles) > stored in weird kinds of ways (such as a zend_hash object). I think it > would be pretty inefficient, since those implementations just scan the > stack, registers and heap and we're trying to do GC not for the PHP > interpreter, but for the code the PHP interpreter is running.
> I have a certain suspicion that a traditional mark-and-sweep collector > might be faster if just on the virtue of eliminating the refcount > field and getting rid of tons of cache misses that way. For just > displaying page, there wouldn't be much memory used and that's all > freed at the end of a request anyway: all of that reference counting > overhead would just disappear. For larger scripts that use a lot of > memory, the only problem would be pause times but in most real life > cases, it seems the total time would be shorter than reference > counting. However, I'm not sure if that would be the case in PHP: > rummaging through objects scattered all over memory would result in a > lot of cache misses. The question is whether that is greater than all > the misses we're currently having just managing the refcount.
> However, answering that question would require implementing the thing, > and that honestly seems like it would be a bit of a nightmare. Roots > would include zvals linked to PHP variables, the stack of the running > PHP code, and the stack and heap of the PHP interpreter itself. It > would've been far easier if PHP had been designed from the ground up > to use some sane way of managing memory, but with the current > situation, with extensions depending on reference counting, it's > pretty difficult.
> If ever a version of this patch is committed, you'll be able to see > that the cycle collector touches the whole reference counting mess > extremely minimally, which is why it was relatively safe to implement.
Question for development, how do we ensure that starting from a specific point in time we enforce usage of those macros? The one thing that comes into my mind is that we could have the members [is_ref,refcount] prefixed with something different when running in debug mode, or insert some random prefix there....(?) Best regards, Marcus

Derick Rethans

19 years ago
On Tue, 4 Sep 2007, Marcus Boerger wrote:
> Tuesday, September 4, 2007, 6:38:17 PM, you wrote: > > > If ever a version of this patch is committed, you'll be able to see > > that the cycle collector touches the whole reference counting mess > > extremely minimally, which is why it was relatively safe to implement. > > Question for development, how do we ensure that starting from a specific > point in time we enforce usage of those macros? The one thing that comes > into my mind is that we could have the members [is_ref,refcount] prefixed > with something different when running in debug mode, or insert some random > prefix there....(?)
Yeah, that's what a previous patch did - I assume something like this is part of the patch that comes after this macrofication patch. regards, Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

David

19 years ago
On 9/5/07, Marcus Boerger <helly@php.net> wrote:
> What is the problem with those objects? Basically there are at least three > seperated memory areas involved. First the zend_object container, the real > object and one or several zvals. The gc would simply have to decrease > refcount on zend_objects if their zval gets down to zero and then leave > zend_object gc'ing to the object storage.
Hmm, maybe we have a misunderstanding here because I don't quite understand what you mean. :) In that paragraph, I was saying how implementing a traditional tracing garbage collector would mean refcounts are no longer necessary. These macros track refcounts, so they would also be no longer necessary.
> Question for development, how do we ensure that starting from a specific > point in time we enforce usage of those macros? The one thing that comes > into my mind is that we could have the members [is_ref,refcount] prefixed > with something different when running in debug mode, or insert some random > prefix there....(?)
In my own code, I have a "__gc" on refcount and is_ref so I get thrown an error if there's a place I failed to macroize. I removed that for this patch, but that's a very good point. If there are no objections, that or another prefix or suffix can be put back into the patch. David

David

19 years ago
> In my own code, I have a "__gc" on refcount and is_ref so I get thrown > an error if there's a place I failed to macroize. I removed that for > this patch, but that's a very good point. If there are no objections, > that or another prefix or suffix can be put back into the patch.
I've posted another version of the patch with the __gc suffix at http://zoo.cs.yale.edu/~yw226/macros2.diff.txt The GC patch is also ready. As soon as the macros patch has been finalized and committed, I will send that out to the mailing list. David

Andi Gutmans

19 years ago
Hi David, In general the patch is fine. The only thing which I'd like to change is to make sure the __gc naming is in an #if ZEND_GC for now otherwise we'll be breaking lots of third party libraries and PECL extensions. Andi
> -----Original Message----- > From: David Wang [mailto:planetbeing@gmail.com] > Sent: Wednesday, September 05, 2007 10:47 PM > To: Marcus Boerger > Cc: Nuno Lopes; internals@lists.php.net; andi@php.net; dmitry@php.net > Subject: Re: [PHP-DEV] Patch for macros for tracking refcount and > is_ref > > > In my own code, I have a "__gc" on refcount and is_ref so I get > thrown > > an error if there's a place I failed to macroize. I removed that for > > this patch, but that's a very good point. If there are no
objections,

David

19 years ago
On 9/7/07, Andi Gutmans <andi@zend.com> wrote:
> The only thing which I'd like to change is to make sure the __gc naming > is in an #if ZEND_GC for now otherwise we'll be breaking lots of third > party libraries and PECL extensions.
Here's an updated version: http://zoo.cs.yale.edu/~yw226/macros.diff.txt David

Derick Rethans

19 years ago
On Thu, 6 Sep 2007, Andi Gutmans wrote:
> In general the patch is fine. > The only thing which I'd like to change is to make sure the __gc naming > is in an #if ZEND_GC for now otherwise we'll be breaking lots of third > party libraries and PECL extensions.
But you might want to wonder if that's not a good thing? Without the prefix there will be no indication for third party extensions that they might be doing something that's not going to work nicely with the new GC anymore. I'd prefer it to have the __gc always there. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Cristian Rodriguez

19 years ago
On 9/7/07, Derick Rethans <derick@php.net> wrote:
> But you might want to wonder if that's not a good thing? Without the > prefix there will be no indication for third party extensions that they > might be doing something that's not going to work nicely with the new GC > anymore. I'd prefer it to have the __gc always there.
And extensions will break anyway with or without the #if ZEND_GC ps: remember to change the Zend/PHP API number as well ;)
-- http://www.kissofjudas.net/

David

18 years ago
> ps: remember to change the Zend/PHP API number as well ;)
Done. I personally think having a ZEND_GC switch sort of defeats the purpose of forcing everyone to start using the macros (whether or not we want the GC), which is something we want to do anyway. However, here are the two versions of the patch, for everyone's consideration: With ZEND_GC: http://zoo.cs.yale.edu/~yw226/macros.diff.txt Without: http://zoo.cs.yale.edu/~yw226/macros2.diff.txt David

Andi Gutmans

18 years ago
Not source compatibility.

Andi Gutmans

18 years ago
> -----Original Message----- > From: Derick Rethans [mailto:derick@php.net] > Sent: Friday, September 07, 2007 12:09 AM > To: Andi Gutmans > Cc: David Wang; Marcus Boerger; Nuno Lopes; internals@lists.php.net; > andi@php.net; dmitry@php.net > Subject: RE: [PHP-DEV] Patch for macros for tracking refcount and > is_ref > > On Thu, 6 Sep 2007, Andi Gutmans wrote: > > > In general the patch is fine. > > The only thing which I'd like to change is to make sure the __gc > naming > > is in an #if ZEND_GC for now otherwise we'll be breaking lots of > third > > party libraries and PECL extensions. > > But you might want to wonder if that's not a good thing? Without the > prefix there will be no indication for third party extensions that they > might be doing something that's not going to work nicely with the new > GC > anymore. I'd prefer it to have the __gc always there.
GC will probably not always be enabled; at least not to begin with (in fact many apps won't even need it). Let's not run before we walk. There's still testing and review and some stabilizing period we should be doing (as we discussed previously). For now, we shouldn't with PHP 5.3 just break any extension (source compatibility) out there. If GC is not being used it should compile and work just fine. Andi

Cristian Rodriguez

18 years ago
On 9/7/07, Andi Gutmans <andi@zend.com> wrote:
>Let's not run before we walk.
The GC already "walks."
>There's still testing and review and some stabilizing period we
should be doing if it is disabled by default it is unlikely that people will test it with real life code even more with in you place a #if ZEND_GC around the functionality...
-- http://www.kissofjudas.net/

Marcus Börger

18 years ago
Hello David, Wednesday, September 5, 2007, 4:19:05 AM, you wrote:
> On 9/5/07, Marcus Boerger <helly@php.net> wrote: >> What is the problem with those objects? Basically there are at least three >> seperated memory areas involved. First the zend_object container, the real >> object and one or several zvals. The gc would simply have to decrease >> refcount on zend_objects if their zval gets down to zero and then leave >> zend_object gc'ing to the object storage.
> Hmm, maybe we have a misunderstanding here because I don't quite > understand what you mean. :) In that paragraph, I was saying how > implementing a traditional tracing garbage collector would mean > refcounts are no longer necessary. These macros track refcounts, so > they would also be no longer necessary.
All true, yet at soume point your gc will free a zval - and a zval only - unless you also use the gc'ing for every object storage in use. Either way zvals and their objects are seperate things and multiple *different* zvals can point to the same object in an object storage.
>> Question for development, how do we ensure that starting from a specific >> point in time we enforce usage of those macros? The one thing that comes >> into my mind is that we could have the members [is_ref,refcount] prefixed >> with something different when running in debug mode, or insert some random >> prefix there....(?)
> In my own code, I have a "__gc" on refcount and is_ref so I get thrown > an error if there's a place I failed to macroize. I removed that for > this patch, but that's a very good point. If there are no objections, > that or another prefix or suffix can be put back into the patch.
> David
Best regards, Marcus

Xuefer Tinys

18 years ago
why not keep ZVAL_ADDREF ZVAL_DELREF for 3rd party source level compatibility reason and deprecate it? e.g.: pecl/event/event.c: 790 ZVAL_ADDREF(ev->php_cb_arg); On Sep 4, 2007 10:24 PM, David Wang <planetbeing@gmail.com> wrote: