- Move is_ref back to being an unsigned char and not a bit field.

This commit is contained in:
Andi Gutmans 1999-10-01 23:31:39 +00:00
parent 4dd47ffbc1
commit 86357a9c27
8 changed files with 33 additions and 35 deletions

View File

@ -125,9 +125,7 @@ struct _zval_struct {
/* Variable information */
zvalue_value value; /* value */
unsigned char type; /* active type */
struct {
unsigned int is_ref:1;
} EA;
unsigned char is_ref;
short refcount;
};
@ -267,7 +265,7 @@ extern zend_utility_values zend_uv;
#define INIT_PZVAL(z) \
(z)->refcount = 1; \
(z)->EA.is_ref = 0;
(z)->is_ref = 0;
#define MAKE_STD_ZVAL(zv) \
zv = (zval *) emalloc(sizeof(zval)); \
@ -283,7 +281,7 @@ extern zend_utility_values zend_uv;
**(ppzv) = *orig_ptr; \
zval_copy_ctor(*(ppzv)); \
(*(ppzv))->refcount=1; \
(*(ppzv))->EA.is_ref = 0; \
(*(ppzv))->is_ref = 0; \
} \
}

View File

@ -243,7 +243,7 @@ ZEND_API int add_property_stringl(zval *arg, char *key, char *str, uint length,
if (zend_hash_find(symtable, (name), (name_length), (void **) &orig_var)==SUCCESS \
&& PZVAL_IS_REF(*orig_var)) { \
var->refcount = (*orig_var)->refcount; \
var->EA.is_ref = 1; \
var->is_ref = 1; \
\
zval_dtor(*orig_var); \
**orig_var = *var; \

View File

@ -228,11 +228,11 @@ ZEND_FUNCTION(each)
entry = *entry_ptr;
/* add value elements */
if (entry->EA.is_ref) {
if (entry->is_ref) {
tmp = (zval *)emalloc(sizeof(zval));
*tmp = *entry;
zval_copy_ctor(tmp);
tmp->EA.is_ref=0;
tmp->is_ref=0;
tmp->refcount=0;
entry=tmp;
}

View File

@ -565,7 +565,7 @@ int zendlex(znode *zendlval CLS_DC);
(ai).ptr = NULL; \
}
#define PZVAL_IS_REF(z) ((z)->EA.is_ref)
#define PZVAL_IS_REF(z) ((z)->is_ref)
#define PZVAL_LOCK(z) ((z)->refcount++)
#define PZVAL_UNLOCK(z) ((z)->refcount--)

View File

@ -99,7 +99,7 @@ static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, int *should_fr
case IS_OVERLOADED_OBJECT:
Ts[node->u.var].tmp_var = get_overloaded_property(ELS_C);
Ts[node->u.var].tmp_var.refcount=1;
Ts[node->u.var].tmp_var.EA.is_ref=1;
Ts[node->u.var].tmp_var.is_ref=1;
return &Ts[node->u.var].tmp_var;
break;
case IS_STRING_OFFSET: {
@ -118,7 +118,7 @@ static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, int *should_fr
}
zval_ptr_dtor(&str);
T->tmp_var.refcount=1;
T->tmp_var.EA.is_ref=1;
T->tmp_var.is_ref=1;
T->tmp_var.type = IS_STRING;
return &T->tmp_var;
}
@ -317,7 +317,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
zendi_zval_dtor(*variable_ptr);
*variable_ptr = *value;
variable_ptr->refcount = refcount;
variable_ptr->EA.is_ref = 1;
variable_ptr->is_ref = 1;
if (type!=IS_TMP_VAR) {
zendi_zval_copy_ctor(*variable_ptr);
zval_ptr_dtor(&value);
@ -395,7 +395,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
break;
}
}
(*variable_ptr_ptr)->EA.is_ref=0;
(*variable_ptr_ptr)->is_ref=0;
}
if (result) {
Ts[result->u.var].var.ptr_ptr = variable_ptr_ptr;
@ -636,7 +636,7 @@ static inline void zend_fetch_dimension_address(znode *result, znode *op1, znode
container->refcount--;
if (container->refcount>0) {
container = *container_ptr = (zval *) emalloc(sizeof(zval));
container->EA.is_ref=0;
container->is_ref=0;
}
container->refcount=1;
}
@ -804,7 +804,7 @@ static inline void zend_fetch_property_address(znode *result, znode *op1, znode
container->refcount--;
if (container->refcount>0) {
container = *container_ptr = (zval *) emalloc(sizeof(zval));
container->EA.is_ref=0;
container->is_ref=0;
}
container->refcount=1;
}
@ -931,7 +931,7 @@ void execute(zend_op_array *op_array ELS_DC)
zval *globals = (zval *) emalloc(sizeof(zval));
globals->refcount=1;
globals->EA.is_ref=1;
globals->is_ref=1;
globals->type = IS_ARRAY;
globals->value.ht = &EG(symbol_table);
if (zend_hash_add(EG(active_symbol_table), "GLOBALS", sizeof("GLOBALS"), &globals, sizeof(zval *), NULL)==FAILURE) {
@ -1489,7 +1489,7 @@ do_fcall_common:
*object.ptr_ptr = tmp;
}
object.ptr->refcount = 1;
object.ptr->EA.is_ref = 1;
object.ptr->is_ref = 1;
}
*this_ptr = object.ptr;
object.ptr->refcount++;
@ -1569,13 +1569,13 @@ do_fcall_common:
varptr = (zval *) emalloc(sizeof(zval));
var_uninit(varptr);
varptr->refcount=0;
varptr->EA.is_ref=0;
varptr->is_ref=0;
} else if (PZVAL_IS_REF(varptr)) {
zval *original_var = varptr;
varptr = (zval *) emalloc(sizeof(zval));
*varptr = *original_var;
varptr->EA.is_ref = 0;
varptr->is_ref = 0;
varptr->refcount = 0;
zval_copy_ctor(varptr);
}
@ -1599,7 +1599,7 @@ send_by_ref:
varptr->refcount = 1;
zval_copy_ctor(varptr);
}
varptr->EA.is_ref = 1;
varptr->is_ref = 1;
/* at the end of this code refcount is always 1 */
}
varptr->refcount++;
@ -1643,7 +1643,7 @@ send_by_ref:
*default_value = tmp;
}
default_value->refcount=0;
default_value->EA.is_ref=0;
default_value->is_ref=0;
param = &default_value;
assignment_value = default_value;
} else {
@ -1759,7 +1759,7 @@ send_by_ref:
}
object_init_ex(&Ts[opline->result.u.var].tmp_var, ce);
Ts[opline->result.u.var].tmp_var.refcount=1;
Ts[opline->result.u.var].tmp_var.EA.is_ref=1;
Ts[opline->result.u.var].tmp_var.is_ref=1;
zval_dtor(&class_name);
FREE_OP(&opline->op1, EG(free_op1));
}
@ -1803,7 +1803,7 @@ send_by_ref:
if (!PZVAL_IS_REF(expr_ptr)) {
SEPARATE_ZVAL(expr_ptr_ptr);
expr_ptr = *expr_ptr_ptr;
expr_ptr->EA.is_ref = 1;
expr_ptr->is_ref = 1;
}
expr_ptr->refcount++;
} else if (PZVAL_IS_REF(expr_ptr)) {

View File

@ -84,10 +84,10 @@ void init_executor(CLS_D ELS_DC)
var_uninit(&EG(uninitialized_zval));
var_uninit(&EG(error_zval));
EG(uninitialized_zval).refcount = 1;
EG(uninitialized_zval).EA.is_ref=0;
EG(uninitialized_zval).is_ref=0;
EG(uninitialized_zval_ptr)=&EG(uninitialized_zval);
EG(error_zval).refcount = 1;
EG(error_zval).EA.is_ref=0;
EG(error_zval).is_ref=0;
EG(error_zval_ptr)=&EG(error_zval);
EG(destroying_function_symbol_table) = 0;
zend_ptr_stack_init(&EG(arg_types_stack));
@ -337,7 +337,7 @@ int call_user_function_ex(HashTable *function_table, zval *object, zval *functio
*params[i] = new_zval;
}
(*params[i])->refcount++;
(*params[i])->EA.is_ref = 1;
(*params[i])->is_ref = 1;
param = *params[i];
} else if (*params[i] != &EG(uninitialized_zval)) {
(*params[i])->refcount++;
@ -473,7 +473,7 @@ ZEND_API inline void zend_assign_to_variable_reference(znode *result, zval **var
zendi_zval_copy_ctor(*value_ptr);
}
value_ptr->refcount = 1;
value_ptr->EA.is_ref = 1;
value_ptr->is_ref = 1;
}
*variable_ptr_ptr = value_ptr;

