XCache is a fast, stable PHP opcode cacher that has been proven and is now running on production servers under high load. https://xcache.lighttpd.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1225 lines
30 KiB

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