On Tue, 2016-04-19 at 23:59 +0800, Lin Yo-An wrote:
> 
> Yes!  not all global variables will be snapshotted, for now I think
> EG, SPL_G (which saves the autoloader instances), and some object
> instances and zval. Then these opcode could be skipped a lot. So this
> looks like something on top of opcache.

This calls for quite some trouble. On the internal level one has to mind
that we use raw pointers for most things and depend on the zend
allocator to clean up memory forcefully on request end. Tracking this
safely is quite some work..

Just think about the different memory areas touched by this code:

bootstrap.php:
    <?php
    class AutoLoader {
        function load($class) {
            static $count = 0;
            eval("class $class { function __construct()  { \$this->c = 
".(++$count).";}}");
        }
    }
    $al = new AutoLoader();
    spl_autoload_register([$al, 'load']);

    $foo = new Foo();
    $bar = new Bar();
    ?>

main.php
    <?php
    bootstrap 'bootsrap.php';
    $baz = new Baz()
    echo $foo->c.$bar->c.$baz->c;
    ?>




On the individual function level you have to be careful about
side-effects. What should happen if session_start() or srand(), just to
mention two very different functions with side-effects,are called from
the bootstrap code.


I believe this is a massive project which requires refactoring for all
internal data structure and review for internal functions to mark them
as bootstrap-safe, or not..

johannes

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to