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 */
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) {
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) {
}
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 &&
}
*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));
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);
//??? 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);
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;
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;
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) {
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;
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);
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);
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));*/
}
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;
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) {
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;
}
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;
{
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) {
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;
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 {
}
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;
}
}
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 {
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;
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;
}
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;
}
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;
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;
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;
}
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) {
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)) {
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;
}
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;
}
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;
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);
}
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);
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);
#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)
memcmp(p->key->val, key->val, key->len) == 0)) {
return p;
}
- idx = p->val.u.next;
+ idx = Z_NEXT(p->val);
}
return NULL;
}
&& !memcmp(p->key->val, str, len)) {
return p;
}
- idx = p->val.u.next;
+ idx = Z_NEXT(p->val);
}
return NULL;
}
if (p->h == h && !p->key) {
return p;
}
- idx = p->val.u.next;
+ idx = Z_NEXT(p->val);
}
return NULL;
}
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();
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();
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();
}
}
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++;
}
{
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) {
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);
}
}
return SUCCESS;
}
prev = p;
- idx = p->val.u.next;
+ idx = Z_NEXT(p->val);
}
return FAILURE;
}
return SUCCESS;
}
prev = p;
- idx = p->val.u.next;
+ idx = Z_NEXT(p->val);
}
return FAILURE;
}
return SUCCESS;
}
prev = p;
- idx = p->val.u.next;
+ idx = Z_NEXT(p->val);
}
return FAILURE;
}
return SUCCESS;
}
prev = p;
- idx = p->val.u.next;
+ idx = Z_NEXT(p->val);
}
return FAILURE;
}
return SUCCESS;
}
prev = p;
- idx = p->val.u.next;
+ idx = Z_NEXT(p->val);
}
return FAILURE;
}
ht->nInternalPointer = idx;
return 1;
}
- idx = ht->arData[idx].val.u.next;
+ idx = Z_NEXT(ht->arData[idx].val);
}
}
return 0;
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);
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;
/* 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 */
}
/* 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();
zend_printf("<code>");
zend_printf("<span style=\"color: %s\">\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:
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;
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:
break;
}
}
- token.type = 0;
+ ZVAL_UNDEF(&token);
}
if (last_color != syntax_highlighter_ini->highlight_html) {
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:
/* lack of break; is intentional */
case T_COMMENT:
case T_DOC_COMMENT:
- token.type = 0;
+ ZVAL_UNDEF(&token);
continue;
case T_END_HEREDOC:
}
zend_write("\n", sizeof("\n") - 1);
prev_space = 1;
- token.type = 0;
+ ZVAL_UNDEF(&token);
continue;
default:
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:
break;
}
}
- prev_space = token.type = 0;
+ prev_space = 0;
+ ZVAL_UNDEF(&token);
}
}
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; i<LANG_SCNG(yy_leng); i++) {
emit_whitespace[(unsigned char) LANG_SCNG(yy_text)[i]]++;
in_string = !in_string;
/* break missing intentionally */
default:
- if (token.type==0) {
+ if (Z_TYPE(token) == IS_UNDEF) {
/* keyword */
switch (token_type) {
case ',':
}
break;
}
- if (token.type == IS_STRING) {
+ if (Z_TYPE(token) == IS_STRING) {
switch (token_type) {
case T_OPEN_TAG:
case T_CLOSE_TAG:
break;
}
}
- token.type = 0;
+ ZVAL_UNDEF(&token);
}
}
ZEND_API void zend_iterator_dtor(zend_object_iterator *iter TSRMLS_DC)
{
- if (--iter->std.gc.refcount > 0) {
+ if (--GC_REFCOUNT(iter) > 0) {
return;
}
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);
if (readsize < yyleng) {
yyless(readsize);
}
- zendlval->type = IS_STRING;
+ Z_TYPE_P(zendlval) = IS_STRING;
} else {
ZVAL_STRINGL(zendlval, yytext, yyleng);
}
} 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"
} 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));
} 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));
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);
} 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));
} 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;
}
} 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));
if (readsize < yyleng) {
yyless(readsize);
}
- zendlval->type = IS_STRING;
+ Z_TYPE_P(zendlval) = IS_STRING;
} else {
ZVAL_STRINGL(zendlval, yytext, yyleng);
}
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;
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;
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;
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)--;
}
}
}
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;
}
}
}
*/
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);
zend_bailout();
}
} else {
- object->gc.refcount--;
+ GC_REFCOUNT(object)--;
}
}
}
/* 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 */
{
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;
#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); \
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;
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);
/* 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)
{
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)
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)) {
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();
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
}
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
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
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;
}
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;
}
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;
}
{
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;
{
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);
}
}
{
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);
}
}
}
#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;
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;
};
/* 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 */
#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))
#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))
#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)
#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)
#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); \
#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); \
#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; \
#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; \
#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; \
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;
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;
}
zend_resource *res = (zend_resource*)p;
TSRMLS_FETCH();
- if (--res->gc.refcount == 0) {
+ if (--GC_REFCOUNT(res) == 0) {
/* destroy resource */
zend_list_delete(res);
}
}
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;
}
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;
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;
}
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;
}
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() */
}
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 */
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)) {
} 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;
}
}
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;
}
call->object = Z_OBJ(EG(This));
if (call->object) {
- call->object->gc.refcount++;
+ GC_REFCOUNT(call->object)++;
}
}
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) {
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 */
}
}
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");
}
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;
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 ||
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;
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);
}
}
* 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");
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 */
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)) {
} 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;
}
}
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);
}
}
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) {
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 */
}
}
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) {
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 */
}
}
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) {
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 */
}
}
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) {
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 */
}
}
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");
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;
}
call->object = Z_OBJ(EG(This));
if (call->object) {
- call->object->gc.refcount++;
+ GC_REFCOUNT(call->object)++;
}
}
* 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");
}
call->object = Z_OBJ(EG(This));
if (call->object) {
- call->object->gc.refcount++;
+ GC_REFCOUNT(call->object)++;
}
}
* 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");
}
call->object = Z_OBJ(EG(This));
if (call->object) {
- call->object->gc.refcount++;
+ GC_REFCOUNT(call->object)++;
}
}
* 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");
}
call->object = Z_OBJ(EG(This));
if (call->object) {
- call->object->gc.refcount++;
+ GC_REFCOUNT(call->object)++;
}
}
* 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");
}
call->object = Z_OBJ(EG(This));
if (call->object) {
- call->object->gc.refcount++;
+ GC_REFCOUNT(call->object)++;
}
}
}
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;
* 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");
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");
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;
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;
* 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");
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;
* 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");
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;
* 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");
* 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");
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;
* 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");
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");
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 ||
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;
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;
}
call->object = Z_OBJ(EG(This));
if (call->object) {
- call->object->gc.refcount++;
+ GC_REFCOUNT(call->object)++;
}
}
* 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");
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;
}
call->object = Z_OBJ(EG(This));
if (call->object) {
- call->object->gc.refcount++;
+ GC_REFCOUNT(call->object)++;
}
}
* 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");
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() */
}
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;
}
call->object = Z_OBJ(EG(This));
if (call->object) {
- call->object->gc.refcount++;
+ GC_REFCOUNT(call->object)++;
}
}
* 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");
}
call->object = Z_OBJ(EG(This));
if (call->object) {
- call->object->gc.refcount++;
+ GC_REFCOUNT(call->object)++;
}
}
* 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");
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() */
}
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;
}
call->object = Z_OBJ(EG(This));
if (call->object) {
- call->object->gc.refcount++;
+ GC_REFCOUNT(call->object)++;
}
}
* 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");
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;
* 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");
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;
* 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");
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;
* 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");
* 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");
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;
* 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");
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");
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 ||
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;
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;
* 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");
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;
* 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");
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() */
}
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;
* 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");
* 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");
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() */
}
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;
* 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");
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);
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);
#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); \
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;
}
/* }}} */
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);
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);
}
#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 {
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));
}
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(""));
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;
/* 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)),
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)) ||
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);
}
}
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);
}
}
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));
}
}
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));
}
}
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));
}
}
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));
}
}
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);
}
}
}
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) >=
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) {
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++;
}
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 */
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++;
}
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++;
}
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:
/* 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));
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:
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,
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,
if (idx == intern->pos) {
return SUCCESS;
}
- idx = ht->arData[idx].val.u.next;
+ idx = Z_NEXT(ht->arData[idx].val);
}
}
/* HASH_UNPROTECT_RECURSION(ht); */
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);
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);
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);
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);
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;
}
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);
}
if (res) {
- res->gc.refcount++;
+ GC_REFCOUNT(res)++;
}
DIRG(default_dir) = res;
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) {
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;
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;
{
zend_resource *le = Z_RES_P(zv);
if (le->ptr == pContext) {
- return --le->gc.refcount == 0;
+ return --GC_REFCOUNT(le) == 0;
}
return 0;
}
*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;
}
}
stream->context = context;
if (context) {
- context->res->gc.refcount++;
+ GC_REFCOUNT(context->res)++;
}
if (oldcontext) {
zend_list_delete(oldcontext->res);
if (context) {
add_property_resource(object, "context", context->res);
- context->res->gc.refcount++;
+ GC_REFCOUNT(context->res)++;
} else {
add_property_null(object, "context");
}
if (xparam->outputs.client) {
xparam->outputs.client->context = stream->context;
if (stream->context) {
- stream->context->res->gc.refcount++;
+ GC_REFCOUNT(stream->context->res)++;
}
}
}