Re: issue in copying the hash table(Reposted third time)
| From: | Kamesh Jayachandran | Date: | Tue, 29 Jun 2004 05:57:38 +0000 |
| Subject: | Re: issue in copying the hash table(Reposted third time) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-10833@lists.php.net to get a copy of this message | ||
Hi Andi,
In Zend/zend.c
function name is compiler_globals_ctor
This function is defined inside the #ifdef ZTS macro
Line of concern
zend_hash_copy(compiler_globals->class_table, global_class_table,
(copy_ctor_func_t) zend_class_add_ref, &tmp_class,
sizeof(zend_class_entry));
If I am correct our global_class_table is a hash table of classname
versus zend_class_entry**.
In this case while making a copy og global_class_table to thread
specific class_table in a deep fashion. zend_hash_copy has to do the
double dereferencing which it can't being a generic fuinction.
So my contention is
The above line should be the following
zend_hash_copy(compiler_globals->class_table, global_class_table,
(copy_ctor_func_t) zend_class_add_ref, &tmp_class,
sizeof(zend_class_entry*));
If sharing of class entries are desired across threads.
Else
We should write a custom class_table deep copy function.
Hope I made it clear.
Awaiting for your comments.
With regards
Kamesh Jayachandran
On Mon, 28 Jun 2004 07:58:59 -0700, "Andi Gutmans" <andi@zend.com> said:
> I don't quite understand the question.
> Can you rephrase what exactly is bothering you?
>
> Andi
>
> At 03:46 AM 6/28/2004 +0530, Kamesh Jayachandran wrote:
> >Hi All,
> >Sorry to repost for the third time.
> >I want the clarification regarding copying the global_class_table to
> >thread specific compiler_globals->class_table in compiler_globals_ctor
> >in Zend/zend.c.
> >
> >According to me memcpy should copy 'whatever source points to' to
> >'destination'.
> >Our class_table hashtable structure looks like this,
> >char *key;
> >zend_class_entry** value;
> >So memcpy should copy only whatever (zend_class_entry**) points to which
> >is semantically wrong good candidate for Segmentation fault.
> >
> >No way memcpy can do double dereferencing for this case.
> >
> >Somehow in Linux when i compile it with maintainer-zts-mode memcpy
> >copies the data fine.
> >I verified all the internal classes. Thread specific class_table is in
> >sink with the global_class_table.
> >
> >
> >Please clarify.
> >
> >Thanks in Advance
> >
> >
> >With regards
> >Kamesh Jayachandran
> >
> >--
> >PHP Internals - PHP Runtime Development Mailing List
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>