Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76693 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68173 invoked from network); 19 Aug 2014 09:30:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Aug 2014 09:30:32 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.171 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.217.171 mail-lb0-f171.google.com Received: from [209.85.217.171] ([209.85.217.171:33446] helo=mail-lb0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C3/B2-55441-43913F35 for ; Tue, 19 Aug 2014 05:30:29 -0400 Received: by mail-lb0-f171.google.com with SMTP id l4so5277854lbv.30 for ; Tue, 19 Aug 2014 02:30:25 -0700 (PDT) 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:content-transfer-encoding; bh=P5BUZcNr7pkpnW526osSeq/JZqnPMTPoEfSyQCnfXbo=; b=07HvIHl5Ty60ntKjeaSnLGFLuxHBlaaifS4cd4yVRJFsPCThThs1B2XqsmUEtC9Rld PLIpFFmG+i9VFFvpV2OWRfIr6fAfXQ9FQ6f1KnttFVhcij3ImKdY9h/NDXJZOuBRcGZ3 h7K6IBjdXSo6wmnoeTGG0YGi5vw+5lUSDQyj+kY/rPc5/eampZWfKI/QM/0Y2OjN8di8 8fQNOZQ//9841cOU7+MJuyBfboDJvuhLWchJKjTSXUZ9r5O2M2nDsCmd4XRhNBAWJwJI AG0QAykQstHehXtdmzeKLrGoXoipXswaxvJWWsz0lFmVLdN64Ugv6HnwrEMIOcmzRqBh OTjw== X-Received: by 10.152.179.168 with SMTP id dh8mr35179316lac.0.1408440624851; Tue, 19 Aug 2014 02:30:24 -0700 (PDT) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.114.187.72 with HTTP; Tue, 19 Aug 2014 02:30:04 -0700 (PDT) In-Reply-To: References: Date: Tue, 19 Aug 2014 17:30:04 +0800 X-Google-Sender-Auth: U0S3UxBhW9fJzqrr6KfeS8VAd-U Message-ID: To: Dmitry Stogov Cc: Andi Gutmans , Nikita Popov , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [VOTE] Abstract Syntax Tree From: laruence@php.net (Laruence) Hey: a fix could be: diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index eb35a51..f738e34 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -33,11 +33,11 @@ static inline void *zend_ast_realloc(void *old, size_t old_size, size_t new_size return new; } -size_t zend_ast_size(zend_uint children) { +size_t zend_ast_size(int children) { return sizeof(zend_ast) + sizeof(zend_ast *) * (children - 1); } -size_t zend_ast_list_size(zend_uint children) { +size_t zend_ast_list_size(int children) { return sizeof(zend_ast_list) + sizeof(zend_ast *) * (children - 1); } my compiler must take (children -1) as a unsigned thanks On Tue, Aug 19, 2014 at 5:21 PM, Laruence wrote: > Hey: > > the problem came from zend_ast_size for 0 children node.. > > backtrace: > > Program terminated with signal 6, Aborted. > #0 0x00000034dc030285 in raise () from /lib64/libc.so.6 > (gdb) bt > #0 0x00000034dc030285 in raise () from /lib64/libc.so.6 > #1 0x00000034dc031d30 in abort () from /lib64/libc.so.6 > #2 0x00000000009d271c in _zend_mm_alloc_int (heap=3D0x82fff40, size=3D34= 359738400, > __zend_filename=3D0xfc5c78 > "/home/huixinchen/opensource/github/php-src/Zend/zend_arena.h", > __zend_lineno=3D69, > __zend_orig_filename=3D0x0, __zend_orig_lineno=3D0) > at /home/huixinchen/opensource/github/php-src/Zend/zend_alloc.c:2003 > #3 0x00000000009d4354 in _emalloc (size=3D34359738400, > __zend_filename=3D0xfc5c78 > "/home/huixinchen/opensource/github/php-src/Zend/zend_arena.h", > __zend_lineno=3D69, > __zend_orig_filename=3D0x0, __zend_orig_lineno=3D0) > at /home/huixinchen/opensource/github/php-src/Zend/zend_alloc.c:2442 > #4 0x0000000000a42c05 in zend_arena_alloc (arena_ptr=3D0x135e698, > size=3D34359738376) > at /home/huixinchen/opensource/github/php-src/Zend/zend_arena.h:69 > #5 0x0000000000a42b0e in zend_ast_alloc (size=3D34359738376) > at /home/huixinchen/opensource/github/php-src/Zend/zend_ast.c:27 > #6 0x0000000000a42dcb in zend_ast_create_from_va_list (kind=3D1, > attr=3D7, va=3D0x7fff2be64550) > at /home/huixinchen/opensource/github/php-src/Zend/zend_ast.c:89 > #7 0x0000000000a4303e in zend_ast_create_ex (kind=3D1, attr=3D7) > at /home/huixinchen/opensource/github/php-src/Zend/zend_ast.c:116 > #8 0x00000000009aa0a3 in zendparse () at > /home/huixinchen/opensource/github/php-src/Zend/zend_language_parser.y:55= 1 > #9 0x00000000009aed81 in compile_file (file_handle=3D0x7fff2be68850, > type=3D8) at Zend/zend_language_scanner.l:586 > #10 0x0000000000784de6 in phar_compile_file (file_handle=3D0x7fff2be68850= , type=3D8) > at /home/huixinchen/opensource/github/php-src/ext/phar/phar.c:3358 > #11 0x0000000000a0bab2 in zend_execute_scripts (type=3D8, retval=3D0x0, > file_count=3D3) > at /home/huixinchen/opensource/github/php-src/Zend/zend.c:1301 > #12 0x000000000097529b in php_execute_script (primary_file=3D0x7fff2be688= 50) > at /home/huixinchen/opensource/github/php-src/main/main.c:2564 > #13 0x0000000000ac44b1 in do_cli (argc=3D31, argv=3D0x82ff680) > at /home/huixinchen/opensource/github/php-src/sapi/cli/php_cli.c:980 > #14 0x0000000000ac55de in main (argc=3D31, argv=3D0x82ff680) > at /home/huixinchen/opensource/github/php-src/sapi/cli/php_cli.c:1358 > (gdb) f 6 > #6 0x0000000000a42dcb in zend_ast_create_from_va_list (kind=3D1, > attr=3D7, va=3D0x7fff2be64550) > at /home/huixinchen/opensource/github/php-src/Zend/zend_ast.c:89 > 89 zend_ast *ast =3D zend_ast_alloc(zend_ast_size(children) TSRMLS_CC); > (gdb) p children > $1 =3D 0 > > thanks > > On Tue, Aug 19, 2014 at 5:12 PM, Laruence wrote: >> Hey: >> >> I find a problem while I was trying play with the patch >> >> Generating phar.php >> Generating phar.phar >> >> Fatal error: Out of memory (allocated 786432) at >> /home/huixinchen/opensource/github/php-src/Zend/zend_arena.h:69 (tried >> to allocate 34359738400 bytes) in >> /home/huixinchen/opensource/github/php-src/ext/phar/phar.php on line >> 163 >> make: *** [ext/phar/phar.phar] Error 255 >> make: *** Waiting for unfinished jobs.... >> >> is this a knew issue? >> >> thanks >> >> On Tue, Aug 19, 2014 at 2:36 PM, Dmitry Stogov wrote: >>> Hi Andi, >>> >>> We already discussed most of semantic changes introduced in AST patch. >>> Most of them came from another approved RFC >>> https://wiki.php.net/rfc/uniform_variable_syntax >>> >>> Thanks. Dmitry. >>> >>> >>> On Tue, Aug 19, 2014 at 6:32 AM, Andi Gutmans wrote: >>> >>>> Hi Nikita, >>>> >>>> I reviewed the AST RFC on my way to vote but there was something that >>>> wasn=E2=80=99t clear to me. >>>> This patch introduces some semantic/behavioral changes in addition to = the >>>> AST. >>>> Are these as a side-effect of how AST was implemented? Or are they >>>> unrelated to the AST patch? >>>> I think some of them make sense but I=E2=80=99m having a bit of a hard= time >>>> separating out the benefits of the AST (which I really like) and makin= g >>>> other changes to semantics w/o really understanding if they are >>>> side-effects and we have no choice vs. we=E2=80=99re trying to solve f= or two >>>> separate items in one RFC. >>>> Any BC breaks here we think could bite us? >>>> >>>> Any insight would be much appreciated. >>>> Thanks! >>>> Andi >>>> >>>> On Aug 18, 2014, at 9:41 AM, Nikita Popov wrote= : >>>> >>>> > Hi internals! >>>> > >>>> > I've opened the vote on the Abstract Syntax Tree RFC: >>>> > >>>> > https://wiki.php.net/rfc/abstract_syntax_tree#vote >>>> > >>>> > Thanks, >>>> > Nikita >>>> >>>> >>>> -- >>>> PHP Internals - PHP Runtime Development Mailing List >>>> To unsubscribe, visit: http://www.php.net/unsub.php >>>> >>>> >> >> >> >> -- >> Laruence Xinchen Hui >> http://www.laruence.com/ > > > > -- > Laruence Xinchen Hui > http://www.laruence.com/ --=20 Laruence Xinchen Hui http://www.laruence.com/