cvs: ZendEngine2(PHP_5_3) / zend_compile.c zend_exceptions.c zend_execute.c zend_execute_API.c zend_globals.h zend_language_scanner.l php-src NEWS
| From: | Dmitry Stogov | Date: | Mon, 21 Jan 2008 19:39:56 +0000 |
| Subject: | cvs: ZendEngine2(PHP_5_3) / zend_compile.c zend_exceptions.c zend_execute.c zend_execute_API.c zend_globals.h zend_language_scanner.l php-src NEWS | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-6284@lists.php.net to get a copy of this message | ||
dmitry Mon Jan 21 19:39:56 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src NEWS
/ZendEngine2 zend_compile.c zend_exceptions.c zend_execute.c
zend_execute_API.c zend_globals.h
zend_language_scanner.l
Log:
Changed exception handling. Now each op_array doesn't contain ZEND_HANDLE_EXCEPTION opcode in
the end
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.80&r2=1.2027.2.547.2.965.2.81&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.80 php-src/NEWS:1.2027.2.547.2.965.2.81 --- php-src/NEWS:1.2027.2.547.2.965.2.80 Mon Jan 21 18:28:11 2008 +++ php-src/NEWS Mon Jan 21 19:39:55 2008 @@ -76,6 +76,9 @@ (Dmitry, Pierre) - Added lcfirst() function. (David C) +- Changed exception handling. Now each op_array doesn't contain + ZEND_HANDLE_EXCEPTION opcode in the end. (Dmitry) + - Fixed possible crash in ext/soap because of uninitialized value. (Zdash Urf) - Fixed bug #43808 (date_create never fails (even when it should)). (Derick) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.36&r2=1.647.2.27.2.41.2.37&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.36 ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.37 --- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.36 Wed Jan 9 07:57:41 2008 +++ ZendEngine2/zend_compile.c Mon Jan 21 19:39:55 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.36 2008/01/09 07:57:41 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.37 2008/01/21 19:39:55 dmitry Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -1303,7 +1303,6 @@ zend_do_extended_info(TSRMLS_C); zend_do_return(NULL, 0 TSRMLS_CC); - zend_do_handle_exception(TSRMLS_C); pass_two(CG(active_op_array) TSRMLS_CC); http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_exceptions.c?r1=1.79.2.6.2.9.2.3&r2=1.79.2.6.2.9.2.4&diff_format=u Index: ZendEngine2/zend_exceptions.c diff -u ZendEngine2/zend_exceptions.c:1.79.2.6.2.9.2.3 ZendEngine2/zend_exceptions.c:1.79.2.6.2.9.2.4 --- ZendEngine2/zend_exceptions.c:1.79.2.6.2.9.2.3 Mon Dec 31 07:17:04 2007 +++ ZendEngine2/zend_exceptions.c Mon Jan 21 19:39:55 2008 @@ -19,13 +19,14 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_exceptions.c,v 1.79.2.6.2.9.2.3 2007/12/31 07:17:04 sebastian Exp $ */ +/* $Id: zend_exceptions.c,v 1.79.2.6.2.9.2.4 2008/01/21 19:39:55 dmitry Exp $ */ #include "zend.h" #include "zend_API.h" #include "zend_builtin_functions.h" #include "zend_interfaces.h" #include "zend_exceptions.h" +#include "zend_vm.h" zend_class_entry *default_exception_ce; zend_class_entry *error_exception_ce; @@ -55,7 +56,7 @@ return; } EG(opline_before_exception) = EG(current_execute_data)->opline; - EG(current_execute_data)->opline = &EG(active_op_array)->opcodes[EG(active_op_array)->last-1-1]; + EG(current_execute_data)->opline = EG(exception_op); } /* }}} */ @@ -567,6 +568,23 @@ { zend_class_entry ce; + memset(EG(exception_op), 0, sizeof(EG(exception_op))); + EG(exception_op)[0].opcode = ZEND_HANDLE_EXCEPTION; + EG(exception_op)[0].op1.op_type = IS_UNUSED; + EG(exception_op)[0].op2.op_type = IS_UNUSED; + EG(exception_op)[0].result.op_type = IS_UNUSED; + ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)); + EG(exception_op)[1].opcode = ZEND_HANDLE_EXCEPTION; + EG(exception_op)[1].op1.op_type = IS_UNUSED; + EG(exception_op)[1].op2.op_type = IS_UNUSED; + EG(exception_op)[1].result.op_type = IS_UNUSED; + ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+1); + EG(exception_op)[2].opcode = ZEND_HANDLE_EXCEPTION; + EG(exception_op)[2].op1.op_type = IS_UNUSED; + EG(exception_op)[2].op2.op_type = IS_UNUSED; + EG(exception_op)[2].result.op_type = IS_UNUSED; + ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+2); + INIT_CLASS_ENTRY(ce, "Exception", default_exception_functions); default_exception_ce = zend_register_internal_class(&ce TSRMLS_CC); default_exception_ce->create_object = zend_default_exception_new; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute.c?r1=1.716.2.12.2.24.2.14&r2=1.716.2.12.2.24.2.15&diff_format=u Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.716.2.12.2.24.2.14 ZendEngine2/zend_execute.c:1.716.2.12.2.24.2.15 --- ZendEngine2/zend_execute.c:1.716.2.12.2.24.2.14 Tue Jan 15 11:52:44 2008 +++ ZendEngine2/zend_execute.c Mon Jan 21 19:39:55 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.716.2.12.2.24.2.14 2008/01/15 11:52:44 dmitry Exp $ */ +/* $Id: zend_execute.c,v 1.716.2.12.2.24.2.15 2008/01/21 19:39:55 dmitry Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -1446,15 +1446,14 @@ EX(opline) = new_op #define ZEND_VM_JMP(new_op) \ - CHECK_SYMBOL_TABLES() \ - EX(opline) = EG(exception)?EX(opline)+1:new_op; \ - ZEND_VM_CONTINUE() + CHECK_SYMBOL_TABLES() \ + if (EXPECTED(!EG(exception))) { \ + EX(opline) = new_op; \ + } \ + ZEND_VM_CONTINUE() #define ZEND_VM_INC_OPCODE() \ - if (!EG(exception)) { \ - CHECK_SYMBOL_TABLES() \ - EX(opline)++; \ - } + EX(opline)++ #define ZEND_VM_EXIT_FROM_EXECUTE_LOOP() \ free_alloca(EX(CVs), EX(use_heap)); \ http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.24.2.19&r2=1.331.2.20.2.24.2.20&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.19 ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.20 --- ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.19 Tue Jan 15 11:47:05 2008 +++ ZendEngine2/zend_execute_API.c Mon Jan 21 19:39:55 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.19 2008/01/15 11:47:05 helly Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.20 2008/01/21 19:39:55 dmitry Exp $ */ #include <stdio.h> #include <signal.h> @@ -1320,8 +1320,6 @@ INIT_ZVAL(ret_opline->op1.u.constant); SET_UNUSED(ret_opline->op2); - zend_do_handle_exception(TSRMLS_C); - if (!CG(active_op_array)->start_op) { CG(active_op_array)->start_op = CG(active_op_array)->opcodes; } @@ -1365,7 +1363,7 @@ zend_exception_error(EG(exception) TSRMLS_CC); } - CG(active_op_array)->last -= 2; /* get rid of that ZEND_RETURN and ZEND_HANDLE_EXCEPTION */ + CG(active_op_array)->last -= 1; /* get rid of that ZEND_RETURN */ CG(active_op_array)->start_op = CG(active_op_array)->opcodes+CG(active_op_array)->last; } /* }}} */ http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_globals.h?r1=1.141.2.3.2.7.2.5&r2=1.141.2.3.2.7.2.6&diff_format=u Index: ZendEngine2/zend_globals.h diff -u ZendEngine2/zend_globals.h:1.141.2.3.2.7.2.5 ZendEngine2/zend_globals.h:1.141.2.3.2.7.2.6 --- ZendEngine2/zend_globals.h:1.141.2.3.2.7.2.5 Mon Dec 31 07:17:04 2007 +++ ZendEngine2/zend_globals.h Mon Jan 21 19:39:55 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_globals.h,v 1.141.2.3.2.7.2.5 2007/12/31 07:17:04 sebastian Exp $ */ +/* $Id: zend_globals.h,v 1.141.2.3.2.7.2.6 2008/01/21 19:39:55 dmitry Exp $ */ #ifndef ZEND_GLOBALS_H #define ZEND_GLOBALS_H @@ -233,6 +233,7 @@ zend_objects_store objects_store; zval *exception; zend_op *opline_before_exception; + zend_op exception_op[3]; struct _zend_execute_data *current_execute_data; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_language_scanner.l?r1=1.131.2.11.2.13.2.3&r2=1.131.2.11.2.13.2.4&diff_format=u Index: ZendEngine2/zend_language_scanner.l diff -u ZendEngine2/zend_language_scanner.l:1.131.2.11.2.13.2.3 ZendEngine2/zend_language_scanner.l:1.131.2.11.2.13.2.4 --- ZendEngine2/zend_language_scanner.l:1.131.2.11.2.13.2.3 Wed Nov 7 09:09:21 2007 +++ ZendEngine2/zend_language_scanner.l Mon Jan 21 19:39:55 2008 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.l,v 1.131.2.11.2.13.2.3 2007/11/07 09:09:21 dmitry Exp $ */ +/* $Id: zend_language_scanner.l,v 1.131.2.11.2.13.2.4 2008/01/21 19:39:55 dmitry Exp $ */ #define yyleng SCNG(yy_leng) #define yytext SCNG(yy_text) @@ -399,7 +399,6 @@ CG(active_op_array) = op_array; compiler_result = zendparse(TSRMLS_C); zend_do_return(&retval_znode, 0 TSRMLS_CC); - zend_do_handle_exception(TSRMLS_C); CG(in_compilation) = original_in_compilation; if (compiler_result==1) { /* parser error */ zend_bailout(); @@ -572,7 +571,6 @@ retval = NULL; } else { zend_do_return(NULL, 0 TSRMLS_CC); - zend_do_handle_exception(TSRMLS_C); CG(active_op_array) = original_active_op_array; pass_two(op_array TSRMLS_CC); retval = op_array;
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.80&r2=1.2027.2.547.2.965.2.81&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.80 php-src/NEWS:1.2027.2.547.2.965.2.81 --- php-src/NEWS:1.2027.2.547.2.965.2.80 Mon Jan 21 18:28:11 2008 +++ php-src/NEWS Mon Jan 21 19:39:55 2008 @@ -76,6 +76,9 @@ (Dmitry, Pierre) - Added lcfirst() function. (David C) +- Changed exception handling. Now each op_array doesn't contain + ZEND_HANDLE_EXCEPTION opcode in the end. (Dmitry) + - Fixed possible crash in ext/soap because of uninitialized value. (Zdash Urf) - Fixed bug #43808 (date_create never fails (even when it should)). (Derick) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.36&r2=1.647.2.27.2.41.2.37&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.36 ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.37 --- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.36 Wed Jan 9 07:57:41 2008 +++ ZendEngine2/zend_compile.c Mon Jan 21 19:39:55 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.36 2008/01/09 07:57:41 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.37 2008/01/21 19:39:55 dmitry Exp $ */ #include <zend_language_parser.h> #include "zend.h" @@ -1303,7 +1303,6 @@ zend_do_extended_info(TSRMLS_C); zend_do_return(NULL, 0 TSRMLS_CC); - zend_do_handle_exception(TSRMLS_C); pass_two(CG(active_op_array) TSRMLS_CC); http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_exceptions.c?r1=1.79.2.6.2.9.2.3&r2=1.79.2.6.2.9.2.4&diff_format=u Index: ZendEngine2/zend_exceptions.c diff -u ZendEngine2/zend_exceptions.c:1.79.2.6.2.9.2.3 ZendEngine2/zend_exceptions.c:1.79.2.6.2.9.2.4 --- ZendEngine2/zend_exceptions.c:1.79.2.6.2.9.2.3 Mon Dec 31 07:17:04 2007 +++ ZendEngine2/zend_exceptions.c Mon Jan 21 19:39:55 2008 @@ -19,13 +19,14 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_exceptions.c,v 1.79.2.6.2.9.2.3 2007/12/31 07:17:04 sebastian Exp $ */ +/* $Id: zend_exceptions.c,v 1.79.2.6.2.9.2.4 2008/01/21 19:39:55 dmitry Exp $ */ #include "zend.h" #include "zend_API.h" #include "zend_builtin_functions.h" #include "zend_interfaces.h" #include "zend_exceptions.h" +#include "zend_vm.h" zend_class_entry *default_exception_ce; zend_class_entry *error_exception_ce; @@ -55,7 +56,7 @@ return; } EG(opline_before_exception) = EG(current_execute_data)->opline; - EG(current_execute_data)->opline = &EG(active_op_array)->opcodes[EG(active_op_array)->last-1-1]; + EG(current_execute_data)->opline = EG(exception_op); } /* }}} */ @@ -567,6 +568,23 @@ { zend_class_entry ce; + memset(EG(exception_op), 0, sizeof(EG(exception_op))); + EG(exception_op)[0].opcode = ZEND_HANDLE_EXCEPTION; + EG(exception_op)[0].op1.op_type = IS_UNUSED; + EG(exception_op)[0].op2.op_type = IS_UNUSED; + EG(exception_op)[0].result.op_type = IS_UNUSED; + ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)); + EG(exception_op)[1].opcode = ZEND_HANDLE_EXCEPTION; + EG(exception_op)[1].op1.op_type = IS_UNUSED; + EG(exception_op)[1].op2.op_type = IS_UNUSED; + EG(exception_op)[1].result.op_type = IS_UNUSED; + ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+1); + EG(exception_op)[2].opcode = ZEND_HANDLE_EXCEPTION; + EG(exception_op)[2].op1.op_type = IS_UNUSED; + EG(exception_op)[2].op2.op_type = IS_UNUSED; + EG(exception_op)[2].result.op_type = IS_UNUSED; + ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+2); + INIT_CLASS_ENTRY(ce, "Exception", default_exception_functions); default_exception_ce = zend_register_internal_class(&ce TSRMLS_CC); default_exception_ce->create_object = zend_default_exception_new; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute.c?r1=1.716.2.12.2.24.2.14&r2=1.716.2.12.2.24.2.15&diff_format=u Index: ZendEngine2/zend_execute.c diff -u ZendEngine2/zend_execute.c:1.716.2.12.2.24.2.14 ZendEngine2/zend_execute.c:1.716.2.12.2.24.2.15 --- ZendEngine2/zend_execute.c:1.716.2.12.2.24.2.14 Tue Jan 15 11:52:44 2008 +++ ZendEngine2/zend_execute.c Mon Jan 21 19:39:55 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.c,v 1.716.2.12.2.24.2.14 2008/01/15 11:52:44 dmitry Exp $ */ +/* $Id: zend_execute.c,v 1.716.2.12.2.24.2.15 2008/01/21 19:39:55 dmitry Exp $ */ #define ZEND_INTENSIVE_DEBUGGING 0 @@ -1446,15 +1446,14 @@ EX(opline) = new_op #define ZEND_VM_JMP(new_op) \ - CHECK_SYMBOL_TABLES() \ - EX(opline) = EG(exception)?EX(opline)+1:new_op; \ - ZEND_VM_CONTINUE() + CHECK_SYMBOL_TABLES() \ + if (EXPECTED(!EG(exception))) { \ + EX(opline) = new_op; \ + } \ + ZEND_VM_CONTINUE() #define ZEND_VM_INC_OPCODE() \ - if (!EG(exception)) { \ - CHECK_SYMBOL_TABLES() \ - EX(opline)++; \ - } + EX(opline)++ #define ZEND_VM_EXIT_FROM_EXECUTE_LOOP() \ free_alloca(EX(CVs), EX(use_heap)); \ http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.24.2.19&r2=1.331.2.20.2.24.2.20&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.19 ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.20 --- ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.19 Tue Jan 15 11:47:05 2008 +++ ZendEngine2/zend_execute_API.c Mon Jan 21 19:39:55 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.19 2008/01/15 11:47:05 helly Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.20 2008/01/21 19:39:55 dmitry Exp $ */ #include <stdio.h> #include <signal.h> @@ -1320,8 +1320,6 @@ INIT_ZVAL(ret_opline->op1.u.constant); SET_UNUSED(ret_opline->op2); - zend_do_handle_exception(TSRMLS_C); - if (!CG(active_op_array)->start_op) { CG(active_op_array)->start_op = CG(active_op_array)->opcodes; } @@ -1365,7 +1363,7 @@ zend_exception_error(EG(exception) TSRMLS_CC); } - CG(active_op_array)->last -= 2; /* get rid of that ZEND_RETURN and ZEND_HANDLE_EXCEPTION */ + CG(active_op_array)->last -= 1; /* get rid of that ZEND_RETURN */ CG(active_op_array)->start_op = CG(active_op_array)->opcodes+CG(active_op_array)->last; } /* }}} */ http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_globals.h?r1=1.141.2.3.2.7.2.5&r2=1.141.2.3.2.7.2.6&diff_format=u Index: ZendEngine2/zend_globals.h diff -u ZendEngine2/zend_globals.h:1.141.2.3.2.7.2.5 ZendEngine2/zend_globals.h:1.141.2.3.2.7.2.6 --- ZendEngine2/zend_globals.h:1.141.2.3.2.7.2.5 Mon Dec 31 07:17:04 2007 +++ ZendEngine2/zend_globals.h Mon Jan 21 19:39:55 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_globals.h,v 1.141.2.3.2.7.2.5 2007/12/31 07:17:04 sebastian Exp $ */ +/* $Id: zend_globals.h,v 1.141.2.3.2.7.2.6 2008/01/21 19:39:55 dmitry Exp $ */ #ifndef ZEND_GLOBALS_H #define ZEND_GLOBALS_H @@ -233,6 +233,7 @@ zend_objects_store objects_store; zval *exception; zend_op *opline_before_exception; + zend_op exception_op[3]; struct _zend_execute_data *current_execute_data; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_language_scanner.l?r1=1.131.2.11.2.13.2.3&r2=1.131.2.11.2.13.2.4&diff_format=u Index: ZendEngine2/zend_language_scanner.l diff -u ZendEngine2/zend_language_scanner.l:1.131.2.11.2.13.2.3 ZendEngine2/zend_language_scanner.l:1.131.2.11.2.13.2.4 --- ZendEngine2/zend_language_scanner.l:1.131.2.11.2.13.2.3 Wed Nov 7 09:09:21 2007 +++ ZendEngine2/zend_language_scanner.l Mon Jan 21 19:39:55 2008 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_language_scanner.l,v 1.131.2.11.2.13.2.3 2007/11/07 09:09:21 dmitry Exp $ */ +/* $Id: zend_language_scanner.l,v 1.131.2.11.2.13.2.4 2008/01/21 19:39:55 dmitry Exp $ */ #define yyleng SCNG(yy_leng) #define yytext SCNG(yy_text) @@ -399,7 +399,6 @@ CG(active_op_array) = op_array; compiler_result = zendparse(TSRMLS_C); zend_do_return(&retval_znode, 0 TSRMLS_CC); - zend_do_handle_exception(TSRMLS_C); CG(in_compilation) = original_in_compilation; if (compiler_result==1) { /* parser error */ zend_bailout(); @@ -572,7 +571,6 @@ retval = NULL; } else { zend_do_return(NULL, 0 TSRMLS_CC); - zend_do_handle_exception(TSRMLS_C); CG(active_op_array) = original_active_op_array; pass_two(op_array TSRMLS_CC); retval = op_array;