Skip to content

#include cleanup part 3 #10279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
7fad42c
Zend/zend_build.h: include php_config.h
MaxKellermann Jan 10, 2023
16947f7
main/php_globals.h: add missing include for PHPAPI
MaxKellermann Jan 10, 2023
11da3c7
ext/standard/md5: include cleanup
MaxKellermann Jan 4, 2023
ac2e01b
Zend/zend_system_id: include cleanup
MaxKellermann Jan 4, 2023
fa36831
Zend/zend_arena: include cleanup
MaxKellermann Jan 4, 2023
a0ac083
Zend/zend_multiply: include cleanup
MaxKellermann Jan 5, 2023
c6caa27
Zend/zend_extensions: include cleanup
MaxKellermann Jan 4, 2023
fec929b
Zend/zend_float: include cleanup
MaxKellermann Jan 4, 2023
beb188f
Zend/zend_stream: include cleanup
MaxKellermann Jan 4, 2023
eb66a59
Zend/Optimizer/zend_cfg: include cleanup
MaxKellermann Jan 4, 2023
a976ed9
Zend/Optimizer/zend_optimizer: include cleanup
MaxKellermann Jan 4, 2023
f28311e
Zend/Optimizer/zend_ssa: include cleanup
MaxKellermann Jan 4, 2023
fb28534
Zend/zend_long: include cleanup
MaxKellermann Jan 4, 2023
4d3cb44
ext/opcache/zend_accelerator_hash: include cleanup
MaxKellermann Jan 5, 2023
de8db1b
Zend/zend_bitset: include cleanup
MaxKellermann Jan 4, 2023
18b168b
Zend/Optimizer/scdf: include cleanup
MaxKellermann Jan 4, 2023
299c244
Zend/Optimizer/dce: include cleanup
MaxKellermann Jan 4, 2023
0b89bed
Zend/Optimizer/sccp: include cleanup
MaxKellermann Jan 4, 2023
ebbda1f
Zend/Optimizer/zend_call_graph: include cleanup
MaxKellermann Jan 4, 2023
16ed908
Zend/zend_inference: include cleanup
MaxKellermann Jan 4, 2023
feefca4
Zend/zend_map_ptr: include cleanup
MaxKellermann Jan 4, 2023
e79e504
Zend/zend_types: include cleanup
MaxKellermann Jan 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Zend/Optimizer/dce.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "Optimizer/zend_ssa.h"
#include "Optimizer/zend_func_info.h"
#include "Optimizer/zend_call_graph.h"
#include "zend_arena.h"
#include "zend_bitset.h"

/* This pass implements a form of dead code elimination (DCE). The algorithm optimistically assumes
Expand Down
3 changes: 3 additions & 0 deletions Zend/Optimizer/sccp.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
*/

#include "zend_API.h"
#include "zend_arena.h"
#include "zend_multiply.h" // for zend_safe_address_guarded()
#include "zend_exceptions.h"
#include "zend_ini.h"
#include "zend_optimizer.h"
#include "zend_type_info.h"
#include "Optimizer/zend_optimizer_internal.h"
#include "Optimizer/zend_call_graph.h"
Expand Down
3 changes: 2 additions & 1 deletion Zend/Optimizer/scdf.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
+----------------------------------------------------------------------+
*/

#include "Optimizer/zend_optimizer_internal.h"
#include "Optimizer/scdf.h"
#include "Optimizer/zend_optimizer_internal.h"
#include "zend_arena.h"

/* This defines a generic framework for sparse conditional dataflow propagation. The algorithm is
* based on "Sparse conditional constant propagation" by Wegman and Zadeck. We're using a
Expand Down
5 changes: 5 additions & 0 deletions Zend/Optimizer/scdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
#define _SCDF_H

#include "zend_bitset.h"
#include "zend_long.h"
#include "zend_ssa.h"

typedef struct _zend_op_array zend_op_array;
typedef struct _zend_optimizer_ctx zend_optimizer_ctx;

typedef struct _scdf_ctx {
zend_op_array *op_array;
Expand Down
10 changes: 3 additions & 7 deletions Zend/Optimizer/zend_call_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@
+----------------------------------------------------------------------+
*/

