Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:28022 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76158 invoked by uid 1010); 14 Feb 2007 12:07:37 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 76143 invoked from network); 14 Feb 2007 12:07:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Feb 2007 12:07:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from [212.25.124.162] ([212.25.124.162:42339] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 91/95-16126-68BF2D54 for ; Wed, 14 Feb 2007 07:07:36 -0500 Received: (qmail 22141 invoked from network); 14 Feb 2007 12:05:47 -0000 Received: from internal.zend.office (HELO thinkpad) (10.1.1.1) by internal.zend.office with SMTP; 14 Feb 2007 12:05:47 -0000 To: "'Sara Golemon'" , , "'Andrei Zmievski'" Cc: "'Andi Gutmans'" , "'Rasmus Lerdorf'" , Date: Wed, 14 Feb 2007 15:07:13 +0300 Message-ID: <000001c75030$b1825730$6e02a8c0@thinkpad> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0001_01C75049.D6CF8F30" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 Importance: Normal In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 Subject: RE: runtime JIT From: dmitry@zend.com ("Dmitry Stogov") ------=_NextPart_000_0001_01C75049.D6CF8F30 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable The patch is attached. To use runtime JIT you will need to change zend_register_auto_global() = to zend_register_auto_global_ex() with "1" as the last argument. = Compile-time JIT is still supported too. Note that the significant part of the patch is reverting of "autoglobals = CV" patch, that is reimplemented using CG(auto_globals_cache). Any objections? Thanks. Dmitry. > -----Original Message----- > From: Dmitry Stogov [mailto:dmitry@zend.com]=20 > Sent: Tuesday, February 13, 2007 10:35 PM > To: 'Sara Golemon'; 'pierre.php@gmail.com'; 'Andrei Zmievski' > Cc: 'Andi Gutmans'; 'Rasmus Lerdorf' > Subject: RE: runtime JIT >=20 >=20 > Hi, >=20 > I see the following simple decision: >=20 > PHP compiler compiles accesses to autoglobals into=20 > ZEND_FETCH_x "name" with flag ZEND_FETCH_AUTOGLOBAL instead=20 > of ZEND_FETCH_GLOBAL. Also this opcode contains an index of=20 > autoglobal descriptor (for fast access during execution). >=20 > During execution of ZEND_FETCH_x with ZEND_FETCH_AUTOGLOBAL,=20 > it looks into autoglobal descriptor, checks if JIT was=20 > already called, and calls autoglobal JIT callback if need. >=20 > The decision walso removes (or modifys) CV autoglobals patch.=20 > We don't need to mix local and autoglobal CV in one array.=20 > Autoglobals zvals are cached in autoglobal desriptors. >=20 > Is this OK? >=20 > Dmitry. >=20 >=20 > > -----Original Message----- > > From: Sara Golemon [mailto:pollita@php.net] > > Sent: Tuesday, February 13, 2007 7:14 PM > > To: pierre.php@gmail.com > > Cc: Dmitry Stogov; Andrei Zmievski; Andi Gutmans; Rasmus Lerdorf > > Subject: Re: runtime JIT > >=20 > >=20 > > >> > We've discussed it all a number of times on the list. Do > > you have > > >> > access to archives? > > >> > > >> I have, but extracting requirements from the list will take huge=20 > > >> amount of time. > > >> Could you point me into the key problems and ideas > > >=20 > > Key Problems: > >=20 > > 1) Scripts need an opportunity to do some processing *prior* > > to the GPC=20 > > values being decoded to unicode so that the script can specify what=20 > > encoding the data is likely to be coming in. > >=20 > > 2) Decoding an entire GPC array at once opens the door to potential > > attack vectors by injecting deliberately invalid data, so=20 > > we'd *like* to=20 > > be able to only decode elements on an as-requested basis (the=20 > > also means=20 > > less-work for the runtime). > >=20 > > Ideas: > >=20 > > 1) Make JIT happen at Runtime (Possibly allowing it to happen on a > > per-element basis) > >=20 > > 2) Wrap GPC arrays in over-loaded objects. Not a *bad*=20 > solution IMO, > > but not without it's problems. (I've explained the BC issues=20 > > surrounding=20 > > this too many times to do it again) > >=20 > > > JIT is now done at compile time, it has to be done at > > runtime instead. > > > That's the key problem/change. What do you mean by "good way"? > > >=20 > > I presume he's referring to the numerous hooks my last=20 > patch put into > > the various FETCH ops as a not-good way. Taking the per-element=20 > > component out of the picture would reduce that somewhat, but=20 > > the need to=20 > > catch all the various fetches would still exist. > >=20 > > -Sara > >=20 >=20 ------=_NextPart_000_0001_01C75049.D6CF8F30 Content-Type: text/plain; name="jit-4.diff.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="jit-4.diff.txt" Index: Zend/zend_compile.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_compile.c,v=0A= retrieving revision 1.737=0A= diff -u -p -d -r1.737 zend_compile.c=0A= --- Zend/zend_compile.c 1 Feb 2007 15:24:10 -0000 1.737=0A= +++ Zend/zend_compile.c 14 Feb 2007 11:40:21 -0000=0A= @@ -160,6 +161,7 @@ void zend_init_compiler_data_structures(=0A= CG(in_compilation) =3D 0;=0A= CG(start_lineno) =3D 0;=0A= init_compiler_declarables(TSRMLS_C);=0A= + memset(CG(auto_globals_cache), 0, sizeof(zval**) * = zend_hash_num_elements(CG(auto_globals)));=0A= zend_hash_apply(CG(auto_globals), (apply_func_t) zend_auto_global_arm = TSRMLS_CC);=0A= zend_stack_init(&CG(labels_stack));=0A= CG(labels) =3D NULL;=0A= @@ -168,6 +170,7 @@ void zend_init_compiler_data_structures(=0A= =0A= void init_compiler(TSRMLS_D)=0A= {=0A= + CG(auto_globals_cache) =3D emalloc(sizeof(zval**) * = zend_hash_num_elements(CG(auto_globals)));=0A= CG(active_op_array) =3D NULL;=0A= zend_init_compiler_data_structures(TSRMLS_C);=0A= zend_init_rsrc_list(TSRMLS_C);=0A= @@ -180,6 +183,8 @@ void init_compiler(TSRMLS_D)=0A= =0A= void shutdown_compiler(TSRMLS_D)=0A= {=0A= + efree(CG(auto_globals_cache));=0A= + CG(auto_globals_cache) =3D NULL;=0A= zend_stack_destroy(&CG(bp_stack));=0A= zend_stack_destroy(&CG(function_call_stack));=0A= zend_stack_destroy(&CG(switch_cond_stack));=0A= @@ -267,7 +272,7 @@ static zend_uint get_temporary_variable(=0A= return (op_array->T)++ * sizeof(temp_variable);=0A= }=0A= =0A= -static int lookup_cv(zend_op_array *op_array, zend_uchar type, zstr = name, int name_len TSRMLS_DC)=0A= +static int lookup_cv(zend_op_array *op_array, zend_uchar type, zstr = name, int name_len)=0A= {=0A= int i =3D 0;=0A= ulong hash_value =3D zend_u_inline_hash_func(type, name, name_len+1);=0A= @@ -290,7 +295,6 @@ static int lookup_cv(zend_op_array *op_a=0A= op_array->vars[i].name =3D name; /* estrndup(name, name_len); */=0A= op_array->vars[i].name_len =3D name_len;=0A= op_array->vars[i].hash_value =3D hash_value;=0A= - op_array->vars[i].fetch_type =3D zend_u_is_auto_global(type, name, = name_len TSRMLS_CC) ? ZEND_FETCH_GLOBAL : ZEND_FETCH_LOCAL;=0A= return i;=0A= }=0A= =0A= @@ -377,18 +381,23 @@ void fetch_simple_variable_ex(znode *res=0A= zend_op opline;=0A= zend_op *opline_ptr;=0A= zend_llist *fetch_list_ptr;=0A= + zend_bool is_auto_global =3D 0;=0A= + zend_auto_global *auto_global;=0A= =0A= if (varname->op_type =3D=3D IS_CONST &&=0A= (Z_TYPE(varname->u.constant) =3D=3D IS_STRING ||=0A= - Z_TYPE(varname->u.constant) =3D=3D IS_UNICODE) &&=0A= - !(Z_UNILEN(varname->u.constant) =3D=3D (sizeof("this")-1) &&=0A= - ZEND_U_EQUAL(Z_TYPE(varname->u.constant), = Z_UNIVAL(varname->u.constant), Z_UNILEN(varname->u.constant), "this", = sizeof("this")-1)) &&=0A= - (CG(active_op_array)->last =3D=3D 0 ||=0A= - CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode = !=3D ZEND_BEGIN_SILENCE)) {=0A= - result->op_type =3D IS_CV;=0A= - result->u.var =3D lookup_cv(CG(active_op_array), = Z_TYPE(varname->u.constant), Z_UNIVAL(varname->u.constant), = Z_UNILEN(varname->u.constant) TSRMLS_CC);=0A= - result->u.EA.type =3D 0;=0A= - return;=0A= + Z_TYPE(varname->u.constant) =3D=3D IS_UNICODE)) {=0A= + is_auto_global =3D = zend_u_is_auto_global_ex(Z_TYPE(varname->u.constant), = Z_UNIVAL(varname->u.constant), Z_UNILEN(varname->u.constant), 0, = &auto_global TSRMLS_CC);=0A= + if (!is_auto_global &&=0A= + !(Z_UNILEN(varname->u.constant) =3D=3D (sizeof("this")-1) &&=0A= + ZEND_U_EQUAL(Z_TYPE(varname->u.constant), = Z_UNIVAL(varname->u.constant), Z_UNILEN(varname->u.constant), "this", = sizeof("this")-1)) &&=0A= + (CG(active_op_array)->last =3D=3D 0 ||=0A= + CG(active_op_array)->opcodes[CG(active_op_array)->last-1].opcode = !=3D ZEND_BEGIN_SILENCE)) {=0A= + result->op_type =3D IS_CV;=0A= + result->u.var =3D lookup_cv(CG(active_op_array), = Z_TYPE(varname->u.constant), Z_UNIVAL(varname->u.constant), = Z_UNILEN(varname->u.constant));=0A= + result->u.EA.type =3D 0;=0A= + return;=0A= + }=0A= }=0A= =0A= if (bp) {=0A= @@ -407,12 +416,9 @@ void fetch_simple_variable_ex(znode *res=0A= SET_UNUSED(opline_ptr->op2);=0A= =0A= opline_ptr->op2.u.EA.type =3D ZEND_FETCH_LOCAL;=0A= - if (varname->op_type =3D=3D IS_CONST &&=0A= - (Z_TYPE(varname->u.constant) =3D=3D IS_STRING ||=0A= - Z_TYPE(varname->u.constant) =3D=3D IS_UNICODE)) {=0A= - if (zend_u_is_auto_global(Z_TYPE(varname->u.constant), = Z_UNIVAL(varname->u.constant), Z_UNILEN(varname->u.constant) TSRMLS_CC)) = {=0A= - opline_ptr->op2.u.EA.type =3D ZEND_FETCH_GLOBAL;=0A= - }=0A= + if (is_auto_global) {=0A= + opline_ptr->op2.u.var =3D auto_global->index;=0A= + opline_ptr->op2.u.EA.type =3D ZEND_FETCH_AUTO_GLOBAL;=0A= }=0A= =0A= if (bp) {=0A= @@ -4310,36 +4316,50 @@ void zend_auto_global_dtor(zend_auto_glo=0A= }=0A= =0A= =0A= -zend_bool zend_u_is_auto_global(zend_uchar type, zstr name, uint = name_len TSRMLS_DC)=0A= +zend_bool zend_u_is_auto_global_ex(zend_uchar type, zstr name, uint = name_len, zend_bool runtime, zend_auto_global **ret TSRMLS_DC)=0A= {=0A= zend_auto_global *auto_global;=0A= =0A= if (zend_u_hash_find(CG(auto_globals), type, name, name_len+1, (void = **) &auto_global)=3D=3DSUCCESS) {=0A= - if (auto_global->armed) {=0A= + if (auto_global->runtime =3D=3D runtime && auto_global->armed) {=0A= auto_global->armed =3D = auto_global->auto_global_callback(auto_global->name, = auto_global->name_len TSRMLS_CC);=0A= }=0A= + if (ret) {=0A= + *ret =3D auto_global;=0A= + }=0A= return 1;=0A= }=0A= return 0;=0A= }=0A= =0A= +zend_bool zend_u_is_auto_global(zend_uchar type, zstr name, uint = name_len TSRMLS_DC)=0A= +{=0A= + return zend_u_is_auto_global_ex(type, name, name_len, 0, NULL = TSRMLS_CC);=0A= +}=0A= +=0A= zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC)=0A= {=0A= - return zend_u_is_auto_global(IS_STRING, ZSTR(name), name_len = TSRMLS_CC);=0A= + return zend_u_is_auto_global_ex(IS_STRING, ZSTR(name), name_len, 0, = NULL TSRMLS_CC);=0A= }=0A= =0A= =0A= -int zend_register_auto_global(char *name, uint name_len, = zend_auto_global_callback auto_global_callback TSRMLS_DC)=0A= +int zend_register_auto_global_ex(char *name, uint name_len, = zend_auto_global_callback auto_global_callback, zend_bool runtime = TSRMLS_DC)=0A= {=0A= zend_auto_global auto_global;=0A= =0A= auto_global.name =3D zend_strndup(name, name_len);=0A= auto_global.name_len =3D name_len;=0A= auto_global.auto_global_callback =3D auto_global_callback;=0A= + auto_global.runtime =3D runtime;=0A= + auto_global.index =3D zend_hash_num_elements(CG(auto_globals));=0A= =0A= return zend_hash_add(CG(auto_globals), name, name_len+1, &auto_global, = sizeof(zend_auto_global), NULL);=0A= }=0A= =0A= +int zend_register_auto_global(char *name, uint name_len, = zend_auto_global_callback auto_global_callback TSRMLS_DC)=0A= +{=0A= + return zend_register_auto_global_ex(name, name_len, = auto_global_callback, 0 TSRMLS_CC);=0A= +}=0A= =0A= int zendlex(znode *zendlval TSRMLS_DC)=0A= {=0A= Index: Zend/zend_compile.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_compile.h,v=0A= retrieving revision 1.353=0A= diff -u -p -d -r1.353 zend_compile.h=0A= --- Zend/zend_compile.h 20 Jan 2007 20:36:55 -0000 1.353=0A= +++ Zend/zend_compile.h 14 Feb 2007 11:40:24 -0000=0A= @@ -174,7 +174,6 @@ typedef struct _zend_compiled_variable {=0A= zstr name;=0A= int name_len;=0A= ulong hash_value;=0A= - zend_uint fetch_type;=0A= } zend_compiled_variable;=0A= =0A= struct _zend_op_array {=0A= @@ -581,12 +580,16 @@ typedef struct _zend_auto_global {=0A= uint name_len;=0A= zend_auto_global_callback auto_global_callback;=0A= zend_bool armed;=0A= + zend_bool runtime;=0A= + zend_uchar index;=0A= } zend_auto_global;=0A= =0A= void zend_auto_global_dtor(zend_auto_global *auto_global);=0A= ZEND_API int zend_register_auto_global(char *name, uint name_len, = zend_auto_global_callback auto_global_callback TSRMLS_DC);=0A= +ZEND_API int zend_register_auto_global_ex(char *name, uint name_len, = zend_auto_global_callback auto_global_callback, zend_bool runtime = TSRMLS_DC);=0A= ZEND_API zend_bool zend_is_auto_global(char *name, uint name_len = TSRMLS_DC);=0A= ZEND_API zend_bool zend_u_is_auto_global(zend_uchar type, zstr name, = uint name_len TSRMLS_DC);=0A= +ZEND_API zend_bool zend_u_is_auto_global_ex(zend_uchar type, zstr name, = uint name_len, zend_bool runtime, zend_auto_global **ret TSRMLS_DC);=0A= ZEND_API int zend_auto_global_disable_jit(char *varname, zend_uint = varname_length TSRMLS_DC);=0A= =0A= int zendlex(znode *zendlval TSRMLS_DC);=0A= @@ -607,7 +610,8 @@ int zendlex(znode *zendlval TSRMLS_DC);=0A= #define ZEND_FETCH_LOCAL 1=0A= #define ZEND_FETCH_STATIC 2=0A= #define ZEND_FETCH_STATIC_MEMBER 3=0A= -#define ZEND_FETCH_GLOBAL_LOCK 4=0A= +#define ZEND_FETCH_GLOBAL_LOCK 4=0A= +#define ZEND_FETCH_AUTO_GLOBAL 5=0A= =0A= =0A= /* class fetches */=0A= Index: Zend/zend_execute.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_execute.c,v=0A= retrieving revision 1.758=0A= diff -u -p -d -r1.758 zend_execute.c=0A= --- Zend/zend_execute.c 20 Jan 2007 20:36:55 -0000 1.758=0A= +++ Zend/zend_execute.c 14 Feb 2007 11:40:28 -0000=0A= @@ -226,9 +226,8 @@ static inline zval *_get_zval_ptr_cv(zno=0A= if (!*ptr) {=0A= zend_compiled_variable *cv =3D &CV_DEF_OF(node->u.var);=0A= zend_uchar utype =3D UG(unicode)?IS_UNICODE:IS_STRING;=0A= - HashTable *symbol_table =3D (cv->fetch_type =3D=3D ZEND_FETCH_GLOBAL) = ? &EG(symbol_table) : EG(active_symbol_table);=0A= =0A= - if (zend_u_hash_quick_find(symbol_table, utype, cv->name, = cv->name_len+1, cv->hash_value, (void **)ptr)=3D=3DFAILURE) {=0A= + if (zend_u_hash_quick_find(EG(active_symbol_table), utype, cv->name, = cv->name_len+1, cv->hash_value, (void **)ptr)=3D=3DFAILURE) {=0A= switch (type) {=0A= case BP_VAR_R:=0A= case BP_VAR_UNSET:=0A= @@ -297,9 +296,8 @@ static inline zval **_get_zval_ptr_ptr_c=0A= if (!*ptr) {=0A= zend_compiled_variable *cv =3D &CV_DEF_OF(node->u.var);=0A= zend_uchar utype =3D UG(unicode)?IS_UNICODE:IS_STRING;=0A= - HashTable *symbol_table =3D (cv->fetch_type =3D=3D ZEND_FETCH_GLOBAL) = ? &EG(symbol_table) : EG(active_symbol_table);=0A= =0A= - if (zend_u_hash_quick_find(symbol_table, utype, cv->name, = cv->name_len+1, cv->hash_value, (void **)ptr)=3D=3DFAILURE) {=0A= + if (zend_u_hash_quick_find(EG(active_symbol_table), utype, cv->name, = cv->name_len+1, cv->hash_value, (void **)ptr)=3D=3DFAILURE) {=0A= switch (type) {=0A= case BP_VAR_R:=0A= case BP_VAR_UNSET:=0A= @@ -903,6 +901,7 @@ static inline HashTable *zend_get_target=0A= break;=0A= case ZEND_FETCH_GLOBAL:=0A= case ZEND_FETCH_GLOBAL_LOCK:=0A= + case ZEND_FETCH_AUTO_GLOBAL:=0A= return &EG(symbol_table);=0A= break;=0A= case ZEND_FETCH_STATIC:=0A= Index: Zend/zend_execute_API.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_execute_API.c,v=0A= retrieving revision 1.392=0A= diff -u -p -d -r1.392 zend_execute_API.c=0A= --- Zend/zend_execute_API.c 1 Jan 2007 09:29:20 -0000 1.392=0A= +++ Zend/zend_execute_API.c 14 Feb 2007 11:40:33 -0000=0A= @@ -1706,6 +1706,7 @@ ZEND_API void zend_reset_all_cv(HashTabl=0A= zend_execute_data *ex;=0A= int i;=0A= =0A= + memset(CG(auto_globals_cache), 0, sizeof(zval**) * = zend_hash_num_elements(CG(auto_globals)));=0A= for (ex =3D EG(current_execute_data); ex; ex =3D = ex->prev_execute_data) {=0A= if (ex->op_array && ex->symbol_table =3D=3D symbol_table) {=0A= for (i =3D 0; i < ex->op_array->last_var; i++) {=0A= @@ -1719,7 +1720,11 @@ ZEND_API int zend_u_delete_global_variab=0A= {=0A= zend_execute_data *ex;=0A= ulong hash_value =3D zend_u_inline_hash_func(type, name, name_len+1);=0A= + zend_auto_global *auto_global;=0A= =0A= + if (zend_u_hash_quick_find(CG(auto_globals), type, name, name_len+1, = hash_value, (void**)&auto_global) =3D=3D SUCCESS) {=0A= + CG(auto_globals_cache)[auto_global->index] =3D NULL;=0A= + }=0A= if (zend_u_hash_quick_exists(&EG(symbol_table), type, name, = name_len+1, hash_value)) {=0A= for (ex =3D EG(current_execute_data); ex; ex =3D = ex->prev_execute_data) {=0A= if (ex->op_array && ex->symbol_table =3D=3D &EG(symbol_table)) {=0A= Index: Zend/zend_globals.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_globals.h,v=0A= retrieving revision 1.166=0A= diff -u -p -d -r1.166 zend_globals.h=0A= --- Zend/zend_globals.h 1 Jan 2007 09:29:21 -0000 1.166=0A= +++ Zend/zend_globals.h 14 Feb 2007 11:40:34 -0000=0A= @@ -96,6 +96,7 @@ struct _zend_compiler_globals {=0A= HashTable filenames_table;=0A= =0A= HashTable *auto_globals;=0A= + zval ***auto_globals_cache;=0A= =0A= zend_bool in_compilation;=0A= zend_bool short_tags;=0A= Index: Zend/zend_vm_def.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_vm_def.h,v=0A= retrieving revision 1.156=0A= diff -u -p -d -r1.156 zend_vm_def.h=0A= --- Zend/zend_vm_def.h 1 Feb 2007 16:38:15 -0000 1.156=0A= +++ Zend/zend_vm_def.h 14 Feb 2007 11:41:03 -0000=0A= @@ -945,9 +945,17 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address=0A= varname =3D &tmp_varname;=0A= }=0A= =0A= - if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_STATIC_MEMBER) {=0A= + if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_AUTO_GLOBAL &&=0A= + CG(auto_globals_cache)[opline->op2.u.var]) {=0A= + retval =3D CG(auto_globals_cache)[opline->op2.u.var];=0A= + } else if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_STATIC_MEMBER) {=0A= retval =3D = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, = Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 0 = TSRMLS_CC);=0A= } else {=0A= + zend_auto_global *auto_global =3D NULL;=0A= +=0A= + if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_AUTO_GLOBAL) {=0A= + zend_u_is_auto_global_ex(Z_TYPE_P(varname), Z_UNIVAL_P(varname), = Z_UNILEN_P(varname), 1, &auto_global TSRMLS_CC);=0A= + }=0A= target_symbol_table =3D zend_get_target_symbol_table(opline, EX(Ts), = type, varname TSRMLS_CC);=0A= /*=0A= if (!target_symbol_table) {=0A= @@ -977,6 +985,11 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address=0A= }=0A= }=0A= switch (opline->op2.u.EA.type) {=0A= + case ZEND_FETCH_AUTO_GLOBAL:=0A= + if (auto_global && (!auto_global->armed || !auto_global->runtime)) {=0A= + CG(auto_globals_cache)[opline->op2.u.var] =3D retval;=0A= + }=0A= + /* break missing intentionally */=0A= case ZEND_FETCH_GLOBAL:=0A= if (OP1_TYPE !=3D IS_TMP_VAR) {=0A= FREE_OP1();=0A= @@ -2987,7 +3000,11 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONS=0A= if (zend_u_hash_del(target_symbol_table, Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1) =3D=3D SUCCESS) {=0A= zend_execute_data *ex =3D EXECUTE_DATA;=0A= ulong hash_value =3D zend_u_inline_hash_func(Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1);=0A= + zend_auto_global *auto_global;=0A= =0A= + if (zend_u_hash_quick_find(CG(auto_globals), Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, hash_value, = (void**)&auto_global) =3D=3D SUCCESS) {=0A= + CG(auto_globals_cache)[auto_global->index] =3D NULL;=0A= + }=0A= do {=0A= int i;=0A= =0A= Index: Zend/zend_vm_execute.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_vm_execute.h,v=0A= retrieving revision 1.159=0A= diff -u -p -d -r1.159 zend_vm_execute.h=0A= --- Zend/zend_vm_execute.h 1 Feb 2007 16:38:15 -0000 1.159=0A= +++ Zend/zend_vm_execute.h 14 Feb 2007 11:41:38 -0000=0A= @@ -1443,9 +1443,17 @@ static int zend_fetch_var_address_helper=0A= varname =3D &tmp_varname;=0A= }=0A= =0A= - if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_STATIC_MEMBER) {=0A= + if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_AUTO_GLOBAL &&=0A= + CG(auto_globals_cache)[opline->op2.u.var]) {=0A= + retval =3D CG(auto_globals_cache)[opline->op2.u.var];=0A= + } else if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_STATIC_MEMBER) {=0A= retval =3D = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, = Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 0 = TSRMLS_CC);=0A= } else {=0A= + zend_auto_global *auto_global =3D NULL;=0A= +=0A= + if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_AUTO_GLOBAL) {=0A= + zend_u_is_auto_global_ex(Z_TYPE_P(varname), Z_UNIVAL_P(varname), = Z_UNILEN_P(varname), 1, &auto_global TSRMLS_CC);=0A= + }=0A= target_symbol_table =3D zend_get_target_symbol_table(opline, EX(Ts), = type, varname TSRMLS_CC);=0A= /*=0A= if (!target_symbol_table) {=0A= @@ -1475,6 +1483,11 @@ static int zend_fetch_var_address_helper=0A= }=0A= }=0A= switch (opline->op2.u.EA.type) {=0A= + case ZEND_FETCH_AUTO_GLOBAL:=0A= + if (auto_global && (!auto_global->armed || !auto_global->runtime)) {=0A= + CG(auto_globals_cache)[opline->op2.u.var] =3D retval;=0A= + }=0A= + /* break missing intentionally */=0A= case ZEND_FETCH_GLOBAL:=0A= if (IS_CONST !=3D IS_TMP_VAR) {=0A= =0A= @@ -2079,7 +2092,11 @@ static int ZEND_UNSET_VAR_SPEC_CONST_HAN=0A= if (zend_u_hash_del(target_symbol_table, Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1) =3D=3D SUCCESS) {=0A= zend_execute_data *ex =3D execute_data;=0A= ulong hash_value =3D zend_u_inline_hash_func(Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1);=0A= + zend_auto_global *auto_global;=0A= =0A= + if (zend_u_hash_quick_find(CG(auto_globals), Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, hash_value, = (void**)&auto_global) =3D=3D SUCCESS) {=0A= + CG(auto_globals_cache)[auto_global->index] =3D NULL;=0A= + }=0A= do {=0A= int i;=0A= =0A= @@ -4057,9 +4074,17 @@ static int zend_fetch_var_address_helper=0A= varname =3D &tmp_varname;=0A= }=0A= =0A= - if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_STATIC_MEMBER) {=0A= + if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_AUTO_GLOBAL &&=0A= + CG(auto_globals_cache)[opline->op2.u.var]) {=0A= + retval =3D CG(auto_globals_cache)[opline->op2.u.var];=0A= + } else if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_STATIC_MEMBER) {=0A= retval =3D = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, = Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 0 = TSRMLS_CC);=0A= } else {=0A= + zend_auto_global *auto_global =3D NULL;=0A= +=0A= + if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_AUTO_GLOBAL) {=0A= + zend_u_is_auto_global_ex(Z_TYPE_P(varname), Z_UNIVAL_P(varname), = Z_UNILEN_P(varname), 1, &auto_global TSRMLS_CC);=0A= + }=0A= target_symbol_table =3D zend_get_target_symbol_table(opline, EX(Ts), = type, varname TSRMLS_CC);=0A= /*=0A= if (!target_symbol_table) {=0A= @@ -4089,6 +4114,11 @@ static int zend_fetch_var_address_helper=0A= }=0A= }=0A= switch (opline->op2.u.EA.type) {=0A= + case ZEND_FETCH_AUTO_GLOBAL:=0A= + if (auto_global && (!auto_global->armed || !auto_global->runtime)) {=0A= + CG(auto_globals_cache)[opline->op2.u.var] =3D retval;=0A= + }=0A= + /* break missing intentionally */=0A= case ZEND_FETCH_GLOBAL:=0A= if (IS_TMP_VAR !=3D IS_TMP_VAR) {=0A= zval_dtor(free_op1.var);=0A= @@ -4694,7 +4724,11 @@ static int ZEND_UNSET_VAR_SPEC_TMP_HANDL=0A= if (zend_u_hash_del(target_symbol_table, Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1) =3D=3D SUCCESS) {=0A= zend_execute_data *ex =3D execute_data;=0A= ulong hash_value =3D zend_u_inline_hash_func(Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1);=0A= + zend_auto_global *auto_global;=0A= =0A= + if (zend_u_hash_quick_find(CG(auto_globals), Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, hash_value, = (void**)&auto_global) =3D=3D SUCCESS) {=0A= + CG(auto_globals_cache)[auto_global->index] =3D NULL;=0A= + }=0A= do {=0A= int i;=0A= =0A= @@ -7178,9 +7212,17 @@ static int zend_fetch_var_address_helper=0A= varname =3D &tmp_varname;=0A= }=0A= =0A= - if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_STATIC_MEMBER) {=0A= + if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_AUTO_GLOBAL &&=0A= + CG(auto_globals_cache)[opline->op2.u.var]) {=0A= + retval =3D CG(auto_globals_cache)[opline->op2.u.var];=0A= + } else if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_STATIC_MEMBER) {=0A= retval =3D = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, = Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 0 = TSRMLS_CC);=0A= } else {=0A= + zend_auto_global *auto_global =3D NULL;=0A= +=0A= + if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_AUTO_GLOBAL) {=0A= + zend_u_is_auto_global_ex(Z_TYPE_P(varname), Z_UNIVAL_P(varname), = Z_UNILEN_P(varname), 1, &auto_global TSRMLS_CC);=0A= + }=0A= target_symbol_table =3D zend_get_target_symbol_table(opline, EX(Ts), = type, varname TSRMLS_CC);=0A= /*=0A= if (!target_symbol_table) {=0A= @@ -7210,6 +7252,11 @@ static int zend_fetch_var_address_helper=0A= }=0A= }=0A= switch (opline->op2.u.EA.type) {=0A= + case ZEND_FETCH_AUTO_GLOBAL:=0A= + if (auto_global && (!auto_global->armed || !auto_global->runtime)) {=0A= + CG(auto_globals_cache)[opline->op2.u.var] =3D retval;=0A= + }=0A= + /* break missing intentionally */=0A= case ZEND_FETCH_GLOBAL:=0A= if (IS_VAR !=3D IS_TMP_VAR) {=0A= if (free_op1.var) {zval_ptr_dtor(&free_op1.var);};=0A= @@ -7914,7 +7961,11 @@ static int ZEND_UNSET_VAR_SPEC_VAR_HANDL=0A= if (zend_u_hash_del(target_symbol_table, Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1) =3D=3D SUCCESS) {=0A= zend_execute_data *ex =3D execute_data;=0A= ulong hash_value =3D zend_u_inline_hash_func(Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1);=0A= + zend_auto_global *auto_global;=0A= =0A= + if (zend_u_hash_quick_find(CG(auto_globals), Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, hash_value, = (void**)&auto_global) =3D=3D SUCCESS) {=0A= + CG(auto_globals_cache)[auto_global->index] =3D NULL;=0A= + }=0A= do {=0A= int i;=0A= =0A= @@ -19760,9 +19811,17 @@ static int zend_fetch_var_address_helper=0A= varname =3D &tmp_varname;=0A= }=0A= =0A= - if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_STATIC_MEMBER) {=0A= + if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_AUTO_GLOBAL &&=0A= + CG(auto_globals_cache)[opline->op2.u.var]) {=0A= + retval =3D CG(auto_globals_cache)[opline->op2.u.var];=0A= + } else if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_STATIC_MEMBER) {=0A= retval =3D = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, = Z_TYPE_P(varname), Z_UNIVAL_P(varname), Z_UNILEN_P(varname), 0 = TSRMLS_CC);=0A= } else {=0A= + zend_auto_global *auto_global =3D NULL;=0A= +=0A= + if (opline->op2.u.EA.type =3D=3D ZEND_FETCH_AUTO_GLOBAL) {=0A= + zend_u_is_auto_global_ex(Z_TYPE_P(varname), Z_UNIVAL_P(varname), = Z_UNILEN_P(varname), 1, &auto_global TSRMLS_CC);=0A= + }=0A= target_symbol_table =3D zend_get_target_symbol_table(opline, EX(Ts), = type, varname TSRMLS_CC);=0A= /*=0A= if (!target_symbol_table) {=0A= @@ -19792,6 +19851,11 @@ static int zend_fetch_var_address_helper=0A= }=0A= }=0A= switch (opline->op2.u.EA.type) {=0A= + case ZEND_FETCH_AUTO_GLOBAL:=0A= + if (auto_global && (!auto_global->armed || !auto_global->runtime)) {=0A= + CG(auto_globals_cache)[opline->op2.u.var] =3D retval;=0A= + }=0A= + /* break missing intentionally */=0A= case ZEND_FETCH_GLOBAL:=0A= if (IS_CV !=3D IS_TMP_VAR) {=0A= =0A= @@ -20483,7 +20547,11 @@ static int ZEND_UNSET_VAR_SPEC_CV_HANDLE=0A= if (zend_u_hash_del(target_symbol_table, Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1) =3D=3D SUCCESS) {=0A= zend_execute_data *ex =3D execute_data;=0A= ulong hash_value =3D zend_u_inline_hash_func(Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1);=0A= + zend_auto_global *auto_global;=0A= =0A= + if (zend_u_hash_quick_find(CG(auto_globals), Z_TYPE_P(varname), = Z_UNIVAL_P(varname), Z_UNILEN_P(varname)+1, hash_value, = (void**)&auto_global) =3D=3D SUCCESS) {=0A= + CG(auto_globals_cache)[auto_global->index] =3D NULL;=0A= + }=0A= do {=0A= int i;=0A= =0A= ------=_NextPart_000_0001_01C75049.D6CF8F30--