Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32037 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45299 invoked by uid 1010); 4 Sep 2007 15:36:07 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 45276 invoked from network); 4 Sep 2007 15:36:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Sep 2007 15:36:07 -0000 Authentication-Results: pb1.pair.com header.from=planetbeing@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=planetbeing@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.182.184 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: planetbeing@gmail.com X-Host-Fingerprint: 64.233.182.184 nf-out-0910.google.com Received: from [64.233.182.184] ([64.233.182.184:19234] helo=nf-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 14/B9-21414-36B7DD64 for ; Tue, 04 Sep 2007 11:36:06 -0400 Received: by nf-out-0910.google.com with SMTP id b21so1525538nfd for ; Tue, 04 Sep 2007 08:35:59 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CraJ6X11v2HFTorYw8medzu6PFjGFqUbxXWEdGP4ApbYGthALzmSzc+MoPkF6Ahya09pC10MSCc2j6NUKYtMR2rrkM8bmB7WrYPqN8XwVfdWFNCLVyg4RYZZv8gO+Sm5WMTl6bxjH7ZOs/K0zjEIu1m3uZNIb0r3sqQelQZr+ls= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=eBRwbx8noFaBQcj/75JFMYKWKTWIqYUtCqahKYsPb1Wh6wQ4EqEkwf52u/qTu+MhPki8fhI/N5bzEDwkcAnguovOhTP+ZrIOd9da6frSf/wlmTlxC5tJ0qN7r9dhzwrkIVA4mjYYE7d2zWbrZ95JoCwrhVdoO+x+vF8u63tTSLQ= Received: by 10.78.200.3 with SMTP id x3mr4252107huf.1188920158857; Tue, 04 Sep 2007 08:35:58 -0700 (PDT) Received: by 10.78.135.16 with HTTP; Tue, 4 Sep 2007 08:35:58 -0700 (PDT) Message-ID: Date: Tue, 4 Sep 2007 23:35:58 +0800 To: "Nuno Lopes" Cc: internals@lists.php.net, andi@php.net, dmitry@php.net In-Reply-To: <20070904162613.4qgfdddo7scw8o8w@w13.mail.sapo.pt> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070904162613.4qgfdddo7scw8o8w@w13.mail.sapo.pt> Subject: Re: [PHP-DEV] Patch for macros for tracking refcount and is_ref From: planetbeing@gmail.com ("David Wang") > 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.