MFZE1 (support return value in execute_scripts)

This commit is contained in:
Zeev Suraski 2001-09-10 00:07:32 +00:00
parent 517bd3018c
commit b06440bceb
3 changed files with 12 additions and 12 deletions

View File

@ -794,6 +794,7 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
int i;
zend_file_handle *file_handle;
zend_op_array *orig_op_array = EG(active_op_array);
zval *local_retval=NULL;
va_start(files, file_count);
for (i=0; i<file_count; i++) {
@ -804,14 +805,12 @@ ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_co
EG(active_op_array) = zend_compile_file(file_handle, ZEND_INCLUDE TSRMLS_CC);
zend_destroy_file_handle(file_handle TSRMLS_CC);
if (EG(active_op_array)) {
EG(return_value_ptr_ptr) = retval ? retval : &local_retval;
zend_execute(EG(active_op_array) TSRMLS_CC);
zval_ptr_dtor(EG(return_value_ptr_ptr));
if (retval) {
EG(return_value_ptr_ptr) = retval;
} else {
EG(return_value_ptr_ptr) = &EG(global_return_value_ptr);
if (!retval) {
zval_ptr_dtor(EG(return_value_ptr_ptr));
local_retval = NULL;
}
EG(global_return_value_ptr) = NULL;
destroy_op_array(EG(active_op_array));
efree(EG(active_op_array));
} else if (type==ZEND_REQUIRE) {

View File

@ -121,8 +121,7 @@ void init_executor(TSRMLS_D)
#if 0&&ZEND_DEBUG
original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv);
#endif
EG(return_value_ptr_ptr) = &EG(global_return_value_ptr);
EG(global_return_value_ptr) = NULL;
EG(return_value_ptr_ptr) = NULL;
EG(symtable_cache_ptr) = EG(symtable_cache)-1;
EG(symtable_cache_limit)=EG(symtable_cache)+SYMTABLE_CACHE_SIZE-1;
@ -608,6 +607,7 @@ void execute_new_code(TSRMLS_D)
{
zend_op *opline, *end;
zend_op *ret_opline;
zval *local_retval=NULL;
if (!CG(interactive)
|| CG(active_op_array)->backpatch_count>0
@ -641,9 +641,13 @@ void execute_new_code(TSRMLS_D)
opline++;
}
EG(return_value_ptr_ptr) = &local_retval;
EG(active_op_array) = CG(active_op_array);
zend_execute(CG(active_op_array) TSRMLS_CC);
zval_ptr_dtor(EG(return_value_ptr_ptr));
if (local_retval) {
zval_ptr_dtor(&local_retval);
}
CG(active_op_array)->last--; /* get rid of that ZEND_RETURN */
CG(active_op_array)->start_op = CG(active_op_array)->opcodes+CG(active_op_array)->last;
}

View File

@ -143,9 +143,6 @@ struct _zend_executor_globals {
zend_function_state *function_state_ptr;
zend_ptr_stack arg_types_stack;
/* for global return() support */
zval *global_return_value_ptr;
/* symbol table cache */
HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
HashTable **symtable_cache_limit;