If you're so inclined to pursue it, you don't (technically) need to modify PHP core at all.
1) Make an extension which hooks zend_compile_file (just as APC and many others do). 2) First request of a file passes through to the real compiler and both returns main() opcodes *and* sends a copy of main() (and any new classes/functions) to JITter. 3) Subsequent requests get ZEND_INTERNAL_(FUNCTION|CLASS) stubs created for calling JIT code 4) RSHUTDOWN method explicitly cleans up ZEND_USER_(FUNCTION|CLASSe)s and JIT-stub ZEND_INTERNAL_(FUNCTION|CLASSe)s since the default sweep will get confused by the staggered function/class types. Only hard part in there is the JIT itself, but that was never going to be simple. :) On Fri, Nov 30, 2012 at 7:04 AM, Raymond Irving <xwis...@gmail.com> wrote: > Many thanks for the feedback. > > I would love see some JIT features added to the core as this would help to > improve the overall performance. > > Sara, > > I like your extension idea as this would not require any changes to the > core. > > Here's another idea: > ----------------------------------- > 1. Modify PHP core to cache opcodes on first request > 2. Create external program (or library) that can be scheduled to compile > cached opcodes to native code when necessary. This can be scheduled as a > cron job > 3. PHP will then run either the cached opcodes or the compiles codes when > the page is request a second time. > > In this solution you get bets of both worlds. PHP can execute opcode cache > or native code if it's available. There would be no need for the core to > further compile or optimize the opcodes as the external program will perform > these operations. The end result is that the application performance will > improve with usage and time. > > What do you think? > > __ > Raymond > > > On Tue, Nov 27, 2012 at 2:37 AM, Sara Golemon <poll...@php.net> wrote: >> >> On Mon, Nov 26, 2012 at 9:09 PM, Rasmus Lerdorf <ras...@lerdorf.com> >> wrote: >> > On 11/26/2012 09:03 PM, Sara Golemon wrote: >> >> P.S. - I do disagree with Rasmus' statement about none of us looking >> >> at fitting a JIT into PHP. ;) >> > >> > I think you misread my reply. I specifically said that a JIT is a >> > possibility, just not the HH approach. >> > >> No no, I caught that. I was just being pedantic in that I *am* >> looking at fitting a few JIT approaches into PHP (via extensions), >> including one based on HipHop's approach. :p But if we're still being >> pedantic, then I should admit to not working too hard on that front. >> >> -Sara > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php