Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79423 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50402 invoked from network); 4 Dec 2014 12:18:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Dec 2014 12:18:19 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.171 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.216.171 mail-qc0-f171.google.com Received: from [209.85.216.171] ([209.85.216.171:33355] helo=mail-qc0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 09/F2-34106-A0150845 for ; Thu, 04 Dec 2014 07:18:18 -0500 Received: by mail-qc0-f171.google.com with SMTP id r5so12594587qcx.16 for ; Thu, 04 Dec 2014 04:18:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=sDe+BudR2NCyH8z38SolhVIClbUU5lxl2e1aKwTa0UQ=; b=rXDcRjUi+368hrPYkqnDbgkv/XbsEtSlx1aQH+s/LNkS+RqYUkxRf7oYETbtwpSYKj NquAU3Dy0kya4uo/ljiB6F4a9Av60W+dH5VuKqt6aHnGvLNn5WuEjqk8DjlStwOlqYaD nVCbnpMbecK5SZWpe2xksIxNlkzz8NthQr+h2sTMJ6ZoQ7slvbwhZckjLiLWww6oS1+r XkxEM9bPiwSPg38bSaZAy1nRMrRrLvld6jDiR76EODG9p8nRKJk4J69+cj6SuDc9bwqZ nrl1O9fgPmTLaFjKW+z8c2vfC+f3f7y7BomJdkAyOdsMrSwse+ykNPeZ+7bohPibHBRy 0uFA== X-Received: by 10.224.14.133 with SMTP id g5mr16425941qaa.81.1417695495848; Thu, 04 Dec 2014 04:18:15 -0800 (PST) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.140.20.86 with HTTP; Thu, 4 Dec 2014 04:17:35 -0800 (PST) In-Reply-To: References: Date: Thu, 4 Dec 2014 13:17:35 +0100 X-Google-Sender-Auth: 9BBPDvfJ_uufkGXHVkCoNlTTVrg Message-ID: To: Ferenc Kovacs Cc: Benjamin Eberlei , PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Turn gc_collect_cycles into a function pointer From: jpauli@php.net (Julien Pauli) On Thu, Dec 4, 2014 at 12:39 PM, Ferenc Kovacs wrote: > > > On Thu, Dec 4, 2014 at 11:53 AM, Julien Pauli wrote: >> >> On Thu, Dec 4, 2014 at 9:30 AM, Benjamin Eberlei >> wrote: >> > Good morning, >> > >> > This is just a very small change, I propose this RFC for discussion to >> > turn >> > the C function "gc_collect_cycles" into a pointer. >> > >> > https://wiki.php.net/rfc/gc_fn_pointer >> > >> > Composer's garbage collection optimization showed that PHP Profilers >> > fail >> > to capture the dynamics of GC and we need better hooks to make this >> > possible. >> >> There are many other things that could be turned into function >> pointers to allow extensions to hook. >> Our hook strategy should be reviewed entirely. >> >> Not only GC. If you look at streams, many of them are not >> overwritable, and some are, but they are missing from the headers file >> so you may not overwrite them. >> >> I suggest we design a wider RFC for PHP7 about what we would be able >> to hook, and what not (and what is the impact, because the more you >> hook , the more complex it becomes about bad interactions). >> >> This may also include a refactoring in the zend_module_entry and the >> zend_extension structs. Fe, zend_extension hooks about the op_array >> could be reworked , I find the op_array_dtor_handler hook misplaced in >> the chain. >> zend_module_entry could also benefit from refactoring to have a better >> knowing of other extensions, and a true dependency manager. >> > > That sounds like a lot of work. > +1 if somebody willing to champion that effort, but I wouldn't delay/discard > this small improvement on the vague promise that maybe this will be solved > as part of a bigger rfc. > just my 2 cents ofc. Yep, but the problem in adding a new hook is that today its for feature A, tomorrow it will be for feature B, etc... There is a risk of lack of consistency between all the ideas, that's why I myself did not propose any single idea in this way, but prefer merging them and propose something more consistent. We could benefit from a new major release to have a more global hooking strategy. Also, as this changes the ABI by publishing a new ZEND_API, we should consider adding this in a major and not in a stable release (even thought that doesnt break the ABI). I agree some ideas may represent more work than others (like a dependency management system for extensions), however, big part of the ideas is just about "what hook to move", "where to", "why" and "what hook to add" (and why). Also, having too many hooks can lead to many problems like extensions incompatibility, something barely taken care of in our module API, but which should as well be redesigned as it doesn't really work that much. Julien.P