Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34861 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75946 invoked by uid 1010); 21 Jan 2008 23:10:52 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 75930 invoked from network); 21 Jan 2008 23:10:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jan 2008 23:10:52 -0000 Authentication-Results: pb1.pair.com header.from=nlopess@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=nlopess@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.55.154.23 as permitted sender) X-PHP-List-Original-Sender: nlopess@php.net X-Host-Fingerprint: 212.55.154.23 relay3.ptmail.sapo.pt Linux 2.4/2.6 Received: from [212.55.154.23] ([212.55.154.23:39917] helo=sapo.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 03/F1-64254-A7625974 for ; Mon, 21 Jan 2008 18:10:52 -0500 Received: (qmail 10437 invoked from network); 21 Jan 2008 23:10:47 -0000 Received: from unknown (HELO sapo.pt) (10.134.35.207) by relay3 with SMTP; 21 Jan 2008 23:10:47 -0000 Received: (qmail 1202 invoked from network); 21 Jan 2008 23:10:48 -0000 X-AntiVirus: PTMail-AV 0.3-0.92.0 X-Virus-Status: Clean (0.00735 seconds) Received: from unknown (HELO pc07654) (nunoplopes@sapo.pt@[85.240.49.66]) (envelope-sender ) by mta12 (qmail-ldap-1.03) with SMTP for ; 21 Jan 2008 23:10:48 -0000 Message-ID: <247E16805B904E159ACE8E1EC4CF1D5F@pc07654> To: "Dmitry Stogov" , "PHP Internals List" References: <4794F6DA.8010400@zend.com> In-Reply-To: <4794F6DA.8010400@zend.com> Date: Mon, 21 Jan 2008 23:10:43 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Windows Mail 6.0.6000.16480 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16545 Subject: Re: [PHP-DEV] Segmented argument_stack From: nlopess@php.net ("Nuno Lopes") Hi Dmitry, The patch looks fine. Although it wastes a bit more memory than the current implementation, I think it's ok. It also has some memory fragmentation, which shouldn't be an issue (we don't have functions with 100 arguments :P). As a side note, I think the following code could be optimized: + while (zend_vm_stack_top(TSRMLS_C) != stack_frame) { + zval *stack_zval_p = zend_vm_stack_pop(TSRMLS_C); + zval_ptr_dtor(&stack_zval_p); } I think you can simply discard the last n ptrs on the stack. A zend_vm_stack_pop(num_elements) would do the trick (or a zend_vm_stack_pop_until(stack_frame)). That way the function call cleanup would be a little faster. Thanks, Nuno ----- Original Message ----- From: "Dmitry Stogov" To: "PHP Internals List" Sent: Monday, January 21, 2008 7:47 PM Subject: [PHP-DEV] Segmented argument_stack > Hi, > > The attached patch (for PHP_5_3) implements the segmented argument_stack > that has the following advantages: > > 1) It fixes #43426 and other crashes which occur because of stack > reallocation. > > 2) The whole stack is never reallocated. So we don't have penalties > because of the while stack copying (it may be 1MB and more). > > 3) CPU stack usage reduced, because execute_data, Ts and CVs now are > stored in the same argument_stack. As result the probability of CPU > stack overflow is reduced. > > 4) func_num_args(), func_get_agr(), func_get_args(), > debug_print_backtrace() and exception's backtrace now always able to get > arguments. They didn't work before in case of incomplete "arguments > frame". For example: "foo(1, func_num_args());". > > 5) bench.php got about 1% speedup > > I'm going to commit the patch into HEAD and PHP_5_3 on Thursday. > Any objections? > > Thanks. Dmitry.