Re: Re: Bug #16265 Updated: Multiply-defined functions in classes not reported

From: Date: Wed, 03 Apr 2002 16:09:46 +0000
Subject: Re: Re: Bug #16265 Updated: Multiply-defined functions in classes not reported
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-82059@lists.php.net to get a copy of this message
I never posted a patch. Becuase the changes that im running are incomplete. I change the compiler and executer. Other things will need to change to reflect this type of change. Api calls like call_user_function() and userland functions like get_defined_methods() in addtion i would think a couple new api functions would come outta this. Like zend_method_exists() zend_get_method() i don't know where else would need to change. but i will include what i have been testing with in this email. I made these changes against 4.1.2 i can't get the cvs version my company seems to block out some ports. So i will send you the patch against 4.1.2. /* brad */ --- Yasuo Ohgaki <yasuo_ohgaki@yahoo.com> wrote: > Hi Brad, > > I would like to try your patch. > Where did you post? I searched ze2 list messages, I couldn't find one. > > -- > Yasuo Ohgaki > > > Brad Lafountain wrote: > > Ok... > > These benchmarks are (win32) > > php-4.1.2 Release_TS_inline (brad) vs php-4.1.2 binary from php.net (php) > > > > i have attached the test scripts that i used. > > (I ran each about 10 times and averaged the times, I used cygwin's time > > command) > > > > case one (worse case for php): > > brad - .11 sec > > php - .45 sec > > > > This is the worse case because php copies all of the functions from the > > previous class to the extended class so this script has 100 classes with 10 > > different functions in each so the 100'th class will have 1000 functions. > With > > this test i still called a function defined in the base class. Not only is > this > > way faster the new way it uses less memory. > > > > case two (worse case for brad): > > brad - .060 sec > > php - .080 sec > > This test has 100 declared classes all inheriting each other, only defining > a > > constructor in each class. Then makes a instance of the 100'th class and > calls > > a method in the base class 100 times. > > > > brad - .075 sec > > php - .090 sec > > The same thing as above but it calls the method 1000 times. > > > > brad - .23 sec > > php - .14 sec > > again with 10000 method calls > > > > As you can tell as the number of method calls go up the time of execution > goes > > up in the 'brad' version. IMHO doing 10000 calls to a method declared in a > base > > class of a inheritance chain of 100 classes and only loosing .09 seconds > isn't > > that bad at all. Seing this type of path will solve a few problems. > > > > --- Yasuo Ohgaki <yasuo_ohgaki@yahoo.com> wrote: > > > >>Brad, > >>How about post detailed benchmarks for your patch? > >> > >>IMHO. This bug is fatal. Especially those who are > >>experienced with other OO languages, such as C++/Java. > >> > >>-- > >>Yasuo Ohgaki > >> > >>Brad Lafountain wrote: > >> > >>>This bug is eaisly fixable. This is also something that i have been trying > >> > >>to > >> > >>>push on a couple of threads now. You would need to do 3 things. > >>> > >>>1) change the compiler so that inherited objects don't copy the opcodes > >>> of the functions. it will just store the parent's ce. > >>> > >>>2) change the executor so it will execute functions recursivly thru the > >>> parents ce's > >>> > >>>( i was talking about this change on engine2 list andi was arguing that it > >>>would be slower on execution of a function. I made the changes and it was > >>>faster. See the 'Mulitple Inhertiance' thread on engine2 list. This would > >> > >>also > >> > >>>allow you to inherit overloaded objects defined in c.. ie Java) > >>> > >>>3) again change the compiler to test only the current ce for > re-definitions > >> > >>of > >> > >>>the defined function. (derick already did this) > >>> > >>>So as far as im conserned making this change will solve many problems... > >> > >>But im > >> > >>>really still confused why andi doesn't want this change. I will send my > >> > >>diff if > >> > >>>you want. > >>> > >>> - Brad > >>> > >>>--- derick@php.net wrote: > >>> > >>> > >>>>ID: 16265 > >>>>Updated by: derick@php.net > >>>>Reported By: dshadow@zort.net > >>>>-Status: Open > >>>>+Status: Suspended > >>>>Bug Type: Scripting Engine problem > >>>>Operating System: Linux > >>>>PHP Version: 4.1.2 > >>>>New Comment: > >>>> > >>>>I'm suspending this for now, this issue is not easily solved > >>>>unfortunately. But we keep this on the todo list for future releases. > >>>> > >>>>Derick > >>>> > >>>> > >>>>Previous Comments: > >>>>------------------------------------------------------------------------ > >>>> > >>>>[2002-04-01 21:37:21] yohgaki@php.net > >>>> > >>>>Need to open again. > >>>>This bug may be suspended. > >>>> > >>>>------------------------------------------------------------------------ > >>>> > >>>>[2002-03-25 15:32:48] derick@php.net > >>>> > >>>>Fixed in CVS, will also be in PHP 4.2.0 > >>>> > >>>>Derick > >>>> > >>>>------------------------------------------------------------------------ > >>>> > >>>>[2002-03-25 13:12:42] dshadow@zort.net > >>>> > >>>>PHP does not report multiply-defined errors for class member functions. > >>>>For example, the following script below, when executed, only outputs > >>>>"two", with no errors. > >>>> > >>>>Instead, PHP should be giving error messages since the function bar has > >>>>been defined multiple times. > >>>> > >>>><? > >>>>class foo > >>>>{ > >>>> function bar() {echo "one\n";} > >>>> function bar() {echo "two\n";} > >>>>} > >>>> > >>>>$f = new foo(); > >>>>$f->bar(); > >>>> > >>>>------------------------------------------------------------------------ > >>>> > >>>> > >>>>-- > >>>>Edit this bug report at > >>>>http://bugs.php.net/?id=16265&edit=1 > >>>> > >>> > >>> > >>> > >>>__________________________________________________ > >>>Do You Yahoo!? > >>>Yahoo! Tax Center - online filing with TurboTax > >>>http://http://taxes.yahoo.com/ > >> > >> > >> > >>-- > >>PHP Development Mailing List > >><http://www.php.net/> > >>To unsubscribe, visit: http://www.php.net/unsub.php > >> > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Yahoo! Tax Center - online filing with TurboTax > > http://http://taxes.yahoo.com/ > > > __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/

« previous php.dev (#82059) next »