Re: com php-src: Executor cleanup: fix GOTO and SWITCH VMs, remove aility to build additional PHP-5.0 compatible VM, hide executor implementation
details.: Zend/zend_compile.h Zend/zend_execute.c Zend/zend_execute.h Zend/zend_vm_def.h Zend/zend_vm_execute.h Zend/zend_vm_gen.php
ext/opcache/Optimizer/zend_optimizer_internal.h
| From: | Derick Rethans | Date: | Fri, 26 Jun 2015 11:11:37 +0000 |
| Subject: | Re: com php-src: Executor cleanup: fix GOTO and SWITCH VMs, remove aility to build additional PHP-5.0 compatible VM, hide executor implementation details.: Zend/zend_compile.h Zend/zend_execute.c Zend/zend_execute.h Zend/zend_vm_def.h Zend/zend_vm_execute.h Zend/zend_vm_gen.php ext/opcache/Optimizer/zend_optimizer_internal.h |
||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86910@lists.php.net to get a copy of this message | ||
On Fri, 26 Jun 2015, Dmitry Stogov wrote:
> You shouldn't use opcode handlers directly, we have a use USER_OPCODE API.
>
> typedef int (*user_opcode_handler_t) (zend_execute_data *execute_data);
>
> #define ZEND_USER_OPCODE_CONTINUE 0 /* execute next opcode */
> #define ZEND_USER_OPCODE_RETURN 1 /* exit from executor (return from function) */
> #define ZEND_USER_OPCODE_DISPATCH 2 /* call original opcode handler */
> #define ZEND_USER_OPCODE_ENTER 3 /* enter into new op_array without recursion */
> #define ZEND_USER_OPCODE_LEAVE 4 /* return to calling op_array within the same executor */
>
> #define ZEND_USER_OPCODE_DISPATCH_TO 0x100 /* call original handler of returned opcode */
>
> ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler);
> ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode);
Sure - I use that:
https://github.com/xdebug/xdebug/blob/master/xdebug.c#L721
The problem is that with:
> typedef int (*user_opcode_handler_t) (zend_execute_data *execute_data);
The PHP 5 code had a define for "zend_execute_data *execute_data" in
"zend_compile.h":
> -#define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data
So the code at for example
https://github.com/xdebug/xdebug/blob/master/xdebug.c#L499
uses that:
static int xdebug_silence_handler(ZEND_OPCODE_HANDLER_ARGS)
Whereas in PHP 7, this ZEND_OPCODE_HANDLER_ARGS define now in a .h file
I can't include (zend_execute_vm.h) — and I can't quite understand *why*
you've moved that macro.
cheers,
Derick
> On Fri, Jun 26, 2015 at 2:46 AM, Derick Rethans <derick@php.net> wrote:
>
> > Hi,
> >
> > this change moved:
> >
> > -#define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data
> > -#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data
> > -
> > -typedef int (*user_opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
> > -typedef int (ZEND_FASTCALL *opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
> > -
> > -extern ZEND_API opcode_handler_t *zend_opcode_handlers;
> > +typedef int (*user_opcode_handler_t) (zend_execute_data *execute_data);
> >
> > to Zend/zend_vm_execute.h:
> >
> > +#define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data
> > +#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data
> > +
> > +typedef int (ZEND_FASTCALL *opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
> >
> >
> > WHich means that I can now no longer override opcodes in Xdebug --- and
> > I certainly can't include Zend/zend_vm_execute.h.
> >
> > The following code now fails (xdebug_code_coverage.[hc]):
> >
> > int xdebug_check_branch_entry_handler(ZEND_OPCODE_HANDLER_ARGS)
> >
> > Is there a different way for declaring/defining these functions now? (I
> > could just expand the ZEND_OPCODE_HANDLER_ARGS macro myself, but that's
> > cheating...
> >
> > cheers,
> > Derick
> >
> >
> > On Thu, 12 Mar 2015, Dmitry Stogov wrote:
> >
> > > Commit: 6289f7e52f07d411bce0a0a99fe65bfbe87e4290
> > > Author: Dmitry Stogov <dmitry@zend.com> Thu, 12 Mar 2015
> > 20:39:04 +0300
> > > Parents: 41571e7fa97feb2f43fc1ed3844daada35a29587
> > > Branches: master
> > >
> > > Link:
> >
> > http://git.php.net/?p=php-src.git;a=commitdiff;h=6289f7e52f07d411bce0a0a99fe65bfbe87e4290
> > >
> > > Log:
> > > Executor cleanup: fix GOTO and SWITCH VMs, remove aility to build
> > additional PHP-5.0 compatible VM, hide executor implementation details.
> > >
> > > Changed paths:
> > > M Zend/zend_compile.h
> > > M Zend/zend_execute.c
> > > M Zend/zend_execute.h
> > > M Zend/zend_vm_def.h
> > > M Zend/zend_vm_execute.h
> > > M Zend/zend_vm_gen.php
> > > M ext/opcache/Optimizer/zend_optimizer_internal.h
> > >
> > >
> >
> > --
> > http://derickrethans.nl |
> > http://xdebug.org
> > Like Xdebug? Consider a donation:
> > http://xdebug.org/donate.php
> > twitter: @derickr and @xdebug
> > Posted with an email client that doesn't mangle email: alpine
> >
>
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine