@@ -99,27 +99,17 @@ void zend_accel_move_user_functions(HashTable *src, zend_script *script)
99
99
src -> pDestructor = orig_dtor ;
100
100
}
101
101
102
- static void zend_hash_clone_constants (HashTable * ht , HashTable * source )
102
+ static void zend_hash_clone_constants (HashTable * ht )
103
103
{
104
104
Bucket * p , * end ;
105
105
zend_class_constant * c ;
106
106
107
- ht -> nTableSize = source -> nTableSize ;
108
- ht -> nTableMask = source -> nTableMask ;
109
- ht -> nNumUsed = source -> nNumUsed ;
110
- ht -> nNumOfElements = source -> nNumOfElements ;
111
- ht -> nNextFreeElement = source -> nNextFreeElement ;
112
- ht -> pDestructor = NULL ;
113
- HT_FLAGS (ht ) = HT_FLAGS (source );
114
- ht -> nInternalPointer = 0 ;
115
-
116
107
if (!(HT_FLAGS (ht ) & HASH_FLAG_INITIALIZED )) {
117
- ht -> arData = source -> arData ;
118
108
return ;
119
109
}
120
110
121
111
p = emalloc (HT_SIZE (ht ));
122
- memcpy (p , HT_GET_DATA_ADDR (source ), HT_USED_SIZE (ht ));
112
+ memcpy (p , HT_GET_DATA_ADDR (ht ), HT_USED_SIZE (ht ));
123
113
HT_SET_DATA_ADDR (ht , p );
124
114
125
115
p = ht -> arData ;
@@ -138,27 +128,19 @@ static void zend_hash_clone_constants(HashTable *ht, HashTable *source)
138
128
}
139
129
}
140
130
141
- static void zend_hash_clone_methods (HashTable * ht , HashTable * source , zend_class_entry * old_ce , zend_class_entry * ce )
131
+ static void zend_hash_clone_methods (HashTable * ht )
142
132
{
143
133
Bucket * p , * end ;
144
134
zend_op_array * new_entry ;
145
135
146
- ht -> nTableSize = source -> nTableSize ;
147
- ht -> nTableMask = source -> nTableMask ;
148
- ht -> nNumUsed = source -> nNumUsed ;
149
- ht -> nNumOfElements = source -> nNumOfElements ;
150
- ht -> nNextFreeElement = source -> nNextFreeElement ;
151
136
ht -> pDestructor = ZEND_FUNCTION_DTOR ;
152
- HT_FLAGS (ht ) = HT_FLAGS (source );
153
- ht -> nInternalPointer = 0 ;
154
137
155
138
if (!(HT_FLAGS (ht ) & HASH_FLAG_INITIALIZED )) {
156
- ht -> arData = source -> arData ;
157
139
return ;
158
140
}
159
141
160
142
p = emalloc (HT_SIZE (ht ));
161
- memcpy (p , HT_GET_DATA_ADDR (source ), HT_USED_SIZE (ht ));
143
+ memcpy (p , HT_GET_DATA_ADDR (ht ), HT_USED_SIZE (ht ));
162
144
HT_SET_DATA_ADDR (ht , p );
163
145
164
146
p = ht -> arData ;
@@ -186,27 +168,17 @@ static void zend_hash_clone_methods(HashTable *ht, HashTable *source, zend_class
186
168
}
187
169
}
188
170
189
- static void zend_hash_clone_prop_info (HashTable * ht , HashTable * source , zend_class_entry * old_ce )
171
+ static void zend_hash_clone_prop_info (HashTable * ht )
190
172
{
191
173
Bucket * p , * end ;
192
174
zend_property_info * prop_info ;
193
175
194
- ht -> nTableSize = source -> nTableSize ;
195
- ht -> nTableMask = source -> nTableMask ;
196
- ht -> nNumUsed = source -> nNumUsed ;
197
- ht -> nNumOfElements = source -> nNumOfElements ;
198
- ht -> nNextFreeElement = source -> nNextFreeElement ;
199
- ht -> pDestructor = NULL ;
200
- HT_FLAGS (ht ) = HT_FLAGS (source );
201
- ht -> nInternalPointer = 0 ;
202
-
203
176
if (!(HT_FLAGS (ht ) & HASH_FLAG_INITIALIZED )) {
204
- ht -> arData = source -> arData ;
205
177
return ;
206
178
}
207
179
208
180
p = emalloc (HT_SIZE (ht ));
209
- memcpy (p , HT_GET_DATA_ADDR (source ), HT_USED_SIZE (ht ));
181
+ memcpy (p , HT_GET_DATA_ADDR (ht ), HT_USED_SIZE (ht ));
210
182
HT_SET_DATA_ADDR (ht , p );
211
183
212
184
p = ht -> arData ;
@@ -236,48 +208,49 @@ static void zend_hash_clone_prop_info(HashTable *ht, HashTable *source, zend_cla
236
208
static void zend_class_copy_ctor (zend_class_entry * * pce )
237
209
{
238
210
zend_class_entry * ce = * pce ;
239
- zend_class_entry * old_ce = ce ;
240
211
zval * src , * dst , * end ;
241
212
242
- * pce = ce = ARENA_REALLOC (old_ce );
213
+ * pce = ce = ARENA_REALLOC (ce );
243
214
ce -> refcount = 1 ;
244
215
245
216
if ((ce -> ce_flags & ZEND_ACC_LINKED ) && IN_ARENA (ce -> parent )) {
246
217
ce -> parent = ARENA_REALLOC (ce -> parent );
247
218
}
248
219
249
- if (old_ce -> default_properties_table ) {
250
- ce -> default_properties_table = emalloc (sizeof (zval ) * old_ce -> default_properties_count );
251
- src = old_ce -> default_properties_table ;
252
- end = src + old_ce -> default_properties_count ;
253
- dst = ce -> default_properties_table ;
220
+ if (ce -> default_properties_table ) {
221
+ dst = emalloc (sizeof (zval ) * ce -> default_properties_count );
222
+ src = ce -> default_properties_table ;
223
+ end = src + ce -> default_properties_count ;
224
+ ce -> default_properties_table = dst ;
254
225
for (; src != end ; src ++ , dst ++ ) {
255
226
ZVAL_COPY_VALUE (dst , src );
256
227
}
257
228
}
258
229
259
- zend_hash_clone_methods (& ce -> function_table , & old_ce -> function_table , old_ce , ce );
230
+ zend_hash_clone_methods (& ce -> function_table );
260
231
261
232
/* static members */
262
- if (old_ce -> default_static_members_table ) {
233
+ if (ce -> default_static_members_table ) {
263
234
int i , end ;
264
235
zend_class_entry * parent = !(ce -> ce_flags & ZEND_ACC_LINKED ) ? NULL : ce -> parent ;
265
236
266
- ce -> default_static_members_table = emalloc (sizeof (zval ) * old_ce -> default_static_members_count );
237
+ dst = emalloc (sizeof (zval ) * ce -> default_static_members_count );
238
+ src = ce -> default_static_members_table ;
239
+ ce -> default_static_members_table = dst ;
267
240
i = ce -> default_static_members_count - 1 ;
268
241
269
242
/* Copy static properties in this class */
270
243
end = parent ? parent -> default_static_members_count : 0 ;
271
244
for (; i >= end ; i -- ) {
272
- zval * p = & ce -> default_static_members_table [i ];
273
- ZVAL_COPY_VALUE (p , & old_ce -> default_static_members_table [i ]);
245
+ zval * p = & dst [i ];
246
+ ZVAL_COPY_VALUE (p , & src [i ]);
274
247
}
275
248
276
249
/* Create indirections to static properties from parent classes */
277
250
while (parent && parent -> default_static_members_table ) {
278
251
end = parent -> parent ? parent -> parent -> default_static_members_count : 0 ;
279
252
for (; i >= end ; i -- ) {
280
- zval * p = & ce -> default_static_members_table [i ];
253
+ zval * p = & dst [i ];
281
254
ZVAL_INDIRECT (p , & parent -> default_static_members_table [i ]);
282
255
}
283
256
@@ -287,10 +260,10 @@ static void zend_class_copy_ctor(zend_class_entry **pce)
287
260
ZEND_MAP_PTR_INIT (ce -> static_members_table , & ce -> default_static_members_table );
288
261
289
262
/* properties_info */
290
- zend_hash_clone_prop_info (& ce -> properties_info , & old_ce -> properties_info , old_ce );
263
+ zend_hash_clone_prop_info (& ce -> properties_info );
291
264
292
265
/* constants table */
293
- zend_hash_clone_constants (& ce -> constants_table , & old_ce -> constants_table );
266
+ zend_hash_clone_constants (& ce -> constants_table );
294
267
295
268
if (ce -> num_interfaces ) {
296
269
zend_class_name * interface_names ;
0 commit comments