diff options
| author | Anatol Belski <ab@php.net> | 2014-09-24 21:39:49 +0200 |
|---|---|---|
| committer | Anatol Belski <ab@php.net> | 2014-09-24 21:39:49 +0200 |
| commit | a2dd6069420c77b4f070ef10916be0d5c9afe84f (patch) | |
| tree | caa9ffe31be09ba030ae4cf7920aaae486af1725 /Zend/zend_execute.c | |
| parent | 70077d84e9817293f59454dc97d6aa3be89f9c7a (diff) | |
| parent | 6a09bdff6a9ec30f744fa12aeb2875a764fc34c5 (diff) | |
| download | php-git-a2dd6069420c77b4f070ef10916be0d5c9afe84f.tar.gz | |
Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (31 commits)
Fixed C++ incompatibility
update the certificate used for the test, as it expired recently
Fixed immutable arrays support
Fix counting of "R:" references in serialize()
Remove dead code
Test use($this) being an error
Move list() condition into assign_znode
typo
NEWS
Fix bug #68074 Allow to use system cipher list instead of hardcoded value
Avoid double checks
the order of the blocks should be Core, then exts in alphabetical order
add missing NEWS entry for the phpdbg compilation fix
add NEWS entry for #68088
Make QM_ASSIGN, JMP_SET and CAST return IS_TMP_VAR.
Removed useless helper
Drop unused result argument
Fix ct binding for cuf/cufa functions
Fix detection of write to built-in function for references
Test use of string names with \ prefix
...
Diffstat (limited to 'Zend/zend_execute.c')
| -rw-r--r-- | Zend/zend_execute.c | 44 |
1 files changed, 11 insertions, 33 deletions
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 031ba54d69..c44456d7ae 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -100,15 +100,6 @@ static const zend_internal_function zend_pass_function = { #define FREE_OP(should_free) \ if (should_free.var) { \ - if ((zend_uintptr_t)should_free.var & 1L) { \ - zval_dtor((zval*)((zend_uintptr_t)should_free.var & ~1L)); \ - } else { \ - zval_ptr_dtor_nogc(should_free.var); \ - } \ - } - -#define FREE_OP_IF_VAR(should_free) \ - if (should_free.var != NULL && (((zend_uintptr_t)should_free.var & 1L) == 0)) { \ zval_ptr_dtor_nogc(should_free.var); \ } @@ -117,10 +108,6 @@ static const zend_internal_function zend_pass_function = { zval_ptr_dtor_nogc(should_free.var); \ } -#define TMP_FREE(z) (zval*)(((zend_uintptr_t)(z)) | 1L) - -#define IS_TMP_FREE(should_free) ((zend_uintptr_t)should_free.var & 1L) - /* End of zend_execute_locks.h */ #define CV_DEF_OF(i) (EX(func)->op_array.vars[i]) @@ -362,7 +349,7 @@ static inline zval *_get_zval_ptr(int op_type, const znode_op *node, const zend_ break; case IS_TMP_VAR: ret = EX_VAR(node->var); - should_free->var = TMP_FREE(ret); + should_free->var = ret; return ret; break; case IS_VAR: @@ -392,7 +379,7 @@ static inline zval *_get_zval_ptr_deref(int op_type, const znode_op *node, const break; case IS_TMP_VAR: ret = EX_VAR(node->var); - should_free->var = TMP_FREE(ret); + should_free->var = ret; return ret; break; case IS_VAR: @@ -744,10 +731,12 @@ static inline void zend_assign_to_object(zval *retval, zval *object_ptr, zval *p ZVAL_COPY(retval, value); } zval_ptr_dtor(value); - FREE_OP_IF_VAR(free_value); + if (value_type == IS_VAR) { + FREE_OP(free_value); + } } -static void zend_assign_to_string_offset(zval *str, zend_long offset, zval *value, int value_type, zval *result TSRMLS_DC) +static void zend_assign_to_string_offset(zval *str, zend_long offset, zval *value, zval *result TSRMLS_DC) { zend_string *old_str; @@ -779,12 +768,6 @@ static void zend_assign_to_string_offset(zval *str, zend_long offset, zval *valu zend_string_release(tmp); } else { Z_STRVAL_P(str)[offset] = Z_STRVAL_P(value)[0]; - if (value_type == IS_TMP_VAR) { - /* we can safely free final_value here - * because separation is done only - * in case value_type == IS_VAR */ - zval_dtor(value); - } } /* * the value of an assignment to a string offset is undefined @@ -824,7 +807,7 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval return variable_ptr; } garbage = Z_COUNTED_P(variable_ptr); - if (GC_REFCOUNT(garbage) == 1) { + if (--GC_REFCOUNT(garbage) == 0) { ZVAL_COPY_VALUE(variable_ptr, value); if (value_type == IS_CONST) { /* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */ @@ -836,10 +819,9 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval Z_ADDREF_P(variable_ptr); } } - _zval_dtor_func(garbage ZEND_FILE_LINE_CC); + _zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC); return variable_ptr; } else { /* we need to split */ - GC_REFCOUNT(garbage)--; /* optimized version of GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr) */ if ((Z_COLLECTABLE_P(variable_ptr)) && UNEXPECTED(!GC_INFO(garbage))) { @@ -1036,7 +1018,7 @@ fetch_from_array: zend_long offset; if (type != BP_VAR_UNSET && UNEXPECTED(Z_STRLEN_P(container) == 0)) { - zval_dtor(container); + zval_ptr_dtor_nogc(container); convert_to_array: ZVAL_NEW_ARR(container); zend_hash_init(Z_ARRVAL_P(container), 8, NULL, ZVAL_PTR_DTOR, 0); @@ -1337,13 +1319,9 @@ static inline zend_brk_cont_element* zend_brk_cont(int nest_levels, int array_of if (nest_levels>1) { zend_op *brk_opline = &op_array->opcodes[jmp_to->brk]; - if (brk_opline->opcode == ZEND_SWITCH_FREE) { - if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { - zval_ptr_dtor(EX_VAR(brk_opline->op1.var)); - } - } else if (brk_opline->opcode == ZEND_FREE) { + if (brk_opline->opcode == ZEND_FREE) { if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { - zval_dtor(EX_VAR(brk_opline->op1.var)); + zval_ptr_dtor_nogc(EX_VAR(brk_opline->op1.var)); } } } |
