diff options
author | Nikita Popov <nikic@php.net> | 2015-04-20 17:39:32 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2015-04-20 18:18:52 +0200 |
commit | 0381c1b79e9491e68c9ca85a21e0a5bd68f3840f (patch) | |
tree | 33aedc77c200495a02b7c1be387b8dcceeb68e7a /Zend/zend_language_scanner.l | |
parent | b99174136c19df728ced6e9ab24b890e82b4cb0e (diff) | |
download | php-git-0381c1b79e9491e68c9ca85a21e0a5bd68f3840f.tar.gz |
Fixed bug #69388
Renamed compiler_context to oparray_context. Introduced per-file
file_context. Moved import tables into the file_context.
context_stack no longer exists, instead keeping backups of contexts
on C stack. Same for file contexts.
TODO: Move more things out of CG into file_context. There should be
a number of other things that we should not try to reuse in nested
compilations.
Diffstat (limited to 'Zend/zend_language_scanner.l')
-rw-r--r-- | Zend/zend_language_scanner.l | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index 205eef1b3a..c94792a358 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -578,22 +578,26 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type) CG(ast_arena) = zend_arena_create(1024 * 32); if (!zendparse()) { zval retval_zv; + zend_file_context original_file_context; + zend_oparray_context original_oparray_context; zend_op_array *original_active_op_array = CG(active_op_array); op_array = emalloc(sizeof(zend_op_array)); init_op_array(op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE); CG(active_op_array) = op_array; ZVAL_LONG(&retval_zv, 1); - zend_stack_push(&CG(context_stack), (void *) &CG(context)); - zend_init_compiler_context(); if (zend_ast_process) { zend_ast_process(CG(ast)); } + + zend_file_context_begin(&original_file_context); + zend_oparray_context_begin(&original_oparray_context); zend_compile_top_stmt(CG(ast)); zend_do_end_compilation(); zend_emit_final_return(&retval_zv); pass_two(op_array); - zend_release_labels(0); + zend_oparray_context_end(&original_oparray_context); + zend_file_context_end(&original_file_context); CG(active_op_array) = original_active_op_array; } @@ -739,21 +743,25 @@ zend_op_array *compile_string(zval *source_string, char *filename) BEGIN(ST_IN_SCRIPTING); if (!zendparse()) { + zend_file_context original_file_context; + zend_oparray_context original_oparray_context; zend_op_array *original_active_op_array = CG(active_op_array); op_array = emalloc(sizeof(zend_op_array)); init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE); CG(active_op_array) = op_array; - zend_stack_push(&CG(context_stack), (void *) &CG(context)); - zend_init_compiler_context(); if (zend_ast_process) { zend_ast_process(CG(ast)); } + + zend_file_context_begin(&original_file_context); + zend_oparray_context_begin(&original_oparray_context); zend_compile_top_stmt(CG(ast)); zend_do_end_compilation(); zend_emit_final_return(NULL); pass_two(op_array); - zend_release_labels(0); + zend_oparray_context_end(&original_oparray_context); + zend_file_context_end(&original_file_context); CG(active_op_array) = original_active_op_array; } |