zeev            Tue Mar 16 14:49:20 2004 EDT

  Modified files:              
    /php-src/main       main.c php_globals.h php_variables.c 
  Log:
  Improve the way auto-globals JIT works, and add the ability to turn it off
  
  
http://cvs.php.net/diff.php/php-src/main/main.c?r1=1.597&r2=1.598&ty=u
Index: php-src/main/main.c
diff -u php-src/main/main.c:1.597 php-src/main/main.c:1.598
--- php-src/main/main.c:1.597   Tue Mar 16 05:14:57 2004
+++ php-src/main/main.c Tue Mar 16 14:49:18 2004
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: main.c,v 1.597 2004/03/16 10:14:57 helly Exp $ */
+/* $Id: main.c,v 1.598 2004/03/16 19:49:18 zeev Exp $ */
 
 /* {{{ includes
  */
@@ -273,6 +273,7 @@
        STD_PHP_INI_BOOLEAN("register_argc_argv",       "1",            
PHP_INI_PERDIR|PHP_INI_SYSTEM,  OnUpdateBool,   register_argc_argv,             
php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("register_globals",         "0",            
PHP_INI_PERDIR|PHP_INI_SYSTEM,  OnUpdateBool,   register_globals,               
php_core_globals,       core_globals)
        STD_PHP_INI_BOOLEAN("register_long_arrays",     "1",            
PHP_INI_PERDIR|PHP_INI_SYSTEM,  OnUpdateBool,   register_long_arrays,   
php_core_globals,       core_globals)
+       STD_PHP_INI_BOOLEAN("auto_globals_jit",         "1",            
PHP_INI_PERDIR|PHP_INI_SYSTEM,  OnUpdateBool,   auto_globals_jit,       
php_core_globals,       core_globals)
 #if PHP_SAFE_MODE
        STD_PHP_INI_BOOLEAN("safe_mode",                        "1",            
PHP_INI_SYSTEM,         OnUpdateBool,                   safe_mode,                     
         php_core_globals,       core_globals)
 #else
http://cvs.php.net/diff.php/php-src/main/php_globals.h?r1=1.96&r2=1.97&ty=u
Index: php-src/main/php_globals.h
diff -u php-src/main/php_globals.h:1.96 php-src/main/php_globals.h:1.97
--- php-src/main/php_globals.h:1.96     Sun Jan 25 23:15:08 2004
+++ php-src/main/php_globals.h  Tue Mar 16 14:49:19 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_globals.h,v 1.96 2004/01/26 04:15:08 sniper Exp $ */
+/* $Id: php_globals.h,v 1.97 2004/03/16 19:49:19 zeev Exp $ */
 
 #ifndef PHP_GLOBALS_H
 #define PHP_GLOBALS_H
@@ -121,6 +121,7 @@
        zend_bool register_globals;
        zend_bool register_long_arrays;
        zend_bool register_argc_argv;
+       zend_bool auto_globals_jit;
 
        zend_bool y2k_compliance;
 
http://cvs.php.net/diff.php/php-src/main/php_variables.c?r1=1.76&r2=1.77&ty=u
Index: php-src/main/php_variables.c
diff -u php-src/main/php_variables.c:1.76 php-src/main/php_variables.c:1.77
--- php-src/main/php_variables.c:1.76   Sun Jan 25 23:15:08 2004
+++ php-src/main/php_variables.c        Tue Mar 16 14:49:19 2004
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_variables.c,v 1.76 2004/01/26 04:15:08 sniper Exp $ */
+/* $Id: php_variables.c,v 1.77 2004/03/16 19:49:19 zeev Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -543,6 +543,7 @@
 static zend_bool php_auto_globals_create_env(char *name, uint name_len TSRMLS_DC);
 static zend_bool php_auto_globals_create_request(char *name, uint name_len TSRMLS_DC);
 
+
 /* {{{ php_hash_environment
  */
 int php_hash_environment(TSRMLS_D)
@@ -551,7 +552,7 @@
        unsigned char _gpc_flags[5] = {0, 0, 0, 0, 0};
        zval *dummy_track_vars_array = NULL;
        zend_bool initialized_dummy_track_vars_array=0;
-       zend_bool jit_initialization = (!PG(register_globals) && 
!PG(register_long_arrays));
+       zend_bool jit_initialization = (PG(auto_globals_jit) && !PG(register_globals) 
&& !PG(register_long_arrays) && !PG(register_argc_argv));
        struct auto_global_record {
                char *name;
                uint name_len;
@@ -609,6 +610,7 @@
                        case 'e':
                        case 'E':
                                if (!jit_initialization && !_gpc_flags[3]) {
+                                       zend_auto_global_disable_jit("_ENV", 
sizeof("_ENV")-1 TSRMLS_CC);
                                        php_auto_globals_create_env("_ENV", 
sizeof("_ENV")-1 TSRMLS_CC);
                                        _gpc_flags[3]=1;
                                        if (PG(register_globals)) {
@@ -619,6 +621,7 @@
                        case 's':
                        case 'S':
                                if (!jit_initialization && !_gpc_flags[4]) {
+                                       zend_auto_global_disable_jit("_SERVER", 
sizeof("_SERVER")-1 TSRMLS_CC);
                                        php_register_server_variables(TSRMLS_C);
                                        _gpc_flags[4]=1;
                                        if (PG(register_globals)) {
@@ -660,6 +663,7 @@
 
        /* Create _REQUEST */
        if (!jit_initialization) {
+               zend_auto_global_disable_jit("_REQUEST", sizeof("_REQUEST")-1 
TSRMLS_CC);
                php_auto_globals_create_request("_REQUEST", sizeof("_REQUEST")-1 
TSRMLS_CC);
        }
 
@@ -746,15 +750,12 @@
 
 void php_startup_auto_globals(TSRMLS_D)
 {
-       zend_bool cb = (!PG(register_globals) && !PG(register_long_arrays));
-
-       /*cb = 0;*/
        zend_register_auto_global("_GET", sizeof("_GET")-1, NULL TSRMLS_CC);
        zend_register_auto_global("_POST", sizeof("_POST")-1, NULL TSRMLS_CC);
        zend_register_auto_global("_COOKIE", sizeof("_COOKIE")-1, NULL TSRMLS_CC);
-       zend_register_auto_global("_SERVER", sizeof("_SERVER")-1, 
cb?php_auto_globals_create_server:NULL TSRMLS_CC);
-       zend_register_auto_global("_ENV", sizeof("_ENV")-1, 
cb?php_auto_globals_create_env:NULL TSRMLS_CC);
-       zend_register_auto_global("_REQUEST", sizeof("_REQUEST")-1, 
cb?php_auto_globals_create_request:NULL TSRMLS_CC);
+       zend_register_auto_global("_SERVER", sizeof("_SERVER")-1, 
php_auto_globals_create_server TSRMLS_CC);
+       zend_register_auto_global("_ENV", sizeof("_ENV")-1, 
php_auto_globals_create_env TSRMLS_CC);
+       zend_register_auto_global("_REQUEST", sizeof("_REQUEST")-1, 
php_auto_globals_create_request TSRMLS_CC);
        zend_register_auto_global("_FILES", sizeof("_FILES")-1, NULL TSRMLS_CC);
 }
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to