From 67be34ec95d48d7b5ce85200f96ce05e8d409f99 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 7 Oct 2014 17:54:24 +0400 Subject: [PATCH] Remove useless parts of EX(old_error_reporting) --- Zend/zend_compile.h | 3 ++- Zend/zend_execute.c | 6 +++--- Zend/zend_types.h | 1 - Zend/zend_vm_def.h | 17 ++++++++--------- Zend/zend_vm_execute.h | 17 ++++++++--------- 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 5490263f0e..55100ac5ec 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -370,7 +370,8 @@ struct _zend_execute_data { zend_array *symbol_table; const zend_op *fast_ret; /* used by FAST_CALL/FAST_RET (finally keyword) */ zend_object *delayed_exception; - zval old_error_reporting; + uint32_t silence_op_num; + uint32_t old_error_reporting; }; #define VM_FRAME_KIND_MASK 0x000000ff diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 2cf15480af..0c455b84d3 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1433,7 +1433,7 @@ static zend_always_inline void i_init_func_execute_data(zend_execute_data *execu EX(return_value) = return_value; EX(scope) = EG(scope); EX(delayed_exception) = NULL; - ZVAL_UNDEF(&EX(old_error_reporting)); + EX(silence_op_num) = -1; /* Handle arguments */ first_extra_arg = op_array->num_args; @@ -1500,7 +1500,7 @@ static zend_always_inline void i_init_code_execute_data(zend_execute_data *execu EX(return_value) = return_value; EX(scope) = EG(scope); EX(delayed_exception) = NULL; - ZVAL_UNDEF(&EX(old_error_reporting)); + EX(silence_op_num) = -1; zend_attach_symbol_table(execute_data); @@ -1527,7 +1527,7 @@ static zend_always_inline void i_init_execute_data(zend_execute_data *execute_da EX(return_value) = return_value; EX(scope) = EG(scope); EX(delayed_exception) = NULL; - ZVAL_UNDEF(&EX(old_error_reporting)); + EX(silence_op_num) = -1; if (UNEXPECTED(EX(symbol_table) != NULL)) { zend_attach_symbol_table(execute_data); diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 1ac7b298eb..b7e806804f 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -141,7 +141,6 @@ struct _zval_struct { uint32_t next; /* hash collision chain */ uint32_t cache_slot; /* literal cache slot */ uint32_t lineno; /* line number (for ast nodes) */ - uint32_t silence_num; /* BEGIN_SILENCE op number */ } u2; }; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index d641442f7e..fd4311c0bd 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5097,9 +5097,9 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY) SAVE_OPLINE(); ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting)); - if (Z_TYPE(EX(old_error_reporting)) == IS_UNDEF) { - ZVAL_LONG(&EX(old_error_reporting), EG(error_reporting)); - EX(old_error_reporting).u2.silence_num = opline->op2.num; + if (EX(silence_op_num) == -1) { + EX(silence_op_num) = opline->op2.num; + EX(old_error_reporting) = EG(error_reporting); } if (EG(error_reporting)) { @@ -5138,9 +5138,8 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY) if (!EG(error_reporting) && Z_LVAL_P(EX_VAR(opline->op1.var)) != 0) { EG(error_reporting) = Z_LVAL_P(EX_VAR(opline->op1.var)); } - if (Z_TYPE(EX(old_error_reporting)) != IS_UNDEF && - EX(old_error_reporting).u2.silence_num == opline->op2.num) { - ZVAL_UNDEF(&EX(old_error_reporting)); + if (EX(silence_op_num) == opline->op2.num) { + EX(silence_op_num) = -1; } ZEND_VM_NEXT_OPCODE(); } @@ -5495,10 +5494,10 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) } /* restore previous error_reporting value */ - if (!EG(error_reporting) && Z_TYPE(EX(old_error_reporting)) != IS_UNDEF && Z_LVAL(EX(old_error_reporting)) != 0) { - EG(error_reporting) = Z_LVAL(EX(old_error_reporting)); + if (!EG(error_reporting) && EX(silence_op_num) != -1 && EX(old_error_reporting) != 0) { + EG(error_reporting) = EX(old_error_reporting); } - ZVAL_UNDEF(&EX(old_error_reporting)); + EX(silence_op_num) = -1; if (finally_op_num && (!catch_op_num || catch_op_num >= finally_op_num)) { if (EX(delayed_exception)) { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 81f75a7ca8..4937bceda2 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1080,9 +1080,9 @@ static int ZEND_FASTCALL ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR SAVE_OPLINE(); ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting)); - if (Z_TYPE(EX(old_error_reporting)) == IS_UNDEF) { - ZVAL_LONG(&EX(old_error_reporting), EG(error_reporting)); - EX(old_error_reporting).u2.silence_num = opline->op2.num; + if (EX(silence_op_num) == -1) { + EX(silence_op_num) = opline->op2.num; + EX(old_error_reporting) = EG(error_reporting); } if (EG(error_reporting)) { @@ -1321,10 +1321,10 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER } /* restore previous error_reporting value */ - if (!EG(error_reporting) && Z_TYPE(EX(old_error_reporting)) != IS_UNDEF && Z_LVAL(EX(old_error_reporting)) != 0) { - EG(error_reporting) = Z_LVAL(EX(old_error_reporting)); + if (!EG(error_reporting) && EX(silence_op_num) != -1 && EX(old_error_reporting) != 0) { + EG(error_reporting) = EX(old_error_reporting); } - ZVAL_UNDEF(&EX(old_error_reporting)); + EX(silence_op_num) = -1; if (finally_op_num && (!catch_op_num || catch_op_num >= finally_op_num)) { if (EX(delayed_exception)) { @@ -10106,9 +10106,8 @@ static int ZEND_FASTCALL ZEND_END_SILENCE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ if (!EG(error_reporting) && Z_LVAL_P(EX_VAR(opline->op1.var)) != 0) { EG(error_reporting) = Z_LVAL_P(EX_VAR(opline->op1.var)); } - if (Z_TYPE(EX(old_error_reporting)) != IS_UNDEF && - EX(old_error_reporting).u2.silence_num == opline->op2.num) { - ZVAL_UNDEF(&EX(old_error_reporting)); + if (EX(silence_op_num) == opline->op2.num) { + EX(silence_op_num) = -1; } ZEND_VM_NEXT_OPCODE(); } -- 2.40.0