| 1 | |
|---|
| 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 | DECL_STRUCT_P_FUNC(`zend_function') |
|---|
| 8 | DECL_STRUCT_P_FUNC(`xc_entry_t') |
|---|
| 9 | |
|---|
| 10 | DECL_STRUCT_P_FUNC(`zend_property_info') |
|---|
| 11 | |
|---|
| 12 | /* }}} */ |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | DEF_STRUCT_P_FUNC(`zend_compiled_variable', , ` |
|---|
| 17 | DISPATCH(int, name_len) |
|---|
| 18 | PROC_USTRING_L(, name, name_len) |
|---|
| 19 | DISPATCH(ulong, hash_value) |
|---|
| 20 | ') |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | DEF_STRUCT_P_FUNC(`zend_uint', , ` |
|---|
| 25 | IFCOPY(`dst[0] = src[0];') |
|---|
| 26 | IFDPRINT(` |
|---|
| 27 | INDENT() |
|---|
| 28 | fprintf(stderr, "%u\n", src[0]); |
|---|
| 29 | ') |
|---|
| 30 | DONE_SIZE(sizeof(src[0])) |
|---|
| 31 | ') |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | DEF_STRUCT_P_FUNC(`int', , ` |
|---|
| 36 | IFCOPY(`*dst = *src;') |
|---|
| 37 | IFDPRINT(` |
|---|
| 38 | INDENT() |
|---|
| 39 | fprintf(stderr, "%d\n", src[0]); |
|---|
| 40 | ') |
|---|
| 41 | DONE_SIZE(sizeof(src[0])) |
|---|
| 42 | ') |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | DEF_STRUCT_P_FUNC(`zend_try_catch_element', , ` |
|---|
| 48 | DISPATCH(zend_uint, try_op) |
|---|
| 49 | DISPATCH(zend_uint, catch_op) |
|---|
| 50 | ') |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | DEF_STRUCT_P_FUNC(`zend_brk_cont_element', , ` |
|---|
| 55 | DISPATCH(int, cont) |
|---|
| 56 | DISPATCH(int, brk) |
|---|
| 57 | DISPATCH(int, parent) |
|---|
| 58 | ') |
|---|
| 59 | |
|---|
| 60 | DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr', `zval_ptr') |
|---|
| 61 | DEF_HASH_TABLE_FUNC(`HashTable_zend_function', `zend_function') |
|---|
| 62 | |
|---|
| 63 | DEF_HASH_TABLE_FUNC(`HashTable_zend_property_info', `zend_property_info') |
|---|
| 64 | |
|---|
| 65 | DEF_STRUCT_P_FUNC(`zval', , ` |
|---|
| 66 | IFDASM(`do { |
|---|
| 67 | zval_dtor(dst); |
|---|
| 68 | *dst = *src; |
|---|
| 69 | zval_copy_ctor(dst); |
|---|
| 70 | ZVAL_REFCOUNT(dst) = 1; |
|---|
| 71 | DONE(value) |
|---|
| 72 | DONE(refcount) |
|---|
| 73 | DONE(type) |
|---|
| 74 | DONE(is_ref) |
|---|
| 75 | } while(0); |
|---|
| 76 | return; |
|---|
| 77 | ', ` |
|---|
| 78 | |
|---|
| 79 | /* Variable information */ |
|---|
| 80 | |
|---|
| 81 | DISABLECHECK(` |
|---|
| 82 | switch (src->type & ~IS_CONSTANT_INDEX) { |
|---|
| 83 | case IS_LONG: |
|---|
| 84 | case IS_RESOURCE: |
|---|
| 85 | case IS_BOOL: |
|---|
| 86 | DISPATCH(long, value.lval) |
|---|
| 87 | break; |
|---|
| 88 | case IS_DOUBLE: |
|---|
| 89 | DISPATCH(double, value.dval) |
|---|
| 90 | break; |
|---|
| 91 | case IS_NULL: |
|---|
| 92 | IFDPRINT(`INDENT()`'fprintf(stderr, "\tNULL\n");') |
|---|
| 93 | break; |
|---|
| 94 | |
|---|
| 95 | case IS_CONSTANT: |
|---|
| 96 | |
|---|
| 97 | if (UG(unicode)) { |
|---|
| 98 | goto proc_unicode; |
|---|
| 99 | } |
|---|
| 100 | |
|---|
| 101 | case IS_STRING: |
|---|
| 102 | |
|---|
| 103 | case FLAG_IS_BC: |
|---|
| 104 | |
|---|
| 105 | DISPATCH(int, value.str.len) |
|---|
| 106 | PROC_STRING_L(value.str.val, value.str.len) |
|---|
| 107 | break; |
|---|
| 108 | |
|---|
| 109 | case IS_UNICODE: |
|---|
| 110 | proc_unicode: |
|---|
| 111 | DISPATCH(int32_t, value.ustr.len) |
|---|
| 112 | PROC_USTRING_L(1, value.ustr.val, value.ustr.len) |
|---|
| 113 | break; |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | case IS_ARRAY: |
|---|
| 117 | case IS_CONSTANT_ARRAY: |
|---|
| 118 | STRUCT_P(HashTable, value.ht, HashTable_zval_ptr) |
|---|
| 119 | break; |
|---|
| 120 | |
|---|
| 121 | case IS_OBJECT: |
|---|
| 122 | IFNOTMEMCPY(`IFCOPY(`memcpy(dst, src, sizeof(src[0]));')') |
|---|
| 123 | |
|---|
| 124 | |
|---|
| 125 | STRUCT_P(zend_class_entry, value.obj.ce) |
|---|
| 126 | STRUCT_P(HashTable, value.obj.properties, HashTable_zval_ptr) |
|---|
| 127 | |
|---|
| 128 | break; |
|---|
| 129 | |
|---|
| 130 | default: |
|---|
| 131 | assert(0); |
|---|
| 132 | } |
|---|
| 133 | ') |
|---|
| 134 | |
|---|
| 135 | DONE(value) |
|---|
| 136 | DISPATCH(zval_data_type, type) |
|---|
| 137 | DISPATCH(zend_uchar, is_ref) |
|---|
| 138 | DISPATCH(zend_ushort, refcount) |
|---|
| 139 | ') |
|---|
| 140 | ') |
|---|
| 141 | |
|---|
| 142 | DEF_STRUCT_P_FUNC(`zval_ptr', , ` |
|---|
| 143 | IFDASM(` |
|---|
| 144 | pushdefFUNC_NAME(`zval') |
|---|
| 145 | FUNC_NAME (dst, src[0] TSRMLS_CC); |
|---|
| 146 | popdef(`FUNC_NAME') |
|---|
| 147 | ', ` |
|---|
| 148 | do { |
|---|
| 149 | IFCALCCOPY(` |
|---|
| 150 | if (processor->reference) { |
|---|
| 151 | zval_ptr *ppzv; |
|---|
| 152 | if (zend_hash_find(&processor->zvalptrs, (char *) &src[0], sizeof(src[0]), (void **) &ppzv) == SUCCESS) { |
|---|
| 153 | IFCOPY(` |
|---|
| 154 | dst[0] = *ppzv; |
|---|
| 155 | /* *dst is updated */ |
|---|
| 156 | |
|---|
| 157 | ') |
|---|
| 158 | IFSTORE(`assert(xc_is_shm(dst[0]));') |
|---|
| 159 | IFRESTORE(`assert(!xc_is_shm(dst[0]));') |
|---|
| 160 | break; |
|---|
| 161 | } |
|---|
| 162 | } |
|---|
| 163 | ') |
|---|
| 164 | |
|---|
| 165 | ALLOC(dst[0], zval) |
|---|
| 166 | IFCALCCOPY(` |
|---|
| 167 | if (processor->reference) { |
|---|
| 168 | IFCALC(` |
|---|
| 169 | /* make dummy */ |
|---|
| 170 | zval_ptr pzv = (zval_ptr)-1; |
|---|
| 171 | ', ` |
|---|
| 172 | zval_ptr pzv = dst[0]; |
|---|
| 173 | ') |
|---|
| 174 | if (zend_hash_add(&processor->zvalptrs, (char *) &src[0], sizeof(src[0]), (void *) &pzv, sizeof(pzv), NULL) == SUCCESS) { |
|---|
| 175 | /* first add, go on */ |
|---|
| 176 | |
|---|
| 177 | } |
|---|
| 178 | else { |
|---|
| 179 | assert(0); |
|---|
| 180 | } |
|---|
| 181 | } |
|---|
| 182 | ') |
|---|
| 183 | IFCOPY(` |
|---|
| 184 | |
|---|
| 185 | ') |
|---|
| 186 | STRUCT_P_EX(zval, dst[0], src[0], `[0]', `', ` ') |
|---|
| 187 | } while (0); |
|---|
| 188 | ') |
|---|
| 189 | DONE_SIZE(sizeof(zval_ptr)) |
|---|
| 190 | ') |
|---|
| 191 | |
|---|
| 192 | |
|---|
| 193 | |
|---|
| 194 | DEF_STRUCT_P_FUNC(`zend_arg_info', , ` |
|---|
| 195 | DISPATCH(zend_uint, name_len) |
|---|
| 196 | PROC_USTRING_L(, name, name_len) |
|---|
| 197 | DISPATCH(zend_uint, class_name_len) |
|---|
| 198 | PROC_USTRING_L(, class_name, class_name_len) |
|---|
| 199 | DISPATCH(zend_bool, array_type_hint) |
|---|
| 200 | DISPATCH(zend_bool, allow_null) |
|---|
| 201 | DISPATCH(zend_bool, pass_by_reference) |
|---|
| 202 | DISPATCH(zend_bool, return_reference) |
|---|
| 203 | DISPATCH(int, required_num_args) |
|---|
| 204 | ') |
|---|
| 205 | |
|---|
| 206 | |
|---|
| 207 | DEF_STRUCT_P_FUNC(`zend_function', , ` |
|---|
| 208 | DISABLECHECK(` |
|---|
| 209 | switch (src->type) { |
|---|
| 210 | case ZEND_INTERNAL_FUNCTION: |
|---|
| 211 | case ZEND_OVERLOADED_FUNCTION: |
|---|
| 212 | IFNOTMEMCPY(`IFCOPY(`memcpy(dst, src, sizeof(src[0]));')') |
|---|
| 213 | break; |
|---|
| 214 | |
|---|
| 215 | case ZEND_USER_FUNCTION: |
|---|
| 216 | case ZEND_EVAL_CODE: |
|---|
| 217 | DONE(type) |
|---|
| 218 | STRUCT(zend_op_array, op_array) |
|---|
| 219 | break; |
|---|
| 220 | |
|---|
| 221 | default: |
|---|
| 222 | assert(0); |
|---|
| 223 | } |
|---|
| 224 | ') |
|---|
| 225 | DONE_SIZE(sizeof(src[0])) |
|---|
| 226 | ') |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | |
|---|
| 230 | DEF_STRUCT_P_FUNC(`zend_property_info', , ` |
|---|
| 231 | DISPATCH(zend_uint, flags) |
|---|
| 232 | DISPATCH(int, name_length) |
|---|
| 233 | PROC_USTRING_L(, name, name_length) |
|---|
| 234 | DISPATCH(ulong, h) |
|---|
| 235 | |
|---|
| 236 | DISPATCH(int, doc_comment_len) |
|---|
| 237 | PROC_USTRING_L(, doc_comment, doc_comment_len) |
|---|
| 238 | |
|---|
| 239 | ') |
|---|
| 240 | |
|---|
| 241 | |
|---|
| 242 | DEF_STRUCT_P_FUNC(`zend_class_entry', , ` |
|---|
| 243 | IFCOPY(` |
|---|
| 244 | processor->active_class_entry_src = src; |
|---|
| 245 | processor->active_class_entry_dst = dst; |
|---|
| 246 | ') |
|---|
| 247 | DISPATCH(char, type) |
|---|
| 248 | DISPATCH(zend_uint, name_length) |
|---|
| 249 | PROC_USTRING_L(, name, name_length) |
|---|
| 250 | IFRESTORE(` |
|---|
| 251 | |
|---|
| 252 | /* just copy parent and resolve on install_class */ |
|---|
| 253 | COPY(parent) |
|---|
| 254 | |
|---|
| 255 | PROC_CLASS_ENTRY_P(parent) |
|---|
| 256 | |
|---|
| 257 | ', ` |
|---|
| 258 | PROC_CLASS_ENTRY_P(parent) |
|---|
| 259 | ') |
|---|
| 260 | |
|---|
| 261 | DISPATCH(int, refcount) |
|---|
| 262 | |
|---|
| 263 | STRUCT_P(int, refcount) |
|---|
| 264 | |
|---|
| 265 | DISPATCH(zend_bool, constants_updated) |
|---|
| 266 | |
|---|
| 267 | DISPATCH(zend_uint, ce_flags) |
|---|
| 268 | |
|---|
| 269 | |
|---|
| 270 | STRUCT(HashTable, default_properties, HashTable_zval_ptr) |
|---|
| 271 | IFCOPY(`dst->builtin_functions = src->builtin_functions;') |
|---|
| 272 | DONE(builtin_functions) |
|---|
| 273 | |
|---|
| 274 | STRUCT(HashTable, properties_info, HashTable_zend_property_info) |
|---|
| 275 | |
|---|
| 276 | STRUCT(HashTable, default_static_members, HashTable_zval_ptr) |
|---|
| 277 | IFCOPY(`dst->static_members = &dst->default_static_members;') |
|---|
| 278 | DONE(static_members) |
|---|
| 279 | |
|---|
| 280 | STRUCT_P(HashTable, static_members, HashTable_zval_ptr) |
|---|
| 281 | |
|---|
| 282 | STRUCT(HashTable, constants_table, HashTable_zval_ptr) |
|---|
| 283 | |
|---|
| 284 | |
|---|
| 285 | IFRESTORE(` |
|---|
| 286 | if (src->num_interfaces) { |
|---|
| 287 | CALLOC(dst->interfaces, zend_class_entry*, src->num_interfaces) |
|---|
| 288 | DONE(`interfaces') |
|---|
| 289 | } |
|---|
| 290 | else { |
|---|
| 291 | COPYNULL(interfaces) |
|---|
| 292 | } |
|---|
| 293 | ') |
|---|
| 294 | IFDASM(` |
|---|
| 295 | if (src->num_interfaces) { |
|---|
| 296 | /* |
|---|
| 297 | zval *arr; |
|---|
| 298 | ALLOC_INIT_ZVAL(arr); |
|---|
| 299 | array_init(arr); |
|---|
| 300 | for (i = 0; i < src->num_interfaces; i ++) { |
|---|
| 301 | zval *zv; |
|---|
| 302 | ALLOC_INIT_ZVAL(zv); |
|---|
| 303 | ZVAL_STRING(src->num_interfaces); |
|---|
| 304 | } |
|---|
| 305 | add_assoc_zval_ex(dst, ZEND_STRS("interfaces"), arr); |
|---|
| 306 | */ |
|---|
| 307 | DONE(`interfaces') |
|---|
| 308 | } |
|---|
| 309 | else { |
|---|
| 310 | COPYNULL(interfaces) |
|---|
| 311 | } |
|---|
| 312 | ') |
|---|
| 313 | IFRESTORE(`', ` |
|---|
| 314 | IFDASM(`', ` |
|---|
| 315 | DONE(`interfaces') |
|---|
| 316 | ') |
|---|
| 317 | ') |
|---|
| 318 | DISPATCH(zend_uint, num_interfaces) |
|---|
| 319 | |
|---|
| 320 | IFRESTORE(`COPY(filename)', `PROC_STRING(filename)') |
|---|
| 321 | DISPATCH(zend_uint, line_start) |
|---|
| 322 | DISPATCH(zend_uint, line_end) |
|---|
| 323 | |
|---|
| 324 | DISPATCH(zend_uint, doc_comment_len) |
|---|
| 325 | PROC_USTRING_L(, doc_comment, doc_comment_len) |
|---|
| 326 | |
|---|
| 327 | /* |
|---|
| 328 | COPY(serialize_func) |
|---|
| 329 | COPY(unserialize_func) |
|---|
| 330 | COPY(iterator_funcs) |
|---|
| 331 | COPY(create_object) |
|---|
| 332 | COPY(get_iterator) |
|---|
| 333 | COPY(interface_gets_implemented) |
|---|
| 334 | COPY(serialize) |
|---|
| 335 | COPY(unserialize) |
|---|
| 336 | /* deal with it inside xc_fix_method */ |
|---|
| 337 | SETNULL(constructor) |
|---|
| 338 | COPY(destructor) |
|---|
| 339 | COPY(clone) |
|---|
| 340 | COPY(__get) |
|---|
| 341 | COPY(__set) |
|---|
| 342 | /* should be >5.1 */ |
|---|
| 343 | |
|---|
| 344 | COPY(__unset) |
|---|
| 345 | COPY(__isset) |
|---|
| 346 | |
|---|
| 347 | COPY(__tostring) |
|---|
| 348 | |
|---|
| 349 | |
|---|
| 350 | COPY(__call) |
|---|
| 351 | |
|---|
| 352 | SETNULL(u_twin) |
|---|
| 353 | |
|---|
| 354 | /* |
|---|
| 355 | COPY(module) |
|---|
| 356 | |
|---|
| 357 | COPY(handle_function_call) |
|---|
| 358 | COPY(handle_property_get) |
|---|
| 359 | COPY(handle_property_set) |
|---|
| 360 | |
|---|
| 361 | |
|---|
| 362 | STRUCT(HashTable, function_table, HashTable_zend_function) |
|---|
| 363 | IFRESTORE(`dst->function_table.pDestructor = ZEND_FUNCTION_DTOR;') |
|---|
| 364 | ') |
|---|
| 365 | |
|---|
| 366 | DEF_STRUCT_P_FUNC(`znode', , ` |
|---|
| 367 | DISPATCH(int, op_type) |
|---|
| 368 | |
|---|
| 369 | |
|---|
| 370 | |
|---|
| 371 | |
|---|
| 372 | /* compatible with zend optimizer */ |
|---|
| 373 | |
|---|
| 374 | |
|---|
| 375 | assert(src->op_type == IS_CONST || |
|---|
| 376 | src->op_type == IS_VAR || |
|---|
| 377 | src->op_type == XCACHE_IS_CV || |
|---|
| 378 | src->op_type == IS_TMP_VAR || |
|---|
| 379 | src->op_type == IS_UNUSED); |
|---|
| 380 | |
|---|
| 381 | |
|---|
| 382 | DISABLECHECK(` |
|---|
| 383 | switch (src->op_type) { |
|---|
| 384 | case IS_CONST: |
|---|
| 385 | STRUCT(zval, u.constant) |
|---|
| 386 | break; |
|---|
| 387 | IFCOPY(` |
|---|
| 388 | IFNOTMEMCPY(` |
|---|
| 389 | default: |
|---|
| 390 | memcpy(&dst->u, &src->u, sizeof(src->u)); |
|---|
| 391 | ') |
|---|
| 392 | ', ` |
|---|
| 393 | case IS_VAR: |
|---|
| 394 | case IS_TMP_VAR: |
|---|
| 395 | |
|---|
| 396 | case IS_CV: |
|---|
| 397 | |
|---|
| 398 | case 16: |
|---|
| 399 | |
|---|
| 400 | DISPATCH(zend_uint, u.var) |
|---|
| 401 | DISPATCH(zend_uint, u.EA.type) |
|---|
| 402 | break; |
|---|
| 403 | case IS_UNUSED: |
|---|
| 404 | IFDASM(`DISPATCH(zend_uint, u.var)') |
|---|
| 405 | DISPATCH(zend_uint, u.opline_num) |
|---|
| 406 | |
|---|
| 407 | DISPATCH(zend_uint, u.fetch_type) |
|---|
| 408 | |
|---|
| 409 | DISPATCH(zend_uint, u.EA.type) |
|---|
| 410 | break; |
|---|
| 411 | ') |
|---|
| 412 | } |
|---|
| 413 | ') |
|---|
| 414 | DONE(u) |
|---|
| 415 | ') |
|---|
| 416 | |
|---|
| 417 | DEF_STRUCT_P_FUNC(`zend_op', , ` |
|---|
| 418 | DISPATCH(zend_uchar, opcode) |
|---|
| 419 | STRUCT(znode, result) |
|---|
| 420 | STRUCT(znode, op1) |
|---|
| 421 | STRUCT(znode, op2) |
|---|
| 422 | DISPATCH(ulong, extended_value) |
|---|
| 423 | DISPATCH(uint, lineno) |
|---|
| 424 | |
|---|
| 425 | IFCOPY(` |
|---|
| 426 | switch (src->opcode) { |
|---|
| 427 | case ZEND_JMP: |
|---|
| 428 | dst->op1.u.jmp_addr = processor->active_opcodes_dst + (src->op1.u.jmp_addr - processor->active_opcodes_src); |
|---|
| 429 | break; |
|---|
| 430 | |
|---|
| 431 | case ZEND_JMPZ: |
|---|
| 432 | case ZEND_JMPNZ: |
|---|
| 433 | case ZEND_JMPZ_EX: |
|---|
| 434 | case ZEND_JMPNZ_EX: |
|---|
| 435 | dst->op2.u.jmp_addr = processor->active_opcodes_dst + (src->op2.u.jmp_addr - processor->active_opcodes_src); |
|---|
| 436 | break; |
|---|
| 437 | |
|---|
| 438 | default: |
|---|
| 439 | break; |
|---|
| 440 | } |
|---|
| 441 | ') |
|---|
| 442 | DISPATCH(opcode_handler_t, handler) |
|---|
| 443 | |
|---|
| 444 | ') |
|---|
| 445 | |
|---|
| 446 | DEF_STRUCT_P_FUNC(`zend_op_array', , ` |
|---|
| 447 | IFRESTORE(` |
|---|
| 448 | if (!processor->readonly_protection) { |
|---|
| 449 | /* really fast shallow copy */ |
|---|
| 450 | memcpy(dst, src, sizeof(src[0])); |
|---|
| 451 | dst->refcount[0] = 1000; |
|---|
| 452 | /* deep */ |
|---|
| 453 | STRUCT_P(HashTable, static_variables, HashTable_zval_ptr) |
|---|
| 454 | define(`SKIPASSERT_ONCE') |
|---|
| 455 | |
|---|
| 456 | IFRESTORE(` |
|---|
| 457 | |
|---|
| 458 | if (dst->scope) { |
|---|
| 459 | dst->scope = xc_get_class(processor, (int) dst->scope); |
|---|
| 460 | xc_fix_method(processor, dst); |
|---|
| 461 | } |
|---|
| 462 | |
|---|
| 463 | ') |
|---|
| 464 | |
|---|
| 465 | } |
|---|
| 466 | else |
|---|
| 467 | ') |
|---|
| 468 | do { |
|---|
| 469 | |
|---|
| 470 | zend_uint ii; |
|---|
| 471 | int i; |
|---|
| 472 | |
|---|
| 473 | /* Common elements */ |
|---|
| 474 | DISPATCH(zend_uchar, type) |
|---|
| 475 | PROC_USTRING(, function_name) |
|---|
| 476 | |
|---|
| 477 | IFRESTORE(` |
|---|
| 478 | if (dst->scope) { |
|---|
| 479 | dst->scope = xc_get_class(processor, (int) dst->scope); |
|---|
| 480 | xc_fix_method(processor, dst); |
|---|
| 481 | } |
|---|
| 482 | DONE(scope) |
|---|
| 483 | ', ` |
|---|
| 484 | PROC_CLASS_ENTRY_P(scope) |
|---|
| 485 | ') |
|---|
| 486 | DISPATCH(zend_uint, fn_flags) |
|---|
| 487 | /* useless */ |
|---|
| 488 | COPY(prototype) |
|---|
| 489 | STRUCT_ARRAY_I(num_args, zend_arg_info, arg_info) |
|---|
| 490 | DISPATCH(zend_uint, num_args) |
|---|
| 491 | DISPATCH(zend_uint, required_num_args) |
|---|
| 492 | DISPATCH(zend_bool, pass_rest_by_reference) |
|---|
| 493 | |
|---|
| 494 | if (src->arg_types) { |
|---|
| 495 | ALLOC(dst->arg_types, zend_uchar, src->arg_types[0] + 1) |
|---|
| 496 | IFCOPY(`memcpy(dst->arg_types, src->arg_types, sizeof(src->arg_types[0]) * (src->arg_types[0]+1));') |
|---|
| 497 | IFDASM(`do { |
|---|
| 498 | zend_uint ii; |
|---|
| 499 | int i; |
|---|
| 500 | zval *zv; |
|---|
| 501 | ALLOC_INIT_ZVAL(zv); |
|---|
| 502 | array_init(zv); |
|---|
| 503 | for (i = 0; i < src->arg_types[0]; i ++) { |
|---|
| 504 | add_next_index_long(zv, src->arg_types[i + 1]); |
|---|
| 505 | } |
|---|
| 506 | add_assoc_zval_ex(dst, ZEND_STRS("arg_types"), zv); |
|---|
| 507 | } while (0);') |
|---|
| 508 | DONE(arg_types) |
|---|
| 509 | } |
|---|
| 510 | else { |
|---|
| 511 | IFDASM(`do { |
|---|
| 512 | /* empty array */ |
|---|
| 513 | zval *zv; |
|---|
| 514 | ALLOC_INIT_ZVAL(zv); |
|---|
| 515 | array_init(zv); |
|---|
| 516 | add_assoc_zval_ex(dst, ZEND_STRS("arg_types"), zv); |
|---|
| 517 | } while (0); |
|---|
| 518 | DONE(arg_types) |
|---|
| 519 | ', ` |
|---|
| 520 | COPYNULL(arg_types) |
|---|
| 521 | ') |
|---|
| 522 | } |
|---|
| 523 | |
|---|
| 524 | DISPATCH(unsigned char, return_reference) |
|---|
| 525 | /* END of common elements */ |
|---|
| 526 | |
|---|
| 527 | SETNULL(u_twin) |
|---|
| 528 | |
|---|
| 529 | |
|---|
| 530 | STRUCT_P(zend_uint, refcount) |
|---|
| 531 | UNFIXPOINTER(zend_uint, refcount) |
|---|
| 532 | |
|---|
| 533 | pushdef(`AFTER_ALLOC', `IFCOPY(` |
|---|
| 534 | processor->active_opcodes_dst = dst->opcodes; |
|---|
| 535 | processor->active_opcodes_src = src->opcodes; |
|---|
| 536 | ')') |
|---|
| 537 | STRUCT_ARRAY_I(last, zend_op, opcodes) |
|---|
| 538 | popdef(`AFTER_ALLOC') |
|---|
| 539 | DISPATCH(zend_uint, last) |
|---|
| 540 | IFCOPY(`dst->size = src->last;DONE(size)', `DISPATCH(zend_uint, size)') |
|---|
| 541 | |
|---|
| 542 | |
|---|
| 543 | STRUCT_ARRAY(last_var, zend_compiled_variable, vars) |
|---|
| 544 | DISPATCH(int, last_var) |
|---|
| 545 | IFCOPY(`dst->size_var = src->last_var;DONE(size_var)', `DISPATCH(zend_uint, size_var)') |
|---|
| 546 | |
|---|
| 547 | |
|---|
| 548 | IFDASM(` |
|---|
| 549 | sinclude(srcdir`/processor/zend_cv.m4') |
|---|
| 550 | ') |
|---|
| 551 | |
|---|
| 552 | |
|---|
| 553 | DISPATCH(zend_uint, T) |
|---|
| 554 | |
|---|
| 555 | STRUCT_ARRAY_I(last_brk_cont, zend_brk_cont_element, brk_cont_array) |
|---|
| 556 | DISPATCH(zend_uint, last_brk_cont) |
|---|
| 557 | DISPATCH(zend_uint, current_brk_cont) |
|---|
| 558 | |
|---|
| 559 | DISPATCH(zend_bool, uses_globals) |
|---|
| 560 | |
|---|
| 561 | |
|---|
| 562 | |
|---|
| 563 | STRUCT_ARRAY(last_try_catch, zend_try_catch_element, try_catch_array) |
|---|
| 564 | DISPATCH(int, last_try_catch) |
|---|
| 565 | |
|---|
| 566 | |
|---|
| 567 | STRUCT_P(HashTable, static_variables, HashTable_zval_ptr) |
|---|
| 568 | |
|---|
| 569 | IFCOPY(`dst->start_op = src->start_op;') |
|---|
| 570 | DONE(start_op) |
|---|
| 571 | DISPATCH(int, backpatch_count) |
|---|
| 572 | |
|---|
| 573 | DISPATCH(zend_bool, done_pass_two) |
|---|
| 574 | |
|---|
| 575 | DISPATCH(zend_bool, uses_this) |
|---|
| 576 | |
|---|
| 577 | |
|---|
| 578 | IFRESTORE(`COPY(filename)', `PROC_STRING(filename)') |
|---|
| 579 | |
|---|
| 580 | PROC_STRING(script_encoding) |
|---|
| 581 | |
|---|
| 582 | |
|---|
| 583 | DISPATCH(zend_uint, line_start) |
|---|
| 584 | DISPATCH(zend_uint, line_end) |
|---|
| 585 | DISPATCH(int, doc_comment_len) |
|---|
| 586 | PROC_USTRING_L(, doc_comment, doc_comment_len) |
|---|
| 587 | |
|---|
| 588 | |
|---|
| 589 | /* reserved */ |
|---|
| 590 | DONE(reserved) |
|---|
| 591 | |
|---|
| 592 | DISPATCH(zend_bool, created_by_eval) |
|---|
| 593 | |
|---|
| 594 | } while (0); |
|---|
| 595 | ') |
|---|
| 596 | |
|---|
| 597 | |
|---|
| 598 | DEF_STRUCT_P_FUNC(`xc_funcinfo_t', , ` |
|---|
| 599 | DISPATCH(zend_uint, key_size) |
|---|
| 600 | |
|---|
| 601 | DISPATCH(zend_uchar, type) |
|---|
| 602 | |
|---|
| 603 | IFRESTORE(`COPY(key)', ` |
|---|
| 604 | PROC_USTRING_N(type, key, key_size) |
|---|
| 605 | ') |
|---|
| 606 | STRUCT(zend_function, func) |
|---|
| 607 | ') |
|---|
| 608 | |
|---|
| 609 | DEF_STRUCT_P_FUNC(`xc_classinfo_t', , ` |
|---|
| 610 | DISPATCH(zend_uint, key_size) |
|---|
| 611 | |
|---|
| 612 | DISPATCH(zend_uchar, type) |
|---|
| 613 | |
|---|
| 614 | IFRESTORE(`COPY(key)', ` |
|---|
| 615 | PROC_USTRING_N(type, key, key_size) |
|---|
| 616 | ') |
|---|
| 617 | |
|---|
| 618 | STRUCT_P(zend_class_entry, cest) |
|---|
| 619 | |
|---|
| 620 | STRUCT(zend_class_entry, cest) |
|---|
| 621 | |
|---|
| 622 | ') |
|---|
| 623 | |
|---|
| 624 | DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , ` |
|---|
| 625 | zend_uint i; |
|---|
| 626 | |
|---|
| 627 | |
|---|
| 628 | DISPATCH(int, device) |
|---|
| 629 | DISPATCH(int, inode) |
|---|
| 630 | |
|---|
| 631 | DISPATCH(size_t, sourcesize) |
|---|
| 632 | |
|---|
| 633 | DISPATCH(time_t, mtime) |
|---|
| 634 | |
|---|
| 635 | STRUCT_P(zend_op_array, op_array) |
|---|
| 636 | |
|---|
| 637 | DISPATCH(zend_uint, funcinfo_cnt) |
|---|
| 638 | STRUCT_ARRAY(funcinfo_cnt, xc_funcinfo_t, funcinfos) |
|---|
| 639 | |
|---|
| 640 | DISPATCH(zend_uint, classinfo_cnt) |
|---|
| 641 | pushdef(`BEFORE_LOOP', ` |
|---|
| 642 | IFCOPY(` |
|---|
| 643 | processor->active_class_num = i + 1; |
|---|
| 644 | ') |
|---|
| 645 | ') |
|---|
| 646 | STRUCT_ARRAY(classinfo_cnt, xc_classinfo_t, classinfos) |
|---|
| 647 | popdef(`BEFORE_LOOP') |
|---|
| 648 | ') |
|---|
| 649 | |
|---|
| 650 | DEF_STRUCT_P_FUNC(`xc_entry_data_var_t', , ` |
|---|
| 651 | DISPATCH(time_t, etime) |
|---|
| 652 | IFSTORE(` |
|---|
| 653 | if (processor->reference) { |
|---|
| 654 | if (zend_hash_add(&processor->zvalptrs, (char *)&src->value, sizeof(&src->value), (void*)&src->value, sizeof(src->value), NULL) == SUCCESS) { |
|---|
| 655 | |
|---|
| 656 | } |
|---|
| 657 | else { |
|---|
| 658 | assert(0); |
|---|
| 659 | } |
|---|
| 660 | } |
|---|
| 661 | ') |
|---|
| 662 | STRUCT_P_EX(zval_ptr, dst->value, src->value, `value', `', `&') |
|---|
| 663 | DONE(value) |
|---|
| 664 | ') |
|---|
| 665 | |
|---|
| 666 | |
|---|
| 667 | DEF_STRUCT_P_FUNC(`xc_entry_t', , ` |
|---|
| 668 | IFCOPY(` |
|---|
| 669 | processor->xce_dst = dst; |
|---|
| 670 | processor->xce_src = src; |
|---|
| 671 | ') |
|---|
| 672 | DISPATCH(xc_entry_type_t, type) |
|---|
| 673 | DISPATCH(size_t, size) |
|---|
| 674 | |
|---|
| 675 | DISPATCH(xc_hash_value_t, hvalue) |
|---|
| 676 | COPY(cache) |
|---|
| 677 | /* skip */ |
|---|
| 678 | DONE(next) |
|---|
| 679 | |
|---|
| 680 | IFSTORE(`dst->refcount = 0; DONE(refcount)', `DISPATCH(long, refcount)') |
|---|
| 681 | |
|---|
| 682 | DISPATCH(time_t, ctime) |
|---|
| 683 | DISPATCH(time_t, atime) |
|---|
| 684 | DISPATCH(time_t, dtime) |
|---|
| 685 | DISPATCH(zend_ulong, hits) |
|---|
| 686 | |
|---|
| 687 | DISPATCH(zend_uchar, name_type) |
|---|
| 688 | |
|---|
| 689 | |
|---|
| 690 | DISABLECHECK(` |
|---|
| 691 | |
|---|
| 692 | if (src->name_type == IS_UNICODE) { |
|---|
| 693 | DISPATCH(int32_t, name.ustr.len) |
|---|
| 694 | } |
|---|
| 695 | else { |
|---|
| 696 | DISPATCH(int, name.str.len) |
|---|
| 697 | } |
|---|
| 698 | |
|---|
| 699 | DISPATCH(int, name.str.len) |
|---|
| 700 | |
|---|
| 701 | IFRESTORE(`COPY(name.str.val)', `PROC_USTRING_L(name_type, name.str.val, name.str.len)') |
|---|
| 702 | ') |
|---|
| 703 | DONE(name) |
|---|
| 704 | |
|---|
| 705 | |
|---|
| 706 | |
|---|
| 707 | DISABLECHECK(` |
|---|
| 708 | switch (src->type) { |
|---|
| 709 | case XC_TYPE_PHP: |
|---|
| 710 | STRUCT_P(xc_entry_data_php_t, data.php) |
|---|
| 711 | break; |
|---|
| 712 | case XC_TYPE_VAR: |
|---|
| 713 | STRUCT_P(xc_entry_data_var_t, data.var) |
|---|
| 714 | break; |
|---|
| 715 | default: |
|---|
| 716 | assert(0); |
|---|
| 717 | } |
|---|
| 718 | ') |
|---|
| 719 | DONE(data) |
|---|
| 720 | |
|---|
| 721 | ') |
|---|
| 722 | |
|---|
| 723 | |
|---|