View File

@ -311,10 +311,10 @@ void pass_include_eval(zend_op_array *op_array)
while (opline<end) {
if (opline->op1.op_type==IS_CONST) {
opline->op1.u.constant.EA.is_ref = 1;
opline->op1.u.constant.is_ref = 1;
}
if (opline->op2.op_type==IS_CONST) {
opline->op2.u.constant.EA.is_ref = 1;
opline->op2.u.constant.is_ref = 1;
}
opline++;
}

View File

@ -72,7 +72,7 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
#define convert_to_long_ex(ppzv) \
if ((*ppzv)->type!=IS_LONG) { \
if (!(*ppzv)->EA.is_ref) { \
if (!(*ppzv)->is_ref) { \
SEPARATE_ZVAL(ppzv); \
} \
convert_to_long(*ppzv); \
@ -80,7 +80,7 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
#define convert_to_double_ex(ppzv) \
if ((*ppzv)->type!=IS_DOUBLE) { \
if (!(*ppzv)->EA.is_ref) { \
if (!(*ppzv)->is_ref) { \
SEPARATE_ZVAL(ppzv); \
} \
convert_to_double(*ppzv); \
@ -88,7 +88,7 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
#define convert_to_string_ex(ppzv) \
if ((*ppzv)->type!=IS_STRING) { \
if (!(*ppzv)->EA.is_ref) { \
if (!(*ppzv)->is_ref) { \
SEPARATE_ZVAL(ppzv); \
} \
convert_to_string(*ppzv); \
@ -96,7 +96,7 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
#define convert_to_array_ex(ppzv) \
if ((*ppzv)->type!=IS_ARRAY) { \
if (!(*ppzv)->EA.is_ref) { \
if (!(*ppzv)->is_ref) { \
SEPARATE_ZVAL(ppzv); \
} \
convert_to_array(*ppzv); \
@ -104,7 +104,7 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
#define convert_to_object_ex(ppzv) \
if ((*ppzv)->type!=IS_OBJECT) { \
if (!(*ppzv)->EA.is_ref) { \
if (!(*ppzv)->is_ref) { \
SEPARATE_ZVAL(ppzv); \
} \
convert_to_object(*ppzv); \
@ -112,7 +112,7 @@ ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
#define convert_to_boolean_ex(ppzv) \
if ((*ppzv)->type!=IS_BOOL) { \
if (!(*ppzv)->EA.is_ref) { \
if (!(*ppzv)->is_ref) { \
SEPARATE_ZVAL(ppzv); \
} \
convert_to_boolean(*ppzv); \