Skip to content

Commit bfbe017

Browse files
committed
Zend/Optimizer/zend_func_info.h: remove forward declarations
These were added by commit c88ffa9, but @dstogov himself opposed to the concept of forward declarations, see php#10338 (comment) (which I don't agree with - in my opinion, forward declarations are a useful tool to reduce header dependencies). Removing these unnecessary forward declarations requires some fiddling with include directives, because they were inconsistent and fragile previously. (They still are, but this PR does not attempt to change this; it only makes problems caused by the forward declaration removal go away.) Please merge this PR if (and only if) my RFC "include cleanup" (https://wiki.php.net/rfc/include_cleanup) gets rejected, to fix the PHP code base according to the RFC decision.
1 parent 995ac31 commit bfbe017

22 files changed

+33
-19
lines changed

Zend/Optimizer/dfa_pass.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "zend_bitset.h"
2626
#include "zend_cfg.h"
2727
#include "zend_ssa.h"
28-
#include "zend_func_info.h"
2928
#include "zend_call_graph.h"
3029
#include "zend_inference.h"
3130
#include "zend_dump.h"

Zend/Optimizer/zend_call_graph.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020
#define ZEND_CALL_GRAPH_H
2121

2222
#include "zend_ssa.h"
23-
#include "zend_func_info.h"
2423
#include "zend_optimizer.h"
2524

2625
typedef struct _zend_send_arg_info {
2726
zend_op *opline;
2827
} zend_send_arg_info;
2928

29+
typedef struct _zend_call_info zend_call_info;
30+
3031
struct _zend_call_info {
3132
zend_op_array *caller_op_array;
3233
zend_op *caller_init_opline;
@@ -42,22 +43,24 @@ struct _zend_call_info {
4243
zend_send_arg_info arg_info[1];
4344
};
4445

45-
struct _zend_func_info {
46+
typedef struct _zend_func_info {
4647
int num;
4748
uint32_t flags;
4849
zend_ssa ssa; /* Static Single Assignment Form */
4950
zend_call_info *caller_info; /* where this function is called from */
5051
zend_call_info *callee_info; /* which functions are called from this one */
5152
zend_call_info **call_map; /* Call info associated with init/call/send opnum */
5253
zend_ssa_var_info return_info;
53-
};
54+
} zend_func_info;
5455

5556
typedef struct _zend_call_graph {
5657
int op_arrays_count;
5758
zend_op_array **op_arrays;
5859
zend_func_info *func_infos;
5960
} zend_call_graph;
6061

62+
#include "zend_func_info.h"
63+
6164
BEGIN_EXTERN_C()
6265

6366
ZEND_API void zend_build_call_graph(zend_arena **arena, zend_script *script, zend_call_graph *call_graph);

Zend/Optimizer/zend_cfg.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818

1919
#include "zend_compile.h"
2020
#include "zend_cfg.h"
21-
#include "zend_func_info.h"
21+
#include "zend_call_graph.h"
2222
#include "zend_worklist.h"
2323
#include "zend_optimizer.h"
2424
#include "zend_optimizer_internal.h"
2525
#include "zend_sort.h"
26+
#include "zend_arena.h"
27+
#include "zend_globals.h"
2628

2729
static void zend_mark_reachable(zend_op *opcodes, zend_cfg *cfg, zend_basic_block *b) /* {{{ */
2830
{

Zend/Optimizer/zend_cfg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#ifndef ZEND_CFG_H
2020
#define ZEND_CFG_H
2121

22+
#include "zend_arena.h"
23+
2224
/* zend_basic_block.flags */
2325
#define ZEND_BB_START (1<<0) /* first block */
2426
#define ZEND_BB_FOLLOW (1<<1) /* follows the next block */

Zend/Optimizer/zend_dump.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "zend_cfg.h"
2121
#include "zend_ssa.h"
2222
#include "zend_inference.h"
23-
#include "zend_func_info.h"
2423
#include "zend_call_graph.h"
2524
#include "zend_dump.h"
2625

Zend/Optimizer/zend_func_info.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@
4040
#define ZEND_FUNC_JIT_ON_HOT_COUNTERS (1<<15) /* used by JIT */
4141
#define ZEND_FUNC_JIT_ON_HOT_TRACE (1<<16) /* used by JIT */
4242

43-
44-
typedef struct _zend_func_info zend_func_info;
45-
typedef struct _zend_call_info zend_call_info;
46-
4743
#define ZEND_FUNC_INFO(op_array) \
4844
((zend_func_info*)((op_array)->reserved[zend_func_info_rid]))
4945

Zend/Optimizer/zend_inference.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
#include "zend_compile.h"
2020
#include "zend_generators.h"
2121
#include "zend_inference.h"
22-
#include "zend_func_info.h"
2322
#include "zend_call_graph.h"
2423
#include "zend_closures.h"
2524
#include "zend_worklist.h"
2625
#include "zend_optimizer_internal.h"
26+
#include "zend_globals.h"
2727

2828
/* The used range inference algorithm is described in:
2929
* V. Campos, R. Rodrigues, I. de Assis Costa and F. Pereira.

Zend/Optimizer/zend_optimizer_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#define ZEND_OPTIMIZER_INTERNAL_H
2424

2525
#include "zend_ssa.h"
26-
#include "zend_func_info.h"
26+
#include "zend_call_graph.h"
2727

2828
#define ZEND_OP1_LITERAL(opline) (op_array)->literals[(opline)->op1.constant]
2929
#define ZEND_OP1_JMP_ADDR(opline) OP_JMP_ADDR(opline, (opline)->op1)

Zend/zend_compile.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,6 @@ struct _zend_execute_data {
758758

759759
#define ZEND_EXTRA_VALUE 1
760760

761-
#include "zend_globals.h"
762-
763761
typedef enum _zend_compile_position {
764762
ZEND_COMPILE_POSITION_AT_SHEBANG = 0,
765763
ZEND_COMPILE_POSITION_AT_OPEN_TAG,

Zend/zend_execute.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include "zend_observer.h"
4444
#include "zend_system_id.h"
4545
#include "zend_call_stack.h"
46-
#include "Optimizer/zend_func_info.h"
46+
#include "Optimizer/zend_call_graph.h"
4747

4848
/* Virtual current working directory support */
4949
#include "zend_virtual_cwd.h"

0 commit comments

Comments
 (0)