I've starting playing around with the zend engine,
is there any hope / plans for better interoperability with how
zend_compile_file() should be extended?
The goal being to reduce the amount of "X is not compatible with Y".
It would be possible to separate extensions in two categories and provide
hooks (without breaking BC):
Bytecode loaders / optimizers / dumpers (zend optimizer, ioncube loader,
vld, etc.)
HOOKS: zend_compile_file, zend_compile_string, zend_execute
Bytecode cache (apc, xcache, etc.)
HOOKS: zend_opc_get, zend_opc_put
Internally (Zend/zend.c, ext/phar/phar.c, ext/spl/php_spl.c, etc..) use
zend_opc_compile_file() ~
zend_op_array * opc _compile_file(zend_file_handle *file_handle, int
lifetime, int type TSRMLS_DC)
{
zend_op_array *retval=NULL;
if( zend_opc_get(file_handle->filename, retval) )
return retval;
retval = zend_compile_file(file_handle, type);
zend_opc_put(file_handle->filename, lifetime, retval);
return retval;
}
zend_opc_get() and zend_opc_put() would just be stub functions that do
nothing, op code caches would change these methods
If there's positive feedback, I can turn this into a RFC and put more work
into it
Hi!
I've starting playing around with the zend engine,
is there any hope / plans for better interoperability with how
zend_compile_file() should be extended?The goal being to reduce the amount of "X is not compatible with Y".
In most cases, overriding zend_compile_file() and calling previous
handler should be enough. If it doesn't work of soe special
modifications then additional handlers might not help either.
Compatibility problems can arise from something like extension X (e.g.
bytecode cache) expects certain structures to reside in shared memory
for performance reasons while extension Y modifying them since it
doesn't know anything about extension X.
Bytecode loaders / optimizers / dumpers (zend optimizer, ioncube loader,
vld, etc.)
Those should use other handlers, such as op array ctor/dtor/handler.
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227