Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43899 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50281 invoked from network); 12 May 2009 11:29:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2009 11:29:13 -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.185 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 212.25.124.185 il-mr1.zend.com Received: from [212.25.124.185] ([212.25.124.185:33814] helo=il-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 43/E6-05302-88D590A4 for ; Tue, 12 May 2009 07:29:13 -0400 Received: from il-gw1.zend.com (unknown [10.1.1.21]) by il-mr1.zend.com (Postfix) with ESMTP id 04319504A5; Tue, 12 May 2009 15:26:49 +0300 (IDT) Received: from ws.home ([10.1.10.12]) by il-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 12 May 2009 14:29:13 +0300 Message-ID: <4A095D83.6030505@zend.com> Date: Tue, 12 May 2009 15:29:07 +0400 User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: Paul Biggar CC: Stanislav Malyshev , Guilherme Blanco , Marcus Boerger , Timm Friebe , internals@lists.php.net References: <155749706.20090117211737@marcus-boerger.de> <497872B8.60807@zend.com> <4A08CA5F.7010200@zend.com> <4A0936B0.8000802@zend.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 12 May 2009 11:29:13.0498 (UTC) FILETIME=[E05F87A0:01C9D2F4] Subject: Re: [PHP-DEV] Method call improvements From: dmitry@zend.com (Dmitry Stogov) Paul Biggar wrote: > On Tue, May 12, 2009 at 9:43 AM, Dmitry Stogov wrote: >>> Apologies, I'm not familiar with run-time inheritence in PHP. My >>> understanding was that when a classes source code is compiled, its >>> parent classes must be known. When is this not the case? >> The parent class may be defined in other file that is loaded at runtime >> using include() statement. It's very usual case. So the PHP first loads the >> include file and then declares child class at runtime. > >>> Must it be known for the class' first instantiation? >> Of course. :) > > > On Tue, May 12, 2009 at 7:25 AM, Dmitry Stogov wrote: >> The real things is even worse as during compilation of a class it's parent >> class doesn't have to be known. So construction of VMTs becomes a bit >> problematic. BTW we could think in this way... > > > OK, so I dont understand this exactly. Is it correct to say that if a > class uses inheritance its compilation will be deferred until its > first instantiation? Or is it compiled when it is seen, and its parent > backpatched in later. When is later? The classes which parent isn't known during compilation inherited at run-time by DECLARE_INHERITED_CLASS opcode. It patches property and method tablas, checks for method compatibility, etc > But I think its fair to say that it has static inheritance - that is, > its full inheritance chain is known before it can be instantiated, and > it can never be changed after that. Right, but it has a lot of dynamic issues anyway. E.g. parent class may be changed or loaded from different file. Thanks. Dmitry. > > > > >>> In the worst case, it _might_ be cheaper to build it at instantiation >>> time, but I would have to look up how expensive that is in a more >>> static language to be sure. Certainly, it is currently so expensive >>> that almost anything else would be better (including the OP's patch). >> I don't see how run-time VMT contraction may help, because calls to virtual >> method must know VMT offset at compile-time. > > Right. Construction is fine. Their use is not. I don't know what I was > thinking. > > > > So it looks like the best way forwards is still the OP's patch? > > > > Thanks, > Paul > > >