Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36038 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70856 invoked from network); 7 Mar 2008 10:17:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2008 10:17:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:33278] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DB/FA-16577-E1611D74 for ; Fri, 07 Mar 2008 05:17:05 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C8803C.6B7888FB" Date: Fri, 7 Mar 2008 12:17:13 +0200 Message-ID: <06B0D32C7A96544490D18AF653D6BDE50261886E@il-ex1.zend.net> X-MS-Has-Attach: yes X-MS-TNEF-Correlator: Thread-Topic: Patch for opcode caches Thread-Index: AciAPF3aX6ZEvYErSGWi6AAar2KG7g== To: "internals Mailing List" Cc: "Andi Gutmans" , "Stas Malyshev" , "phpxcache" Subject: Patch for opcode caches From: dmitry@zend.com ("Dmitry Stogov") ------_=_NextPart_001_01C8803C.6B7888FB Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, The attached patch for PHP_5_3 is going to provide general solution to control some aspects of PHP compilation. It is absolutely necessary for all opcode caches to make cached scripts work exactly in the same way as non-cached. The problem occurs because early binding of inherited classes is not possible for cached scripts. As result inheritance is handled in run-time and classes might be created in wrong order. Most opcode caches do some tricks to resolve this issue, but all of them fail to do it right way. The patch introduces CG(compiler_options), which is a set of compiler flags that can be used by some extensions as opcode caches and debuggers. Such flags change the process of compilation a bit. For example to solve inherence early binding problem the opcode cache need to compile file with additional flags=20 extension_compile_file() { ... orig_compiler_options =3D CG(compiler_options); CG(compiler_options) |=3D ZEND_COMPILE_IGNORE_INTERNAL_CLASSES | ZEND_COMPILE_DELAYED_BINDING; orig_compile_file(); CG(compiler_options) =3D orig_compiler_options; ... } And then during restoration from cache call zend_do_delayed_early_binding(). This way even with cache all classes will be created exactly in the same order. The same CG(compiler_options) might be used to change other aspects of compilation in the future. The patch also optimizes ZEND_FETCH_CLASS+ZEND_ADD_INTERFACE opcodes into single ZEND_ADD_INTERFACE, and makes verification of abstract classes with interfaces only once. I'm going to commit the patch on Monday or Tuesday. Thanks. Dmitry. ------_=_NextPart_001_01C8803C.6B7888FB--