#include "zend_compile.h"
#include "zend_extensions.h"
#include "Optimizer/zend_optimizer.h"
#include "zend_optimizer_internal.h"
#include "zend_inference.h"
#include "zend_call_graph.h"
#include "zend_arena.h"
#include "zend_bitset.h"
#include "zend_func_info.h"
#include "zend_inference.h"
#include "zend_call_graph.h"
#include "zend_optimizer_internal.h"

static void zend_op_array_calc(zend_op_array *op_array, void *context)
{
Expand Down
5 changes: 3 additions & 2 deletions Zend/Optimizer/zend_call_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
#define ZEND_CALL_GRAPH_H

#include "zend_ssa.h"
#include "zend_func_info.h"
#include "zend_optimizer.h"

typedef struct _zend_func_info zend_func_info;
typedef struct _zend_call_info zend_call_info;

typedef struct _zend_send_arg_info {
zend_op *opline;
Expand Down
9 changes: 4 additions & 5 deletions Zend/Optimizer/zend_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
+----------------------------------------------------------------------+
*/

#include "zend_compile.h"
#include "zend_cfg.h"
#include "zend_func_info.h"
#include "zend_worklist.h"
#include "zend_optimizer.h"
#include "zend_func_info.h" // for ZEND_FUNC_FREE_LOOP_VAR
#include "zend_globals.h" // struct _zend_executor_globals
#include "zend_globals_macros.h" // for EG()
#include "zend_optimizer_internal.h"
#include "zend_sort.h"
#include "zend_worklist.h"

static void zend_mark_reachable(zend_op *opcodes, zend_cfg *cfg, zend_basic_block *b) /* {{{ */
{
Expand Down
7 changes: 7 additions & 0 deletions Zend/Optimizer/zend_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
#ifndef ZEND_CFG_H
#define ZEND_CFG_H

#include "zend_portability.h" // for BEGIN_EXTERN_C

#include <stdint.h>

typedef struct _zend_arena zend_arena;
typedef struct _zend_op_array zend_op_array;

/* zend_basic_block.flags */
#define ZEND_BB_START (1<<0) /* first block */
#define ZEND_BB_FOLLOW (1<<1) /* follows the next block */
Expand Down
8 changes: 5 additions & 3 deletions Zend/Optimizer/zend_inference.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
+----------------------------------------------------------------------+
*/

#include "zend_compile.h"
#include "zend_generators.h"
#include "zend_inference.h"
#include "zend_closures.h" // for zend_ce_closure
#include "zend_generators.h" // for zend_ce_generator
#include "zend_func_info.h"
#include "zend_globals.h" // struct _zend_executor_globals
#include "zend_globals_macros.h" // for EG()
#include "zend_call_graph.h"
#include "zend_closures.h"
#include "zend_worklist.h"
#include "zend_optimizer.h"
#include "zend_optimizer_internal.h"

/* The used range inference algorithm is described in:
Expand Down
9 changes: 4 additions & 5 deletions Zend/Optimizer/zend_inference.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
#ifndef ZEND_INFERENCE_H
#define ZEND_INFERENCE_H

#include "zend_optimizer.h"
#include "zend_cfg.h" // for CRT_CONSTANT()
#include "zend_compile.h" // for struct _zend_op
#include "zend_portability.h" // for BEGIN_EXTERN_C
#include "zend_ssa.h"
#include "zend_bitset.h"

/* Bitmask for type inference (zend_ssa_var_info.type) */
#include "zend_type_info.h"
#include "zend_type_info.h" // for MAY_BE_*

#define MAY_BE_PACKED_GUARD (1<<27) /* needs packed array guard */
#define MAY_BE_CLASS_GUARD (1<<27) /* needs class guard */
Expand Down
19 changes: 9 additions & 10 deletions Zend/Optimizer/zend_optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@

#include "Optimizer/zend_optimizer.h"
#include "Optimizer/zend_optimizer_internal.h"
#include "zend_API.h"
#include "zend_constants.h"
#include "zend_execute.h"
#include "zend_vm.h"
#include "zend_cfg.h"
#include "zend_func_info.h"
#include "zend_call_graph.h"
#include "zend_inference.h"
#include "zend_dump.h"
#include "php.h"
#include "php_globals.h" // for PG()
#include "zend_API.h" // for ZVAL_EMPTY_STRING()
#include "zend_arena.h"
#include "zend_call_graph.h" // for struct _zend_func_info
#include "zend_dump.h" // for zend_dump_op_array()
#include "zend_inference.h" // for OP1_INFO(), ...
#include "zend_ini.h"
#include "zend_observer.h"
#include "zend_virtual_cwd.h" //for IS_ABSOLUTE_PATH()
#include "zend_vm.h"

#ifndef ZEND_OPTIMIZER_MAX_REGISTERED_PASSES
# define ZEND_OPTIMIZER_MAX_REGISTERED_PASSES 32
Expand Down
7 changes: 5 additions & 2 deletions Zend/Optimizer/zend_optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
#ifndef ZEND_OPTIMIZER_H
#define ZEND_OPTIMIZER_H

#include "zend.h"
#include "zend_compile.h"
#include "zend_compile.h" // for zend_op_array
#include "zend_hash.h"
#include "zend_portability.h" // for BEGIN_EXTERN_C

typedef struct _zend_string zend_string;

#define ZEND_OPTIMIZER_PASS_1 (1<<0) /* Simple local optimizations */
#define ZEND_OPTIMIZER_PASS_2 (1<<1) /* */
Expand Down
9 changes: 5 additions & 4 deletions Zend/Optimizer/zend_ssa.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
+----------------------------------------------------------------------+
*/

#include "zend_compile.h"
#include "zend_dfg.h"
#include "zend_ssa.h"
#include "zend_arena.h"
#include "zend_optimizer_internal.h"
#include "zend_dfg.h"
#include "zend_dump.h"
#include "zend_inference.h"
#include "Optimizer/zend_optimizer_internal.h"
#include "zend_inference.h" // for zend_sub_will_overflow()
#include "zend_type_info.h" // for MAY_BE_REF

static bool dominates(const zend_basic_block *blocks, int a, int b) {
while (blocks[b].level > blocks[a].level) {
Expand Down
8 changes: 7 additions & 1 deletion Zend/Optimizer/zend_ssa.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@
#ifndef ZEND_SSA_H
#define ZEND_SSA_H

#include "zend_optimizer.h"
#include "zend_cfg.h"
#include "zend_compile.h" // for struct _zend_op
#include "zend_long.h"
#include "zend_portability.h" // for BEGIN_EXTERN_C
#include "zend_types.h" // for zend_result

typedef struct _zend_class_entry zend_class_entry;
typedef struct _zend_script zend_script;

typedef struct _zend_ssa_range {
zend_long min;
Expand Down
5 changes: 4 additions & 1 deletion Zend/zend_arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
#ifndef _ZEND_ARENA_H_
#define _ZEND_ARENA_H_

#include "zend.h"
#include "zend_multiply.h" // for zend_safe_address()
#include "zend.h" // for zend_error()

#include <stddef.h> // for size_t

#ifndef ZEND_TRACK_ARENA_ALLOC

Expand Down
7 changes: 7 additions & 0 deletions Zend/zend_bitset.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
#ifndef _ZEND_BITSET_H_
#define _ZEND_BITSET_H_

#include "zend_portability.h" // for zend_always_inline

#include "zend_long.h"

#include <stdint.h>
#include <string.h>

typedef zend_ulong *zend_bitset;

#define ZEND_BITSET_ELM_SIZE sizeof(zend_ulong)
Expand Down
6 changes: 6 additions & 0 deletions Zend/zend_build.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
#ifndef ZEND_BUILD_H
#define ZEND_BUILD_H

#ifdef PHP_WIN32
#include "config.w32.h"
#else
#include "php_config.h"
#endif

#define ZEND_TOSTR_(x) #x
#define ZEND_TOSTR(x) ZEND_TOSTR_(x)

Expand Down
5 changes: 4 additions & 1 deletion Zend/zend_extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
*/

#include "zend_extensions.h"
#include "zend_system_id.h"
#include "zend_arena.h"
#include "zend_globals.h" // for struct _zend_compiler_globals
#include "zend_globals_macros.h" // for CG()
#include "zend_system_id.h" // for zend_add_system_entropy()

ZEND_API zend_llist zend_extensions;
ZEND_API uint32_t zend_extension_flags = 0;
Expand Down
11 changes: 9 additions & 2 deletions Zend/zend_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@
#ifndef ZEND_EXTENSIONS_H
#define ZEND_EXTENSIONS_H

#include "zend_compile.h"
#include "zend_build.h"
#include "zend_build.h" // for ZEND_TOSTR()
#include "zend_portability.h" // for BEGIN_EXTERN_C
#include "zend_types.h" // for zend_result

#include <stddef.h> // for size_t

typedef struct _zend_execute_data zend_execute_data;
typedef struct _zend_op_array zend_op_array;
typedef struct _zend_llist zend_llist;

/*
The constants below are derived from ext/opcache/ZendAccelerator.h
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_float.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
+----------------------------------------------------------------------+
*/

#include "zend.h"
#include "zend_compile.h"
#include "zend_float.h"
#include "zend_globals.h" // struct _zend_executor_globals
#include "zend_globals_macros.h" // for EG()

ZEND_API void zend_init_fpu(void) /* {{{ */
{
Expand Down
2 changes: 2 additions & 0 deletions Zend/zend_float.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#ifndef ZEND_FLOAT_H
#define ZEND_FLOAT_H

#include "zend_portability.h" // for BEGIN_EXTERN_C

BEGIN_EXTERN_C()

/*
Expand Down
6 changes: 6 additions & 0 deletions Zend/zend_long.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
#ifndef ZEND_LONG_H
#define ZEND_LONG_H

#ifdef PHP_WIN32
#include "config.w32.h"
#else
#include "php_config.h" // for SIZEOF_SIZE_T
#endif

#include <inttypes.h>
#include <stdint.h>

Expand Down
4 changes: 3 additions & 1 deletion Zend/zend_map_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef ZEND_MAP_PTR_H
#define ZEND_MAP_PTR_H

#include "zend_portability.h"
#include "zend_portability.h" // for BEGIN_EXTERN_C

#define ZEND_MAP_PTR_KIND_PTR 0
#define ZEND_MAP_PTR_KIND_PTR_OR_OFFSET 1
Expand Down Expand Up @@ -69,6 +69,8 @@
# error "Unknown ZEND_MAP_PTR_KIND"
#endif

typedef struct _zend_string zend_string;

BEGIN_EXTERN_C()

ZEND_API void zend_map_ptr_reset(void);
Expand Down
5 changes: 3 additions & 2 deletions Zend/zend_multiply.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
+----------------------------------------------------------------------+
*/

#include "zend_portability.h"

#ifndef ZEND_MULTIPLY_H
#define ZEND_MULTIPLY_H

#include "zend_portability.h"
#include "zend.h" // for zend_error_noreturn()

#if PHP_HAVE_BUILTIN_SMULL_OVERFLOW && SIZEOF_LONG == SIZEOF_ZEND_LONG

#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
Expand Down
6 changes: 4 additions & 2 deletions Zend/zend_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
+----------------------------------------------------------------------+
*/

#include "zend.h"
#include "zend_compile.h"
#include "zend_stream.h"
#include "zend_globals.h" // struct _zend_compiler_globals
#include "zend_globals_macros.h" // for CG()
#include "zend_string.h"
#include "zend.h" // for zend_stream_open_function

ZEND_DLIMPORT int isatty(int fd);

Expand Down
9 changes: 8 additions & 1 deletion Zend/zend_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@
#ifndef ZEND_STREAM_H
#define ZEND_STREAM_H

#include <sys/types.h>
#include "zend_portability.h" // for BEGIN_EXTERN_C
#include "zend_types.h" // for zend_uchar

#include <stdbool.h>
#include <stdio.h> // for FILE
#include <sys/types.h> // for ssize_t
#include <sys/stat.h>

typedef struct _zend_string zend_string;

/* Lightweight stream implementation for the ZE scanners.
* These functions are private to the engine.
* */
Expand Down
5 changes: 2 additions & 3 deletions Zend/zend_system_id.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
+----------------------------------------------------------------------+
*/

#include "php.h"
#include "zend_system_id.h"
#include "zend_extensions.h"
#include "zend_extensions.h" // for ZEND_EXTENSION_BUILD_ID
#include "ext/standard/md5.h"
#include "ext/hash/php_hash.h"
#include "ext/hash/php_hash.h" // for php_hash_bin2hex()

ZEND_API char zend_system_id[32];

Expand Down
Loading