Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27445 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9223 invoked by uid 1010); 15 Jan 2007 04:25:07 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 9208 invoked from network); 15 Jan 2007 04:25:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2007 04:25:07 -0000 Authentication-Results: pb1.pair.com header.from=pollita@php.net; sender-id=unknown; domainkeys=good Authentication-Results: pb1.pair.com smtp.mail=pollita@php.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain php.net from 140.211.166.39 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pollita@php.net X-Host-Fingerprint: 140.211.166.39 osu1.php.net Linux 2.4/2.6 Received: from [140.211.166.39] ([140.211.166.39:52872] helo=osu1.php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D7/C0-02482-3220BA54 for ; Sun, 14 Jan 2007 23:25:07 -0500 X-DomainKeys: Ecelerity dk_sign implementing draft-delany-domainkeys-base-01 DomainKey-Signature: q=dns; a=rsa-sha1; c=nofws; s=mx; d=php.net; h=From:Subject:To:Date; b=Z80tJJivux5LyX1KdMt+POcmr7zswjQ9fmzqQEvUqRjTPpUeY7JYDv77ldK8TA30 qzOgX/Rwule5ZC7vuzjTYrNvQlfNh7gqGk9Lymuc/TroEchrQODj3dJzuz2vZKQZ Authentication-Results: osu1.php.net smtp.user=pollita; auth=pass (LOGIN) X-Host-Fingerprint: 216.145.49.15 unknown Received: from [216.145.49.15] ([216.145.49.15:62182] helo=[10.72.72.213]) by osu1.php.net (ecelerity 2.1.1.11-rc1 r(13363/13364M)) with ESMTPSA (cipher=AES256-SHA) id 29/1F-07125-B620BA54 for ; Sun, 14 Jan 2007 20:26:20 -0800 Message-ID: <45AB0207.5080505@php.net> Date: Sun, 14 Jan 2007 20:24:39 -0800 User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Runtime JIT Proposals From: pollita@php.net (Sara Golemon) For reasons best left on IRC, it looks like I'll be working on runtime JIT. To that end, I've come up with a few proposals of varying complexity and feature-set completeness: Option 1: Dump support for compile-time JIT and replace it with a call at runtime using the same semantics. Advantages: No change in the API (well, no further change anyway, Unicode support pretty much guarantees that things will change regardless). Disadvantages: Could someone be relying on compile-time JIT for something already? Maybe activation triggers an action which has to take place prior to script execution? For what I've seen JIT isn't in heavy use, but my perceptions on the topic aren't definitive. Option 2: Leave compile-time JIT alone, and add a second callback for runtime JIT. Advantages: Doesn't break BC, and offers extensions the chance to know that the code contains autoglobal references without actually having to act on them unless they're needed. Disadvantages: Adds to complexity/confusion by having two separate callbacks for essentially the same action. Option 3: Extend JIT signature with a "stage" parameter to indicate if the JIT trigger is occuring during compile-time or run-time. The callback can decide when/if it performs processing using current return value disarming semantics. Option 4: Include fetchtype and subelement during runtime JIT callback allowing JIT callback to only do work necessary to prepare for the read/write call being performed. e.g. int php_example_jit_callback(int str_type, zstr str, int str_len, int stage, zval *container, int fetch_type, zval *element); Where str_type/str/str_len indicate the name of the variable being JITed, stage is one of COMPILETIME or RUNTIME, container is the autoglobal itself. Fetch_type is ZEND_FETCH_(DIM_|OBJ_)?_(R|W|RW), and element is the specific property/offset (only applicable for DIM/OBJ fetches, NULL for plain fetch. Advantages: Gives maximum flexibility to the implementation. In the case of http request encoding, it allows the decoder to differentiate between requests for a single element and fetches which want to retreive the entire array (e.g. foreach). Disadvantages: Adds a lot of complexity to the fetching of autoglobals and qand effectively doubles the amount of callback work being done for autoglobal objects. Will also confuse implementers on what the difference between this fetch callback is and the (read|write)_(dimension|property) callbacks used by objects. In response to the suggestion to just turn $_REQUEST (et.al.) into objects with overloaded array access, the big danger there is that the following behavior would change: $postdata = $_REQUEST; foreach($postdata as $idx => $val) { $postdata[$idx] = some_filter_func($val); } Were $_REQUEST turned into an object with overloaded array access, these changes to $postdata would modify the values in the original $_REQUEST (due to the reference-like behavior of PHP5+ objects). Personally, I like Option 4, but then I like complexity. I can certainly see going for any of the others, but I want to go with something that the rest of the group can see being appropriately useful. If I can get something approaching a semi-consensus on direction, I can have an implementation (or a couple, depending on feelings on the matter) in a few days. -Sara