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