Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20283 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1178 invoked by uid 1010); 24 Nov 2005 05:00:30 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 1162 invoked from network); 24 Nov 2005 05:00:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Nov 2005 05:00:30 -0000 X-Host-Fingerprint: 69.12.155.130 69-12-155-130.dsl.static.sonic.net Linux 2.4/2.6 Received: from ([69.12.155.130:4070] helo=pigeon.alphaweb.net) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 9A/92-11378-CE845834 for ; Thu, 24 Nov 2005 00:00:28 -0500 Received: from localhost ([127.0.0.1] helo=stumpy) by pigeon.alphaweb.net with smtp (Exim 4.10) id 1Ef8Qq-00035E-00 for internals@lists.php.net; Wed, 23 Nov 2005 20:10:00 -0800 Message-ID: <005001c5f0b4$56570450$7d051fac@stumpy> To: References: <005b01c5f07e$cfa28f90$5c8be5a9@ohr.berkeley.edu> Date: Wed, 23 Nov 2005 21:02:57 -0800 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 Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Subject: Re: Labeled Breaks (not the G-word) From: pollita@php.net ("Sara Golemon") Set of tests available too now: http://libssh2.org/patches/labeled_break_tests.tgz It can be untarred from the root of a PHP dist and it'll unfold into Zend/tests/break/ > http://libssh2.org/patches/labeled_break.diff > > A few notes about the implementation: > > * The parser is modified slightly to catch T_BREAK T_LNUMBER ';' and > T_BREAK > T_STRING ';' specifically. This is in-line with the decision to remove > the > ability to jump to variable targets. e.g. `break $foo;` will result in an > E_PARSE. > > * current break container is moved from op1.u.opline_num to extended_value > (This means updating continue; as well) > > * op1 is used to store the label's name until pass_two(), at that point > it's > converted to a jmp_addr. Non-labeled breaks leave op1 unused and jmp_addr > explicitly set to NULL > > * zend_brk opcode handler updated to use op1->u.jmp_addr if available > (labeled breaks), or el->brk (numbered breaks) if not. zend_brk and > zend_cont both updated per current break container change above. > > * Labeled breaks must target the same break container or higher within the > same op_array, and must only jump "forward" in execution. These checks > are > handled in pass_two() which is the earliest point at which all labeled are > declared. > > * Label hash is only allocated/initialized if labels are declared. > > Known Issues: > > * When an error is thrown from pass_two(), the error message states it's > in > Unknown on line 0. Gotta find a better way to handle that.... > > * This adds an element to zend_op_array so be sure to either `make clean` > or > at least `touch Zend/*.c` after applying it otherwise you'll be in > segfault > country. > > -Sara