Skip to content

Commit 6567de0

Browse files
Merge branch 'php:master' into master
2 parents 7a9c2b4 + 585ac79 commit 6567de0

File tree

167 files changed

+306
-579
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+306
-579
lines changed

Zend/Optimizer/block_pass.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,13 +631,13 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
631631
case ZEND_JMPNZ_EX:
632632
while (1) {
633633
if (opline->op1_type == IS_CONST) {
634-
if (zend_is_true(&ZEND_OP1_LITERAL(opline)) ==
635-
(opline->opcode == ZEND_JMPZ_EX)) {
634+
bool is_jmpz_ex = opline->opcode == ZEND_JMPZ_EX;
635+
if (zend_is_true(&ZEND_OP1_LITERAL(opline)) == is_jmpz_ex) {
636636

637637
++(*opt_count);
638638
opline->opcode = ZEND_QM_ASSIGN;
639639
zval_ptr_dtor_nogc(&ZEND_OP1_LITERAL(opline));
640-
ZVAL_BOOL(&ZEND_OP1_LITERAL(opline), opline->opcode == ZEND_JMPZ_EX);
640+
ZVAL_BOOL(&ZEND_OP1_LITERAL(opline), is_jmpz_ex);
641641
opline->op2.num = 0;
642642
block->successors_count = 1;
643643
block->successors[0] = block->successors[1];

Zend/Optimizer/dce.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "Optimizer/zend_ssa.h"
2323
#include "Optimizer/zend_func_info.h"
2424
#include "Optimizer/zend_call_graph.h"
25-
#include "zend_arena.h"
2625
#include "zend_bitset.h"
2726

2827
/* This pass implements a form of dead code elimination (DCE). The algorithm optimistically assumes

Zend/Optimizer/sccp.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@
1818
*/
1919

2020
#include "zend_API.h"
21-
#include "zend_arena.h"
22-
#include "zend_multiply.h" // for zend_safe_address_guarded()
2321
#include "zend_exceptions.h"
2422
#include "zend_ini.h"
25-
#include "zend_optimizer.h"
2623
#include "zend_type_info.h"
2724
#include "Optimizer/zend_optimizer_internal.h"
2825
#include "Optimizer/zend_call_graph.h"

Zend/Optimizer/scdf.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
+----------------------------------------------------------------------+
1717
*/
1818

19-
#include "Optimizer/scdf.h"
2019
#include "Optimizer/zend_optimizer_internal.h"
21-
#include "zend_arena.h"
20+
#include "Optimizer/scdf.h"
2221

2322
/* This defines a generic framework for sparse conditional dataflow propagation. The algorithm is
2423
* based on "Sparse conditional constant propagation" by Wegman and Zadeck. We're using a

Zend/Optimizer/scdf.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020
#define _SCDF_H
2121

2222
#include "zend_bitset.h"
23-
#include "zend_long.h"
24-
#include "zend_ssa.h"
25-
26-
typedef struct _zend_op_array zend_op_array;
27-
typedef struct _zend_optimizer_ctx zend_optimizer_ctx;
2823

2924
typedef struct _scdf_ctx {
3025
zend_op_array *op_array;

Zend/Optimizer/zend_call_graph.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@
1616
+----------------------------------------------------------------------+
1717
*/
1818

19+
#include "zend_compile.h"
20+
#include "zend_extensions.h"
21+
#include "Optimizer/zend_optimizer.h"
22+
#include "zend_optimizer_internal.h"
23+
#include "zend_inference.h"
1924
#include "zend_call_graph.h"
20-
#include "zend_arena.h"
21-
#include "zend_bitset.h"
2225
#include "zend_func_info.h"
23-
#include "zend_optimizer_internal.h"
26+
#include "zend_inference.h"
27+
#include "zend_call_graph.h"
2428

2529
static void zend_op_array_calc(zend_op_array *op_array, void *context)
2630
{

Zend/Optimizer/zend_call_graph.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
#define ZEND_CALL_GRAPH_H
2121

2222
#include "zend_ssa.h"
23-
24-
typedef struct _zend_func_info zend_func_info;
25-
typedef struct _zend_call_info zend_call_info;
23+
#include "zend_func_info.h"
24+
#include "zend_optimizer.h"
2625

2726
typedef struct _zend_send_arg_info {
2827
zend_op *opline;

Zend/Optimizer/zend_cfg.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
+----------------------------------------------------------------------+
1717
*/
1818

19+
#include "zend_compile.h"
1920
#include "zend_cfg.h"
20-
#include "zend_func_info.h" // for ZEND_FUNC_FREE_LOOP_VAR
21-
#include "zend_globals.h" // struct _zend_executor_globals
22-
#include "zend_globals_macros.h" // for EG()
23-
#include "zend_optimizer_internal.h"
21+
#include "zend_func_info.h"
2422
#include "zend_worklist.h"
23+
#include "zend_optimizer.h"
24+
#include "zend_optimizer_internal.h"
25+
#include "zend_sort.h"
2526

2627
static void zend_mark_reachable(zend_op *opcodes, zend_cfg *cfg, zend_basic_block *b) /* {{{ */
2728
{

Zend/Optimizer/zend_cfg.h

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

22-
#include "zend_portability.h" // for BEGIN_EXTERN_C
23-
24-
#include <stdint.h>
25-
26-
typedef struct _zend_arena zend_arena;
27-
typedef struct _zend_op_array zend_op_array;
28-
2922
/* zend_basic_block.flags */
3023
#define ZEND_BB_START (1<<0) /* first block */
3124
#define ZEND_BB_FOLLOW (1<<1) /* follows the next block */

Zend/Optimizer/zend_inference.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@
1616
+----------------------------------------------------------------------+
1717
*/
1818

19+
#include "zend_compile.h"
20+
#include "zend_generators.h"
1921
#include "zend_inference.h"
20-
#include "zend_closures.h" // for zend_ce_closure
21-
#include "zend_generators.h" // for zend_ce_generator
2222
#include "zend_func_info.h"
23-
#include "zend_globals.h" // struct _zend_executor_globals
24-
#include "zend_globals_macros.h" // for EG()
2523
#include "zend_call_graph.h"
24+
#include "zend_closures.h"
2625
#include "zend_worklist.h"
27-
#include "zend_optimizer.h"
2826
#include "zend_optimizer_internal.h"
2927

3028
/* The used range inference algorithm is described in:

Zend/Optimizer/zend_inference.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
#ifndef ZEND_INFERENCE_H
2020
#define ZEND_INFERENCE_H
2121

22-
#include "zend_cfg.h" // for CRT_CONSTANT()
23-
#include "zend_compile.h" // for struct _zend_op
24-
#include "zend_portability.h" // for BEGIN_EXTERN_C
22+
#include "zend_optimizer.h"
2523
#include "zend_ssa.h"
26-
#include "zend_type_info.h" // for MAY_BE_*
24+
#include "zend_bitset.h"
25+
26+
/* Bitmask for type inference (zend_ssa_var_info.type) */
27+
#include "zend_type_info.h"
2728

2829
#define MAY_BE_PACKED_GUARD (1<<27) /* needs packed array guard */
2930
#define MAY_BE_CLASS_GUARD (1<<27) /* needs class guard */

Zend/Optimizer/zend_optimizer.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@
2121

2222
#include "Optimizer/zend_optimizer.h"
2323
#include "Optimizer/zend_optimizer_internal.h"
24-
#include "php_globals.h" // for PG()
25-
#include "zend_API.h" // for ZVAL_EMPTY_STRING()
26-
#include "zend_arena.h"
27-
#include "zend_call_graph.h" // for struct _zend_func_info
28-
#include "zend_dump.h" // for zend_dump_op_array()
29-
#include "zend_inference.h" // for OP1_INFO(), ...
30-
#include "zend_ini.h"
31-
#include "zend_observer.h"
32-
#include "zend_virtual_cwd.h" //for IS_ABSOLUTE_PATH()
24+
#include "zend_API.h"
25+
#include "zend_constants.h"
26+
#include "zend_execute.h"
3327
#include "zend_vm.h"
28+
#include "zend_cfg.h"
29+
#include "zend_func_info.h"
30+
#include "zend_call_graph.h"
31+
#include "zend_inference.h"
32+
#include "zend_dump.h"
33+
#include "php.h"
34+
#include "zend_observer.h"
3435

3536
#ifndef ZEND_OPTIMIZER_MAX_REGISTERED_PASSES
3637
# define ZEND_OPTIMIZER_MAX_REGISTERED_PASSES 32

Zend/Optimizer/zend_optimizer.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,8 @@
2222
#ifndef ZEND_OPTIMIZER_H
2323
#define ZEND_OPTIMIZER_H
2424

25-
#include "zend_compile.h" // for zend_op_array
26-
#include "zend_hash.h"
27-
#include "zend_portability.h" // for BEGIN_EXTERN_C
28-
29-
typedef struct _zend_string zend_string;
25+
#include "zend.h"
26+
#include "zend_compile.h"
3027

3128
#define ZEND_OPTIMIZER_PASS_1 (1<<0) /* Simple local optimizations */
3229
#define ZEND_OPTIMIZER_PASS_2 (1<<1) /* */

Zend/Optimizer/zend_ssa.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717
+----------------------------------------------------------------------+
1818
*/
1919

20-
#include "zend_ssa.h"
21-
#include "zend_arena.h"
22-
#include "zend_optimizer_internal.h"
20+
#include "zend_compile.h"
2321
#include "zend_dfg.h"
22+
#include "zend_ssa.h"
2423
#include "zend_dump.h"
25-
#include "zend_inference.h" // for zend_sub_will_overflow()
26-
#include "zend_type_info.h" // for MAY_BE_REF
24+
#include "zend_inference.h"
25+
#include "Optimizer/zend_optimizer_internal.h"
2726

2827
static bool dominates(const zend_basic_block *blocks, int a, int b) {
2928
while (blocks[b].level > blocks[a].level) {

Zend/Optimizer/zend_ssa.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,8 @@
1919
#ifndef ZEND_SSA_H
2020
#define ZEND_SSA_H
2121

22+
#include "zend_optimizer.h"
2223
#include "zend_cfg.h"
23-
#include "zend_compile.h" // for struct _zend_op
24-
#include "zend_long.h"
25-
#include "zend_portability.h" // for BEGIN_EXTERN_C
26-
#include "zend_types.h" // for zend_result
27-
28-
typedef struct _zend_class_entry zend_class_entry;
29-
typedef struct _zend_script zend_script;
3024

3125
typedef struct _zend_ssa_range {
3226
zend_long min;

Zend/zend.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "zend_observer.h"
3737
#include "zend_fibers.h"
3838
#include "zend_call_stack.h"
39-
#include "zend_strtod.h"
4039
#include "Optimizer/zend_optimizer.h"
4140

4241
static size_t global_map_ptr_last = 0;

Zend/zend_API.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@
1919
+----------------------------------------------------------------------+
2020
*/
2121

22+
#include "zend.h"
23+
#include "zend_execute.h"
2224
#include "zend_API.h"
23-
#include "zend_arena.h"
24-
#include "zend_objects.h" // for zend_objects_new()
25+
#include "zend_modules.h"
2526
#include "zend_extensions.h"
2627
#include "zend_constants.h"
27-
#include "zend_interfaces.h" // for zend_ce_stringable
28+
#include "zend_interfaces.h"
2829
#include "zend_exceptions.h"
30+
#include "zend_closures.h"
2931
#include "zend_inheritance.h"
3032
#include "zend_ini.h"
3133
#include "zend_enum.h"
@@ -2712,7 +2714,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
27122714
internal_function->prototype = NULL;
27132715
internal_function->attributes = NULL;
27142716
if (EG(active)) { // at run-time: this ought to only happen if registered with dl() or somehow temporarily at runtime
2715-
ZEND_MAP_PTR_INIT(internal_function->run_time_cache, zend_arena_alloc(&CG(arena), zend_internal_run_time_cache_reserved_size()));
2717+
ZEND_MAP_PTR_INIT(internal_function->run_time_cache, zend_arena_calloc(&CG(arena), 1, zend_internal_run_time_cache_reserved_size()));
27162718
} else {
27172719
ZEND_MAP_PTR_NEW(internal_function->run_time_cache);
27182720
}

Zend/zend_API.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
#ifndef ZEND_API_H
2323
#define ZEND_API_H
2424

25-
#include "zend_compile.h" // for zif_handler
26-
#include "zend_execute.h" // for get_active_function_or_method_name()
27-
#include "zend_globals.h" // for struct _zend_compiler_globals used by ZEND_MAP_PTR_GET_IMM()
28-
#include "zend_globals_macros.h" // for CG() used by ZEND_MAP_PTR_GET_IMM()
29-
#include "zend_portability.h" // for BEGIN_EXTERN_C
25+
#include "zend_modules.h"
26+
#include "zend_list.h"
27+
#include "zend_operators.h"
28+
#include "zend_variables.h"
29+
#include "zend_execute.h"
30+
#include "zend_type_info.h"
3031

31-
typedef struct _zend_module_entry zend_module_entry;
3232

3333
BEGIN_EXTERN_C()
3434

Zend/zend_alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
* with more specialized routines when the requested size is known.
5252
*/
5353

54-
#include "zend_alloc.h"
5554
#include "zend.h"
55+
#include "zend_alloc.h"
5656
#include "zend_globals.h"
5757
#include "zend_operators.h"
5858
#include "zend_multiply.h"

Zend/zend_alloc.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
#ifndef ZEND_ALLOC_H
2222
#define ZEND_ALLOC_H
2323

24-
#include "zend_portability.h" // for BEGIN_EXTERN_C
25-
#include "zend_types.h" // for zend_result
24+
#include <stdio.h>
25+
26+
#include "../TSRM/TSRM.h"
27+
#include "zend.h"
2628

2729
#ifndef ZEND_MM_ALIGNMENT
2830
# error "ZEND_MM_ALIGNMENT was not defined during configure"

Zend/zend_arena.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
#ifndef _ZEND_ARENA_H_
2020
#define _ZEND_ARENA_H_
2121

22-
#include "zend_multiply.h" // for zend_safe_address()
23-
#include "zend.h" // for zend_error()
24-
25-
#include <stddef.h> // for size_t
22+
#include "zend.h"
2623

2724
#ifndef ZEND_TRACK_ARENA_ALLOC
2825

Zend/zend_ast.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
*/
1919

2020
#include "zend_ast.h"
21-
#include "zend_API.h" // for array_set_zval_key
22-
#include "zend_arena.h"
21+
#include "zend_API.h"
22+
#include "zend_operators.h"
23+
#include "zend_language_parser.h"
24+
#include "zend_smart_str.h"
25+
#include "zend_exceptions.h"
2326
#include "zend_constants.h"
2427
#include "zend_enum.h"
25-
#include "zend_language_parser.h" // for T_*
26-
#include "zend_smart_str.h"
27-
#include "zend_exceptions.h" // for zend_throw_error
2828

2929
ZEND_API zend_ast_process_t zend_ast_process = NULL;
3030

Zend/zend_ast.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
#ifndef ZEND_AST_H
2222
#define ZEND_AST_H
2323

24-
#include "zend_types.h" // for zval
25-
26-
#include <stdint.h>
24+
#include "zend.h"
2725

2826
#ifndef ZEND_AST_SPEC
2927
# define ZEND_AST_SPEC 1

Zend/zend_bitset.h

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

22-
#include "zend_portability.h" // for zend_always_inline
23-
24-
#include "zend_long.h"
25-
26-
#include <stdint.h>
27-
#include <string.h>
28-
2922
typedef zend_ulong *zend_bitset;
3023

3124
#define ZEND_BITSET_ELM_SIZE sizeof(zend_ulong)

Zend/zend_build.h

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

22-
#ifdef PHP_WIN32
23-
#include "config.w32.h"
24-
#else
25-
#include "php_config.h"
26-
#endif
27-
2822
#define ZEND_TOSTR_(x) #x
2923
#define ZEND_TOSTR(x) ZEND_TOSTR_(x)
3024

Zend/zend_call_stack.c

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

1919
/* Inspired from Chromium's stack_util.cc */
2020

21-
#include "zend_call_stack.h"
21+
#include "zend.h"
2222
#include "zend_globals.h"
23-
23+
#include "zend_portability.h"
24+
#include "zend_call_stack.h"
2425
#include <stdint.h>
25-
2626
#ifdef ZEND_WIN32
2727
# include <processthreadsapi.h>
2828
# include <memoryapi.h>

0 commit comments

Comments
 (0)