diff options
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r-- | Zend/zend_compile.c | 48 |
1 files changed, 22 insertions, 26 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 20a4a78c39..14d937bb55 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -31,7 +31,7 @@ #include "zend_language_scanner.h" #define CONSTANT_EX(op_array, op) \ - (op_array)->literals[op].constant + (op_array)->literals[op] #define CONSTANT(op) \ CONSTANT_EX(CG(active_op_array), op) @@ -61,7 +61,7 @@ } while (0) #define GET_CACHE_SLOT(literal) do { \ - CG(active_op_array)->literals[literal].cache_slot = CG(active_op_array)->last_cache_slot++; \ + Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) = CG(active_op_array)->last_cache_slot++; \ if ((CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) && CG(active_op_array)->run_time_cache) { \ CG(active_op_array)->run_time_cache = erealloc(CG(active_op_array)->run_time_cache, CG(active_op_array)->last_cache_slot * sizeof(void*)); \ CG(active_op_array)->run_time_cache[CG(active_op_array)->last_cache_slot - 1] = NULL; \ @@ -71,7 +71,7 @@ #define POLYMORPHIC_CACHE_SLOT_SIZE 2 #define GET_POLYMORPHIC_CACHE_SLOT(literal) do { \ - CG(active_op_array)->literals[literal].cache_slot = CG(active_op_array)->last_cache_slot; \ + Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) = CG(active_op_array)->last_cache_slot; \ CG(active_op_array)->last_cache_slot += POLYMORPHIC_CACHE_SLOT_SIZE; \ if ((CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE) && CG(active_op_array)->run_time_cache) { \ CG(active_op_array)->run_time_cache = erealloc(CG(active_op_array)->run_time_cache, CG(active_op_array)->last_cache_slot * sizeof(void*)); \ @@ -81,10 +81,10 @@ } while (0) #define FREE_POLYMORPHIC_CACHE_SLOT(literal) do { \ - if (CG(active_op_array)->literals[literal].cache_slot != -1 && \ - CG(active_op_array)->literals[literal].cache_slot == \ + if (Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) != -1 && \ + Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) == \ CG(active_op_array)->last_cache_slot - POLYMORPHIC_CACHE_SLOT_SIZE) { \ - CG(active_op_array)->literals[literal].cache_slot = -1; \ + Z_CACHE_SLOT(CG(active_op_array)->literals[literal]) = -1; \ CG(active_op_array)->last_cache_slot -= POLYMORPHIC_CACHE_SLOT_SIZE; \ } \ } while (0) @@ -350,7 +350,7 @@ static inline void zend_insert_literal(zend_op_array *op_array, zval *zv, int li } } ZVAL_COPY_VALUE(&CONSTANT_EX(op_array, literal_position), zv); - op_array->literals[literal_position].cache_slot = -1; + Z_CACHE_SLOT(op_array->literals[literal_position]) = -1; } /* }}} */ @@ -365,7 +365,7 @@ int zend_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC) /* {{{ * while (i >= CG(context).literals_size) { CG(context).literals_size += 16; /* FIXME */ } - op_array->literals = (zend_literal*)erealloc(op_array->literals, CG(context).literals_size * sizeof(zend_literal)); + op_array->literals = (zval*)erealloc(op_array->literals, CG(context).literals_size * sizeof(zval)); } zend_insert_literal(op_array, zv, i TSRMLS_CC); return i; @@ -378,7 +378,7 @@ int zend_append_individual_literal(zend_op_array *op_array, const zval *zv TSRML { int i = op_array->last_literal; op_array->last_literal++; - op_array->literals = (zend_literal*)erealloc(op_array->literals, (i + 1) * sizeof(zend_literal)); + op_array->literals = (zval*)erealloc(op_array->literals, (i + 1) * sizeof(zval)); zend_insert_literal(op_array, zv, i TSRMLS_CC); return i; } @@ -391,8 +391,8 @@ int zend_add_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC zval c; if (op_array->last_literal > 0 && - &op_array->literals[op_array->last_literal - 1].constant == zv && - op_array->literals[op_array->last_literal - 1].cache_slot == -1) { + &op_array->literals[op_array->last_literal - 1] == zv && + Z_CACHE_SLOT(op_array->literals[op_array->last_literal - 1]) == -1) { /* we already have function name as last literal (do nothing) */ ret = op_array->last_literal - 1; } else { @@ -417,8 +417,8 @@ int zend_add_ns_func_name_literal(zend_op_array *op_array, const zval *zv TSRMLS zval c; if (op_array->last_literal > 0 && - &op_array->literals[op_array->last_literal - 1].constant == zv && - op_array->literals[op_array->last_literal - 1].cache_slot == -1) { + &op_array->literals[op_array->last_literal - 1] == zv && + Z_CACHE_SLOT(op_array->literals[op_array->last_literal - 1]) == -1) { /* we already have function name as last literal (do nothing) */ ret = op_array->last_literal - 1; } else { @@ -452,8 +452,8 @@ int zend_add_class_name_literal(zend_op_array *op_array, const zval *zv TSRMLS_D zval c; if (op_array->last_literal > 0 && - &op_array->literals[op_array->last_literal - 1].constant == zv && - op_array->literals[op_array->last_literal - 1].cache_slot == -1) { + &op_array->literals[op_array->last_literal - 1] == zv && + Z_CACHE_SLOT(op_array->literals[op_array->last_literal - 1]) == -1) { /* we already have function name as last literal (do nothing) */ ret = op_array->last_literal - 1; } else { @@ -486,8 +486,8 @@ int zend_add_const_name_literal(zend_op_array *op_array, const zval *zv, int unq zval c; if (op_array->last_literal > 0 && - &op_array->literals[op_array->last_literal - 1].constant == zv && - op_array->literals[op_array->last_literal - 1].cache_slot == -1) { + &op_array->literals[op_array->last_literal - 1] == zv && + Z_CACHE_SLOT(op_array->literals[op_array->last_literal - 1]) == -1) { /* we already have function name as last literal (do nothing) */ ret = op_array->last_literal - 1; } else { @@ -3847,9 +3847,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent } } - for (zend_hash_internal_pointer_reset(&ce->properties_info); - (property_info = zend_hash_get_current_data_ptr(&ce->properties_info)) != NULL; - zend_hash_move_forward(&ce->properties_info)) { + ZEND_HASH_FOREACH_PTR(&ce->properties_info, property_info) { if (property_info->ce == ce) { if (property_info->flags & ZEND_ACC_STATIC) { property_info->offset += parent_ce->default_static_members_count; @@ -3857,7 +3855,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent property_info->offset += parent_ce->default_properties_count; } } - } + } ZEND_HASH_FOREACH_END(); zend_hash_merge_ex(&ce->properties_info, &parent_ce->properties_info, (ce->type & ZEND_INTERNAL_CLASS ? zend_duplicate_property_info_internal_zval : zend_duplicate_property_info_zval), (merge_checker_func_t) do_inherit_property_access_check, ce); @@ -4430,9 +4428,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* { * - if compatible, then strict notice */ for (i = 0; i < ce->num_traits; i++) { - for (zend_hash_internal_pointer_reset(&ce->traits[i]->properties_info); - (property_info = zend_hash_get_current_data_ptr(&ce->traits[i]->properties_info)) != NULL; - zend_hash_move_forward(&ce->traits[i]->properties_info)) { + ZEND_HASH_FOREACH_PTR(&ce->traits[i]->properties_info, property_info) { /* first get the unmangeld name if necessary, * then check whether the property is already there */ @@ -4507,7 +4503,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* { prop_value, flags, doc_comment TSRMLS_CC); STR_RELEASE(prop_name); - } + } ZEND_HASH_FOREACH_END(); } } /* }}} */ @@ -6209,7 +6205,7 @@ void zend_do_cast(znode *result, const znode *expr, int type TSRMLS_DC) /* {{{ * zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC); opline->opcode = ZEND_CAST; - opline->result_type = IS_TMP_VAR; + opline->result_type = IS_VAR; opline->result.var = get_temporary_variable(CG(active_op_array)); SET_NODE(opline->op1, expr); SET_UNUSED(opline->op2); |