diff options
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r-- | Zend/zend_compile.c | 84 |
1 files changed, 2 insertions, 82 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index f0dc4444e4..6d6f3c3769 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -148,9 +148,6 @@ void zend_init_compiler_data_structures(TSRMLS_D) CG(start_lineno) = 0; init_compiler_declarables(TSRMLS_C); zend_hash_apply(CG(auto_globals), (apply_func_t) zend_auto_global_arm TSRMLS_CC); - zend_stack_init(&CG(labels_stack)); - CG(labels) = NULL; - CG(last_label) = NULL; } @@ -177,7 +174,6 @@ void shutdown_compiler(TSRMLS_D) zend_hash_destroy(&CG(script_encodings_table)); zend_hash_destroy(&CG(filenames_table)); zend_llist_destroy(&CG(open_files)); - zend_stack_destroy(&CG(labels_stack)); } @@ -679,10 +675,6 @@ static inline void do_begin_loop(TSRMLS_D) CG(active_op_array)->current_brk_cont = CG(active_op_array)->last_brk_cont; brk_cont_element = get_next_brk_cont_element(CG(active_op_array)); brk_cont_element->parent = parent; - if (CG(last_label)) { - CG(last_label)->loop = CG(active_op_array)->current_brk_cont; - CG(last_label) = NULL; - } } @@ -1249,10 +1241,6 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n CG(doc_comment) = NULL; CG(doc_comment_len) = 0; } - - zend_stack_push(&CG(labels_stack), (void *) &CG(labels), sizeof(HashTable*)); - CG(labels) = NULL; - CG(last_label) = NULL; } void zend_do_handle_exception(TSRMLS_D) @@ -1262,21 +1250,6 @@ void zend_do_handle_exception(TSRMLS_D) opline->opcode = ZEND_HANDLE_EXCEPTION; SET_UNUSED(opline->op1); SET_UNUSED(opline->op2); - - if (CG(labels)) { - zend_hash_destroy(CG(labels)); - FREE_HASHTABLE(CG(labels)); - } - if (!zend_stack_is_empty(&CG(labels_stack))) { - HashTable **pht; - - zend_stack_top(&CG(labels_stack), (void**)&pht); - CG(labels) = *pht; - zend_stack_del_top(&CG(labels_stack)); - } else { - CG(labels) = NULL; - } - CG(last_label) = NULL; } @@ -2692,37 +2665,8 @@ void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC) if (expr) { if (expr->op_type != IS_CONST) { zend_error(E_COMPILE_ERROR, "'%s' operator with non-constant operand is no longer supported", op == ZEND_BRK ? "break" : "continue"); - } else { - if (Z_TYPE(expr->u.constant) == IS_STRING || - Z_TYPE(expr->u.constant) == IS_UNICODE) { - zend_label *label; - - if (CG(labels) == NULL || - zend_u_hash_find(CG(labels), Z_TYPE(expr->u.constant), Z_UNIVAL(expr->u.constant), Z_UNILEN(expr->u.constant)+1, (void**)&label) == FAILURE) { - zend_error(E_COMPILE_ERROR, "%s to undefined label '%R'", op == ZEND_BRK ? "break" : "continue", Z_TYPE(expr->u.constant), Z_UNIVAL(expr->u.constant)); - } - - if (label->loop != -1) { - long distance = 1; - long current = CG(active_op_array)->current_brk_cont; - - while (current != -1) { - if (label->loop == current) { - zval_dtor(&expr->u.constant); - Z_TYPE(expr->u.constant) = IS_LONG; - Z_LVAL(expr->u.constant) = distance; - break; - } - distance++; - current = CG(active_op_array)->brk_cont_array[current].parent; - } - } - if (Z_TYPE(expr->u.constant) != IS_LONG) { - zend_error(E_COMPILE_ERROR, "%s to label '%R', that doesn't mark outer loop", op == ZEND_BRK ? "break" : "continue", Z_TYPE(expr->u.constant), Z_UNIVAL(expr->u.constant)); - } - } else if (Z_TYPE(expr->u.constant) != IS_LONG || Z_LVAL(expr->u.constant) < 1) { - zend_error(E_COMPILE_ERROR, "'%s' operator accepts only positive numbers and labels", op == ZEND_BRK ? "break" : "continue"); - } + } else if (Z_TYPE(expr->u.constant) != IS_LONG || Z_LVAL(expr->u.constant) < 1) { + zend_error(E_COMPILE_ERROR, "'%s' operator accepts only positive numbers", op == ZEND_BRK ? "break" : "continue"); } opline->op2 = *expr; } else { @@ -4371,30 +4315,6 @@ void zend_do_normalization(znode *result, znode *str TSRMLS_DC) *result = opline->result; } -void zend_do_label(znode *label TSRMLS_DC) -{ - zend_op_array *oparray = CG(active_op_array); - zend_label dest; - - if (!CG(labels)) { - ALLOC_HASHTABLE(CG(labels)); - zend_hash_init(CG(labels), 4, NULL, NULL, 0); - } - - dest.brk_cont = oparray->current_brk_cont; - dest.loop = -1; - dest.opline_num = get_next_op_number(oparray); - - if (zend_u_hash_add(CG(labels), Z_TYPE(label->u.constant), Z_UNIVAL(label->u.constant), - Z_UNILEN(label->u.constant) + 1, (void**)&dest, sizeof(zend_label), (void**)&CG(last_label)) == FAILURE) { - CG(last_label) = NULL; - zend_error(E_COMPILE_ERROR, "Label '%R' already defined", Z_TYPE(label->u.constant), Z_UNIVAL(label->u.constant)); - } - - /* Done with label now */ - zval_dtor(&label->u.constant); -} - /* * Local variables: * tab-width: 4 |