Re: [PATCH] No runtime fetching of built-in global constants

From: Date: Thu, 31 Jul 2008 14:29:26 +0000
Subject: Re: [PATCH] No runtime fetching of built-in global constants
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-39502@lists.php.net to get a copy of this message
Thanks Matt. I committed near the same patch. It's not so optimal, but little bit more clear. Thanks. Dmitry. Matt Wilmas wrote: > Hi Dmitry, > > For the behavior change that I mentioned in the other thread, with this > code: > > function foo() { > static $a = -PHP_INT_MAX; > } > > Which could work sometimes, and sometimes not (if in a namespace or > ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION is set). I changed things so that > there is no substitution of constants (except with CT_SUBST flag, like > always) for compile time constants (ZEND_CT mode). They don't create a > FETCH_CONSTANT opcode anyway. :-) > > Another thing I realized wasn't getting optimized (runtime constants), which > can be, is with: > > namespace foo; > $a = ::PHP_INT_MAX; // :: for global scope > > So the patch allows substitution there as well. > > http://realplain.com/php/ct_const_fixes.diff > http://realplain.com/php/ct_const_fixes_5_3.diff > > > - Matt > > > ----- Original Message ----- > From: "Dmitry Stogov" > Sent: Thursday, July 24, 2008 > >> I would propose the attached patch for this optimization. >> >> Opcode caches and encoders will have to disable this optimization with >> ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION >> >> Any objections? >> >> Thanks. Dmitry. >> >

« previous php.internals (#39502) next »