zend_call_graph.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Zend Engine, Call Graph |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1998-2018 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Dmitry Stogov <dmitry@php.net> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef ZEND_CALL_GRAPH_H
  19. #define ZEND_CALL_GRAPH_H
  20. #include "zend_ssa.h"
  21. #include "zend_func_info.h"
  22. #include "zend_optimizer.h"
  23. typedef struct _zend_send_arg_info {
  24. zend_op *opline;
  25. } zend_send_arg_info;
  26. typedef struct _zend_recv_arg_info {
  27. int ssa_var;
  28. zend_ssa_var_info info;
  29. } zend_recv_arg_info;
  30. struct _zend_call_info {
  31. zend_op_array *caller_op_array;
  32. zend_op *caller_init_opline;
  33. zend_op *caller_call_opline;
  34. zend_function *callee_func;
  35. zend_call_info *next_caller;
  36. zend_call_info *next_callee;
  37. zend_func_info *clone;
  38. int recursive;
  39. int num_args;
  40. zend_send_arg_info arg_info[1];
  41. };
  42. struct _zend_func_info {
  43. int num;
  44. uint32_t flags;
  45. zend_ssa ssa; /* Static Single Assignmnt Form */
  46. zend_call_info *caller_info; /* where this function is called from */
  47. zend_call_info *callee_info; /* which functions are called from this one */
  48. zend_call_info **call_map; /* Call info associated with init/call/send opnum */
  49. int num_args; /* (-1 - unknown) */
  50. zend_recv_arg_info *arg_info;
  51. zend_ssa_var_info return_info;
  52. zend_func_info *clone;
  53. int clone_num;
  54. int return_value_used; /* -1 unknown, 0 no, 1 yes */
  55. void *codegen_data;
  56. };
  57. typedef struct _zend_call_graph {
  58. int op_arrays_count;
  59. zend_op_array **op_arrays;
  60. zend_func_info *func_infos;
  61. } zend_call_graph;
  62. BEGIN_EXTERN_C()
  63. int zend_build_call_graph(zend_arena **arena, zend_script *script, uint32_t build_flags, zend_call_graph *call_graph);
  64. zend_call_info **zend_build_call_map(zend_arena **arena, zend_func_info *info, zend_op_array *op_array);
  65. int zend_analyze_calls(zend_arena **arena, zend_script *script, uint32_t build_flags, zend_op_array *op_array, zend_func_info *func_info);
  66. END_EXTERN_C()
  67. #endif /* ZEND_CALL_GRAPH_H */
  68. /*
  69. * Local variables:
  70. * tab-width: 4
  71. * c-basic-offset: 4
  72. * indent-tabs-mode: t
  73. * End:
  74. */