Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62256 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65139 invoked from network); 19 Aug 2012 08:58:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Aug 2012 08:58:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.42 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.215.42 mail-lpp01m010-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:51130] helo=mail-lpp01m010-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0E/49-00850-B9AA0305 for ; Sun, 19 Aug 2012 04:58:04 -0400 Received: by lahl5 with SMTP id l5so2891463lah.29 for ; Sun, 19 Aug 2012 01:58:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=2+5ltW3S6Njgit2xxkFoMT2/C1i77m9b5M8LAUsUBno=; b=MhCh0aruwC5au8FfjlnR6dXZryEPQ/oFrSRsSyhsl3J0nqzxvgnetjzzDaRFCglsQX erhOInANl+IhDErnO6i1ZYay4iQVL0jB0okAupKofzfkZ70jRwM57MtnpW5i1a+24fMp wcWSpXWialu+kIeKiuhf3T/9DNqZkao0rqM6UA3b4jQCk4toxFVrkMGvjf9f9eteVNPe ViRdhZtgMYZrleq7wV9JwlTXIZ0OyY9x93jdqRMQjC1VQI+cshJzyCAiXcfTtDAkvWM/ sJ5KECAYTGIL0tOTaXP9v7XfpRmrpxY5b6OSjlkzpjZbU/MziYkOAXkyig0Q1sjEYCxu DGOA== MIME-Version: 1.0 Received: by 10.152.144.234 with SMTP id sp10mr10113384lab.51.1345366680115; Sun, 19 Aug 2012 01:58:00 -0700 (PDT) Received: by 10.152.122.51 with HTTP; Sun, 19 Aug 2012 01:58:00 -0700 (PDT) In-Reply-To: <50306B5E.7050106@sugarcrm.com> References: <5010138D.5050804@ajf.me> <501015B9.6050704@ajf.me> <501058B9.5050004@lsces.co.uk> <501249B6.5070507@lsces.co.uk> <50128825.4020902@lsces.co.uk> <50231FAD.40104@garfieldtech.com> <50306B5E.7050106@sugarcrm.com> Date: Sun, 19 Aug 2012 10:58:00 +0200 Message-ID: To: Stas Malyshev Cc: Sherif Ramadan , Larry Garfield , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Re: Generators in PHP From: nikita.ppv@gmail.com (Nikita Popov) On Sun, Aug 19, 2012 at 6:28 AM, Stas Malyshev wrote: > Hi! > >> For PHP we would need to have some similar behavior. PHP's current >> exception model is incompatible with GeneratorExitException (because >> PHP does not have BaseExceptions). So what I'd probably do instead is >> monkeypatch a ZEND_RETURN opcode at the current execution position and > > Patching opcodes is not a good idea, since opcodes could be cached, and > the cache can be shared between different processes. Patching a single opcode should be okay, because it does not require modification of the op_array. Only execute_data->opline has to be changed (and the execute data is not shared). The exception handling mechanism currently uses the same technique. It patches an ZEND_HANDLE_EXCEPTION opcode into the current position. Nikita