[1] | 1 | dnl ================ |
---|
| 2 | /* {{{ Pre-declare */ |
---|
| 3 | DECL_STRUCT_P_FUNC(`zval') |
---|
| 4 | DECL_STRUCT_P_FUNC(`zval_ptr') |
---|
[825] | 5 | DECL_STRUCT_P_FUNC(`zval_ptr_nullable') |
---|
[1] | 6 | DECL_STRUCT_P_FUNC(`zend_op_array') |
---|
| 7 | DECL_STRUCT_P_FUNC(`zend_class_entry') |
---|
[95] | 8 | #ifdef HAVE_XCACHE_CONSTANT |
---|
| 9 | DECL_STRUCT_P_FUNC(`zend_constant') |
---|
| 10 | #endif |
---|
[1] | 11 | DECL_STRUCT_P_FUNC(`zend_function') |
---|
| 12 | DECL_STRUCT_P_FUNC(`xc_entry_t') |
---|
| 13 | #ifdef ZEND_ENGINE_2 |
---|
| 14 | DECL_STRUCT_P_FUNC(`zend_property_info') |
---|
| 15 | #endif |
---|
| 16 | /* }}} */ |
---|
| 17 | dnl ==================================================== |
---|
| 18 | dnl {{{ zend_compiled_variable |
---|
| 19 | #ifdef IS_CV |
---|
| 20 | DEF_STRUCT_P_FUNC(`zend_compiled_variable', , ` |
---|
| 21 | DISPATCH(int, name_len) |
---|
[103] | 22 | PROC_ZSTRING_L(, name, name_len) |
---|
[1] | 23 | DISPATCH(ulong, hash_value) |
---|
| 24 | ') |
---|
| 25 | #endif |
---|
| 26 | dnl }}} |
---|
| 27 | dnl {{{ zend_uint |
---|
| 28 | DEF_STRUCT_P_FUNC(`zend_uint', , ` |
---|
| 29 | IFCOPY(`dst[0] = src[0];') |
---|
| 30 | IFDPRINT(` |
---|
| 31 | INDENT() |
---|
| 32 | fprintf(stderr, "%u\n", src[0]); |
---|
| 33 | ') |
---|
| 34 | DONE_SIZE(sizeof(src[0])) |
---|
| 35 | ') |
---|
| 36 | dnl }}} |
---|
| 37 | dnl {{{ int |
---|
| 38 | #ifndef ZEND_ENGINE_2 |
---|
| 39 | DEF_STRUCT_P_FUNC(`int', , ` |
---|
| 40 | IFCOPY(`*dst = *src;') |
---|
| 41 | IFDPRINT(` |
---|
| 42 | INDENT() |
---|
| 43 | fprintf(stderr, "%d\n", src[0]); |
---|
| 44 | ') |
---|
| 45 | DONE_SIZE(sizeof(src[0])) |
---|
| 46 | ') |
---|
| 47 | #endif |
---|
| 48 | dnl }}} |
---|
| 49 | dnl {{{ zend_try_catch_element |
---|
| 50 | #ifdef ZEND_ENGINE_2 |
---|
| 51 | DEF_STRUCT_P_FUNC(`zend_try_catch_element', , ` |
---|
| 52 | DISPATCH(zend_uint, try_op) |
---|
| 53 | DISPATCH(zend_uint, catch_op) |
---|
| 54 | ') |
---|
| 55 | #endif /* ifdef ZEND_ENGINE_2 */ |
---|
| 56 | dnl }}} |
---|
| 57 | dnl {{{ zend_brk_cont_element |
---|
| 58 | DEF_STRUCT_P_FUNC(`zend_brk_cont_element', , ` |
---|
[194] | 59 | #ifdef ZEND_ENGINE_2_2 |
---|
| 60 | DISPATCH(int, start) |
---|
| 61 | #endif |
---|
[1] | 62 | DISPATCH(int, cont) |
---|
| 63 | DISPATCH(int, brk) |
---|
| 64 | DISPATCH(int, parent) |
---|
| 65 | ') |
---|
| 66 | dnl }}} |
---|
| 67 | DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr', `zval_ptr') |
---|
[825] | 68 | DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr_nullable', `zval_ptr_nullable') |
---|
[1] | 69 | DEF_HASH_TABLE_FUNC(`HashTable_zend_function', `zend_function') |
---|
| 70 | #ifdef ZEND_ENGINE_2 |
---|
| 71 | DEF_HASH_TABLE_FUNC(`HashTable_zend_property_info', `zend_property_info') |
---|
| 72 | #endif |
---|
| 73 | DEF_STRUCT_P_FUNC(`zval', , `dnl {{{ |
---|
| 74 | IFDASM(`do { |
---|
| 75 | zval_dtor(dst); |
---|
| 76 | *dst = *src; |
---|
| 77 | zval_copy_ctor(dst); |
---|
[487] | 78 | Z_SET_REFCOUNT(*dst, 1); |
---|
[1] | 79 | DONE(value) |
---|
| 80 | DONE(type) |
---|
[485] | 81 | #ifdef ZEND_ENGINE_2_3 |
---|
| 82 | DONE(is_ref__gc) |
---|
| 83 | DONE(refcount__gc) |
---|
| 84 | #else |
---|
[1] | 85 | DONE(is_ref) |
---|
[485] | 86 | DONE(refcount) |
---|
[482] | 87 | #endif |
---|
[1] | 88 | } while(0); |
---|
| 89 | ', ` |
---|
| 90 | dnl IFDASM else |
---|
| 91 | /* Variable information */ |
---|
| 92 | dnl {{{ zvalue_value |
---|
| 93 | DISABLECHECK(` |
---|
[491] | 94 | switch ((Z_TYPE_P(src) & IS_CONSTANT_TYPE_MASK)) { |
---|
[1] | 95 | case IS_LONG: |
---|
| 96 | case IS_RESOURCE: |
---|
| 97 | case IS_BOOL: |
---|
| 98 | DISPATCH(long, value.lval) |
---|
| 99 | break; |
---|
| 100 | case IS_DOUBLE: |
---|
| 101 | DISPATCH(double, value.dval) |
---|
| 102 | break; |
---|
| 103 | case IS_NULL: |
---|
| 104 | IFDPRINT(`INDENT()`'fprintf(stderr, "\tNULL\n");') |
---|
| 105 | break; |
---|
| 106 | |
---|
| 107 | case IS_CONSTANT: |
---|
| 108 | #ifdef IS_UNICODE |
---|
| 109 | if (UG(unicode)) { |
---|
| 110 | goto proc_unicode; |
---|
| 111 | } |
---|
| 112 | #endif |
---|
| 113 | case IS_STRING: |
---|
| 114 | #ifdef FLAG_IS_BC |
---|
| 115 | case FLAG_IS_BC: |
---|
| 116 | #endif |
---|
| 117 | DISPATCH(int, value.str.len) |
---|
| 118 | PROC_STRING_L(value.str.val, value.str.len) |
---|
| 119 | break; |
---|
| 120 | #ifdef IS_UNICODE |
---|
| 121 | case IS_UNICODE: |
---|
| 122 | proc_unicode: |
---|
[103] | 123 | DISPATCH(int32_t, value.uni.len) |
---|
| 124 | PROC_ZSTRING_L(1, value.uni.val, value.uni.len) |
---|
[1] | 125 | break; |
---|
| 126 | #endif |
---|
| 127 | |
---|
| 128 | case IS_ARRAY: |
---|
| 129 | case IS_CONSTANT_ARRAY: |
---|
| 130 | STRUCT_P(HashTable, value.ht, HashTable_zval_ptr) |
---|
| 131 | break; |
---|
| 132 | |
---|
| 133 | case IS_OBJECT: |
---|
| 134 | IFNOTMEMCPY(`IFCOPY(`memcpy(dst, src, sizeof(src[0]));')') |
---|
| 135 | dnl STRUCT(value.obj) |
---|
| 136 | #ifndef ZEND_ENGINE_2 |
---|
| 137 | STRUCT_P(zend_class_entry, value.obj.ce) |
---|
| 138 | STRUCT_P(HashTable, value.obj.properties, HashTable_zval_ptr) |
---|
| 139 | #endif |
---|
| 140 | break; |
---|
| 141 | |
---|
| 142 | default: |
---|
| 143 | assert(0); |
---|
| 144 | } |
---|
| 145 | ') |
---|
| 146 | dnl }}} |
---|
| 147 | DONE(value) |
---|
| 148 | DISPATCH(zval_data_type, type) |
---|
[485] | 149 | #ifdef ZEND_ENGINE_2_3 |
---|
| 150 | DISPATCH(zend_uchar, is_ref__gc) |
---|
| 151 | #else |
---|
[1] | 152 | DISPATCH(zend_uchar, is_ref) |
---|
[485] | 153 | #endif |
---|
| 154 | |
---|
| 155 | #ifdef ZEND_ENGINE_2_3 |
---|
| 156 | DISPATCH(zend_uint, refcount__gc) |
---|
| 157 | #elif defined(ZEND_ENGINE_2) |
---|
[484] | 158 | DISPATCH(zend_uint, refcount) |
---|
| 159 | #else |
---|
[1] | 160 | DISPATCH(zend_ushort, refcount) |
---|
[484] | 161 | #endif |
---|
[1] | 162 | ')dnl IFDASM |
---|
| 163 | ') |
---|
| 164 | dnl }}} |
---|
| 165 | DEF_STRUCT_P_FUNC(`zval_ptr', , `dnl {{{ |
---|
| 166 | IFDASM(` |
---|
| 167 | pushdefFUNC_NAME(`zval') |
---|
| 168 | FUNC_NAME (dst, src[0] TSRMLS_CC); |
---|
| 169 | popdef(`FUNC_NAME') |
---|
| 170 | ', ` |
---|
| 171 | do { |
---|
| 172 | IFCALCCOPY(` |
---|
| 173 | if (processor->reference) { |
---|
| 174 | zval_ptr *ppzv; |
---|
[231] | 175 | if (zend_hash_find(&processor->zvalptrs, (char *) &src[0], sizeof(src[0]), (void **) &ppzv) == SUCCESS) { |
---|
[1] | 176 | IFCOPY(` |
---|
| 177 | dst[0] = *ppzv; |
---|
| 178 | /* *dst is updated */ |
---|
[248] | 179 | dnl fprintf(stderr, "*dst is set to %p, KIND is_shm %d\n", dst[0], xc_is_shm(dst[0])); |
---|
[1] | 180 | ') |
---|
[233] | 181 | IFCALCSTORE(`processor->have_references = 1;') |
---|
[1] | 182 | IFSTORE(`assert(xc_is_shm(dst[0]));') |
---|
| 183 | IFRESTORE(`assert(!xc_is_shm(dst[0]));') |
---|
| 184 | break; |
---|
| 185 | } |
---|
| 186 | } |
---|
| 187 | ') |
---|
| 188 | |
---|
| 189 | ALLOC(dst[0], zval) |
---|
| 190 | IFCALCCOPY(` |
---|
| 191 | if (processor->reference) { |
---|
| 192 | IFCALC(` |
---|
| 193 | /* make dummy */ |
---|
| 194 | zval_ptr pzv = (zval_ptr)-1; |
---|
| 195 | ', ` |
---|
| 196 | zval_ptr pzv = dst[0]; |
---|
[248] | 197 | FIXPOINTER_EX(zval, pzv) |
---|
[1] | 198 | ') |
---|
[231] | 199 | if (zend_hash_add(&processor->zvalptrs, (char *) &src[0], sizeof(src[0]), (void *) &pzv, sizeof(pzv), NULL) == SUCCESS) { |
---|
[1] | 200 | /* first add, go on */ |
---|
| 201 | dnl fprintf(stderr, "mark[%p] = %p\n", src[0], pzv); |
---|
| 202 | } |
---|
| 203 | else { |
---|
| 204 | assert(0); |
---|
| 205 | } |
---|
| 206 | } |
---|
| 207 | ') |
---|
| 208 | IFCOPY(` |
---|
| 209 | dnl fprintf(stderr, "copy from %p to %p\n", src[0], dst[0]); |
---|
| 210 | ') |
---|
[534] | 211 | IFDPRINT(`INDENT()`'fprintf(stderr, "[%p] ", src[0]);') |
---|
[4] | 212 | STRUCT_P_EX(zval, dst[0], src[0], `[0]', `', ` ') |
---|
[248] | 213 | FIXPOINTER_EX(zval, dst[0]) |
---|
[1] | 214 | } while (0); |
---|
| 215 | ') |
---|
| 216 | DONE_SIZE(sizeof(zval_ptr)) |
---|
| 217 | ') |
---|
| 218 | dnl }}} |
---|
[825] | 219 | DEF_STRUCT_P_FUNC(`zval_ptr_nullable', , `dnl {{{ |
---|
| 220 | if (src[0]) { |
---|
| 221 | STRUCT_P_EX(zval_ptr, dst, src, `', `', ` ') |
---|
| 222 | } |
---|
| 223 | else { |
---|
| 224 | IFCOPY(`COPYNULL_EX(src[0], src)') |
---|
| 225 | } |
---|
| 226 | DONE_SIZE(sizeof(zval_ptr_nullable)) |
---|
| 227 | ') |
---|
| 228 | dnl }}} |
---|
[1] | 229 | dnl {{{ zend_arg_info |
---|
| 230 | #ifdef ZEND_ENGINE_2 |
---|
| 231 | DEF_STRUCT_P_FUNC(`zend_arg_info', , ` |
---|
| 232 | DISPATCH(zend_uint, name_len) |
---|
[645] | 233 | PROC_ZSTRING_L(, name, name_len) |
---|
[1] | 234 | DISPATCH(zend_uint, class_name_len) |
---|
[645] | 235 | PROC_ZSTRING_L(, class_name, class_name_len) |
---|
[716] | 236 | #ifdef ZEND_ENGINE_2_4 |
---|
| 237 | DISPATCH(zend_uchar, type_hint) |
---|
| 238 | #else |
---|
[1] | 239 | DISPATCH(zend_bool, array_type_hint) |
---|
[716] | 240 | #endif |
---|
[1] | 241 | DISPATCH(zend_bool, allow_null) |
---|
| 242 | DISPATCH(zend_bool, pass_by_reference) |
---|
[716] | 243 | #ifndef ZEND_ENGINE_2_4 |
---|
[1] | 244 | DISPATCH(zend_bool, return_reference) |
---|
| 245 | DISPATCH(int, required_num_args) |
---|
[716] | 246 | #endif |
---|
[1] | 247 | ') |
---|
| 248 | #endif |
---|
| 249 | dnl }}} |
---|
[95] | 250 | #ifdef HAVE_XCACHE_CONSTANT |
---|
| 251 | DEF_STRUCT_P_FUNC(`zend_constant', , `dnl {{{ |
---|
| 252 | STRUCT(zval, value) |
---|
| 253 | DISPATCH(int, flags) |
---|
| 254 | DISPATCH(uint, name_len) |
---|
[218] | 255 | pushdef(`emalloc', `malloc($1)') |
---|
| 256 | pushdef(`ecalloc', `calloc($1, $2)') |
---|
[505] | 257 | PROC_ZSTRING_N(, name, name_len) |
---|
[218] | 258 | popdef(`ecalloc') |
---|
| 259 | popdef(`emalloc') |
---|
[95] | 260 | DISPATCH(int, module_number) |
---|
| 261 | ') |
---|
| 262 | dnl }}} |
---|
| 263 | #endif |
---|
[1] | 264 | DEF_STRUCT_P_FUNC(`zend_function', , `dnl {{{ |
---|
| 265 | DISABLECHECK(` |
---|
| 266 | switch (src->type) { |
---|
| 267 | case ZEND_INTERNAL_FUNCTION: |
---|
| 268 | case ZEND_OVERLOADED_FUNCTION: |
---|
| 269 | IFNOTMEMCPY(`IFCOPY(`memcpy(dst, src, sizeof(src[0]));')') |
---|
| 270 | break; |
---|
| 271 | |
---|
| 272 | case ZEND_USER_FUNCTION: |
---|
| 273 | case ZEND_EVAL_CODE: |
---|
| 274 | DONE(type) |
---|
| 275 | STRUCT(zend_op_array, op_array) |
---|
| 276 | break; |
---|
| 277 | |
---|
| 278 | default: |
---|
| 279 | assert(0); |
---|
| 280 | } |
---|
| 281 | ') |
---|
| 282 | DONE_SIZE(sizeof(src[0])) |
---|
| 283 | ') |
---|
| 284 | dnl }}} |
---|
| 285 | dnl {{{ zend_property_info |
---|
| 286 | #ifdef ZEND_ENGINE_2 |
---|
| 287 | DEF_STRUCT_P_FUNC(`zend_property_info', , ` |
---|
| 288 | DISPATCH(zend_uint, flags) |
---|
| 289 | DISPATCH(int, name_length) |
---|
[103] | 290 | PROC_ZSTRING_L(, name, name_length) |
---|
[1] | 291 | DISPATCH(ulong, h) |
---|
[716] | 292 | #ifdef ZEND_ENGINE_2_4 |
---|
| 293 | DISPATCH(int, offset) |
---|
| 294 | #endif |
---|
[56] | 295 | #ifdef ZEND_ENGINE_2_1 |
---|
[1] | 296 | DISPATCH(int, doc_comment_len) |
---|
[272] | 297 | PROC_ZSTRING_L(, doc_comment, doc_comment_len) |
---|
[56] | 298 | #endif |
---|
[78] | 299 | dnl isnt in php6 yet |
---|
[504] | 300 | #if defined(ZEND_ENGINE_2_2) |
---|
[78] | 301 | PROC_CLASS_ENTRY_P(ce) |
---|
| 302 | #endif |
---|
[1] | 303 | ') |
---|
| 304 | #endif |
---|
| 305 | dnl }}} |
---|
| 306 | DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{ |
---|
[199] | 307 | IFCALCCOPY(` |
---|
[1] | 308 | processor->active_class_entry_src = src; |
---|
[199] | 309 | IFCOPY(`processor->active_class_entry_dst = dst;') |
---|
[1] | 310 | ') |
---|
| 311 | DISPATCH(char, type) |
---|
| 312 | DISPATCH(zend_uint, name_length) |
---|
[103] | 313 | PROC_ZSTRING_L(, name, name_length) |
---|
[1] | 314 | IFRESTORE(` |
---|
| 315 | #ifndef ZEND_ENGINE_2 |
---|
| 316 | /* just copy parent and resolve on install_class */ |
---|
| 317 | COPY(parent) |
---|
| 318 | #else |
---|
| 319 | PROC_CLASS_ENTRY_P(parent) |
---|
| 320 | #endif |
---|
| 321 | ', ` |
---|
| 322 | PROC_CLASS_ENTRY_P(parent) |
---|
| 323 | ') |
---|
| 324 | #ifdef ZEND_ENGINE_2 |
---|
| 325 | DISPATCH(int, refcount) |
---|
| 326 | #else |
---|
| 327 | STRUCT_P(int, refcount) |
---|
| 328 | #endif |
---|
[716] | 329 | #ifndef ZEND_ENGINE_2_4 |
---|
[1] | 330 | DISPATCH(zend_bool, constants_updated) |
---|
[716] | 331 | #endif |
---|
[1] | 332 | #ifdef ZEND_ENGINE_2 |
---|
| 333 | DISPATCH(zend_uint, ce_flags) |
---|
| 334 | #endif |
---|
| 335 | |
---|
[721] | 336 | #ifdef ZEND_ENGINE_2 |
---|
| 337 | STRUCT(HashTable, properties_info, HashTable_zend_property_info) |
---|
| 338 | #endif |
---|
| 339 | |
---|
[716] | 340 | #ifdef ZEND_ENGINE_2_4 |
---|
| 341 | DISPATCH(int, default_properties_count) |
---|
[825] | 342 | STRUCT_ARRAY(default_properties_count, zval_ptr_nullable, default_properties_table) |
---|
[716] | 343 | DISPATCH(int, default_static_members_count) |
---|
[825] | 344 | STRUCT_ARRAY(default_static_members_count, zval_ptr_nullable, default_static_members_table) |
---|
[730] | 345 | IFCOPY(`dst->static_members_table = dst->default_static_members_table;') |
---|
[716] | 346 | DONE(static_members_table) |
---|
| 347 | #else |
---|
[1] | 348 | IFCOPY(`dst->builtin_functions = src->builtin_functions;') |
---|
| 349 | DONE(builtin_functions) |
---|
[716] | 350 | STRUCT(HashTable, default_properties, HashTable_zval_ptr) |
---|
[721] | 351 | # ifdef ZEND_ENGINE_2_1 |
---|
[233] | 352 | STRUCT(HashTable, default_static_members, HashTable_zval_ptr) |
---|
[1] | 353 | IFCOPY(`dst->static_members = &dst->default_static_members;') |
---|
| 354 | DONE(static_members) |
---|
[721] | 355 | # elif defined(ZEND_ENGINE_2) |
---|
[233] | 356 | STRUCT_P(HashTable, static_members, HashTable_zval_ptr) |
---|
[1] | 357 | # endif |
---|
[716] | 358 | #endif /* ZEND_ENGINE_2_4 */ |
---|
| 359 | |
---|
| 360 | #ifdef ZEND_ENGINE_2 |
---|
[1] | 361 | STRUCT(HashTable, constants_table, HashTable_zval_ptr) |
---|
| 362 | |
---|
| 363 | dnl runtime binding: ADD_INTERFACE will deal with it |
---|
[716] | 364 | dnl runtime binding: ADD_TRAIT will deal with it |
---|
[1] | 365 | IFRESTORE(` |
---|
| 366 | if (src->num_interfaces) { |
---|
| 367 | CALLOC(dst->interfaces, zend_class_entry*, src->num_interfaces) |
---|
[4] | 368 | DONE(`interfaces') |
---|
[825] | 369 | } |
---|
| 370 | else { |
---|
| 371 | COPYNULL(`interfaces') |
---|
| 372 | } |
---|
[716] | 373 | # ifdef ZEND_ENGINE_2_4 |
---|
[825] | 374 | if (src->num_traits) { |
---|
[716] | 375 | CALLOC(dst->traits, zend_class_entry*, src->num_traits) |
---|
| 376 | DONE(`traits') |
---|
| 377 | DONE(`trait_aliases') |
---|
| 378 | DONE(`trait_precedences') |
---|
[1] | 379 | } |
---|
| 380 | else { |
---|
[716] | 381 | COPYNULL(`traits') |
---|
| 382 | COPYNULL(`trait_aliases') |
---|
| 383 | COPYNULL(`trait_precedences') |
---|
[825] | 384 | } |
---|
[716] | 385 | # endif |
---|
[1] | 386 | ') |
---|
| 387 | IFDASM(` |
---|
| 388 | if (src->num_interfaces) { |
---|
| 389 | /* |
---|
[662] | 390 | int i; |
---|
[1] | 391 | zval *arr; |
---|
| 392 | ALLOC_INIT_ZVAL(arr); |
---|
| 393 | array_init(arr); |
---|
| 394 | for (i = 0; i < src->num_interfaces; i ++) { |
---|
| 395 | zval *zv; |
---|
| 396 | ALLOC_INIT_ZVAL(zv); |
---|
| 397 | ZVAL_STRING(src->num_interfaces); |
---|
| 398 | } |
---|
| 399 | add_assoc_zval_ex(dst, ZEND_STRS("interfaces"), arr); |
---|
| 400 | */ |
---|
[4] | 401 | DONE(`interfaces') |
---|
[825] | 402 | } |
---|
| 403 | else { |
---|
| 404 | COPYNULL(`interfaces') |
---|
| 405 | } |
---|
[716] | 406 | # ifdef ZEND_ENGINE_2_4 |
---|
[825] | 407 | if (src->num_traits) { |
---|
[716] | 408 | DONE(`traits') |
---|
| 409 | DONE(`trait_aliases') |
---|
| 410 | DONE(`trait_precedences') |
---|
[1] | 411 | } |
---|
| 412 | else { |
---|
[716] | 413 | COPYNULL(`traits') |
---|
| 414 | COPYNULL(`trait_aliases') |
---|
| 415 | COPYNULL(`trait_precedences') |
---|
[825] | 416 | } |
---|
[716] | 417 | # endif |
---|
[1] | 418 | ') |
---|
[4] | 419 | IFRESTORE(`', ` |
---|
| 420 | IFDASM(`', ` |
---|
| 421 | DONE(`interfaces') |
---|
[716] | 422 | # ifdef ZEND_ENGINE_2_4 |
---|
| 423 | DONE(`traits') |
---|
| 424 | DONE(`trait_aliases') |
---|
| 425 | DONE(`trait_precedences') |
---|
| 426 | # endif |
---|
[4] | 427 | ') |
---|
| 428 | ') |
---|
[1] | 429 | DISPATCH(zend_uint, num_interfaces) |
---|
[716] | 430 | # ifdef ZEND_ENGINE_2_4 |
---|
| 431 | DISPATCH(zend_uint, num_traits) |
---|
| 432 | # endif |
---|
[1] | 433 | |
---|
[716] | 434 | # ifdef ZEND_ENGINE_2_4 |
---|
| 435 | DISABLECHECK(` |
---|
| 436 | IFRESTORE(`dst->info.user.filename = processor->entry_src->filepath;', `PROC_STRING(info.user.filename)') |
---|
| 437 | DISPATCH(zend_uint, info.user.line_start) |
---|
| 438 | DISPATCH(zend_uint, info.user.line_end) |
---|
| 439 | DISPATCH(zend_uint, info.user.doc_comment_len) |
---|
| 440 | PROC_ZSTRING_L(, info.user.doc_comment, info.user.doc_comment_len) |
---|
| 441 | ') |
---|
| 442 | DONE(info) |
---|
| 443 | # else |
---|
[687] | 444 | IFRESTORE(`dst->filename = processor->entry_src->filepath;DONE(filename)', `PROC_STRING(filename)') |
---|
[1] | 445 | DISPATCH(zend_uint, line_start) |
---|
| 446 | DISPATCH(zend_uint, line_end) |
---|
[716] | 447 | # ifdef ZEND_ENGINE_2_1 |
---|
[1] | 448 | DISPATCH(zend_uint, doc_comment_len) |
---|
[272] | 449 | PROC_ZSTRING_L(, doc_comment, doc_comment_len) |
---|
[716] | 450 | # endif |
---|
| 451 | # endif |
---|
| 452 | |
---|
[1] | 453 | /* # NOT DONE */ |
---|
| 454 | COPY(serialize_func) |
---|
| 455 | COPY(unserialize_func) |
---|
| 456 | COPY(iterator_funcs) |
---|
| 457 | COPY(create_object) |
---|
| 458 | COPY(get_iterator) |
---|
| 459 | COPY(interface_gets_implemented) |
---|
[716] | 460 | # ifdef ZEND_ENGINE_2_3 |
---|
[480] | 461 | COPY(get_static_method) |
---|
[716] | 462 | # endif |
---|
[1] | 463 | COPY(serialize) |
---|
| 464 | COPY(unserialize) |
---|
| 465 | /* deal with it inside xc_fix_method */ |
---|
| 466 | SETNULL(constructor) |
---|
| 467 | COPY(destructor) |
---|
| 468 | COPY(clone) |
---|
| 469 | COPY(__get) |
---|
| 470 | COPY(__set) |
---|
| 471 | /* should be >5.1 */ |
---|
[716] | 472 | # ifdef ZEND_ENGINE_2_1 |
---|
[1] | 473 | COPY(__unset) |
---|
| 474 | COPY(__isset) |
---|
[716] | 475 | # if defined(ZEND_ENGINE_2_2) || PHP_MAJOR_VERSION >= 6 |
---|
[1] | 476 | COPY(__tostring) |
---|
[716] | 477 | # endif |
---|
| 478 | # endif |
---|
[1] | 479 | COPY(__call) |
---|
[716] | 480 | # ifdef ZEND_CALLSTATIC_FUNC_NAME |
---|
[480] | 481 | COPY(__callstatic) |
---|
[716] | 482 | # endif |
---|
| 483 | # ifndef ZEND_ENGINE_2_4 |
---|
[1] | 484 | /* # NOT DONE */ |
---|
| 485 | COPY(module) |
---|
[716] | 486 | # endif |
---|
| 487 | #else /* ZEND_ENGINE_2 */ |
---|
[1] | 488 | COPY(handle_function_call) |
---|
| 489 | COPY(handle_property_get) |
---|
| 490 | COPY(handle_property_set) |
---|
| 491 | #endif |
---|
[89] | 492 | dnl must do after SETNULL(constructor) and dst->parent |
---|
[1] | 493 | STRUCT(HashTable, function_table, HashTable_zend_function) |
---|
[99] | 494 | IFRESTORE(`dst->function_table.pDestructor = ZEND_FUNCTION_DTOR;') |
---|
[199] | 495 | IFCALCCOPY(` |
---|
[89] | 496 | processor->active_class_entry_src = NULL; |
---|
[199] | 497 | IFCOPY(`processor->active_class_entry_dst = NULL;') |
---|
[89] | 498 | ') |
---|
[1] | 499 | ') |
---|
| 500 | dnl }}} |
---|
[716] | 501 | #ifdef ZEND_ENGINE_2_4 |
---|
| 502 | undefine(`UNION_znode_op') |
---|
| 503 | define(`UNION_znode_op', `dnl {{{ |
---|
[822] | 504 | #ifndef NDEBUG |
---|
| 505 | switch ((src->$1_type ifelse($1, `result', & ~EXT_TYPE_UNUSED))) { |
---|
[721] | 506 | case IS_CONST: |
---|
| 507 | case IS_VAR: |
---|
| 508 | case IS_CV: |
---|
| 509 | case IS_TMP_VAR: |
---|
| 510 | case IS_UNUSED: |
---|
| 511 | break; |
---|
| 512 | |
---|
| 513 | default: |
---|
| 514 | assert(0); |
---|
| 515 | } |
---|
[822] | 516 | #endif |
---|
[721] | 517 | |
---|
[716] | 518 | dnl dirty dispatch |
---|
| 519 | DISABLECHECK(` |
---|
[822] | 520 | switch ((src->$1_type ifelse($1, `result', & ~EXT_TYPE_UNUSED))) { |
---|
[716] | 521 | case IS_CONST: |
---|
[822] | 522 | ifelse($1, `result', ` |
---|
| 523 | DISPATCH(zend_uint, $1.constant) |
---|
| 524 | ', ` |
---|
| 525 | IFDASM(`{ |
---|
| 526 | zval *zv; |
---|
| 527 | ALLOC_INIT_ZVAL(zv); |
---|
| 528 | *zv = src->$1.literal->constant; |
---|
| 529 | zval_copy_ctor(zv); |
---|
| 530 | add_assoc_zval_ex(dst, ZEND_STRS("$1.constant"), zv); |
---|
[716] | 531 | } |
---|
[822] | 532 | ', ` |
---|
| 533 | IFCOPY(` |
---|
| 534 | dst->$1 = src->$1; |
---|
| 535 | ', ` |
---|
| 536 | DISPATCH(zend_uint, $1.constant) |
---|
| 537 | ') |
---|
| 538 | ') |
---|
[716] | 539 | ') |
---|
| 540 | break; |
---|
| 541 | IFCOPY(` |
---|
| 542 | IFNOTMEMCPY(` |
---|
| 543 | default: |
---|
[822] | 544 | $1 = $2; |
---|
[716] | 545 | ') |
---|
| 546 | ', ` |
---|
| 547 | case IS_VAR: |
---|
| 548 | case IS_TMP_VAR: |
---|
| 549 | case IS_CV: |
---|
| 550 | DISPATCH(zend_uint, $1.var) |
---|
| 551 | break; |
---|
| 552 | case IS_UNUSED: |
---|
| 553 | IFDASM(`DISPATCH(zend_uint, $1.var)') |
---|
| 554 | DISPATCH(zend_uint, $1.opline_num) |
---|
| 555 | break; |
---|
| 556 | ') |
---|
| 557 | } |
---|
| 558 | ') |
---|
| 559 | DONE($1) |
---|
| 560 | ') |
---|
| 561 | dnl }}} |
---|
| 562 | #else |
---|
[1] | 563 | DEF_STRUCT_P_FUNC(`znode', , `dnl {{{ |
---|
| 564 | DISPATCH(int, op_type) |
---|
| 565 | |
---|
| 566 | #ifdef IS_CV |
---|
[11] | 567 | # define XCACHE_IS_CV IS_CV |
---|
[1] | 568 | #else |
---|
[11] | 569 | /* compatible with zend optimizer */ |
---|
| 570 | # define XCACHE_IS_CV 16 |
---|
[1] | 571 | #endif |
---|
[11] | 572 | assert(src->op_type == IS_CONST || |
---|
| 573 | src->op_type == IS_VAR || |
---|
| 574 | src->op_type == XCACHE_IS_CV || |
---|
[1] | 575 | src->op_type == IS_TMP_VAR || |
---|
| 576 | src->op_type == IS_UNUSED); |
---|
| 577 | dnl dirty dispatch |
---|
| 578 | DISABLECHECK(` |
---|
| 579 | switch (src->op_type) { |
---|
| 580 | case IS_CONST: |
---|
| 581 | STRUCT(zval, u.constant) |
---|
| 582 | break; |
---|
| 583 | IFCOPY(` |
---|
| 584 | IFNOTMEMCPY(` |
---|
| 585 | default: |
---|
| 586 | memcpy(&dst->u, &src->u, sizeof(src->u)); |
---|
| 587 | ') |
---|
| 588 | ', ` |
---|
| 589 | case IS_VAR: |
---|
| 590 | case IS_TMP_VAR: |
---|
[310] | 591 | case XCACHE_IS_CV: |
---|
[1] | 592 | DISPATCH(zend_uint, u.var) |
---|
| 593 | DISPATCH(zend_uint, u.EA.type) |
---|
| 594 | break; |
---|
| 595 | case IS_UNUSED: |
---|
| 596 | IFDASM(`DISPATCH(zend_uint, u.var)') |
---|
| 597 | DISPATCH(zend_uint, u.opline_num) |
---|
| 598 | #ifndef ZEND_ENGINE_2 |
---|
| 599 | DISPATCH(zend_uint, u.fetch_type) |
---|
| 600 | #endif |
---|
| 601 | DISPATCH(zend_uint, u.EA.type) |
---|
| 602 | break; |
---|
| 603 | ') |
---|
| 604 | } |
---|
| 605 | ') |
---|
| 606 | DONE(u) |
---|
[716] | 607 | #if 0 |
---|
| 608 | DONE(EA) |
---|
| 609 | #endif |
---|
[310] | 610 | #undef XCACHE_IS_CV |
---|
[1] | 611 | ') |
---|
| 612 | dnl }}} |
---|
[716] | 613 | #endif |
---|
[1] | 614 | DEF_STRUCT_P_FUNC(`zend_op', , `dnl {{{ |
---|
| 615 | DISPATCH(zend_uchar, opcode) |
---|
[716] | 616 | #ifdef ZEND_ENGINE_2_4 |
---|
| 617 | UNION_znode_op(result) |
---|
| 618 | UNION_znode_op(op1) |
---|
| 619 | UNION_znode_op(op2) |
---|
| 620 | #else |
---|
[1] | 621 | STRUCT(znode, result) |
---|
| 622 | STRUCT(znode, op1) |
---|
| 623 | STRUCT(znode, op2) |
---|
[716] | 624 | #endif |
---|
[1] | 625 | DISPATCH(ulong, extended_value) |
---|
| 626 | DISPATCH(uint, lineno) |
---|
| 627 | #ifdef ZEND_ENGINE_2_1 |
---|
[716] | 628 | #ifdef ZEND_ENGINE_2_4 |
---|
| 629 | DISPATCH(zend_uchar, op1_type) |
---|
| 630 | DISPATCH(zend_uchar, op2_type) |
---|
| 631 | DISPATCH(zend_uchar, result_type) |
---|
| 632 | #endif |
---|
[1] | 633 | IFCOPY(` |
---|
[822] | 634 | pushdef(`UNION_znode_op_literal', ` |
---|
| 635 | if (dst->$1_type == IS_CONST) { |
---|
| 636 | IFSTORE(` |
---|
| 637 | dst->$1.constant = src->$1.literal - processor->active_op_array_src->literals; |
---|
| 638 | dst->$1.literal = &processor->active_op_array_dst->literals[dst->$1.constant]; |
---|
| 639 | ') |
---|
| 640 | } |
---|
| 641 | ') |
---|
| 642 | UNION_znode_op_literal(op1) |
---|
| 643 | UNION_znode_op_literal(op2) |
---|
| 644 | popdef(`UNION_znode_op_literal') |
---|
[1] | 645 | switch (src->opcode) { |
---|
[515] | 646 | #ifdef ZEND_GOTO |
---|
| 647 | case ZEND_GOTO: |
---|
| 648 | #endif |
---|
[1] | 649 | case ZEND_JMP: |
---|
[785] | 650 | assert(Z_OP(src->op1).jmp_addr >= processor->active_opcodes_src && Z_OP(src->op1).jmp_addr - processor->active_opcodes_src < processor->active_op_array_src->last); |
---|
[716] | 651 | Z_OP(dst->op1).jmp_addr = processor->active_opcodes_dst + (Z_OP(src->op1).jmp_addr - processor->active_opcodes_src); |
---|
[785] | 652 | assert(Z_OP(dst->op1).jmp_addr >= processor->active_opcodes_dst && Z_OP(dst->op1).jmp_addr - processor->active_opcodes_dst < processor->active_op_array_dst->last); |
---|
[1] | 653 | break; |
---|
| 654 | |
---|
| 655 | case ZEND_JMPZ: |
---|
| 656 | case ZEND_JMPNZ: |
---|
| 657 | case ZEND_JMPZ_EX: |
---|
| 658 | case ZEND_JMPNZ_EX: |
---|
[485] | 659 | #ifdef ZEND_JMP_SET |
---|
| 660 | case ZEND_JMP_SET: |
---|
| 661 | #endif |
---|
[785] | 662 | assert(Z_OP(src->op2).jmp_addr >= processor->active_opcodes_src && Z_OP(src->op2).jmp_addr - processor->active_opcodes_src < processor->active_op_array_src->last); |
---|
[716] | 663 | Z_OP(dst->op2).jmp_addr = processor->active_opcodes_dst + (Z_OP(src->op2).jmp_addr - processor->active_opcodes_src); |
---|
[785] | 664 | assert(Z_OP(dst->op2).jmp_addr >= processor->active_opcodes_dst && Z_OP(dst->op2).jmp_addr - processor->active_opcodes_dst < processor->active_op_array_dst->last); |
---|
[1] | 665 | break; |
---|
| 666 | |
---|
| 667 | default: |
---|
| 668 | break; |
---|
| 669 | } |
---|
| 670 | ') |
---|
| 671 | DISPATCH(opcode_handler_t, handler) |
---|
| 672 | #endif |
---|
| 673 | ') |
---|
| 674 | dnl }}} |
---|
[716] | 675 | #ifdef ZEND_ENGINE_2_4 |
---|
| 676 | DEF_STRUCT_P_FUNC(`zend_literal', , `dnl {{{ |
---|
| 677 | STRUCT(zval, constant) |
---|
| 678 | DISPATCH(zend_ulong, hash_value) |
---|
| 679 | DISPATCH(zend_uint, cache_slot) |
---|
| 680 | ') |
---|
| 681 | dnl }}} |
---|
| 682 | #endif |
---|
[1] | 683 | DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{ |
---|
| 684 | IFRESTORE(` |
---|
[771] | 685 | const xc_op_array_info_t *op_array_info = &processor->active_op_array_infos_src[processor->active_op_array_index++]; |
---|
[212] | 686 | dnl shadow copy must NOT meet: |
---|
| 687 | dnl readonly_protection=on |
---|
| 688 | dnl main op_array && have early binding |
---|
[548] | 689 | #ifdef ZEND_COMPILE_DELAYED_BINDING |
---|
| 690 | zend_bool need_early_binding = 0; |
---|
| 691 | #else |
---|
| 692 | zend_bool need_early_binding = processor->php_src->have_early_binding; |
---|
| 693 | #endif |
---|
[662] | 694 | zend_bool shallow_copy = !processor->readonly_protection && !(src == processor->php_src->op_array && need_early_binding); |
---|
| 695 | if (shallow_copy) { |
---|
| 696 | zend_bool gc_arg_info = 0; |
---|
[822] | 697 | zend_bool gc_opcodes = 0; |
---|
[1] | 698 | /* really fast shallow copy */ |
---|
| 699 | memcpy(dst, src, sizeof(src[0])); |
---|
| 700 | dst->refcount[0] = 1000; |
---|
| 701 | /* deep */ |
---|
| 702 | STRUCT_P(HashTable, static_variables, HashTable_zval_ptr) |
---|
[508] | 703 | #ifdef ZEND_ENGINE_2 |
---|
[662] | 704 | STRUCT_ARRAY(num_args, zend_arg_info, arg_info) |
---|
| 705 | gc_arg_info = 1; |
---|
[508] | 706 | #endif |
---|
[822] | 707 | dst->filename = processor->entry_src->filepath; |
---|
| 708 | #ifdef ZEND_ENGINE_2_4 |
---|
| 709 | if (src->literals /* || op_array_info->literalsinfo_cnt */) { |
---|
| 710 | gc_opcodes = 1; |
---|
| 711 | } |
---|
| 712 | #else |
---|
[662] | 713 | if (op_array_info->oplineinfo_cnt) { |
---|
[822] | 714 | gc_opcodes = 1; |
---|
| 715 | } |
---|
| 716 | #endif |
---|
| 717 | if (gc_opcodes) { |
---|
[779] | 718 | zend_op *opline, *end; |
---|
[662] | 719 | COPY_N_EX(last, zend_op, opcodes) |
---|
[779] | 720 | |
---|
| 721 | for (opline = dst->opcodes, end = opline + src->last; opline < end; ++opline) { |
---|
[822] | 722 | #ifdef ZEND_ENGINE_2_4 |
---|
| 723 | pushdef(`UNION_znode_op_literal', ` |
---|
| 724 | if (opline->$1_type == IS_CONST) { |
---|
| 725 | opline->$1.constant = opline->$1.literal - src->literals; |
---|
| 726 | opline->$1.literal = &dst->literals[opline->$1.constant]; |
---|
| 727 | } |
---|
| 728 | ') |
---|
| 729 | UNION_znode_op_literal(op1) |
---|
| 730 | UNION_znode_op_literal(op2) |
---|
| 731 | popdef(`UNION_znode_op_literal') |
---|
| 732 | #endif |
---|
| 733 | |
---|
[779] | 734 | switch (opline->opcode) { |
---|
| 735 | #ifdef ZEND_GOTO |
---|
| 736 | case ZEND_GOTO: |
---|
| 737 | #endif |
---|
| 738 | case ZEND_JMP: |
---|
| 739 | Z_OP(opline->op1).jmp_addr = dst->opcodes + (Z_OP(opline->op1).jmp_addr - src->opcodes); |
---|
| 740 | break; |
---|
| 741 | |
---|
| 742 | case ZEND_JMPZ: |
---|
| 743 | case ZEND_JMPNZ: |
---|
| 744 | case ZEND_JMPZ_EX: |
---|
| 745 | case ZEND_JMPNZ_EX: |
---|
| 746 | #ifdef ZEND_JMP_SET |
---|
| 747 | case ZEND_JMP_SET: |
---|
| 748 | #endif |
---|
| 749 | Z_OP(opline->op2).jmp_addr = dst->opcodes + (Z_OP(opline->op2).jmp_addr - src->opcodes); |
---|
| 750 | break; |
---|
| 751 | |
---|
| 752 | default: |
---|
| 753 | break; |
---|
| 754 | } |
---|
| 755 | } |
---|
[662] | 756 | } |
---|
| 757 | if (gc_arg_info || gc_opcodes) { |
---|
| 758 | xc_gc_op_array_t gc_op_array; |
---|
| 759 | #ifdef ZEND_ENGINE_2 |
---|
| 760 | gc_op_array.num_args = gc_arg_info ? dst->num_args : 0; |
---|
| 761 | gc_op_array.arg_info = gc_arg_info ? dst->arg_info : NULL; |
---|
| 762 | #endif |
---|
| 763 | gc_op_array.opcodes = gc_opcodes ? dst->opcodes : NULL; |
---|
| 764 | xc_gc_add_op_array(&gc_op_array TSRMLS_CC); |
---|
| 765 | } |
---|
[1] | 766 | define(`SKIPASSERT_ONCE') |
---|
| 767 | } |
---|
| 768 | else |
---|
| 769 | ') |
---|
| 770 | do { |
---|
| 771 | dnl RESTORE is done above! |
---|
| 772 | |
---|
| 773 | /* Common elements */ |
---|
| 774 | DISPATCH(zend_uchar, type) |
---|
[103] | 775 | PROC_ZSTRING(, function_name) |
---|
[1] | 776 | #ifdef ZEND_ENGINE_2 |
---|
| 777 | DISPATCH(zend_uint, fn_flags) |
---|
[662] | 778 | STRUCT_ARRAY(num_args, zend_arg_info, arg_info) |
---|
[1] | 779 | DISPATCH(zend_uint, num_args) |
---|
| 780 | DISPATCH(zend_uint, required_num_args) |
---|
[716] | 781 | # ifndef ZEND_ENGINE_2_4 |
---|
[1] | 782 | DISPATCH(zend_bool, pass_rest_by_reference) |
---|
[716] | 783 | # endif |
---|
[1] | 784 | #else |
---|
| 785 | if (src->arg_types) { |
---|
| 786 | ALLOC(dst->arg_types, zend_uchar, src->arg_types[0] + 1) |
---|
| 787 | IFCOPY(`memcpy(dst->arg_types, src->arg_types, sizeof(src->arg_types[0]) * (src->arg_types[0]+1));') |
---|
| 788 | IFDASM(`do { |
---|
| 789 | int i; |
---|
| 790 | zval *zv; |
---|
| 791 | ALLOC_INIT_ZVAL(zv); |
---|
| 792 | array_init(zv); |
---|
| 793 | for (i = 0; i < src->arg_types[0]; i ++) { |
---|
| 794 | add_next_index_long(zv, src->arg_types[i + 1]); |
---|
| 795 | } |
---|
| 796 | add_assoc_zval_ex(dst, ZEND_STRS("arg_types"), zv); |
---|
| 797 | } while (0);') |
---|
| 798 | DONE(arg_types) |
---|
| 799 | } |
---|
| 800 | else { |
---|
| 801 | IFDASM(`do { |
---|
| 802 | /* empty array */ |
---|
| 803 | zval *zv; |
---|
| 804 | ALLOC_INIT_ZVAL(zv); |
---|
| 805 | array_init(zv); |
---|
| 806 | add_assoc_zval_ex(dst, ZEND_STRS("arg_types"), zv); |
---|
| 807 | } while (0); |
---|
| 808 | DONE(arg_types) |
---|
| 809 | ', ` |
---|
| 810 | COPYNULL(arg_types) |
---|
| 811 | ') |
---|
| 812 | } |
---|
| 813 | #endif |
---|
[716] | 814 | #ifndef ZEND_ENGINE_2_4 |
---|
[1] | 815 | DISPATCH(unsigned char, return_reference) |
---|
[716] | 816 | #endif |
---|
[1] | 817 | /* END of common elements */ |
---|
| 818 | #ifdef IS_UNICODE |
---|
[103] | 819 | dnl SETNULL(u_twin) |
---|
[1] | 820 | #endif |
---|
| 821 | |
---|
| 822 | STRUCT_P(zend_uint, refcount) |
---|
| 823 | UNFIXPOINTER(zend_uint, refcount) |
---|
[221] | 824 | IFSTORE(`dst->refcount[0] = 1;') |
---|
[1] | 825 | |
---|
[822] | 826 | #ifdef ZEND_ENGINE_2_4 |
---|
| 827 | dnl before copying opcodes |
---|
| 828 | DISPATCH(int, last_literal) |
---|
| 829 | STRUCT_ARRAY(last_literal, zend_literal, literals) |
---|
| 830 | #endif |
---|
| 831 | |
---|
[1] | 832 | pushdef(`AFTER_ALLOC', `IFCOPY(` |
---|
[779] | 833 | #ifndef NDEBUG |
---|
| 834 | processor->active_op_array_dst = dst; |
---|
| 835 | processor->active_op_array_src = src; |
---|
| 836 | #endif |
---|
[1] | 837 | processor->active_opcodes_dst = dst->opcodes; |
---|
| 838 | processor->active_opcodes_src = src->opcodes; |
---|
| 839 | ')') |
---|
[662] | 840 | STRUCT_ARRAY(last, zend_op, opcodes) |
---|
[1] | 841 | popdef(`AFTER_ALLOC') |
---|
| 842 | DISPATCH(zend_uint, last) |
---|
[716] | 843 | #ifndef ZEND_ENGINE_2_4 |
---|
[1] | 844 | IFCOPY(`dst->size = src->last;DONE(size)', `DISPATCH(zend_uint, size)') |
---|
[716] | 845 | #endif |
---|
[1] | 846 | |
---|
| 847 | #ifdef IS_CV |
---|
| 848 | STRUCT_ARRAY(last_var, zend_compiled_variable, vars) |
---|
| 849 | DISPATCH(int, last_var) |
---|
[716] | 850 | # ifndef ZEND_ENGINE_2_4 |
---|
[1] | 851 | IFCOPY(`dst->size_var = src->last_var;DONE(size_var)', `DISPATCH(zend_uint, size_var)') |
---|
[716] | 852 | # endif |
---|
[1] | 853 | #else |
---|
| 854 | dnl zend_cv.m4 is illegal to be made public, don not ask me for it |
---|
| 855 | IFDASM(` |
---|
[4] | 856 | sinclude(srcdir`/processor/zend_cv.m4') |
---|
[1] | 857 | ') |
---|
| 858 | #endif |
---|
| 859 | |
---|
| 860 | DISPATCH(zend_uint, T) |
---|
| 861 | |
---|
[662] | 862 | STRUCT_ARRAY(last_brk_cont, zend_brk_cont_element, brk_cont_array) |
---|
[1] | 863 | DISPATCH(zend_uint, last_brk_cont) |
---|
[716] | 864 | #ifndef ZEND_ENGINE_2_4 |
---|
[1] | 865 | DISPATCH(zend_uint, current_brk_cont) |
---|
[716] | 866 | #endif |
---|
[1] | 867 | #ifndef ZEND_ENGINE_2 |
---|
| 868 | DISPATCH(zend_bool, uses_globals) |
---|
| 869 | #endif |
---|
| 870 | |
---|
| 871 | #ifdef ZEND_ENGINE_2 |
---|
| 872 | STRUCT_ARRAY(last_try_catch, zend_try_catch_element, try_catch_array) |
---|
| 873 | DISPATCH(int, last_try_catch) |
---|
| 874 | #endif |
---|
| 875 | |
---|
| 876 | STRUCT_P(HashTable, static_variables, HashTable_zval_ptr) |
---|
| 877 | |
---|
[716] | 878 | #ifndef ZEND_ENGINE_2_4 |
---|
[95] | 879 | COPY(start_op) |
---|
[1] | 880 | DISPATCH(int, backpatch_count) |
---|
[716] | 881 | #endif |
---|
[562] | 882 | #ifdef ZEND_ENGINE_2_3 |
---|
| 883 | DISPATCH(zend_uint, this_var) |
---|
| 884 | #endif |
---|
[1] | 885 | |
---|
[716] | 886 | #ifndef ZEND_ENGINE_2_4 |
---|
[1] | 887 | DISPATCH(zend_bool, done_pass_two) |
---|
[716] | 888 | #endif |
---|
[562] | 889 | /* 5.0 <= ver < 5.3 */ |
---|
| 890 | #if defined(ZEND_ENGINE_2) && !defined(ZEND_ENGINE_2_3) |
---|
[1] | 891 | DISPATCH(zend_bool, uses_this) |
---|
| 892 | #endif |
---|
| 893 | |
---|
[687] | 894 | IFRESTORE(`dst->filename = processor->entry_src->filepath;DONE(filename)', `PROC_STRING(filename)') |
---|
[1] | 895 | #ifdef IS_UNICODE |
---|
[267] | 896 | IFRESTORE(` |
---|
| 897 | COPY(script_encoding) |
---|
| 898 | ', ` |
---|
| 899 | PROC_STRING(script_encoding) |
---|
| 900 | ') |
---|
[1] | 901 | #endif |
---|
| 902 | #ifdef ZEND_ENGINE_2 |
---|
| 903 | DISPATCH(zend_uint, line_start) |
---|
| 904 | DISPATCH(zend_uint, line_end) |
---|
| 905 | DISPATCH(int, doc_comment_len) |
---|
[272] | 906 | PROC_ZSTRING_L(, doc_comment, doc_comment_len) |
---|
[1] | 907 | #endif |
---|
[548] | 908 | #ifdef ZEND_COMPILE_DELAYED_BINDING |
---|
| 909 | DISPATCH(zend_uint, early_binding); |
---|
| 910 | #endif |
---|
[1] | 911 | |
---|
| 912 | /* reserved */ |
---|
| 913 | DONE(reserved) |
---|
| 914 | #if defined(HARDENING_PATCH) && HARDENING_PATCH |
---|
| 915 | DISPATCH(zend_bool, created_by_eval) |
---|
| 916 | #endif |
---|
[724] | 917 | #ifdef ZEND_ENGINE_2_4 |
---|
| 918 | COPYNULL(run_time_cache) |
---|
| 919 | COPYNULL(last_cache_slot) |
---|
| 920 | #endif |
---|
[1] | 921 | } while (0); |
---|
[684] | 922 | IFRESTORE(`xc_fix_op_array_info(processor->entry_src, processor->php_src, dst, !shallow_copy, op_array_info TSRMLS_CC);') |
---|
[189] | 923 | |
---|
[219] | 924 | #ifdef ZEND_ENGINE_2 |
---|
| 925 | dnl mark it as -1 on store, and lookup parent on restore |
---|
| 926 | IFSTORE(`dst->prototype = (processor->active_class_entry_src && src->prototype) ? (zend_function *) -1 : NULL; DONE(prototype)', ` |
---|
| 927 | IFRESTORE(`do { |
---|
| 928 | zend_function *parent; |
---|
| 929 | if (src->prototype != NULL |
---|
| 930 | && zend_u_hash_find(&(processor->active_class_entry_dst->parent->function_table), |
---|
| 931 | UG(unicode) ? IS_UNICODE : IS_STRING, |
---|
[513] | 932 | src->function_name, xc_zstrlen(UG(unicode) ? IS_UNICODE : IS_STRING, src->function_name) + 1, |
---|
[219] | 933 | (void **) &parent) == SUCCESS) { |
---|
| 934 | /* see do_inherit_method_check() */ |
---|
| 935 | if ((parent->common.fn_flags & ZEND_ACC_ABSTRACT)) { |
---|
| 936 | dst->prototype = parent; |
---|
| 937 | } else if (!(parent->common.fn_flags & ZEND_ACC_CTOR) || (parent->common.prototype && (parent->common.prototype->common.scope->ce_flags & ZEND_ACC_INTERFACE))) { |
---|
| 938 | /* ctors only have a prototype if it comes from an interface */ |
---|
| 939 | dst->prototype = parent->common.prototype ? parent->common.prototype : parent; |
---|
| 940 | } |
---|
| 941 | else { |
---|
| 942 | dst->prototype = NULL; |
---|
| 943 | } |
---|
| 944 | } |
---|
| 945 | else { |
---|
| 946 | dst->prototype = NULL; |
---|
| 947 | } |
---|
| 948 | DONE(prototype) |
---|
| 949 | } while (0); |
---|
| 950 | ', ` |
---|
| 951 | COPYNULL(prototype) |
---|
| 952 | ') |
---|
| 953 | ') |
---|
[716] | 954 | |
---|
[219] | 955 | #endif |
---|
| 956 | |
---|
[189] | 957 | #ifdef ZEND_ENGINE_2 |
---|
[507] | 958 | PROC_CLASS_ENTRY_P(scope) |
---|
| 959 | IFCOPY(` |
---|
[219] | 960 | if (src->scope) { |
---|
[507] | 961 | xc_fix_method(processor, dst TSRMLS_CC); |
---|
[189] | 962 | } |
---|
[507] | 963 | ') |
---|
[189] | 964 | #endif |
---|
| 965 | |
---|
| 966 | IFRESTORE(` |
---|
| 967 | if (xc_have_op_array_ctor) { |
---|
| 968 | zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) xc_zend_extension_op_array_ctor_handler, dst TSRMLS_CC); |
---|
| 969 | } |
---|
| 970 | ') |
---|
[1] | 971 | ') |
---|
| 972 | dnl }}} |
---|
| 973 | |
---|
[95] | 974 | #ifdef HAVE_XCACHE_CONSTANT |
---|
| 975 | DEF_STRUCT_P_FUNC(`xc_constinfo_t', , `dnl {{{ |
---|
| 976 | DISPATCH(zend_uint, key_size) |
---|
| 977 | #ifdef IS_UNICODE |
---|
| 978 | DISPATCH(zend_uchar, type) |
---|
| 979 | #endif |
---|
| 980 | IFRESTORE(`COPY(key)', ` |
---|
[103] | 981 | PROC_ZSTRING_N(type, key, key_size) |
---|
[95] | 982 | ') |
---|
[506] | 983 | DISPATCH(ulong, h) |
---|
[95] | 984 | STRUCT(zend_constant, constant) |
---|
| 985 | ') |
---|
| 986 | dnl }}} |
---|
| 987 | #endif |
---|
[662] | 988 | DEF_STRUCT_P_FUNC(`xc_op_array_info_t', , `dnl {{{ |
---|
[721] | 989 | #ifdef ZEND_ENGINE_2_4 |
---|
| 990 | DISPATCH(zend_uint, literalinfo_cnt) |
---|
| 991 | DISPATCH_ARRAY(literalinfo_cnt, int, literalinfos) |
---|
| 992 | #else |
---|
[662] | 993 | DISPATCH(zend_uint, oplineinfo_cnt) |
---|
| 994 | DISPATCH_ARRAY(oplineinfo_cnt, int, oplineinfos) |
---|
[721] | 995 | #endif |
---|
[662] | 996 | ') |
---|
| 997 | dnl }}} |
---|
[1] | 998 | DEF_STRUCT_P_FUNC(`xc_funcinfo_t', , `dnl {{{ |
---|
| 999 | DISPATCH(zend_uint, key_size) |
---|
| 1000 | #ifdef IS_UNICODE |
---|
| 1001 | DISPATCH(zend_uchar, type) |
---|
| 1002 | #endif |
---|
| 1003 | IFRESTORE(`COPY(key)', ` |
---|
[103] | 1004 | PROC_ZSTRING_N(type, key, key_size) |
---|
[1] | 1005 | ') |
---|
[506] | 1006 | DISPATCH(ulong, h) |
---|
[662] | 1007 | IFRESTORE(`COPY(op_array_info)', ` |
---|
| 1008 | STRUCT(xc_op_array_info_t, op_array_info) |
---|
| 1009 | ') |
---|
| 1010 | IFRESTORE(` |
---|
[666] | 1011 | processor->active_op_array_infos_src = &src->op_array_info; |
---|
[662] | 1012 | processor->active_op_array_index = 0; |
---|
| 1013 | ') |
---|
[1] | 1014 | STRUCT(zend_function, func) |
---|
| 1015 | ') |
---|
| 1016 | dnl }}} |
---|
| 1017 | DEF_STRUCT_P_FUNC(`xc_classinfo_t', , `dnl {{{ |
---|
| 1018 | DISPATCH(zend_uint, key_size) |
---|
| 1019 | #ifdef IS_UNICODE |
---|
| 1020 | DISPATCH(zend_uchar, type) |
---|
| 1021 | #endif |
---|
| 1022 | IFRESTORE(`COPY(key)', ` |
---|
[103] | 1023 | PROC_ZSTRING_N(type, key, key_size) |
---|
[1] | 1024 | ') |
---|
[506] | 1025 | DISPATCH(ulong, h) |
---|
[662] | 1026 | DISPATCH(zend_uint, methodinfo_cnt) |
---|
| 1027 | IFRESTORE(`COPY(methodinfos)', ` |
---|
| 1028 | STRUCT_ARRAY(methodinfo_cnt, xc_op_array_info_t, methodinfos) |
---|
| 1029 | ') |
---|
| 1030 | IFRESTORE(` |
---|
[666] | 1031 | processor->active_op_array_infos_src = src->methodinfos; |
---|
[662] | 1032 | processor->active_op_array_index = 0; |
---|
| 1033 | ') |
---|
[1] | 1034 | #ifdef ZEND_ENGINE_2 |
---|
| 1035 | STRUCT_P(zend_class_entry, cest) |
---|
| 1036 | #else |
---|
| 1037 | STRUCT(zend_class_entry, cest) |
---|
| 1038 | #endif |
---|
[548] | 1039 | #ifndef ZEND_COMPILE_DELAYED_BINDING |
---|
[212] | 1040 | DISPATCH(int, oplineno) |
---|
[548] | 1041 | #endif |
---|
[1] | 1042 | ') |
---|
| 1043 | dnl }}} |
---|
[268] | 1044 | #ifdef ZEND_ENGINE_2_1 |
---|
| 1045 | DEF_STRUCT_P_FUNC(`xc_autoglobal_t', , `dnl {{{ |
---|
| 1046 | DISPATCH(zend_uint, key_len) |
---|
| 1047 | #ifdef IS_UNICODE |
---|
| 1048 | DISPATCH(zend_uchar, type) |
---|
| 1049 | #endif |
---|
| 1050 | IFRESTORE(`COPY(key)', ` |
---|
| 1051 | PROC_ZSTRING_L(type, key, key_len) |
---|
| 1052 | ') |
---|
[506] | 1053 | DISPATCH(ulong, h) |
---|
[268] | 1054 | ') |
---|
| 1055 | dnl }}} |
---|
| 1056 | #endif |
---|
[496] | 1057 | #ifdef E_STRICT |
---|
| 1058 | DEF_STRUCT_P_FUNC(`xc_compilererror_t', , `dnl {{{ |
---|
[648] | 1059 | DISPATCH(int, type) |
---|
[496] | 1060 | DISPATCH(uint, lineno) |
---|
| 1061 | DISPATCH(int, error_len) |
---|
| 1062 | PROC_STRING_L(error, error_len) |
---|
| 1063 | ') |
---|
| 1064 | dnl }}} |
---|
| 1065 | #endif |
---|
[1] | 1066 | DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , `dnl {{{ |
---|
[311] | 1067 | IFCOPY(` |
---|
| 1068 | processor->php_dst = dst; |
---|
| 1069 | processor->php_src = src; |
---|
| 1070 | ') |
---|
| 1071 | |
---|
| 1072 | DISPATCH(xc_hash_value_t, hvalue) |
---|
| 1073 | /* skip */ |
---|
| 1074 | DONE(next) |
---|
| 1075 | COPY(cache) |
---|
| 1076 | DISPATCH(xc_md5sum_t, md5) |
---|
| 1077 | DISPATCH(zend_ulong, refcount) |
---|
| 1078 | |
---|
[1] | 1079 | DISPATCH(size_t, sourcesize) |
---|
[311] | 1080 | DISPATCH(zend_ulong, hits) |
---|
| 1081 | DISPATCH(size_t, size) |
---|
[1] | 1082 | |
---|
[662] | 1083 | IFRESTORE(`COPY(op_array_info)', ` |
---|
| 1084 | STRUCT(xc_op_array_info_t, op_array_info) |
---|
| 1085 | ') |
---|
| 1086 | IFRESTORE(` |
---|
| 1087 | processor->active_op_array_infos_src = &dst->op_array_info; |
---|
| 1088 | processor->active_op_array_index = 0; |
---|
| 1089 | ') |
---|
[1] | 1090 | STRUCT_P(zend_op_array, op_array) |
---|
| 1091 | |
---|
[95] | 1092 | #ifdef HAVE_XCACHE_CONSTANT |
---|
| 1093 | DISPATCH(zend_uint, constinfo_cnt) |
---|
[503] | 1094 | STRUCT_ARRAY(constinfo_cnt, xc_constinfo_t, constinfos) |
---|
[95] | 1095 | #endif |
---|
| 1096 | |
---|
[1] | 1097 | DISPATCH(zend_uint, funcinfo_cnt) |
---|
| 1098 | STRUCT_ARRAY(funcinfo_cnt, xc_funcinfo_t, funcinfos) |
---|
| 1099 | |
---|
| 1100 | DISPATCH(zend_uint, classinfo_cnt) |
---|
[662] | 1101 | STRUCT_ARRAY(classinfo_cnt, xc_classinfo_t, classinfos, , IFRESTORE(`processor->active_class_index')) |
---|
[268] | 1102 | #ifdef ZEND_ENGINE_2_1 |
---|
| 1103 | DISPATCH(zend_uint, autoglobal_cnt) |
---|
[495] | 1104 | IFRESTORE(` |
---|
| 1105 | COPY(autoglobals) |
---|
| 1106 | ', ` |
---|
| 1107 | STRUCT_ARRAY(autoglobal_cnt, xc_autoglobal_t, autoglobals) |
---|
| 1108 | ') |
---|
[268] | 1109 | #endif |
---|
[496] | 1110 | #ifdef E_STRICT |
---|
| 1111 | DISPATCH(zend_uint, compilererror_cnt) |
---|
| 1112 | IFRESTORE(` |
---|
| 1113 | COPY(compilererrors) |
---|
| 1114 | ', ` |
---|
| 1115 | STRUCT_ARRAY(compilererror_cnt, xc_compilererror_t, compilererrors) |
---|
| 1116 | ') |
---|
| 1117 | #endif |
---|
[548] | 1118 | #ifndef ZEND_COMPILE_DELAYED_BINDING |
---|
[212] | 1119 | DISPATCH(zend_bool, have_early_binding) |
---|
[548] | 1120 | #endif |
---|
[311] | 1121 | DISPATCH(zend_bool, have_references) |
---|
[1] | 1122 | ') |
---|
| 1123 | dnl }}} |
---|
| 1124 | DEF_STRUCT_P_FUNC(`xc_entry_data_var_t', , `dnl {{{ |
---|
[230] | 1125 | IFDPRINT(`INDENT()`'fprintf(stderr, "zval:value");') |
---|
[4] | 1126 | STRUCT_P_EX(zval_ptr, dst->value, src->value, `value', `', `&') |
---|
[311] | 1127 | DISPATCH(zend_bool, have_references) |
---|
[1] | 1128 | DONE(value) |
---|
| 1129 | ') |
---|
| 1130 | dnl }}} |
---|
| 1131 | dnl {{{ xc_entry_t |
---|
| 1132 | DEF_STRUCT_P_FUNC(`xc_entry_t', , ` |
---|
| 1133 | DISPATCH(xc_entry_type_t, type) |
---|
| 1134 | DISPATCH(size_t, size) |
---|
| 1135 | |
---|
| 1136 | DISPATCH(xc_hash_value_t, hvalue) |
---|
| 1137 | COPY(cache) |
---|
| 1138 | /* skip */ |
---|
| 1139 | DONE(next) |
---|
| 1140 | |
---|
| 1141 | IFSTORE(`dst->refcount = 0; DONE(refcount)', `DISPATCH(long, refcount)') |
---|
| 1142 | |
---|
| 1143 | DISPATCH(time_t, ctime) |
---|
| 1144 | DISPATCH(time_t, atime) |
---|
| 1145 | DISPATCH(time_t, dtime) |
---|
[114] | 1146 | DISPATCH(long, ttl) |
---|
[1] | 1147 | DISPATCH(zend_ulong, hits) |
---|
| 1148 | #ifdef IS_UNICODE |
---|
| 1149 | DISPATCH(zend_uchar, name_type) |
---|
| 1150 | #endif |
---|
| 1151 | dnl {{{ name |
---|
| 1152 | DISABLECHECK(` |
---|
| 1153 | #ifdef IS_UNICODE |
---|
| 1154 | if (src->name_type == IS_UNICODE) { |
---|
| 1155 | DISPATCH(int32_t, name.ustr.len) |
---|
| 1156 | } |
---|
| 1157 | else { |
---|
| 1158 | DISPATCH(int, name.str.len) |
---|
| 1159 | } |
---|
| 1160 | #else |
---|
| 1161 | DISPATCH(int, name.str.len) |
---|
| 1162 | #endif |
---|
[103] | 1163 | IFRESTORE(`COPY(name.str.val)', ` |
---|
| 1164 | #ifdef IS_UNICODE |
---|
| 1165 | PROC_ZSTRING_L(name_type, name.uni.val, name.uni.len) |
---|
| 1166 | #else |
---|
| 1167 | PROC_STRING_L(name.str.val, name.str.len) |
---|
| 1168 | #endif |
---|
| 1169 | ') |
---|
[1] | 1170 | ') |
---|
| 1171 | DONE(name) |
---|
| 1172 | dnl }}} |
---|
| 1173 | |
---|
| 1174 | dnl {{{ data |
---|
| 1175 | DISABLECHECK(` |
---|
| 1176 | switch (src->type) { |
---|
| 1177 | case XC_TYPE_PHP: |
---|
[662] | 1178 | IFCALCCOPY(`COPY(data.php)', `STRUCT_P(xc_entry_data_php_t, data.php)') |
---|
[1] | 1179 | break; |
---|
[311] | 1180 | |
---|
[1] | 1181 | case XC_TYPE_VAR: |
---|
| 1182 | STRUCT_P(xc_entry_data_var_t, data.var) |
---|
| 1183 | break; |
---|
[311] | 1184 | |
---|
[1] | 1185 | default: |
---|
| 1186 | assert(0); |
---|
| 1187 | } |
---|
| 1188 | ') |
---|
| 1189 | DONE(data) |
---|
| 1190 | dnl }}} |
---|
[311] | 1191 | DISPATCH(time_t, mtime) |
---|
| 1192 | #ifdef HAVE_INODE |
---|
| 1193 | DISPATCH(int, device) |
---|
| 1194 | DISPATCH(int, inode) |
---|
| 1195 | #endif |
---|
[684] | 1196 | |
---|
[688] | 1197 | if (src->type == XC_TYPE_PHP) { |
---|
| 1198 | DISPATCH(int, filepath_len) |
---|
| 1199 | IFRESTORE(`COPY(filepath)', `PROC_STRING_L(filepath, filepath_len)') |
---|
| 1200 | DISPATCH(int, dirpath_len) |
---|
| 1201 | IFRESTORE(`COPY(dirpath)', `PROC_STRING_L(dirpath, dirpath_len)') |
---|
[684] | 1202 | #ifdef IS_UNICODE |
---|
[688] | 1203 | DISPATCH(int, ufilepath_len) |
---|
| 1204 | IFRESTORE(`COPY(ufilepath)', `PROC_USTRING_L(ufilepath, ufilepath_len)') |
---|
| 1205 | DISPATCH(int, udirpath_len) |
---|
| 1206 | IFRESTORE(`COPY(udirpath)', `PROC_USTRING_L(udirpath, udirpath_len)') |
---|
[684] | 1207 | #endif |
---|
[688] | 1208 | } |
---|
| 1209 | else { |
---|
| 1210 | DONE(filepath_len) |
---|
| 1211 | DONE(filepath) |
---|
| 1212 | DONE(dirpath_len) |
---|
| 1213 | DONE(dirpath) |
---|
| 1214 | #ifdef IS_UNICODE |
---|
| 1215 | DONE(ufilepath_len) |
---|
| 1216 | DONE(ufilepath) |
---|
| 1217 | DONE(udirpath_len) |
---|
| 1218 | DONE(udirpath) |
---|
| 1219 | #endif |
---|
| 1220 | } |
---|
[1] | 1221 | ') |
---|
| 1222 | dnl }}} |
---|
| 1223 | dnl ==================================================== |
---|