Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20277 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1325 invoked by uid 1010); 23 Nov 2005 22:39:52 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 1310 invoked from network); 23 Nov 2005 22:39:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Nov 2005 22:39:52 -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:3130] helo=pigeon.alphaweb.net) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 67/89-11378-7BFE4834 for ; Wed, 23 Nov 2005 17:39:51 -0500 Received: from localhost ([127.0.0.1] helo=peiscg33m) by pigeon.alphaweb.net with smtp (Exim 4.10) id 1Ef2UZ-0000nt-00 for internals@lists.php.net; Wed, 23 Nov 2005 13:49:27 -0800 Message-ID: <005b01c5f07e$cfa28f90$5c8be5a9@ohr.berkeley.edu> Reply-To: "Sara Golemon" To: Date: Wed, 23 Nov 2005 14:39:30 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Subject: Labeled Breaks (not the G-word) From: pollita@php.net ("Sara Golemon") 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