From: Dmitry Stogov Date: Wed, 2 Apr 2014 10:34:44 +0000 (+0400) Subject: Changed data layout to allow more efficient operations X-Git-Tag: POST_PHPNG_MERGE~412^2~174 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8099d0468426dbee59f540048376653535270ce;p=php Changed data layout to allow more efficient operations --- diff --git a/Zend/zend.h b/Zend/zend.h index 9f41978b1f..cae486a324 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -351,22 +351,22 @@ void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((nore static zend_always_inline zend_uint zval_refcount_p(zval* pz) { ZEND_ASSERT(Z_REFCOUNTED_P(pz)); - return Z_COUNTED_P(pz)->refcount; + return GC_REFCOUNT(Z_COUNTED_P(pz)); } static zend_always_inline zend_uint zval_set_refcount_p(zval* pz, zend_uint rc) { ZEND_ASSERT(Z_REFCOUNTED_P(pz)); - return Z_COUNTED_P(pz)->refcount = rc; + return GC_REFCOUNT(Z_COUNTED_P(pz)) = rc; } static zend_always_inline zend_uint zval_addref_p(zval* pz) { ZEND_ASSERT(Z_REFCOUNTED_P(pz)); - return ++Z_COUNTED_P(pz)->refcount; + return ++GC_REFCOUNT(Z_COUNTED_P(pz)); } static zend_always_inline zend_uint zval_delref_p(zval* pz) { ZEND_ASSERT(Z_REFCOUNTED_P(pz)); - return --Z_COUNTED_P(pz)->refcount; + return --GC_REFCOUNT(Z_COUNTED_P(pz)); } /* excpt.h on Digital Unix 4.0 defines function_table */ diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index f481f09e6e..1ab74aba00 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1911,8 +1911,8 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ if (class_type->op_type != IS_UNUSED) { cur_arg_info->allow_null = 0; - if (class_type->u.constant.type != IS_NULL) { - if (class_type->u.constant.type == IS_ARRAY) { + if (Z_TYPE(class_type->u.constant) != IS_NULL) { + if (Z_TYPE(class_type->u.constant) == IS_ARRAY) { cur_arg_info->type_hint = IS_ARRAY; if (op == ZEND_RECV_INIT) { if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) { @@ -1921,7 +1921,7 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with array type hint can only be an array or NULL"); } } - } else if (class_type->u.constant.type == IS_CALLABLE) { + } else if (Z_TYPE(class_type->u.constant) == IS_CALLABLE) { cur_arg_info->type_hint = IS_CALLABLE; if (op == ZEND_RECV_INIT) { if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) { @@ -5700,7 +5700,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con } zend_do_build_full_name(NULL, constant_container, constant_name, 1 TSRMLS_CC); *result = *constant_container; - result->u.constant.type = IS_CONSTANT | fetch_type; + Z_TYPE(result->u.constant) = IS_CONSTANT | fetch_type; break; case ZEND_RT: if (constant_container->op_type == IS_CONST && @@ -5750,7 +5750,7 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con } *result = *constant_name; - result->u.constant.type = IS_CONSTANT | fetch_type; + Z_TYPE(result->u.constant) = IS_CONSTANT | fetch_type; break; case ZEND_RT: compound = memchr(Z_STRVAL(constant_name->u.constant), '\\', Z_STRLEN(constant_name->u.constant)); @@ -5900,9 +5900,9 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode switch (Z_TYPE(offset->u.constant) & IS_CONSTANT_TYPE_MASK) { case IS_CONSTANT: //??? /* Ugly hack to denote that this value has a constant index */ - Z_STR(offset->u.constant)->gc.u.v.flags |= IS_STR_CONSTANT; + Z_GC_FLAGS(offset->u.constant) |= IS_STR_CONSTANT; if (Z_TYPE(offset->u.constant) & IS_CONSTANT_UNQUALIFIED) { - Z_STR(offset->u.constant)->gc.u.v.flags |= IS_STR_CONSTANT_UNQUALIFIED; + Z_GC_FLAGS(offset->u.constant) |= IS_STR_CONSTANT_UNQUALIFIED; } //??? Z_TYPE(element) |= IS_CONSTANT_INDEX; //??? Z_STRVAL(offset->u.constant) = erealloc(Z_STRVAL(offset->u.constant), Z_STRLEN(offset->u.constant)+3); @@ -5917,7 +5917,7 @@ void zend_do_add_static_array_element(znode *result, znode *offset, const znode //??? int len = sizeof(zend_ast *); //??? Z_TYPE(element) |= IS_CONSTANT_INDEX; key = STR_INIT((char*)&Z_AST(offset->u.constant), sizeof(zend_ast*), 0); - key->gc.u.v.flags |= IS_STR_AST; + GC_FLAGS(key) |= IS_STR_AST; //??? key[len] = Z_TYPE(offset->u.constant); //??? key[len + 1] = 0; zend_symtable_update(Z_ARRVAL(result->u.constant), key, &element); diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 5cb2e6f618..e661a64976 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -52,7 +52,7 @@ void zend_exception_set_previous(zend_object *exception, zend_object *add_previo previous = zend_read_property(default_exception_ce, pzv, "previous", sizeof("previous")-1, 1 TSRMLS_CC); if (Z_TYPE_P(previous) == IS_NULL) { zend_update_property(default_exception_ce, pzv, "previous", sizeof("previous")-1, &tmp TSRMLS_CC); - add_previous->gc.refcount--; + GC_REFCOUNT(add_previous)--; return; } pzv = previous; diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index bdc0e2e8db..a68716f874 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -953,7 +953,7 @@ static inline zval *zend_fetch_dimension_address_inner(HashTable *ht, const zval zend_string *offset_key; ulong hval; - switch (dim->type) { + switch (Z_TYPE_P(dim)) { case IS_NULL: offset_key = STR_EMPTY_ALLOC(); goto fetch_string_dim; diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index d5f70a15c9..77ac0dc2cb 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -561,7 +561,7 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope save = NULL; } zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual); - p->type = IS_STRING; + Z_TYPE_P(p) = IS_STRING; if (!inline_change) { ZVAL_STRINGL(p, actual, actual_len); } else if (save && save->val != actual) { @@ -600,19 +600,19 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope zend_hash_move_forward(Z_ARRVAL_P(p)); continue; } - if (!(str_index->gc.u.v.flags & (IS_STR_CONSTANT | IS_STR_AST))) { + if (!(GC_FLAGS(str_index) & (IS_STR_CONSTANT | IS_STR_AST))) { zend_hash_move_forward(Z_ARRVAL_P(p)); continue; } - if (str_index->gc.u.v.flags & IS_STR_AST) { + if (GC_FLAGS(str_index) & IS_STR_AST) { zend_ast_ref *ast = *(zend_ast_ref **)str_index->val; zend_ast_evaluate(&const_value, ast->ast, scope TSRMLS_CC); zend_ast_destroy(ast->ast); efree(ast); //??? - } else if (!zend_get_constant_ex(str_index->val, str_index->len, &const_value, scope, str_index->gc.u.v.flags & ~(IS_STR_PERSISTENT | IS_STR_INTERNED |IS_STR_PERMANENT) TSRMLS_CC)) { + } else if (!zend_get_constant_ex(str_index->val, str_index->len, &const_value, scope, GC_FLAGS(str_index) & ~(IS_STR_PERSISTENT | IS_STR_INTERNED |IS_STR_PERMANENT) TSRMLS_CC)) { char *actual, *str; const char *save = str_index->val; int len; @@ -624,7 +624,7 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope len -= ((colon - str) + 1); str = colon; } else { - if (str_index->gc.u.v.flags & IS_STR_CONSTANT_UNQUALIFIED) { + if (GC_FLAGS(str_index) & IS_STR_CONSTANT_UNQUALIFIED) { if ((actual = (char *)zend_memrchr(str, '\\', len))) { actual++; len -= (actual - str); @@ -638,7 +638,7 @@ ZEND_API int zval_update_constant_ex(zval *p, void *arg, zend_class_entry *scope if (save[0] == '\\') { ++save; } - if (!(str_index->gc.u.v.flags & IS_STR_CONSTANT_UNQUALIFIED)) { + if (!(GC_FLAGS(str_index) & IS_STR_CONSTANT_UNQUALIFIED)) { zend_error(E_ERROR, "Undefined constant '%s'", save); } zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", str, str); @@ -1687,8 +1687,8 @@ ZEND_API void zend_rebuild_symbol_table(TSRMLS_D) /* {{{ */ EG(active_symbol_table) = *(EG(symtable_cache_ptr)--); } else { EG(active_symbol_table) = emalloc(sizeof(zend_array)); - EG(active_symbol_table)->gc.refcount = 0; - EG(active_symbol_table)->gc.u.v.type = IS_ARRAY; + GC_REFCOUNT(EG(active_symbol_table)) = 0; + GC_TYPE_INFO(EG(active_symbol_table)) = IS_ARRAY; zend_hash_init(&EG(active_symbol_table)->ht, ex->op_array->last_var, NULL, ZVAL_PTR_DTOR, 0); /*printf("Cache miss! Initialized %x\n", EG(active_symbol_table));*/ } diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c index dca99c0911..5fbc3e58c3 100644 --- a/Zend/zend_gc.c +++ b/Zend/zend_gc.c @@ -136,9 +136,9 @@ ZEND_API void gc_init(TSRMLS_D) ZEND_API void gc_possible_root(zend_refcounted *ref TSRMLS_DC) { - if (UNEXPECTED(GC_ADDRESS(ref->u.v.gc_info) && - GC_GET_COLOR(ref->u.v.gc_info) == GC_BLACK && - GC_ADDRESS(ref->u.v.gc_info) >= GC_G(last_unused) - GC_G(buf))) { + if (UNEXPECTED(GC_ADDRESS(GC_INFO(ref)) && + GC_GET_COLOR(GC_INFO(ref)) == GC_BLACK && + GC_ADDRESS(GC_INFO(ref)) >= GC_G(last_unused) - GC_G(buf))) { /* The given zval is a garbage that is going to be deleted by * currently running GC */ return; @@ -146,10 +146,10 @@ ZEND_API void gc_possible_root(zend_refcounted *ref TSRMLS_DC) GC_BENCH_INC(zval_possible_root); - if (GC_GET_COLOR(ref->u.v.gc_info) == GC_BLACK) { - GC_SET_PURPLE(ref->u.v.gc_info); + if (GC_GET_COLOR(GC_INFO(ref)) == GC_BLACK) { + GC_SET_PURPLE(GC_INFO(ref)); - if (!GC_ADDRESS(ref->u.v.gc_info)) { + if (!GC_ADDRESS(GC_INFO(ref))) { gc_root_buffer *newRoot = GC_G(unused); if (newRoot) { @@ -159,17 +159,17 @@ ZEND_API void gc_possible_root(zend_refcounted *ref TSRMLS_DC) GC_G(first_unused)++; } else { if (!GC_G(gc_enabled)) { - GC_SET_BLACK(ref->u.v.gc_info); + GC_SET_BLACK(GC_INFO(ref)); return; } - ref->refcount++; + GC_REFCOUNT(ref)++; gc_collect_cycles(TSRMLS_C); - ref->refcount--; + GC_REFCOUNT(ref)--; newRoot = GC_G(unused); if (!newRoot) { return; } - GC_SET_PURPLE(ref->u.v.gc_info); + GC_SET_PURPLE(GC_INFO(ref)); GC_G(unused) = newRoot->prev; } @@ -178,7 +178,7 @@ ZEND_API void gc_possible_root(zend_refcounted *ref TSRMLS_DC) GC_G(roots).next->prev = newRoot; GC_G(roots).next = newRoot; - GC_SET_ADDRESS(ref->u.v.gc_info, newRoot - GC_G(buf)); + GC_SET_ADDRESS(GC_INFO(ref), newRoot - GC_G(buf)); newRoot->ref = ref; @@ -193,18 +193,18 @@ ZEND_API void gc_remove_from_buffer(zend_refcounted *ref TSRMLS_DC) { gc_root_buffer *root; - if (UNEXPECTED(GC_ADDRESS(ref->u.v.gc_info) && - GC_GET_COLOR(ref->u.v.gc_info) == GC_BLACK && - GC_ADDRESS(ref->u.v.gc_info) >= GC_G(last_unused) - GC_G(buf))) { + if (UNEXPECTED(GC_ADDRESS(GC_INFO(ref)) && + GC_GET_COLOR(GC_INFO(ref)) == GC_BLACK && + GC_ADDRESS(GC_INFO(ref)) >= GC_G(last_unused) - GC_G(buf))) { /* The given zval is a garbage that is going to be deleted by * currently running GC */ return; } - root = GC_G(buf) + GC_ADDRESS(ref->u.v.gc_info); + root = GC_G(buf) + GC_ADDRESS(GC_INFO(ref)); GC_BENCH_INC(zval_remove_from_buffer); GC_REMOVE_FROM_ROOTS(root); - ref->u.v.gc_info = 0; + GC_INFO(ref) = 0; /* updete next root that is going to be freed */ if (GC_G(next_to_free) == root) { @@ -220,9 +220,9 @@ static void gc_scan_black(zend_refcounted *ref TSRMLS_DC) tail_call: ht = NULL; - GC_SET_BLACK(ref->u.v.gc_info); + GC_SET_BLACK(GC_INFO(ref)); - if (ref->u.v.type == IS_OBJECT && EG(objects_store).object_buckets) { + if (GC_TYPE(ref) == IS_OBJECT && EG(objects_store).object_buckets) { zend_object_get_gc_t get_gc; zend_object *obj = (zend_object*)ref; @@ -239,10 +239,10 @@ tail_call: for (i = 0; i < n; i++) { if (Z_REFCOUNTED(table[i])) { ref = Z_COUNTED(table[i]); - if (ref->u.v.type != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) { - ref->refcount++; + if (GC_TYPE(ref) != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) { + GC_REFCOUNT(ref)++; } - if (GC_GET_COLOR(ref->u.v.gc_info) != GC_BLACK) { + if (GC_GET_COLOR(GC_INFO(ref)) != GC_BLACK) { if (!props && i == n - 1) { goto tail_call; } else { @@ -256,21 +256,21 @@ tail_call: } ht = props; } - } else if (ref->u.v.type == IS_ARRAY) { + } else if (GC_TYPE(ref) == IS_ARRAY) { if ((zend_array*)ref != &EG(symbol_table)) { ht = &((zend_array*)ref)->ht; } - } else if (ref->u.v.type == IS_REFERENCE) { + } else if (GC_TYPE(ref) == IS_REFERENCE) { if (Z_REFCOUNTED(((zend_reference*)ref)->val)) { if (UNEXPECTED(!EG(objects_store).object_buckets) && Z_TYPE(((zend_reference*)ref)->val) == IS_OBJECT) { return; } ref = Z_COUNTED(((zend_reference*)ref)->val); - if (ref->u.v.type != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) { - ref->refcount++; + if (GC_TYPE(ref) != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) { + GC_REFCOUNT(ref)++; } - if (GC_GET_COLOR(ref->u.v.gc_info) != GC_BLACK) { + if (GC_GET_COLOR(GC_INFO(ref)) != GC_BLACK) { goto tail_call; } } @@ -281,10 +281,10 @@ tail_call: p = ht->arData + idx; if (!Z_REFCOUNTED(p->val)) continue; ref = Z_COUNTED(p->val); - if (ref->u.v.type != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) { - ref->refcount++; + if (GC_TYPE(ref) != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) { + GC_REFCOUNT(ref)++; } - if (GC_GET_COLOR(ref->u.v.gc_info) != GC_BLACK) { + if (GC_GET_COLOR(GC_INFO(ref)) != GC_BLACK) { if (idx == ht->nNumUsed-1) { goto tail_call; } else { @@ -301,12 +301,12 @@ static void gc_mark_grey(zend_refcounted *ref TSRMLS_DC) Bucket *p; tail_call: - if (GC_GET_COLOR(ref->u.v.gc_info) != GC_GREY) { + if (GC_GET_COLOR(GC_INFO(ref)) != GC_GREY) { ht = NULL; GC_BENCH_INC(zval_marked_grey); - GC_SET_COLOR(ref->u.v.gc_info, GC_GREY); + GC_SET_COLOR(GC_INFO(ref), GC_GREY); - if (ref->u.v.type == IS_OBJECT && EG(objects_store).object_buckets) { + if (GC_TYPE(ref) == IS_OBJECT && EG(objects_store).object_buckets) { zend_object_get_gc_t get_gc; zend_object *obj = (zend_object*)ref; @@ -323,8 +323,8 @@ tail_call: for (i = 0; i < n; i++) { if (Z_REFCOUNTED(table[i])) { ref = Z_COUNTED(table[i]); - if (ref->u.v.type != IS_ARRAY || ((zend_array*)ref) != &EG(symbol_table)) { - ref->refcount--; + if (GC_TYPE(ref) != IS_ARRAY || ((zend_array*)ref) != &EG(symbol_table)) { + GC_REFCOUNT(ref)--; } if (!props && i == n - 1) { goto tail_call; @@ -338,21 +338,21 @@ tail_call: } ht = props; } - } else if (ref->u.v.type == IS_ARRAY) { + } else if (GC_TYPE(ref) == IS_ARRAY) { if (((zend_array*)ref) == &EG(symbol_table)) { - GC_SET_BLACK(ref->u.v.gc_info); + GC_SET_BLACK(GC_INFO(ref)); } else { ht = &((zend_array*)ref)->ht; } - } else if (ref->u.v.type == IS_REFERENCE) { + } else if (GC_TYPE(ref) == IS_REFERENCE) { if (Z_REFCOUNTED(((zend_reference*)ref)->val)) { if (UNEXPECTED(!EG(objects_store).object_buckets) && Z_TYPE(((zend_reference*)ref)->val) == IS_OBJECT) { return; } ref = Z_COUNTED(((zend_reference*)ref)->val); - if (ref->u.v.type != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) { - ref->refcount--; + if (GC_TYPE(ref) != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) { + GC_REFCOUNT(ref)--; } goto tail_call; } @@ -363,8 +363,8 @@ tail_call: p = ht->arData + idx; if (!Z_REFCOUNTED(p->val)) continue; ref = Z_COUNTED(p->val); - if (ref->u.v.type != IS_ARRAY || ((zend_array*)ref) != &EG(symbol_table)) { - ref->refcount--; + if (GC_TYPE(ref) != IS_ARRAY || ((zend_array*)ref) != &EG(symbol_table)) { + GC_REFCOUNT(ref)--; } if (idx == ht->nNumUsed-1) { goto tail_call; @@ -380,10 +380,10 @@ static void gc_mark_roots(TSRMLS_D) gc_root_buffer *current = GC_G(roots).next; while (current != &GC_G(roots)) { - if (GC_GET_COLOR(current->ref->u.v.gc_info) == GC_PURPLE) { + if (GC_GET_COLOR(GC_INFO(current->ref)) == GC_PURPLE) { gc_mark_grey(current->ref TSRMLS_CC); //??? } else { -//??? GC_SET_ADDRESS(current->ref->u.v.gc_info, 0); +//??? GC_SET_ADDRESS(GC_INFO(current->ref), 0); //??? GC_REMOVE_FROM_ROOTS(current); } current = current->next; @@ -397,13 +397,13 @@ static void gc_scan(zend_refcounted *ref TSRMLS_DC) Bucket *p; tail_call: - if (GC_GET_COLOR(ref->u.v.gc_info) == GC_GREY) { + if (GC_GET_COLOR(GC_INFO(ref)) == GC_GREY) { ht = NULL; - if (ref->refcount > 0) { + if (GC_REFCOUNT(ref) > 0) { gc_scan_black(ref TSRMLS_CC); } else { - GC_SET_COLOR(ref->u.v.gc_info, GC_WHITE); - if (ref->u.v.type == IS_OBJECT && EG(objects_store).object_buckets) { + GC_SET_COLOR(GC_INFO(ref), GC_WHITE); + if (GC_TYPE(ref) == IS_OBJECT && EG(objects_store).object_buckets) { zend_object_get_gc_t get_gc; zend_object *obj = (zend_object*)ref; @@ -432,13 +432,13 @@ tail_call: } ht = props; } - } else if (ref->u.v.type == IS_ARRAY) { + } else if (GC_TYPE(ref) == IS_ARRAY) { if ((zend_array*)ref == &EG(symbol_table)) { - GC_SET_BLACK(ref->u.v.gc_info); + GC_SET_BLACK(GC_INFO(ref)); } else { ht = &((zend_array*)ref)->ht; } - } else if (ref->u.v.type == IS_REFERENCE) { + } else if (GC_TYPE(ref) == IS_REFERENCE) { if (Z_REFCOUNTED(((zend_reference*)ref)->val)) { if (UNEXPECTED(!EG(objects_store).object_buckets) && Z_TYPE(((zend_reference*)ref)->val) == IS_OBJECT) { @@ -482,21 +482,21 @@ static int gc_collect_white(zend_refcounted *ref TSRMLS_DC) Bucket *p; tail_call: - if (ref->u.v.gc_info == GC_WHITE) { + if (GC_INFO(ref) == GC_WHITE) { ht = NULL; - GC_SET_BLACK(ref->u.v.gc_info); + GC_SET_BLACK(GC_INFO(ref)); /* don't count references for compatibilty ??? */ - if (ref->u.v.type != IS_REFERENCE) { + if (GC_TYPE(ref) != IS_REFERENCE) { count++; } - if (ref->u.v.type == IS_OBJECT && EG(objects_store).object_buckets) { + if (GC_TYPE(ref) == IS_OBJECT && EG(objects_store).object_buckets) { zend_object_get_gc_t get_gc; zend_object *obj = (zend_object*)ref; /* PURPLE instead of BLACK to prevent buffering in nested gc calls */ -//??? GC_SET_PURPLE(obj->gc.u.v.gc_info); +//??? GC_SET_PURPLE(GC_INFO(obj)); if (EXPECTED(IS_VALID(EG(objects_store).object_buckets[obj->handle]) && (get_gc = obj->handlers->get_gc) != NULL)) { @@ -517,8 +517,8 @@ tail_call: for (i = 0; i < n; i++) { if (Z_REFCOUNTED(table[i])) { ref = Z_COUNTED(table[i]); - if (ref->u.v.type != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) { - ref->refcount++; + if (GC_TYPE(ref) != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) { + GC_REFCOUNT(ref)++; } if (!props && i == n - 1) { goto tail_call; @@ -535,17 +535,17 @@ tail_call: } ht = props; } - } else if (ref->u.v.type == IS_ARRAY) { + } else if (GC_TYPE(ref) == IS_ARRAY) { ht = &((zend_array*)ref)->ht; - } else if (ref->u.v.type == IS_REFERENCE) { + } else if (GC_TYPE(ref) == IS_REFERENCE) { if (Z_REFCOUNTED(((zend_reference*)ref)->val)) { if (UNEXPECTED(!EG(objects_store).object_buckets) && Z_TYPE(((zend_reference*)ref)->val) == IS_OBJECT) { return count; } ref = Z_COUNTED(((zend_reference*)ref)->val); - if (ref->u.v.type != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) { - ref->refcount++; + if (GC_TYPE(ref) != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) { + GC_REFCOUNT(ref)++; } goto tail_call; } @@ -563,8 +563,8 @@ tail_call: continue; } ref = Z_COUNTED(p->val); - if (ref->u.v.type != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) { - ref->refcount++; + if (GC_TYPE(ref) != IS_ARRAY || (zend_array*)ref != &EG(symbol_table)) { + GC_REFCOUNT(ref)++; } if (idx == ht->nNumUsed-1) { goto tail_call; @@ -582,10 +582,10 @@ static int gc_collect_roots(TSRMLS_D) gc_root_buffer *current = GC_G(roots).next; while (current != &GC_G(roots)) { - GC_SET_ADDRESS(current->ref->u.v.gc_info, 0); - if (current->ref->u.v.gc_info == GC_WHITE) { + GC_SET_ADDRESS(GC_INFO(current->ref), 0); + if (GC_INFO(current->ref) == GC_WHITE) { count += gc_collect_white(current->ref TSRMLS_CC); - GC_SET_ADDRESS(current->ref->u.v.gc_info, current - GC_G(buf)); + GC_SET_ADDRESS(GC_INFO(current->ref), current - GC_G(buf)); } else { GC_REMOVE_FROM_ROOTS(current); } @@ -638,18 +638,18 @@ ZEND_API int gc_collect_cycles(TSRMLS_D) while (current != &GC_G(to_free)) { p = current->ref; GC_G(next_to_free) = current->next; - if (p->u.v.type == IS_OBJECT) { + if (GC_TYPE(p) == IS_OBJECT) { zend_object *obj = (zend_object*)p; if (EG(objects_store).object_buckets && obj->handlers->dtor_obj && IS_VALID(EG(objects_store).object_buckets[obj->handle]) && - !(obj->gc.u.v.flags & IS_OBJ_DESTRUCTOR_CALLED)) { + !(GC_FLAGS(obj) & IS_OBJ_DESTRUCTOR_CALLED)) { - obj->gc.u.v.flags |= IS_OBJ_DESTRUCTOR_CALLED; - obj->gc.refcount++; + GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED; + GC_REFCOUNT(obj)++; obj->handlers->dtor_obj(obj TSRMLS_CC); - obj->gc.refcount--; + GC_REFCOUNT(obj)--; } } current = GC_G(next_to_free); @@ -660,25 +660,25 @@ ZEND_API int gc_collect_cycles(TSRMLS_D) while (current != &GC_G(to_free)) { p = current->ref; GC_G(next_to_free) = current->next; - if (p->u.v.type == IS_OBJECT) { + if (GC_TYPE(p) == IS_OBJECT) { zend_object *obj = (zend_object*)p; if (EG(objects_store).object_buckets && IS_VALID(EG(objects_store).object_buckets[obj->handle])) { - obj->gc.u.v.type = IS_NULL; + GC_TYPE(obj) = IS_NULL; zend_objects_store_free(obj TSRMLS_CC); } - } else if (p->u.v.type == IS_ARRAY) { + } else if (GC_TYPE(p) == IS_ARRAY) { zend_array *arr = (zend_array*)p; - arr->gc.u.v.type = IS_NULL; + GC_TYPE(arr) = IS_NULL; zend_hash_destroy(&arr->ht); GC_REMOVE_FROM_BUFFER(arr); efree(arr); - } else if (p->u.v.type == IS_REFERENCE) { + } else if (GC_TYPE(p) == IS_REFERENCE) { zend_reference *ref = (zend_reference*)p; - ref->gc.u.v.type = IS_NULL; + GC_TYPE(ref) = IS_NULL; if (EXPECTED(EG(objects_store).object_buckets != NULL) || Z_TYPE(ref->val) != IS_OBJECT) { zval_dtor(&ref->val); diff --git a/Zend/zend_gc.h b/Zend/zend_gc.h index 58606ccc93..a7e8b64b25 100644 --- a/Zend/zend_gc.h +++ b/Zend/zend_gc.h @@ -131,7 +131,7 @@ END_EXTERN_C() #define GC_REMOVE_FROM_BUFFER(p) do { \ zend_refcounted *_p = (zend_refcounted*)(p); \ - if (GC_ADDRESS(_p->u.v.gc_info)) { \ + if (GC_ADDRESS(GC_INFO(_p))) { \ gc_remove_from_buffer(_p TSRMLS_CC); \ } \ } while (0) diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 59d9cedbc0..0eb1f49ef9 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -202,7 +202,7 @@ static zend_always_inline Bucket *zend_hash_find_bucket(const HashTable *ht, zen memcmp(p->key->val, key->val, key->len) == 0)) { return p; } - idx = p->val.u.next; + idx = Z_NEXT(p->val); } return NULL; } @@ -223,7 +223,7 @@ static zend_always_inline Bucket *zend_hash_str_find_bucket(const HashTable *ht, && !memcmp(p->key->val, str, len)) { return p; } - idx = p->val.u.next; + idx = Z_NEXT(p->val); } return NULL; } @@ -241,7 +241,7 @@ static zend_always_inline Bucket *zend_hash_index_find_bucket(const HashTable *h if (p->h == h && !p->key) { return p; } - idx = p->val.u.next; + idx = Z_NEXT(p->val); } return NULL; } @@ -300,7 +300,7 @@ ZEND_API zval *_zend_hash_add_or_update(HashTable *ht, zend_string *key, zval *p STR_ADDREF(key); ZVAL_COPY_VALUE(&p->val, pData); nIndex = h & ht->nTableMask; - p->val.u.next = ht->arHash[nIndex]; + Z_NEXT(p->val) = ht->arHash[nIndex]; ht->arHash[nIndex] = idx; HANDLE_UNBLOCK_INTERRUPTIONS(); @@ -388,7 +388,7 @@ new_packed: p->h = h; p->key = NULL; ZVAL_COPY_VALUE(&p->val, pData); - p->val.u.next = INVALID_IDX; + Z_NEXT(p->val) = INVALID_IDX; HANDLE_UNBLOCK_INTERRUPTIONS(); @@ -433,7 +433,7 @@ convert_to_hash: p->key = NULL; nIndex = h & ht->nTableMask; ZVAL_COPY_VALUE(&p->val, pData); - p->val.u.next = ht->arHash[nIndex]; + Z_NEXT(p->val) = ht->arHash[nIndex]; ht->arHash[nIndex] = idx; HANDLE_UNBLOCK_INTERRUPTIONS(); @@ -486,7 +486,7 @@ ZEND_API int zend_hash_rehash(HashTable *ht) } } nIndex = ht->arData[j].h & ht->nTableMask; - ht->arData[j].val.u.next = ht->arHash[nIndex]; + Z_NEXT(ht->arData[j].val) = ht->arHash[nIndex]; ht->arHash[nIndex] = j; j++; } @@ -498,9 +498,9 @@ static zend_always_inline void _zend_hash_del_el_ex(HashTable *ht, uint idx, Buc { if (!(ht->flags & HASH_FLAG_PACKED)) { if (prev) { - prev->val.u.next = p->val.u.next; + Z_NEXT(prev->val) = Z_NEXT(p->val); } else { - ht->arHash[p->h & ht->nTableMask] = p->val.u.next; + ht->arHash[p->h & ht->nTableMask] = Z_NEXT(p->val); } } if (ht->nNumUsed - 1 == idx) { @@ -544,11 +544,11 @@ static zend_always_inline void _zend_hash_del_el(HashTable *ht, uint idx, Bucket idx = ht->arHash[nIndex]; if (p != ht->arData + idx) { prev = ht->arData + idx; - while (ht->arData + prev->val.u.next != p) { - idx = prev->val.u.next; + while (ht->arData + Z_NEXT(prev->val) != p) { + idx = Z_NEXT(prev->val); prev = ht->arData + idx; } - idx = prev->val.u.next; + idx = Z_NEXT(prev->val); } } @@ -589,7 +589,7 @@ ZEND_API int zend_hash_del(HashTable *ht, zend_string *key) return SUCCESS; } prev = p; - idx = p->val.u.next; + idx = Z_NEXT(p->val); } return FAILURE; } @@ -641,7 +641,7 @@ ZEND_API int zend_hash_del_ind(HashTable *ht, zend_string *key) return SUCCESS; } prev = p; - idx = p->val.u.next; + idx = Z_NEXT(p->val); } return FAILURE; } @@ -688,7 +688,7 @@ ZEND_API int zend_hash_str_del(HashTable *ht, const char *str, int len) return SUCCESS; } prev = p; - idx = p->val.u.next; + idx = Z_NEXT(p->val); } return FAILURE; } @@ -722,7 +722,7 @@ ZEND_API int zend_hash_str_del_ind(HashTable *ht, const char *str, int len) return SUCCESS; } prev = p; - idx = p->val.u.next; + idx = Z_NEXT(p->val); } return FAILURE; } @@ -763,7 +763,7 @@ ZEND_API int zend_hash_index_del(HashTable *ht, ulong h) return SUCCESS; } prev = p; - idx = p->val.u.next; + idx = Z_NEXT(p->val); } return FAILURE; } @@ -1292,7 +1292,7 @@ ZEND_API int zend_hash_set_pointer(HashTable *ht, const HashPointer *ptr) ht->nInternalPointer = idx; return 1; } - idx = ht->arData[idx].val.u.next; + idx = Z_NEXT(ht->arData[idx].val); } } return 0; @@ -1516,7 +1516,7 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zend_s if (q->h == num_index && q->key == NULL) { break; } - idx2 = q->val.u.next; + idx2 = Z_NEXT(q->val); } } else if (key_type == HASH_KEY_IS_STRING) { h = STR_HASH_VAL(str_index); @@ -1536,7 +1536,7 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zend_s memcmp(q->key->val, str_index->val, str_index->len) == 0)) { break; } - idx2 = q->val.u.next; + idx2 = Z_NEXT(q->val); } } else { return FAILURE; @@ -1562,13 +1562,13 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zend_s /* remove old key from hash */ if (ht->arHash[p->h & ht->nTableMask] == idx1) { - ht->arHash[p->h & ht->nTableMask] = p->val.u.next; + ht->arHash[p->h & ht->nTableMask] = Z_NEXT(p->val); } else { uint idx3 = ht->arHash[p->h & ht->nTableMask]; - while (ht->arData[idx3].val.u.next != idx1) { - idx3 = ht->arData[idx3].val.u.next; + while (Z_NEXT(ht->arData[idx3].val) != idx1) { + idx3 = Z_NEXT(ht->arData[idx3].val); } - ht->arData[idx3].val.u.next = p->val.u.next; + Z_NEXT(ht->arData[idx3].val) = Z_NEXT(p->val); } /* update key */ @@ -1585,7 +1585,7 @@ ZEND_API int zend_hash_update_current_key_ex(HashTable *ht, int key_type, zend_s } /* insert new key into hash */ - p->val.u.next = ht->arHash[p->h & ht->nTableMask]; + Z_NEXT(p->val) = ht->arHash[p->h & ht->nTableMask]; ht->arHash[p->h & ht->nTableMask] = idx1; HANDLE_UNBLOCK_INTERRUPTIONS(); diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c index 03bf6611f6..9959d96fc7 100644 --- a/Zend/zend_highlight.c +++ b/Zend/zend_highlight.c @@ -92,7 +92,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini zend_printf(""); zend_printf("\n", last_color); /* highlight stuff coming back from zendlex() */ - token.type = 0; + ZVAL_UNDEF(&token); while ((token_type=lex_scan(&token TSRMLS_CC))) { switch (token_type) { case T_INLINE_HTML: @@ -116,11 +116,11 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini break; case T_WHITESPACE: zend_html_puts((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC); /* no color needed */ - token.type = 0; + ZVAL_UNDEF(&token); continue; break; default: - if (token.type == 0) { + if (Z_TYPE(token) == IS_UNDEF) { next_color = syntax_highlighter_ini->highlight_keyword; } else { next_color = syntax_highlighter_ini->highlight_default; @@ -140,7 +140,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini zend_html_puts((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng) TSRMLS_CC); - if (token.type == IS_STRING) { + if (Z_TYPE(token) == IS_STRING) { switch (token_type) { case T_OPEN_TAG: case T_OPEN_TAG_WITH_ECHO: @@ -154,7 +154,7 @@ ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini break; } } - token.type = 0; + ZVAL_UNDEF(&token); } if (last_color != syntax_highlighter_ini->highlight_html) { @@ -170,7 +170,7 @@ ZEND_API void zend_strip(TSRMLS_D) int token_type; int prev_space = 0; - token.type = 0; + ZVAL_UNDEF(&token); while ((token_type=lex_scan(&token TSRMLS_CC))) { switch (token_type) { case T_WHITESPACE: @@ -181,7 +181,7 @@ ZEND_API void zend_strip(TSRMLS_D) /* lack of break; is intentional */ case T_COMMENT: case T_DOC_COMMENT: - token.type = 0; + ZVAL_UNDEF(&token); continue; case T_END_HEREDOC: @@ -192,7 +192,7 @@ ZEND_API void zend_strip(TSRMLS_D) } zend_write("\n", sizeof("\n") - 1); prev_space = 1; - token.type = 0; + ZVAL_UNDEF(&token); continue; default: @@ -200,7 +200,7 @@ ZEND_API void zend_strip(TSRMLS_D) break; } - if (token.type == IS_STRING) { + if (Z_TYPE(token) == IS_STRING) { switch (token_type) { case T_OPEN_TAG: case T_OPEN_TAG_WITH_ECHO: @@ -215,7 +215,8 @@ ZEND_API void zend_strip(TSRMLS_D) break; } } - prev_space = token.type = 0; + prev_space = 0; + ZVAL_UNDEF(&token); } } diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c index 5d627d4c1d..05254a30bc 100644 --- a/Zend/zend_indent.c +++ b/Zend/zend_indent.c @@ -59,14 +59,14 @@ ZEND_API void zend_indent(TSRMLS_D) memset(emit_whitespace, 0, sizeof(int)*256); /* highlight stuff coming back from zendlex() */ - token.type = 0; + ZVAL_UNDEF(&token); while ((token_type=lex_scan(&token TSRMLS_CC))) { switch (token_type) { case T_INLINE_HTML: zend_write((char*)LANG_SCNG(yy_text), LANG_SCNG(yy_leng)); break; case T_WHITESPACE: { - token.type = 0; + ZVAL_UNDEF(&token); /* eat whitespace, emit newlines */ for (i=0; istd.gc.refcount > 0) { + if (--GC_REFCOUNT(iter) > 0) { return; } diff --git a/Zend/zend_language_scanner.c b/Zend/zend_language_scanner.c index fe2f7186c4..22474d171b 100644 --- a/Zend/zend_language_scanner.c +++ b/Zend/zend_language_scanner.c @@ -617,7 +617,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC) zend_op_array *retval; char *opened_path = NULL; - if (filename->type != IS_STRING) { + if (Z_TYPE_P(filename) != IS_STRING) { tmp = *filename; zval_copy_ctor(&tmp); convert_to_string(&tmp); @@ -1152,7 +1152,7 @@ inline_html: if (readsize < yyleng) { yyless(readsize); } - zendlval->type = IS_STRING; + Z_TYPE_P(zendlval) = IS_STRING; } else { ZVAL_STRINGL(zendlval, yytext, yyleng); } @@ -2952,12 +2952,12 @@ yy173: } else { Z_DVAL_P(zendlval) = zend_strtod(yytext, NULL); } - zendlval->type = IS_DOUBLE; + Z_TYPE_P(zendlval) = IS_DOUBLE; return T_DNUMBER; } } - zendlval->type = IS_LONG; + Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } #line 2964 "Zend/zend_language_scanner.c" @@ -3310,7 +3310,7 @@ yy200: } else { Z_LVAL_P(zendlval) = strtol(bin, NULL, 2); } - zendlval->type = IS_LONG; + Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } else { ZVAL_DOUBLE(zendlval, zend_bin_strtod(bin, NULL)); @@ -3346,7 +3346,7 @@ yy203: } else { Z_LVAL_P(zendlval) = strtol(hex, NULL, 16); } - zendlval->type = IS_LONG; + Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } else { ZVAL_DOUBLE(zendlval, zend_hex_strtod(hex, NULL)); diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 877eb78b66..b34ce73ff2 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -615,7 +615,7 @@ zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC) zend_op_array *retval; char *opened_path = NULL; - if (filename->type != IS_STRING) { + if (Z_TYPE_P(filename) != IS_STRING) { tmp = *filename; zval_copy_ctor(&tmp); convert_to_string(&tmp); @@ -1505,7 +1505,7 @@ NEWLINE ("\r"|"\n"|"\r\n") } else { Z_LVAL_P(zendlval) = strtol(bin, NULL, 2); } - zendlval->type = IS_LONG; + Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } else { ZVAL_DOUBLE(zendlval, zend_bin_strtod(bin, NULL)); @@ -1525,12 +1525,12 @@ NEWLINE ("\r"|"\n"|"\r\n") } else { Z_DVAL_P(zendlval) = zend_strtod(yytext, NULL); } - zendlval->type = IS_DOUBLE; + Z_TYPE_P(zendlval) = IS_DOUBLE; return T_DNUMBER; } } - zendlval->type = IS_LONG; + Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } @@ -1550,7 +1550,7 @@ NEWLINE ("\r"|"\n"|"\r\n") } else { Z_LVAL_P(zendlval) = strtol(hex, NULL, 16); } - zendlval->type = IS_LONG; + Z_TYPE_P(zendlval) = IS_LONG; return T_LNUMBER; } else { ZVAL_DOUBLE(zendlval, zend_hex_strtod(hex, NULL)); @@ -1815,7 +1815,7 @@ inline_html: if (readsize < yyleng) { yyless(readsize); } - zendlval->type = IS_STRING; + Z_TYPE_P(zendlval) = IS_STRING; } else { ZVAL_STRINGL(zendlval, yytext, yyleng); } diff --git a/Zend/zend_list.c b/Zend/zend_list.c index 42450695d1..2566eb6d2e 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -43,7 +43,7 @@ ZEND_API zval *zend_list_insert(void *ptr, int type TSRMLS_DC) ZEND_API int _zend_list_delete(zend_resource *res TSRMLS_DC) { - if (res->gc.refcount <= 0) { + if (GC_REFCOUNT(res) <= 0) { return zend_hash_index_del(&EG(regular_list), res->handle); } else { return SUCCESS; @@ -52,7 +52,7 @@ ZEND_API int _zend_list_delete(zend_resource *res TSRMLS_DC) ZEND_API int _zend_list_close(zend_resource *res TSRMLS_DC) { - if (res->gc.refcount <= 0) { + if (GC_REFCOUNT(res) <= 0) { return zend_list_delete(res); } else if (res->type >= 0) { zend_rsrc_list_dtors_entry *ld; diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index ec353b7a2c..bf985b12bc 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -28,10 +28,8 @@ ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC) { - object->gc.refcount = 1; - object->gc.u.v.type = IS_OBJECT; - object->gc.u.v.flags = 0; - object->gc.u.v.gc_info = 0; + GC_REFCOUNT(object) = 1; + GC_TYPE_INFO(object) = IS_OBJECT; object->ce = ce; object->properties = NULL; object->guards = NULL; diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index be215ed086..a65b4a993e 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -48,11 +48,11 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS zend_object *obj = objects->object_buckets[i]; if (IS_VALID(obj)) { - if (!(obj->gc.u.v.flags & IS_OBJ_DESTRUCTOR_CALLED)) { - obj->gc.u.v.flags |= IS_OBJ_DESTRUCTOR_CALLED; - obj->gc.refcount++; + if (!(GC_FLAGS(obj) & IS_OBJ_DESTRUCTOR_CALLED)) { + GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED; + GC_REFCOUNT(obj)++; obj->handlers->dtor_obj(obj TSRMLS_CC); - obj->gc.refcount--; + GC_REFCOUNT(obj)--; } } } @@ -69,7 +69,7 @@ ZEND_API void zend_objects_store_mark_destructed(zend_objects_store *objects TSR zend_object *obj = objects->object_buckets[i]; if (IS_VALID(obj)) { - obj->gc.u.v.flags |= IS_OBJ_DESTRUCTOR_CALLED; + GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED; } } } @@ -136,24 +136,24 @@ ZEND_API void zend_objects_store_del(zend_object *object TSRMLS_DC) /* {{{ */ */ if (EG(objects_store).object_buckets && IS_VALID(EG(objects_store).object_buckets[object->handle])) { - if (object->gc.refcount == 0) { + if (GC_REFCOUNT(object) == 0) { int failure = 0; - if (!(object->gc.u.v.flags & IS_OBJ_DESTRUCTOR_CALLED)) { - object->gc.u.v.flags |= IS_OBJ_DESTRUCTOR_CALLED; + if (!(GC_FLAGS(object) & IS_OBJ_DESTRUCTOR_CALLED)) { + GC_FLAGS(object) |= IS_OBJ_DESTRUCTOR_CALLED; if (object->handlers->dtor_obj) { - object->gc.refcount++; + GC_REFCOUNT(object)++; zend_try { object->handlers->dtor_obj(object TSRMLS_CC); } zend_catch { failure = 1; } zend_end_try(); - object->gc.refcount--; + GC_REFCOUNT(object)--; } } - if (object->gc.refcount == 0) { + if (GC_REFCOUNT(object) == 0) { zend_uint handle = object->handle; EG(objects_store).object_buckets[handle] = SET_INVALID(object); @@ -171,7 +171,7 @@ ZEND_API void zend_objects_store_del(zend_object *object TSRMLS_DC) /* {{{ */ zend_bailout(); } } else { - object->gc.refcount--; + GC_REFCOUNT(object)--; } } } @@ -218,7 +218,7 @@ ZEND_API void zend_object_store_set_object(zval *zobject, zend_object *object TS /* Called when the ctor was terminated by an exception */ ZEND_API void zend_object_store_ctor_failed(zend_object *obj TSRMLS_DC) { - obj->gc.u.v.flags |= IS_OBJ_DESTRUCTOR_CALLED; + GC_FLAGS(obj) |= IS_OBJ_DESTRUCTOR_CALLED; } /* Proxy objects workings */ @@ -254,9 +254,8 @@ ZEND_API zend_object *zend_object_create_proxy(zval *object, zval *member TSRMLS { zend_proxy_object *obj = emalloc(sizeof(zend_proxy_object)); - obj->std.gc.refcount = 1; - obj->std.gc.u.v.type = IS_OBJECT; - obj->std.gc.u.v.gc_info = 0; + GC_REFCOUNT(obj) = 1; + GC_TYPE_INFO(obj) = IS_OBJECT; obj->std.ce = NULL; obj->std.properties = NULL; obj->std.guards = NULL; diff --git a/Zend/zend_objects_API.h b/Zend/zend_objects_API.h index e54d9f53b6..f3800c855b 100644 --- a/Zend/zend_objects_API.h +++ b/Zend/zend_objects_API.h @@ -66,7 +66,7 @@ #define OBJ_RELEASE(obj) do { \ zend_object *_obj = (obj); \ - if (--_obj->gc.refcount == 0) { \ + if (--GC_REFCOUNT(_obj) == 0) { \ zend_objects_store_del(_obj TSRMLS_CC); \ } else { \ gc_possible_root(&_obj->gc TSRMLS_CC); \ diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 7a463b5494..f2082b4ba0 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -772,7 +772,7 @@ ZEND_API void convert_to_object(zval *op) /* {{{ */ memcpy(properties, Z_ARRVAL_P(op), sizeof(HashTable)); object_and_properties_init(op, zend_standard_class_def, properties); - if (--arr->gc.refcount == 0) { + if (--GC_REFCOUNT(arr) == 0) { efree(arr); } break; diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 052abf364c..1fe473ba52 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -338,8 +338,8 @@ ZEND_API void multi_convert_to_double_ex(int argc, ...); ZEND_API void multi_convert_to_string_ex(int argc, ...); ZEND_API int add_char_to_string(zval *result, const zval *op1, const zval *op2); ZEND_API int add_string_to_string(zval *result, const zval *op1, const zval *op2); -#define convert_to_cstring(op) if ((op)->type != IS_STRING) { _convert_to_cstring((op) ZEND_FILE_LINE_CC); } -#define convert_to_string(op) if ((op)->type != IS_STRING) { _convert_to_string((op) ZEND_FILE_LINE_CC); } +#define convert_to_cstring(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_cstring((op) ZEND_FILE_LINE_CC); } +#define convert_to_string(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_string((op) ZEND_FILE_LINE_CC); } ZEND_API double zend_string_to_double(const char *number, zend_uint length); @@ -449,7 +449,7 @@ ZEND_API void zend_update_current_locale(void); /* The offset in bytes between the value and type fields of a zval */ #define ZVAL_OFFSETOF_TYPE \ - (offsetof(zval,type) - offsetof(zval,value)) + (offsetof(zval, u.v.type) - offsetof(zval, value)) static zend_always_inline int fast_increment_function(zval *op1) { diff --git a/Zend/zend_string.c b/Zend/zend_string.c index abd784ed5f..c6a1f0183f 100644 --- a/Zend/zend_string.c +++ b/Zend/zend_string.c @@ -37,8 +37,8 @@ ZEND_API zend_ulong zend_hash_func(const char *str, uint len) static void _str_dtor(zval *zv) { zend_string *str = Z_STR_P(zv); - str->gc.u.v.flags &= ~IS_STR_INTERNED; - str->gc.refcount = 1; + GC_FLAGS(str) &= ~IS_STR_INTERNED; + GC_REFCOUNT(str) = 1; } void zend_interned_strings_init(TSRMLS_D) @@ -104,12 +104,12 @@ static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC) return p->key; } } - idx = p->val.u.next; + idx = Z_NEXT(p->val); } - str->gc.refcount = 1; + GC_REFCOUNT(str) = 1; // str->gc.u.v.type = IS_INTERNED_STRING; - str->gc.u.v.flags |= IS_STR_INTERNED; + GC_FLAGS(str) |= IS_STR_INTERNED; //??? if (CG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength) >= //??? CG(interned_strings_end)) { @@ -154,7 +154,7 @@ static zend_string *zend_new_interned_string_int(zend_string *str TSRMLS_DC) Z_STR(p->val) = str; Z_TYPE(p->val) = IS_STRING; nIndex = h & CG(interned_strings).nTableMask; - p->val.u.next = CG(interned_strings).arHash[nIndex]; + Z_NEXT(p->val) = CG(interned_strings).arHash[nIndex]; CG(interned_strings).arHash[nIndex] = idx; HANDLE_UNBLOCK_INTERRUPTIONS(); @@ -175,8 +175,8 @@ static void zend_interned_strings_snapshot_int(TSRMLS_D) while (idx > 0) { idx--; p = CG(interned_strings).arData + idx; - ZEND_ASSERT(p->key->gc.u.v.flags & IS_STR_PERSISTENT); - p->key->gc.u.v.flags |= IS_STR_PERMANENT; + ZEND_ASSERT(GC_FLAGS(p->key) & IS_STR_PERSISTENT); + GC_FLAGS(p->key) |= IS_STR_PERMANENT; } #endif } @@ -192,23 +192,23 @@ static void zend_interned_strings_restore_int(TSRMLS_D) while (idx > 0) { idx--; p = CG(interned_strings).arData + idx; - if (p->key->gc.u.v.flags & IS_STR_PERMANENT) break; + if (GC_FLAGS(p->key) & IS_STR_PERMANENT) break; CG(interned_strings).nNumUsed--; CG(interned_strings).nNumOfElements--; - p->key->gc.u.v.flags &= ~IS_STR_INTERNED; - p->key->gc.refcount = 1; + GC_FLAGS(p->key) &= ~IS_STR_INTERNED; + GC_REFCOUNT(p->key) = 1; STR_FREE(p->key); nIndex = p->h & CG(interned_strings).nTableMask; if (CG(interned_strings).arHash[nIndex] == idx) { - CG(interned_strings).arHash[nIndex] = p->val.u.next; + CG(interned_strings).arHash[nIndex] = Z_NEXT(p->val); } else { uint prev = CG(interned_strings).arHash[nIndex]; - while (CG(interned_strings).arData[prev].val.u.next != idx) { - prev = CG(interned_strings).arData[prev].val.u.next; + while (Z_NEXT(CG(interned_strings).arData[prev].val) != idx) { + prev = Z_NEXT(CG(interned_strings).arData[prev].val); } - CG(interned_strings).arData[prev].val.u.next = p->val.u.next; + Z_NEXT(CG(interned_strings).arData[prev].val) = Z_NEXT(p->val); } } #endif diff --git a/Zend/zend_string.h b/Zend/zend_string.h index 3a94ba03e8..0687700be8 100644 --- a/Zend/zend_string.h +++ b/Zend/zend_string.h @@ -36,7 +36,7 @@ void zend_interned_strings_dtor(TSRMLS_D); END_EXTERN_C() #ifndef ZTS -# define IS_INTERNED(s) ((s)->gc.u.v.flags & IS_STR_INTERNED) +# define IS_INTERNED(s) (GC_FLAGS(s) & IS_STR_INTERNED) #else # define IS_INTERNED(s) 0 #endif @@ -72,7 +72,7 @@ static zend_always_inline void zend_str_forget_hash_val(zend_string *s) static zend_always_inline zend_uint zend_str_refcount(zend_string *s) { if (!IS_INTERNED(s)) { - return s->gc.refcount; + return GC_REFCOUNT(s); } return 1; } @@ -80,7 +80,7 @@ static zend_always_inline zend_uint zend_str_refcount(zend_string *s) static zend_always_inline zend_uint zend_str_addref(zend_string *s) { if (!IS_INTERNED(s)) { - return ++s->gc.refcount; + return ++GC_REFCOUNT(s); } return 1; } @@ -88,7 +88,7 @@ static zend_always_inline zend_uint zend_str_addref(zend_string *s) static zend_always_inline zend_uint zend_str_delref(zend_string *s) { if (!IS_INTERNED(s)) { - return --s->gc.refcount; + return --GC_REFCOUNT(s); } return 1; } @@ -97,10 +97,11 @@ static zend_always_inline zend_string *zend_str_alloc(int len, int persistent) { zend_string *ret = pemalloc(sizeof(zend_string) + len, persistent); - ret->gc.refcount = 1; - ret->gc.u.v.type = IS_STRING; - ret->gc.u.v.flags = (persistent ? IS_STR_PERSISTENT : 0); - ret->gc.u.v.gc_info = 0; + GC_REFCOUNT(ret) = 1; +// TODO use one assignment ??? + GC_TYPE(ret) = IS_STRING; + GC_FLAGS(ret) = (persistent ? IS_STR_PERSISTENT : 0); + GC_INFO(ret) = 0; ret->h = 0; ret->len = len; return ret; @@ -155,7 +156,7 @@ static zend_always_inline void zend_str_free(zend_string *s) { if (!IS_INTERNED(s)) { ZEND_ASSERT(STR_REFCOUNT(s) <= 1); - pefree(s, s->gc.u.v.flags & IS_STR_PERSISTENT); + pefree(s, GC_FLAGS(s) & IS_STR_PERSISTENT); } } @@ -163,7 +164,7 @@ static zend_always_inline void zend_str_release(zend_string *s) { if (!IS_INTERNED(s)) { if (STR_DELREF(s) == 0) { - pefree(s, s->gc.u.v.flags & IS_STR_PERSISTENT); + pefree(s, GC_FLAGS(s) & IS_STR_PERSISTENT); } } } diff --git a/Zend/zend_types.h b/Zend/zend_types.h index fb299d31ec..d9dd039b73 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -22,6 +22,22 @@ #ifndef ZEND_TYPES_H #define ZEND_TYPES_H +#ifdef WORDS_BIGENDIAN +# define ZEND_ENDIAN_LOHI(lo, hi) hi; lo; +# define ZEND_ENDIAN_LOHI_3(lo, mi, hi) hi; mi; lo; +# define ZEND_ENDIAN_LOHI_4(a, b, c, d) d; c; b; a; +# define ZEND_ENDIAN_LOHI_C(lo, hi) hi, lo +# define ZEND_ENDIAN_LOHI_C_3(lo, mi, hi) hi, mi, lo, +# define ZEND_ENDIAN_LOHI_C_4(a, b, c, d) d, c, b, a +#else +# define ZEND_ENDIAN_LOHI(lo, hi) lo; hi; +# define ZEND_ENDIAN_LOHI_3(lo, mi, hi) lo; mi; hi; +# define ZEND_ENDIAN_LOHI_4(a, b, c, d) a; b; c; d; +# define ZEND_ENDIAN_LOHI_C(lo, hi) lo, hi +# define ZEND_ENDIAN_LOHI_C_3(lo, mi, hi) lo, mi, hi, +# define ZEND_ENDIAN_LOHI_C_4(a, b, c, d) a, b, c, d +#endif + typedef unsigned char zend_bool; typedef unsigned char zend_uchar; typedef unsigned int zend_uint; @@ -90,22 +106,29 @@ typedef union _zend_value { struct _zval_struct { zend_value value; /* value */ - zend_uchar type; /* active type */ - zend_uchar var_flags; /* various IS_VAR flags */ union { - zend_uint next; /* hash collision chain */ + struct { + ZEND_ENDIAN_LOHI_4( + zend_uchar type, /* active type */ + zend_uchar flags, /* various IS_VAR flags */ + zend_uchar res1, + zend_uchar res2) + } v; + zend_uint type_info; } u; + zend_uint next; /* hash collision chain */ }; struct _zend_refcounted { zend_uint refcount; /* reference counter 32-bit */ union { struct { - zend_uchar type; - zend_uchar flags; /* used for strings & objects */ - zend_ushort gc_info; /* keeps GC root number (or 0) and color */ + ZEND_ENDIAN_LOHI_3( + zend_uchar type, + zend_uchar flags, /* used for strings & objects */ + zend_ushort gc_info) /* keeps GC root number (or 0) and color */ } v; - zend_uint long_type; + zend_uint type_info; } u; }; @@ -210,9 +233,39 @@ struct _zend_ast_ref { /* All data types < IS_STRING have their constructor/destructors skipped */ #define IS_REFCOUNTED(type) ((type) >= IS_STRING) -#define Z_TYPE(zval) (zval).type +#define Z_TYPE(zval) (zval).u.v.type #define Z_TYPE_P(zval_p) Z_TYPE(*(zval_p)) +#define Z_FLAGS(zval) (zval).u.v.flags +#define Z_FLAGS_P(zval_p) Z_FLAGS(*(zval_p)) + +#define Z_TYPE_INFO(zval) (zval).u.type_info +#define Z_TYPE_INFO_P(zval_p) Z_TYPE_INFO(*(zval_p)) + +#define Z_NEXT(zval) (zval).next +#define Z_NEXT_P(zval_p) Z_NEXT(*(zval_p)) + +#define Z_COUNTED(zval) (zval).value.counted +#define Z_COUNTED_P(zval_p) Z_COUNTED(*(zval_p)) + +#define GC_REFCOUNT(p) ((zend_refcounted*)(p))->refcount +#define GC_TYPE(p) ((zend_refcounted*)(p))->u.v.type +#define GC_FLAGS(p) ((zend_refcounted*)(p))->u.v.flags +#define GC_INFO(p) ((zend_refcounted*)(p))->u.v.gc_info +#define GC_TYPE_INFO(p) ((zend_refcounted*)(p))->u.type_info + +#define Z_GC_TYPE(zval) GC_TYPE(Z_COUNTED(zval)) +#define Z_GC_TYPE_P(zval_p) Z_GC_TYPE(*(zval_p)) + +#define Z_GC_FLAGS(zval) GC_FLAGS(Z_COUNTED(zval)) +#define Z_GC_FLAGS_P(zval_p) Z_GC_TYPE(*(zval_p)) + +#define Z_GC_INFO(zval) GC_INFO(Z_COUNTED(zval)) +#define Z_GC_INFO_P(zval_p) Z_GC_INFO(*(zval_p)) + +#define Z_GC_TYPE_INFO(zval) GC_TYPE_INFO(Z_COUNTED(zval)) +#define Z_GC_TYPE_INFO_P(zval_p) Z_GC_TYPE_INFO(*(zval_p)) + /* zval.var_flags */ #define IS_VAR_RET_REF (1<<0) /* return by by reference */ @@ -230,18 +283,18 @@ struct _zend_ast_ref { #define IS_OBJ_DESTRUCTOR_CALLED (1<<3) #define Z_OBJ_APPLY_COUNT(zval) \ - (Z_OBJ(zval)->gc.u.v.flags & IS_OBJ_APPLY_COUNT) + (Z_GC_FLAGS(zval) & IS_OBJ_APPLY_COUNT) #define Z_OBJ_INC_APPLY_COUNT(zval) do { \ - Z_OBJ(zval)->gc.u.v.flags = \ - (Z_OBJ(zval)->gc.u.v.flags & ~IS_OBJ_APPLY_COUNT) | \ - ((Z_OBJ(zval)->gc.u.v.flags & IS_OBJ_APPLY_COUNT) + 1); \ + Z_GC_FLAGS(zval) = \ + (Z_GC_FLAGS(zval) & ~IS_OBJ_APPLY_COUNT) | \ + ((Z_GC_FLAGS(zval) & IS_OBJ_APPLY_COUNT) + 1); \ } while (0) #define Z_OBJ_DEC_APPLY_COUNT(zval) do { \ - Z_OBJ(zval)->gc.u.v.flags = \ - (Z_OBJ(zval)->gc.u.v.flags & ~IS_OBJ_APPLY_COUNT) | \ - ((Z_OBJ(zval)->gc.u.v.flags & IS_OBJ_APPLY_COUNT) - 1); \ + Z_GC_FLAGS(zval) = \ + (Z_GC_FLAGS(zval) & ~IS_OBJ_APPLY_COUNT) | \ + ((Z_GC_FLAGS(zval) & IS_OBJ_APPLY_COUNT) - 1); \ } while (0) #define Z_OBJ_APPLY_COUNT_P(zv) Z_OBJ_APPLY_COUNT(*(zv)) @@ -265,15 +318,6 @@ struct _zend_ast_ref { #define Z_DVAL(zval) (zval).value.dval #define Z_DVAL_P(zval_p) Z_DVAL(*(zval_p)) -#define Z_COUNTED(zval) (zval).value.counted -#define Z_COUNTED_P(zval_p) Z_COUNTED(*(zval_p)) - -#define Z_GC_TYPE(zval) Z_COUNTED(zval)->type -#define Z_GC_TYPE_P(zval_p) Z_GC_TYPE(*(zval_p)) - -#define Z_GC_INFO(zval) Z_COUNTED(zval)->u.v.gc_info -#define Z_GC_INFO_P(zval_p) Z_GC_INFO(*(zval_p)) - #define Z_STR(zval) (zval).value.str #define Z_STR_P(zval_p) Z_STR(*(zval_p)) @@ -393,9 +437,8 @@ struct _zend_ast_ref { #define ZVAL_NEW_ARR(z) do { \ zval *__z = (z); \ zend_array *_arr = emalloc(sizeof(zend_array)); \ - _arr->gc.refcount = 1; \ - _arr->gc.u.v.type = IS_ARRAY; \ - _arr->gc.u.v.gc_info = 0; \ + GC_REFCOUNT(_arr) = 1; \ + GC_TYPE_INFO(_arr) = IS_ARRAY; \ Z_ARR_P(__z) = _arr; \ Z_TYPE_P(__z) = IS_ARRAY; \ } while (0) @@ -403,9 +446,8 @@ struct _zend_ast_ref { #define ZVAL_NEW_PERSISTENT_ARR(z) do { \ zval *__z = (z); \ zend_array *_arr = malloc(sizeof(zend_array)); \ - _arr->gc.refcount = 1; \ - _arr->gc.u.v.type = IS_ARRAY; \ - _arr->gc.u.v.gc_info = 0; \ + GC_REFCOUNT(_arr) = 1; \ + GC_TYPE_INFO(_arr) = IS_ARRAY; \ Z_ARR_P(__z) = _arr; \ Z_TYPE_P(__z) = IS_ARRAY; \ } while (0) @@ -424,9 +466,8 @@ struct _zend_ast_ref { #define ZVAL_NEW_RES(z, h, p, t) do { \ zend_resource *_res = emalloc(sizeof(zend_resource)); \ - _res->gc.refcount = 1; \ - _res->gc.u.v.type = IS_RESOURCE; \ - _res->gc.u.v.gc_info = 0; \ + GC_REFCOUNT(_res) = 1; \ + GC_TYPE_INFO(_res) = IS_RESOURCE; \ _res->handle = (h); \ _res->type = (t); \ _res->ptr = (p); \ @@ -437,9 +478,8 @@ struct _zend_ast_ref { #define ZVAL_NEW_PERSISTENT_RES(z, h, p, t) do { \ zend_resource *_res = malloc(sizeof(zend_resource)); \ - _res->gc.refcount = 1; \ - _res->gc.u.v.type = IS_RESOURCE; \ - _res->gc.u.v.gc_info = 0; \ + GC_REFCOUNT(_res) = 1; \ + GC_TYPE_INFO(_res) = IS_RESOURCE; \ _res->handle = (h); \ _res->type = (t); \ _res->ptr = (p); \ @@ -456,9 +496,8 @@ struct _zend_ast_ref { #define ZVAL_NEW_REF(z, r) do { \ zend_reference *_ref = emalloc(sizeof(zend_reference)); \ - _ref->gc.refcount = 1; \ - _ref->gc.u.v.type = IS_REFERENCE; \ - _ref->gc.u.v.gc_info = 0; \ + GC_REFCOUNT(_ref) = 1; \ + GC_TYPE_INFO(_ref) = IS_REFERENCE; \ ZVAL_COPY_VALUE(&_ref->val, r); \ Z_REF_P(z) = _ref; \ Z_TYPE_P(z) = IS_REFERENCE; \ @@ -467,9 +506,8 @@ struct _zend_ast_ref { #define ZVAL_NEW_AST(z, a) do { \ zval *__z = (z); \ zend_ast_ref *_ast = emalloc(sizeof(zend_ast_ref)); \ - _ast->gc.refcount = 1; \ - _ast->gc.u.v.type = IS_CONSTANT_AST; \ - _ast->gc.u.v.gc_info = 0; \ + GC_REFCOUNT(_ast) = 1; \ + GC_TYPE_INFO(_ast) = IS_CONSTANT_AST; \ _ast->ast = (a); \ Z_AST_P(__z) = _ast; \ Z_TYPE_P(__z) = IS_CONSTANT_AST; \ @@ -497,9 +535,8 @@ struct _zend_ast_ref { #define ZVAL_STR_OFFSET(z, s, o) do { \ zend_str_offset *x = emalloc(sizeof(zend_str_offset)); \ - x->gc.refcount = 1; \ - x->gc.u.v.type = IS_STR_OFFSET; \ - x->gc.u.v.gc_info = 0; \ + GC_REFCOUNT(x) = 1; \ + GC_TYPE_INFO(x) = IS_STR_OFFSET; \ x->str = (s); \ x->offset = (o); \ Z_STR_OFFSET_P(z) = x; \ diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index e9a0db8654..0a2059d4bc 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -30,7 +30,7 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC) { //??? switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) { - switch (p->u.v.type) { + switch (GC_TYPE(p)) { case IS_STRING: case IS_CONSTANT: { zend_string *str = (zend_string*)p; @@ -45,7 +45,7 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC) if (arr != &EG(symbol_table)) { /* break possible cycles */ - arr->gc.u.v.type = IS_NULL; + GC_TYPE(arr) = IS_NULL; zend_hash_destroy(&arr->ht); goto gc_exit; } @@ -69,7 +69,7 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC) zend_resource *res = (zend_resource*)p; TSRMLS_FETCH(); - if (--res->gc.refcount == 0) { + if (--GC_REFCOUNT(res) == 0) { /* destroy resource */ zend_list_delete(res); } @@ -77,7 +77,7 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC) } case IS_REFERENCE: { zend_reference *ref = (zend_reference*)p; - if (--ref->gc.refcount == 0) { + if (--GC_REFCOUNT(ref) == 0) { zval_ptr_dtor(&ref->val); goto gc_exit; } @@ -96,7 +96,7 @@ exit: ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC) { //??? switch (Z_TYPE_P(zvalue) & IS_CONSTANT_TYPE_MASK) { - switch (p->u.v.type) { + switch (GC_TYPE(p)) { case IS_STRING: case IS_CONSTANT: { zend_string *str = (zend_string*)p; @@ -111,7 +111,7 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC) if (arr != &EG(symbol_table)) { /* break possible cycles */ - arr->gc.u.v.type = IS_NULL; + GC_TYPE(arr) = IS_NULL; zend_hash_destroy(&arr->ht); goto gc_exit; } @@ -256,8 +256,8 @@ ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC) case IS_CONSTANT_AST: { zend_ast_ref *ast = emalloc(sizeof(zend_ast_ref)); - ast->gc.refcount = 1; - ast->gc.u.v.type = IS_CONSTANT_AST; + GC_REFCOUNT(ast) = 1; + GC_TYPE_INFO(ast) = IS_CONSTANT_AST; ast->ast = zend_ast_copy(Z_ASTVAL_P(zvalue)); Z_AST_P(zvalue) = ast; } diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 20ce76a06e..937eb9ef3d 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1807,7 +1807,7 @@ ZEND_VM_HANDLER(39, ZEND_ASSIGN_REF, VAR|CV, VAR|CV) value_ptr && !Z_ISREF_P(value_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && - !(value_ptr->var_flags & IS_VAR_RET_REF)) { + !(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { if (!OP2_FREE) { PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */ } @@ -2025,7 +2025,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) ZVAL_NULL(ret); //??? ret->var.ptr_ptr = &ret->var.ptr; - ret->var_flags = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; + Z_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; if (!zend_execute_internal) { /* saves one function call if zend_execute_internal is not used */ @@ -2050,7 +2050,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) ZVAL_NULL(return_value); //??? ret->var.ptr_ptr = &ret->var.ptr; - return_value->var_flags = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; + Z_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; } if (UNEXPECTED((EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) { @@ -2092,7 +2092,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) } else { //??? Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr); //??? Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1); - EX_VAR(opline->result.var)->var_flags = 0; + Z_FLAGS_P(EX_VAR(opline->result.var)) = 0; //??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr; } } @@ -2501,7 +2501,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV) if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -2617,7 +2617,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS } call->object = Z_OBJ(EG(This)); if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } } @@ -2691,7 +2691,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) Z_OBJ_HANDLER_P(function_name, get_closure) && Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &call->called_scope, &call->fbc, &call->object TSRMLS_CC) == SUCCESS) { if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } if (OP2_TYPE == IS_VAR && OP2_FREE && Z_REFCOUNT_P(function_name) == 1 && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { @@ -2756,7 +2756,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } } @@ -2913,7 +2913,7 @@ ZEND_VM_HANDLER(111, ZEND_RETURN_BY_REF, CONST|TMP|VAR|CV, ANY) if (OP1_TYPE == IS_VAR && !Z_ISREF_P(retval_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && - (retval_ptr->var_flags & IS_VAR_RET_REF)) { + (Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { //??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { } else { zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -3025,7 +3025,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV) } ZVAL_OBJ(EX_VAR(opline->op2.var), EG(exception)); if (UNEXPECTED(EG(exception) != exception)) { - EG(exception)->gc.refcount++; + GC_REFCOUNT(EG(exception))++; HANDLE_EXCEPTION(); } else { EG(exception) = NULL; @@ -3109,7 +3109,7 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY) varptr = GET_OP1_ZVAL_PTR(BP_VAR_R); if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) || - (varptr->var_flags & IS_VAR_RET_REF)) && + (Z_FLAGS_P(varptr) & IS_VAR_RET_REF)) && ((!Z_REFCOUNTED_P(varptr) && Z_TYPE_P(varptr) != IS_STRING) || Z_ISREF_P(varptr) || Z_TYPE_P(varptr) == IS_OBJECT || @@ -3909,7 +3909,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY) inc_filename = GET_OP1_ZVAL_PTR(BP_VAR_R); ZVAL_UNDEF(&tmp_inc_filename); - if (inc_filename->type!=IS_STRING) { + if (Z_TYPE_P(inc_filename) != IS_STRING) { ZVAL_DUP(&tmp_inc_filename, inc_filename); convert_to_string(&tmp_inc_filename); inc_filename = &tmp_inc_filename; @@ -5202,9 +5202,9 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) if (call->object) { if (call->is_ctor_call) { if (call->is_ctor_result_used) { - call->object->gc.refcount--; + GC_REFCOUNT(call->object)--; } - if (call->object->gc.refcount == 1) { + if (GC_REFCOUNT(call->object) == 1) { zend_object_store_ctor_failed(call->object TSRMLS_CC); } } @@ -5445,7 +5445,7 @@ ZEND_VM_HANDLER(160, ZEND_YIELD, CONST|TMP|VAR|CV|UNUSED, CONST|TMP|VAR|CV|UNUSE * not return by reference we throw a notice. */ if (OP1_TYPE == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 0614e1f3cb..6ce1f99b9c 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -554,7 +554,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR ZVAL_NULL(ret); //??? ret->var.ptr_ptr = &ret->var.ptr; - ret->var_flags = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; + Z_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; if (!zend_execute_internal) { /* saves one function call if zend_execute_internal is not used */ @@ -579,7 +579,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR ZVAL_NULL(return_value); //??? ret->var.ptr_ptr = &ret->var.ptr; - return_value->var_flags = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; + Z_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0; } if (UNEXPECTED((EG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) != 0)) { @@ -621,7 +621,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR } else { //??? Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr); //??? Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1); - EX_VAR(opline->result.var)->var_flags = 0; + Z_FLAGS_P(EX_VAR(opline->result.var)) = 0; //??? EX_T(opline->result.var).var.ptr_ptr = &EX_T(opline->result.var).var.ptr; } } @@ -1198,9 +1198,9 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER if (call->object) { if (call->is_ctor_call) { if (call->is_ctor_result_used) { - call->object->gc.refcount--; + GC_REFCOUNT(call->object)--; } - if (call->object->gc.refcount == 1) { + if (GC_REFCOUNT(call->object) == 1) { zend_object_store_ctor_failed(call->object TSRMLS_CC); } } @@ -1477,7 +1477,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE Z_OBJ_HANDLER_P(function_name, get_closure) && Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &call->called_scope, &call->fbc, &call->object TSRMLS_CC) == SUCCESS) { if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } if (IS_CONST == IS_VAR && 0 && Z_REFCOUNT_P(function_name) == 1 && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { @@ -1542,7 +1542,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } } @@ -1804,7 +1804,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H Z_OBJ_HANDLER_P(function_name, get_closure) && Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &call->called_scope, &call->fbc, &call->object TSRMLS_CC) == SUCCESS) { if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } if (IS_TMP_VAR == IS_VAR && 1 && Z_REFCOUNT_P(function_name) == 1 && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { @@ -1869,7 +1869,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } } @@ -1993,7 +1993,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H Z_OBJ_HANDLER_P(function_name, get_closure) && Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &call->called_scope, &call->fbc, &call->object TSRMLS_CC) == SUCCESS) { if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } if (IS_VAR == IS_VAR && (free_op2.var != NULL) && Z_REFCOUNT_P(function_name) == 1 && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { @@ -2058,7 +2058,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } } @@ -2219,7 +2219,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA Z_OBJ_HANDLER_P(function_name, get_closure) && Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &call->called_scope, &call->fbc, &call->object TSRMLS_CC) == SUCCESS) { if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } if (IS_CV == IS_VAR && 0 && Z_REFCOUNT_P(function_name) == 1 && call->fbc->common.fn_flags & ZEND_ACC_CLOSURE) { @@ -2284,7 +2284,7 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } } @@ -2602,7 +2602,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HAND if (IS_CONST == IS_VAR && !Z_ISREF_P(retval_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && - (retval_ptr->var_flags & IS_VAR_RET_REF)) { + (Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { //??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { } else { zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -2835,7 +2835,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA inc_filename = opline->op1.zv; ZVAL_UNDEF(&tmp_inc_filename); - if (inc_filename->type!=IS_STRING) { + if (Z_TYPE_P(inc_filename) != IS_STRING) { ZVAL_DUP(&tmp_inc_filename, inc_filename); convert_to_string(&tmp_inc_filename); inc_filename = &tmp_inc_filename; @@ -3835,7 +3835,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( } call->object = Z_OBJ(EG(This)); if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } } @@ -4274,7 +4274,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLE * not return by reference we throw a notice. */ if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -4760,7 +4760,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE } call->object = Z_OBJ(EG(This)); if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } } @@ -4927,7 +4927,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ * not return by reference we throw a notice. */ if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -5592,7 +5592,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE } call->object = Z_OBJ(EG(This)); if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } } @@ -5906,7 +5906,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ * not return by reference we throw a notice. */ if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -6279,7 +6279,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER } call->object = Z_OBJ(EG(This)); if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } } @@ -6595,7 +6595,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDL * not return by reference we throw a notice. */ if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -7081,7 +7081,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN } call->object = Z_OBJ(EG(This)); if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } } @@ -7139,7 +7139,7 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A } ZVAL_OBJ(EX_VAR(opline->op2.var), EG(exception)); if (UNEXPECTED(EG(exception) != exception)) { - EG(exception)->gc.refcount++; + GC_REFCOUNT(EG(exception))++; HANDLE_EXCEPTION(); } else { EG(exception) = NULL; @@ -7301,7 +7301,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A * not return by reference we throw a notice. */ if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -7676,7 +7676,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLE if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(retval_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && - (retval_ptr->var_flags & IS_VAR_RET_REF)) { + (Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { //??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { } else { zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -7910,7 +7910,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND inc_filename = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); ZVAL_UNDEF(&tmp_inc_filename); - if (inc_filename->type!=IS_STRING) { + if (Z_TYPE_P(inc_filename) != IS_STRING) { ZVAL_DUP(&tmp_inc_filename, inc_filename); convert_to_string(&tmp_inc_filename); inc_filename = &tmp_inc_filename; @@ -8953,7 +8953,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CONST_HANDLER(ZEND_OPCO if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -9266,7 +9266,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ * not return by reference we throw a notice. */ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -9751,7 +9751,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -9919,7 +9919,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR * not return by reference we throw a notice. */ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -10583,7 +10583,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -10898,7 +10898,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR * not return by reference we throw a notice. */ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -11455,7 +11455,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER * not return by reference we throw a notice. */ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -11939,7 +11939,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_ if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -12105,7 +12105,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG * not return by reference we throw a notice. */ if (IS_TMP_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -12672,7 +12672,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLE if (IS_VAR == IS_VAR && !Z_ISREF_P(retval_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && - (retval_ptr->var_flags & IS_VAR_RET_REF)) { + (Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { //??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { } else { zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -12772,7 +12772,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND varptr = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) || - (varptr->var_flags & IS_VAR_RET_REF)) && + (Z_FLAGS_P(varptr) & IS_VAR_RET_REF)) && ((!Z_REFCOUNTED_P(varptr) && Z_TYPE_P(varptr) != IS_STRING) || Z_ISREF_P(varptr) || Z_TYPE_P(varptr) == IS_OBJECT || @@ -13027,7 +13027,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND inc_filename = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); ZVAL_UNDEF(&tmp_inc_filename); - if (inc_filename->type!=IS_STRING) { + if (Z_TYPE_P(inc_filename) != IS_STRING) { ZVAL_DUP(&tmp_inc_filename, inc_filename); convert_to_string(&tmp_inc_filename); inc_filename = &tmp_inc_filename; @@ -15151,7 +15151,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCO if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -15266,7 +15266,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE } call->object = Z_OBJ(EG(This)); if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } } @@ -15966,7 +15966,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ * not return by reference we throw a notice. */ if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -17439,7 +17439,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -17555,7 +17555,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND } call->object = Z_OBJ(EG(This)); if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } } @@ -18016,7 +18016,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HANDLER_AR * not return by reference we throw a notice. */ if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -19626,7 +19626,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDL value_ptr && !Z_ISREF_P(value_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && - !(value_ptr->var_flags & IS_VAR_RET_REF)) { + !(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { if (!(free_op2.var != NULL)) { PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */ } @@ -19728,7 +19728,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -19844,7 +19844,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND } call->object = Z_OBJ(EG(This)); if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } } @@ -20452,7 +20452,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLER_AR * not return by reference we throw a notice. */ if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -21263,7 +21263,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z } call->object = Z_OBJ(EG(This)); if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } } @@ -21579,7 +21579,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER * not return by reference we throw a notice. */ if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -23007,7 +23007,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLE value_ptr && !Z_ISREF_P(value_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && - !(value_ptr->var_flags & IS_VAR_RET_REF)) { + !(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { if (!0) { PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */ } @@ -23108,7 +23108,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_ if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -23223,7 +23223,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ } call->object = Z_OBJ(EG(This)); if (call->object) { - call->object->gc.refcount++; + GC_REFCOUNT(call->object)++; } } @@ -23683,7 +23683,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARG * not return by reference we throw a notice. */ if (IS_VAR == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -24683,7 +24683,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER(ZEND_O if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -25140,7 +25140,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDL * not return by reference we throw a notice. */ if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -26064,7 +26064,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_TMP_HANDLER(ZEND_OPC if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -26429,7 +26429,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDLER * not return by reference we throw a notice. */ if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -27353,7 +27353,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_VAR_HANDLER(ZEND_OPC if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -27718,7 +27718,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDLER * not return by reference we throw a notice. */ if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -28120,7 +28120,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_UNUSED_HANDLER(ZEND_OPCODE_HAND * not return by reference we throw a notice. */ if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -29042,7 +29042,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CV_HANDLER(ZEND_OPCO if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -29406,7 +29406,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ * not return by reference we throw a notice. */ if (IS_UNUSED == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -29954,7 +29954,7 @@ static int ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER if (IS_CV == IS_VAR && !Z_ISREF_P(retval_ptr)) { if (opline->extended_value == ZEND_RETURNS_FUNCTION && - (retval_ptr->var_flags & IS_VAR_RET_REF)) { + (Z_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) { //??? } else if (EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { } else { zend_error(E_NOTICE, "Only variable references should be returned by reference"); @@ -30053,7 +30053,7 @@ static int ZEND_FASTCALL ZEND_SEND_VAR_NO_REF_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL varptr = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) || - (varptr->var_flags & IS_VAR_RET_REF)) && + (Z_FLAGS_P(varptr) & IS_VAR_RET_REF)) && ((!Z_REFCOUNTED_P(varptr) && Z_TYPE_P(varptr) != IS_STRING) || Z_ISREF_P(varptr) || Z_TYPE_P(varptr) == IS_OBJECT || @@ -30296,7 +30296,7 @@ static int ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL inc_filename = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); ZVAL_UNDEF(&tmp_inc_filename); - if (inc_filename->type!=IS_STRING) { + if (Z_TYPE_P(inc_filename) != IS_STRING) { ZVAL_DUP(&tmp_inc_filename, inc_filename); convert_to_string(&tmp_inc_filename); inc_filename = &tmp_inc_filename; @@ -32271,7 +32271,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST_HANDLER(ZEND_OPCOD if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -32874,7 +32874,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_A * not return by reference we throw a notice. */ if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -34338,7 +34338,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_ if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -34796,7 +34796,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG * not return by reference we throw a notice. */ if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -36397,7 +36397,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLE value_ptr && !Z_ISREF_P(value_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && - !(value_ptr->var_flags & IS_VAR_RET_REF)) { + !(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { if (!(free_op2.var != NULL)) { PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */ } @@ -36498,7 +36498,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_ if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -37103,7 +37103,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG * not return by reference we throw a notice. */ if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -38093,7 +38093,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ * not return by reference we throw a notice. */ if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); @@ -39512,7 +39512,7 @@ static int ZEND_FASTCALL ZEND_ASSIGN_REF_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER value_ptr && !Z_ISREF_P(value_ptr) && opline->extended_value == ZEND_RETURNS_FUNCTION && - !(value_ptr->var_flags & IS_VAR_RET_REF)) { + !(Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) { if (!0) { PZVAL_LOCK(value_ptr); /* undo the effect of get_zval_ptr_ptr() */ } @@ -39612,7 +39612,7 @@ static int ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HANDLER(ZEND_OPCODE_H if ((call->fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) { call->object = NULL; } else { - call->object->gc.refcount++; /* For $this pointer */ + GC_REFCOUNT(call->object)++; /* For $this pointer */ } call->num_additional_args = 0; @@ -40068,7 +40068,7 @@ static int ZEND_FASTCALL ZEND_YIELD_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS * not return by reference we throw a notice. */ if (IS_CV == IS_VAR && !Z_ISREF_P(value_ptr) && !(opline->extended_value == ZEND_RETURNS_FUNCTION - && (value_ptr->var_flags & IS_VAR_RET_REF)) + && (Z_FLAGS_P(value_ptr) & IS_VAR_RET_REF)) //??? && EX_T(opline->op1.var).var.ptr_ptr == &EX_T(opline->op1.var).var.ptr) { ) { zend_error(E_NOTICE, "Only variable references should be yielded by reference"); diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 5164072104..e0cd1e3015 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -3968,7 +3968,7 @@ zval *date_interval_read_property(zval *object, zval *member, int type, const ze zval tmp_member; timelib_sll value = -1; - if (member->type != IS_STRING) { + if (Z_TYPE_P(member) != IS_STRING) { tmp_member = *member; zval_copy_ctor(&tmp_member); convert_to_string(&tmp_member); @@ -4034,7 +4034,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, const php_interval_obj *obj; zval tmp_member, tmp_value; - if (member->type != IS_STRING) { + if (Z_TYPE_P(member) != IS_STRING) { tmp_member = *member; zval_copy_ctor(&tmp_member); convert_to_string(&tmp_member); @@ -4054,7 +4054,7 @@ void date_interval_write_property(zval *object, zval *member, zval *value, const #define SET_VALUE_FROM_STRUCT(n,m) \ if (strcmp(Z_STRVAL_P(member), m) == 0) { \ - if (value->type != IS_LONG) { \ + if (Z_TYPE_P(value) != IS_LONG) { \ tmp_value = *value; \ zval_copy_ctor(&tmp_value); \ convert_to_long(&tmp_value); \ diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index 40672f3ef6..163cded77d 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -427,11 +427,11 @@ static void _free_mysql_result(zend_resource *rsrc TSRMLS_DC) static void php_mysql_set_default_link(zend_resource *link TSRMLS_DC) { if (MySG(default_link) != NULL) { - if (--(MySG(default_link)->gc.refcount) == 0) { + if (--GC_REFCOUNT((MySG(default_link))) == 0) { zend_list_delete(MySG(default_link)); } } - ++link->gc.refcount; + ++GC_REFCOUNT(link); MySG(default_link) = link; } /* }}} */ @@ -568,7 +568,7 @@ ZEND_MODULE_STARTUP_D(mysql) le_result = zend_register_list_destructors_ex(_free_mysql_result, NULL, "mysql result", module_number); le_link = zend_register_list_destructors_ex(_close_mysql_link, NULL, "mysql link", module_number); le_plink = zend_register_list_destructors_ex(NULL, _close_mysql_plink, "mysql link persistent", module_number); - Z_TYPE(mysql_module_entry) = type; + mysql_module_entry.type = type; REGISTER_LONG_CONSTANT("MYSQL_ASSOC", MYSQL_ASSOC, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("MYSQL_NUM", MYSQL_NUM, CONST_CS | CONST_PERSISTENT); @@ -986,7 +986,7 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) link = (zend_resource *)index_ptr->ptr; if (link && (link->type == le_link || link->type == le_plink)) { - link->gc.refcount++; + GC_REFCOUNT(link)++; ZVAL_RES(return_value, link); php_mysql_set_default_link(link TSRMLS_CC); STR_RELEASE(hashed_details); @@ -1126,10 +1126,10 @@ PHP_FUNCTION(mysql_close) } #endif if (!mysql_link) { - --res->gc.refcount; + --GC_REFCOUNT(res); MySG(default_link) = NULL; } else if (mysql_link && Z_RES_P(mysql_link) == MySG(default_link)) { - --res->gc.refcount; + --GC_REFCOUNT(res); MySG(default_link) = NULL; zend_list_close(res); } else { @@ -2431,9 +2431,9 @@ PHP_FUNCTION(mysql_fetch_field) add_property_long(return_value, "primary_key", IS_PRI_KEY(mysql_field->flags)?1:0); add_property_long(return_value, "multiple_key", (mysql_field->flags&MULTIPLE_KEY_FLAG?1:0)); add_property_long(return_value, "unique_key", (mysql_field->flags&UNIQUE_KEY_FLAG?1:0)); - add_property_long(return_value, "numeric", IS_NUM(Z_TYPE_P(mysql_field))?1:0); + add_property_long(return_value, "numeric", IS_NUM(mysql_field->type)?1:0); add_property_long(return_value, "blob", IS_BLOB(mysql_field->flags)?1:0); - add_property_string(return_value, "type", php_mysql_get_field_name(Z_TYPE_P(mysql_field)), 1); + add_property_string(return_value, "type", php_mysql_get_field_name(mysql_field->type), 1); add_property_long(return_value, "unsigned", (mysql_field->flags&UNSIGNED_FLAG?1:0)); add_property_long(return_value, "zerofill", (mysql_field->flags&ZEROFILL_FLAG?1:0)); } @@ -2504,7 +2504,7 @@ static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type) RETVAL_LONG(mysql_field->length); break; case PHP_MYSQL_FIELD_TYPE: - RETVAL_STRING(php_mysql_get_field_name(Z_TYPE_P(mysql_field))); + RETVAL_STRING(php_mysql_get_field_name(mysql_field->type)); break; case PHP_MYSQL_FIELD_FLAGS: memcpy(buf, "", sizeof("")); diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index 221fd0f1f2..b8d226ef84 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -238,7 +238,7 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { if (ZEND_OP1_TYPE(opline) == IS_UNUSED && ZEND_OP2_TYPE(opline) == IS_CONST && - ZEND_OP2_LITERAL(opline).type == IS_STRING) { + Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) { /* substitute persistent constants */ zend_uint tv = ZEND_RESULT(opline).var; zval c; @@ -257,12 +257,12 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { /* class constant */ if (ZEND_OP1_TYPE(opline) != IS_UNUSED && ZEND_OP2_TYPE(opline) == IS_CONST && - ZEND_OP2_LITERAL(opline).type == IS_STRING) { + Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) { zend_class_entry *ce = NULL; if (ZEND_OP1_TYPE(opline) == IS_CONST && - ZEND_OP1_LITERAL(opline).type == IS_STRING) { + Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) { /* for A::B */ if (op_array->scope && !strncasecmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), @@ -348,8 +348,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) { extension_loaded(x) */ if (opline->extended_value == 1 && (opline - 1)->opcode == ZEND_SEND_VAL && - ZEND_OP1_TYPE(opline - 1) == IS_CONST && ZEND_OP1_LITERAL(opline - 1).type == IS_STRING && - ZEND_OP1_TYPE(opline) == IS_CONST && ZEND_OP1_LITERAL(opline).type == IS_STRING) { + ZEND_OP1_TYPE(opline - 1) == IS_CONST && Z_TYPE(ZEND_OP1_LITERAL(opline - 1)) == IS_STRING && + ZEND_OP1_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) { if ((Z_STRLEN(ZEND_OP1_LITERAL(opline)) == sizeof("function_exists")-1 && !memcmp(Z_STRVAL(ZEND_OP1_LITERAL(opline)), "function_exists", sizeof("function_exists")-1)) || diff --git a/ext/opcache/Optimizer/pass2.c b/ext/opcache/Optimizer/pass2.c index d5f4f0492b..e7e6f3d591 100644 --- a/ext/opcache/Optimizer/pass2.c +++ b/ext/opcache/Optimizer/pass2.c @@ -16,7 +16,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { case ZEND_MUL: case ZEND_DIV: if (ZEND_OP1_TYPE(opline) == IS_CONST) { - if (ZEND_OP1_LITERAL(opline).type == IS_STRING) { + if (Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) { convert_scalar_to_number(&ZEND_OP1_LITERAL(opline) TSRMLS_CC); } } @@ -30,7 +30,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { break; } if (ZEND_OP2_TYPE(opline) == IS_CONST) { - if (ZEND_OP2_LITERAL(opline).type == IS_STRING) { + if (Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) { convert_scalar_to_number(&ZEND_OP2_LITERAL(opline) TSRMLS_CC); } } @@ -40,7 +40,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { case ZEND_SL: case ZEND_SR: if (ZEND_OP1_TYPE(opline) == IS_CONST) { - if (ZEND_OP1_LITERAL(opline).type != IS_LONG) { + if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_LONG) { convert_to_long(&ZEND_OP1_LITERAL(opline)); } } @@ -53,7 +53,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { break; } if (ZEND_OP2_TYPE(opline) == IS_CONST) { - if (ZEND_OP2_LITERAL(opline).type != IS_LONG) { + if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_LONG) { convert_to_long(&ZEND_OP2_LITERAL(opline)); } } @@ -61,7 +61,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { case ZEND_CONCAT: if (ZEND_OP1_TYPE(opline) == IS_CONST) { - if (ZEND_OP1_LITERAL(opline).type != IS_STRING) { + if (Z_TYPE(ZEND_OP1_LITERAL(opline)) != IS_STRING) { convert_to_string(&ZEND_OP1_LITERAL(opline)); } } @@ -72,7 +72,7 @@ if (ZEND_OPTIMIZER_PASS_2 & OPTIMIZATION_LEVEL) { break; } if (ZEND_OP2_TYPE(opline) == IS_CONST) { - if (ZEND_OP2_LITERAL(opline).type != IS_STRING) { + if (Z_TYPE(ZEND_OP2_LITERAL(opline)) != IS_STRING) { convert_to_string(&ZEND_OP2_LITERAL(opline)); } } diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index cb93fbf633..7d5d9bc595 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -289,13 +289,13 @@ static void accel_interned_strings_restore_state(TSRMLS_D) nIndex = p->h & ZCSG(interned_strings).nTableMask; if (ZCSG(interned_strings).arHash[nIndex] == idx) { - ZCSG(interned_strings).arHash[nIndex] = p->val.u.next; + ZCSG(interned_strings).arHash[nIndex] = Z_NEXT(p->val); } else { uint prev = ZCSG(interned_strings).arHash[nIndex]; - while (ZCSG(interned_strings).arData[prev].val.u.next != idx) { - prev = ZCSG(interned_strings).arData[prev].val.u.next; + while (Z_NEXT(ZCSG(interned_strings).arData[prev].val) != idx) { + prev = Z_NEXT(ZCSG(interned_strings).arData[prev].val); } - ZCSG(interned_strings).arData[prev].val.u.next = p->val.u.next; + Z_NEXT(ZCSG(interned_strings).arData[prev].val) = Z_NEXT(p->val); } } } @@ -335,7 +335,7 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC) return p->key; } } - idx = p->val.u.next; + idx = Z_NEXT(p->val); } if (ZCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(zend_string) + str->len) >= @@ -352,14 +352,15 @@ zend_string *accel_new_interned_string(zend_string *str TSRMLS_DC) p->key = (zend_string*) ZCSG(interned_strings_top); ZCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(zend_string) + str->len); p->h = h; - p->key->gc.refcount = 1; - p->key->gc.u.v.type = IS_STRING; - p->key->gc.u.v.flags = IS_STR_INTERNED | IS_STR_PERMANENT; + GC_REFCOUNT(p->key) = 1; +// TODO: use one assignment ??? + GC_TYPE(p->key) = IS_STRING; + GC_FLAGS(p->key) = IS_STR_INTERNED | IS_STR_PERMANENT; p->key->h = str->h; p->key->len = str->len; memcpy(p->key->val, str->val, str->len); ZVAL_STR(&p->val, p->key); - p->val.u.next = ZCSG(interned_strings).arHash[nIndex]; + Z_NEXT(p->val) = ZCSG(interned_strings).arHash[nIndex]; ZCSG(interned_strings).arHash[nIndex] = idx; //??? if (free_src) { diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c index 89b3b1137e..e8fd91b8cf 100644 --- a/ext/opcache/zend_accelerator_util_funcs.c +++ b/ext/opcache/zend_accelerator_util_funcs.c @@ -393,7 +393,7 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind) ht->nNumUsed = p->h + 1; } else { q = ht->arData + ht->nNumUsed; - q->val.u.next = ht->arHash[nIndex]; + Z_NEXT(q->val) = ht->arHash[nIndex]; ht->arHash[nIndex] = ht->nNumUsed++; } @@ -403,7 +403,7 @@ static void zend_hash_clone_zval(HashTable *ht, HashTable *source, int bind) q->key = NULL; } else { q->key = STR_DUP(p->key, 0); - q->key->gc.u.v.flags = p->key->gc.u.v.flags; + GC_FLAGS(q->key) = GC_FLAGS(p->key); } /* Copy data */ @@ -462,7 +462,7 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class ht->nNumUsed = p->h + 1; } else { q = ht->arData + ht->nNumUsed; - q->val.u.next = ht->arHash[nIndex]; + Z_NEXT(q->val) = ht->arHash[nIndex]; ht->arHash[nIndex] = ht->nNumUsed++; } @@ -557,7 +557,7 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla ht->nNumUsed = p->h + 1; } else { q = ht->arData + ht->nNumUsed; - q->val.u.next = ht->arHash[nIndex]; + Z_NEXT(q->val) = ht->arHash[nIndex]; ht->arHash[nIndex] = ht->nNumUsed++; } diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c index d638acdb15..7706840c89 100644 --- a/ext/opcache/zend_persist.c +++ b/ext/opcache/zend_persist.c @@ -115,15 +115,15 @@ static void zend_persist_zval(zval *z TSRMLS_DC) void *new_ptr; #if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO - switch (z->type & IS_CONSTANT_TYPE_MASK) { + switch (Z_TYPE_P(z) & IS_CONSTANT_TYPE_MASK) { #else - switch (z->type & ~IS_CONSTANT_INDEX) { + switch (Z_TYPE_P(z) & ~IS_CONSTANT_INDEX) { #endif case IS_STRING: case IS_CONSTANT: - flags = Z_STR_P(z)->gc.u.v.flags & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT); + flags = Z_GC_FLAGS_P(z) & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT); zend_accel_store_interned_string(Z_STR_P(z)); - Z_STR_P(z)->gc.u.v.flags |= flags; + Z_GC_FLAGS_P(z) |= flags; break; case IS_ARRAY: case IS_CONSTANT_ARRAY: diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c index bb050afaaf..93b53ae817 100644 --- a/ext/opcache/zend_persist_calc.c +++ b/ext/opcache/zend_persist_calc.c @@ -73,9 +73,9 @@ static uint zend_hash_persist_calc(HashTable *ht, uint (*pPersistElement)(zval * /* persist bucket and key */ if (p->key) { - zend_uchar flags = p->key->gc.u.v.flags & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT); + zend_uchar flags = GC_FLAGS(p->key) & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT); ADD_INTERNED_STRING(p->key, 1); - p->key->gc.u.v.flags |= flags; + GC_FLAGS(p->key) |= flags; } ADD_SIZE(pPersistElement(&p->val TSRMLS_CC)); @@ -112,15 +112,15 @@ static uint zend_persist_zval_calc(zval *z TSRMLS_DC) START_SIZE(); #if ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO - switch (z->type & IS_CONSTANT_TYPE_MASK) { + switch (Z_TYPE_P(z) & IS_CONSTANT_TYPE_MASK) { #else - switch (z->type & ~IS_CONSTANT_INDEX) { + switch (Z_TYPE_P(z) & ~IS_CONSTANT_INDEX) { #endif case IS_STRING: case IS_CONSTANT: - flags = Z_STR_P(z)->gc.u.v.flags & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT); + flags = Z_GC_FLAGS_P(z) & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT); ADD_INTERNED_STRING(Z_STR_P(z), 0); - Z_STR_P(z)->gc.u.v.flags |= flags; + Z_GC_FLAGS_P(z) |= flags; break; case IS_ARRAY: case IS_CONSTANT_ARRAY: diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 34755690ca..60580b86f5 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -4507,7 +4507,7 @@ ZEND_METHOD(reflection_class, isSubclassOf) return; } - switch(class_name->type) { + switch (Z_TYPE_P(class_name)) { case IS_STRING: if ((class_ce = zend_lookup_class(Z_STR_P(class_name) TSRMLS_CC)) == NULL) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, @@ -4551,7 +4551,7 @@ ZEND_METHOD(reflection_class, implementsInterface) return; } - switch(interface->type) { + switch (Z_TYPE_P(interface)) { case IS_STRING: if ((interface_ce = zend_lookup_class(Z_STR_P(interface) TSRMLS_CC)) == NULL) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 47f5fa2402..6d83e8a60e 100644 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -139,7 +139,7 @@ SPL_API int spl_hash_verify_pos_ex(spl_array_object * intern, HashTable * ht TSR if (idx == intern->pos) { return SUCCESS; } - idx = ht->arData[idx].val.u.next; + idx = Z_NEXT(ht->arData[idx].val); } } /* HASH_UNPROTECT_RECURSION(ht); */ @@ -367,7 +367,7 @@ fetch_dim_string: case IS_DOUBLE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { + if (Z_TYPE_P(offset) == IS_DOUBLE) { index = (long)Z_DVAL_P(offset); } else { index = Z_LVAL_P(offset); @@ -496,7 +496,7 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval zend_error(E_WARNING, "Modification of ArrayObject during sorting is prohibited"); return; } - if (offset->type == IS_DOUBLE) { + if (Z_TYPE_P(offset) == IS_DOUBLE) { index = (long)Z_DVAL_P(offset); } else { index = Z_LVAL_P(offset); @@ -577,7 +577,7 @@ static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval case IS_RESOURCE: case IS_BOOL: case IS_LONG: - if (offset->type == IS_DOUBLE) { + if (Z_TYPE_P(offset) == IS_DOUBLE) { index = (long)Z_DVAL_P(offset); } else { index = Z_LVAL_P(offset); @@ -642,7 +642,7 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o case IS_LONG: { HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); - if (offset->type == IS_DOUBLE) { + if (Z_TYPE_P(offset) == IS_DOUBLE) { index = (long)Z_DVAL_P(offset); } else { index = Z_LVAL_P(offset); diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index a1271dc070..1703f2e3ad 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1508,7 +1508,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z Z_ADDREF(cfi->fci.function_name); } cfi->object = cfi->fcc.object; - if (cfi->object) cfi->object->gc.refcount++; + if (cfi->object) GC_REFCOUNT(cfi->object)++; intern->u.cbfilter = cfi; break; } diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index e4d3c564c7..7e768df0de 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -254,7 +254,7 @@ static int browscap_read_file(char *filename, browser_data *browdata, int persis return FAILURE; } fh.filename = filename; - Z_TYPE(fh) = ZEND_HANDLE_FP; + fh.type = ZEND_HANDLE_FP; browdata->current_section_name = NULL; zend_parse_ini_file(&fh, 1, ZEND_INI_SCANNER_RAW, (zend_ini_parser_cb_t) php_browscap_parser_cb, browdata TSRMLS_CC); diff --git a/ext/standard/dir.c b/ext/standard/dir.c index b305c9451b..377d3123ea 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -116,7 +116,7 @@ static void php_set_default_dir(zend_resource *res TSRMLS_DC) } if (res) { - res->gc.refcount++; + GC_REFCOUNT(res)++; } DIRG(default_dir) = res; diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 2107807c35..0efd14c57f 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -196,7 +196,7 @@ PHP_FUNCTION(stream_socket_server) context = php_stream_context_from_zval(zcontext, flags & PHP_FILE_NO_DEFAULT_CONTEXT); if (context) { - context->res->gc.refcount++; + GC_REFCOUNT(context->res)++; } if (zerrno) { @@ -1236,7 +1236,7 @@ static void apply_filter_to_stream(int append, INTERNAL_FUNCTION_PARAMETERS) if (filter) { filter->res = ZEND_REGISTER_RESOURCE(NULL, filter, php_file_le_stream_filter()); - filter->res->gc.refcount++; + GC_REFCOUNT(filter->res)++; RETURN_RES(filter->res); } else { RETURN_FALSE; diff --git a/main/streams/php_stream_context.h b/main/streams/php_stream_context.h index bdfba8f60f..c0b70934c6 100644 --- a/main/streams/php_stream_context.h +++ b/main/streams/php_stream_context.h @@ -38,7 +38,7 @@ typedef void (*php_stream_notification_func)(php_stream_context *context, FG(default_context) ? FG(default_context) : \ (FG(default_context) = php_stream_context_alloc(TSRMLS_C)) ) -#define php_stream_context_to_zval(context, zval) { ZVAL_RES(zval, (context)->res); (context)->res->gc.refcount++; } +#define php_stream_context_to_zval(context, zval) { ZVAL_RES(zval, (context)->res); GC_REFCOUNT((context)->res)++; } typedef struct _php_stream_notifier php_stream_notifier; diff --git a/main/streams/streams.c b/main/streams/streams.c index ad8bcf2070..553404dc3c 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -69,7 +69,7 @@ static int _php_stream_release_context(zval *zv, void *pContext TSRMLS_DC) { zend_resource *le = Z_RES_P(zv); if (le->ptr == pContext) { - return --le->gc.refcount == 0; + return --GC_REFCOUNT(le) == 0; } return 0; } @@ -138,10 +138,10 @@ PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream * *stream = (php_stream*)le->ptr; if (!regentry) { /* not found in regular list */ - le->gc.refcount++; + GC_REFCOUNT(le)++; (*stream)->res = ZEND_REGISTER_RESOURCE(NULL, *stream, le_pstream); } else { - regentry->gc.refcount++; + GC_REFCOUNT(regentry)++; (*stream)->res = regentry; } } @@ -2155,7 +2155,7 @@ PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream stream->context = context; if (context) { - context->res->gc.refcount++; + GC_REFCOUNT(context->res)++; } if (oldcontext) { zend_list_delete(oldcontext->res); diff --git a/main/streams/userspace.c b/main/streams/userspace.c index f27055c180..7c6aa92316 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -289,7 +289,7 @@ static void user_stream_create_object(struct php_user_stream_wrapper *uwrap, php if (context) { add_property_resource(object, "context", context->res); - context->res->gc.refcount++; + GC_REFCOUNT(context->res)++; } else { add_property_null(object, "context"); } diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index 91b00496c7..0f2e530aa7 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -733,7 +733,7 @@ static inline int php_tcp_sockop_accept(php_stream *stream, php_netstream_data_t if (xparam->outputs.client) { xparam->outputs.client->context = stream->context; if (stream->context) { - stream->context->res->gc.refcount++; + GC_REFCOUNT(stream->context->res)++; } } }