PHP kernel two major stream request processing
static int Php_handler (Request_rec *r) {/* Initiliaze the context */php_struct * volatile ctx; void *conf; Apr_bucket_brigade * Volatile Brigade; Apr_bucket *bucket; apr_status_t RV; Request_rec * volatile parent_req = NULL; Tsrmls_fetch (); Zend_file_handle zfd; Zfd.type = Zend_handle_filename; Zfd.filename = (char *) r->filename; Zfd.free_filename = 0; Zfd.opened_path = null;zend_execute_scripts (Zend_include tsrmls_cc, NULL, 1, &ZFD); ZEND_API int zend_execute_scripts (int type tsrmls_dc, zval **retval, int file_count, ...)/* * {{*/{... eg (active_op_array) = \zend_compile_file (File_handle, type TSRMLS_CC); Zend_execute (eg (active_op_array) TSRMLS _CC); Zend_api void Execute (zend_op_array *op_array tsrmls_dc) { //Initialize execution context Zend_ Execute_data Execute_data; //If there is an exception, exit execution if (EG (exception) { return, } /* Initialize Execute_data */ EX (FBC) = NULL; Initialize the function being called EX (object) = NULL; Initialize the object being called EX (old_error_reporting) = NULL; Initialize error reporting variables //Allocate space for execution stack if (Op_array->t < Temp_va R_stack_limit) { EX (Ts) = (temp_variable *) Do_alloca (sizeof (temp_variable) * op_array-& Gt T); } else { EX (Ts) = (temp_variable *) safe_emalloc (sizeof (TEMP_VARIABL e), op_array->t, 0); } //Allocate space for temporary variables and initialize these spaces EX (CVs) = (zval***) do_alloca (sizeof (ZV al**) * Op_array->last_var); memset (EX (CVs), 0, sizeof (zval**) * Op_array->last_var); EX (op_array) = Op_array; //Toggle Execution Context EX (original_in_execution) = EG (in_execution); EX (symbol_table) = EG (active_symbol_table); EX (prev_execute_data) = EG (Current_execute_data); Pushes the execution data in the current global variable stack EG (current_execute_data) = &execute_data; Pushes the current execution context stack EG (in_execution) = 1; /Initialize first instruction (opcode) /* #define ZEND_VM_SET_OPCODE (NEW_OP) \& nbsp; Check_symbol_tables () \ EX (opline) = new_op Execute_data.opline for the currently executing opcode * * if (op_array->start_op) { &NB Sp Zend_vm_set_opcode (OP_ARRAY->START_OP); } else { Zend_vm_set_opcode (op_array->opcodes); &NB Sp } if (OP_ARRAY->uses_this && eg (this)) { EG (this)->refcount++;/* for $this pointer */&NBS p; if (Zend_hash_add (EG (active_symbol_table), "This", sizeof ("the"), &eg (this), sizeof ( Zval *), NULL) ==failure) { EG (this)->refcount--; &N Bsp } } //Assign the memory address of the storage opline to the EXECUTOR_GLOBALS.ONLINE_PTR, OpCode execution EG (opline_ptr) = &ex (Opline) can be tracked in real time; EX (function_state). function = (zend_function *) Op_array; EG (function_state_ptr) = &ex (function_state); #if zend_debug /* function_state.function_symbol_table is saved as-is to a stack, &n Bsp * which is an intentional UMR. shut it up if we ' re in debug. */ EX (function_state). Function_symbol_ta ble = NULL; #endif while (1) { #ifdef zend_win32 if (EG (timed_out)) { zend_timeout (0), &N Bsp } #endif //loop calls each Opline handler function if it is launched function, the return value is greater than 0, exit if (EX (opline)->handler (&execute_data tsrmls_cc) > 0) {  ; return; } } Zend_error_noreturn (e_error, "A Rrived at end of main loop which shouldn ' t happen "); }
http://www.bkjia.com/PHPjc/914780.html www.bkjia.com true http://www.bkjia.com/PHPjc/914780.html techarticle PHP kernel Two major flow request processing static int Php_handler (Request_rec *r) {/* Initiliaze the context */php_struct * volatile ctx; void *co nf Apr_bucket_brigade * Volatile Brigad ...