php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
zend_inference.h File Reference
#include "zend_optimizer.h"
#include "zend_ssa.h"
#include "zend_bitset.h"
#include "zend_type_info.h"
#include <stdint.h>

Go to the source code of this file.

Macros

#define MAY_BE_PACKED_GUARD   (1<<27) /* needs packed array guard */
 
#define MAY_BE_CLASS_GUARD   (1<<27) /* needs class guard */
 
#define MAY_BE_GUARD   (1<<28) /* needs type guard */
 
#define MAY_HAVE_DTOR
 
#define DEFINE_SSA_OP_HAS_RANGE(opN)
 
#define DEFINE_SSA_OP_MIN_RANGE(opN)
 
#define DEFINE_SSA_OP_MAX_RANGE(opN)
 
#define DEFINE_SSA_OP_RANGE_UNDERFLOW(opN)
 
#define DEFINE_SSA_OP_RANGE_OVERFLOW(opN)
 
#define OP1_HAS_RANGE()
 
#define OP1_MIN_RANGE()
 
#define OP1_MAX_RANGE()
 
#define OP1_RANGE_UNDERFLOW()
 
#define OP1_RANGE_OVERFLOW()
 
#define OP2_HAS_RANGE()
 
#define OP2_MIN_RANGE()
 
#define OP2_MAX_RANGE()
 
#define OP2_RANGE_UNDERFLOW()
 
#define OP2_RANGE_OVERFLOW()
 
#define DEFINE_SSA_OP_INFO(opN)
 
#define DEFINE_SSA_OP_DEF_INFO(opN)
 
#define OP1_INFO()
 
#define OP2_INFO()
 
#define OP1_DATA_INFO()
 
#define OP2_DATA_INFO()
 
#define RES_USE_INFO()
 
#define OP1_DEF_INFO()
 
#define OP2_DEF_INFO()
 
#define OP1_DATA_DEF_INFO()
 
#define OP2_DATA_DEF_INFO()
 
#define RES_INFO()
 

Functions

ZEND_API uint32_t ZEND_FASTCALL zend_array_type_info (const zval *zv)
 
ZEND_API void zend_ssa_find_false_dependencies (const zend_op_array *op_array, zend_ssa *ssa)
 
ZEND_API void zend_ssa_find_sccs (const zend_op_array *op_array, zend_ssa *ssa)
 
ZEND_API zend_result zend_ssa_inference (zend_arena **raena, const zend_op_array *op_array, const zend_script *script, zend_ssa *ssa, zend_long optimization_level)
 
ZEND_API uint32_t zend_array_element_type (uint32_t t1, uint8_t op_type, int write, int insert)
 
ZEND_API bool zend_inference_propagate_range (const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op, int var, zend_ssa_range *tmp)
 
ZEND_API uint32_t zend_fetch_arg_info_type (const zend_script *script, const zend_arg_info *arg_info, zend_class_entry **pce)
 
ZEND_API void zend_init_func_return_info (const zend_op_array *op_array, const zend_script *script, zend_ssa_var_info *ret)
 
uint32_t zend_get_return_info_from_signature_only (const zend_function *func, const zend_script *script, zend_class_entry **ce, bool *ce_is_instanceof, bool use_tentative_return_info)
 
ZEND_API bool zend_may_throw_ex (const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, const zend_ssa *ssa, uint32_t t1, uint32_t t2)
 
ZEND_API bool zend_may_throw (const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, const zend_ssa *ssa)
 
ZEND_API zend_result zend_update_type_info (const zend_op_array *op_array, zend_ssa *ssa, const zend_script *script, zend_op *opline, zend_ssa_op *ssa_op, const zend_op **ssa_opcodes, zend_long optimization_level)
 

Macro Definition Documentation

◆ DEFINE_SSA_OP_DEF_INFO

#define DEFINE_SSA_OP_DEF_INFO ( opN)
Value:
static zend_always_inline uint32_t _ssa_##opN##_def_info(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op) \
{ \
return get_ssa_var_info(ssa, ssa->var_info ? ssa_op->opN##_def : -1); \
} \
struct _zend_op zend_op
struct _zend_op_array zend_op_array
#define zend_always_inline
struct _zend_ssa zend_ssa
struct _zend_ssa_op zend_ssa_op

Definition at line 184 of file zend_inference.h.

◆ DEFINE_SSA_OP_HAS_RANGE

#define DEFINE_SSA_OP_HAS_RANGE ( opN)
Value:
static zend_always_inline bool _ssa_##opN##_has_range(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op) \
{ \
if (opline->opN##_type == IS_CONST) { \
zval *zv = CRT_CONSTANT(opline->opN); \
return (Z_TYPE_P(zv) == IS_LONG); \
} else { \
return (opline->opN##_type != IS_UNUSED && \
ssa->var_info && \
ssa_op->opN##_use >= 0 && \
ssa->var_info[ssa_op->opN##_use].has_range); \
} \
return 0; \
} \
zval * zv
Definition ffi.c:3975
struct _zval_struct zval
#define CRT_CONSTANT(node)
Definition zend_cfg.h:110
#define IS_UNUSED
#define IS_CONST
#define Z_TYPE_P(zval_p)
Definition zend_types.h:660
#define IS_LONG
Definition zend_types.h:604

Definition at line 39 of file zend_inference.h.

◆ DEFINE_SSA_OP_INFO

#define DEFINE_SSA_OP_INFO ( opN)
Value:
static zend_always_inline uint32_t _ssa_##opN##_info(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op) \
{ \
if (opline->opN##_type == IS_CONST) { \
return _const_op_type(CRT_CONSTANT(opline->opN)); \
} else { \
return get_ssa_var_info(ssa, ssa->var_info ? ssa_op->opN##_use : -1); \
} \
} \

Definition at line 174 of file zend_inference.h.

◆ DEFINE_SSA_OP_MAX_RANGE

#define DEFINE_SSA_OP_MAX_RANGE ( opN)
Value:
static zend_always_inline zend_long _ssa_##opN##_max_range(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op) \
{ \
if (opline->opN##_type == IS_CONST) { \
zval *zv = CRT_CONSTANT(opline->opN); \
if (Z_TYPE_P(zv) == IS_LONG) { \
return Z_LVAL_P(zv); \
} \
} else if (opline->opN##_type != IS_UNUSED && \
ssa->var_info && \
ssa_op->opN##_use >= 0 && \
ssa->var_info[ssa_op->opN##_use].has_range) { \
return ssa->var_info[ssa_op->opN##_use].range.max; \
} \
return ZEND_LONG_MAX; \
} \
int32_t zend_long
Definition zend_long.h:42
#define ZEND_LONG_MAX
Definition zend_long.h:45
#define Z_LVAL_P(zval_p)
Definition zend_types.h:966

Definition at line 71 of file zend_inference.h.

◆ DEFINE_SSA_OP_MIN_RANGE

#define DEFINE_SSA_OP_MIN_RANGE ( opN)
Value:
static zend_always_inline zend_long _ssa_##opN##_min_range(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op) \
{ \
if (opline->opN##_type == IS_CONST) { \
zval *zv = CRT_CONSTANT(opline->opN); \
if (Z_TYPE_P(zv) == IS_LONG) { \
return Z_LVAL_P(zv); \
} \
} else if (opline->opN##_type != IS_UNUSED && \
ssa->var_info && \
ssa_op->opN##_use >= 0 && \
ssa->var_info[ssa_op->opN##_use].has_range) { \
return ssa->var_info[ssa_op->opN##_use].range.min; \
} \
return ZEND_LONG_MIN; \
} \
#define ZEND_LONG_MIN
Definition zend_long.h:46

Definition at line 54 of file zend_inference.h.

◆ DEFINE_SSA_OP_RANGE_OVERFLOW

#define DEFINE_SSA_OP_RANGE_OVERFLOW ( opN)
Value:
static zend_always_inline char _ssa_##opN##_range_overflow(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op) \
{ \
if (opline->opN##_type == IS_CONST) { \
zval *zv = CRT_CONSTANT(opline->opN); \
if (Z_TYPE_P(zv) == IS_LONG) { \
return 0; \
} \
} else if (opline->opN##_type != IS_UNUSED && \
ssa->var_info && \
ssa_op->opN##_use >= 0 && \
ssa->var_info[ssa_op->opN##_use].has_range) { \
return ssa->var_info[ssa_op->opN##_use].range.overflow; \
} \
return 1; \
} \

Definition at line 105 of file zend_inference.h.

◆ DEFINE_SSA_OP_RANGE_UNDERFLOW

#define DEFINE_SSA_OP_RANGE_UNDERFLOW ( opN)
Value:
static zend_always_inline char _ssa_##opN##_range_underflow(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op) \
{ \
if (opline->opN##_type == IS_CONST) { \
zval *zv = CRT_CONSTANT(opline->opN); \
if (Z_TYPE_P(zv) == IS_LONG) { \
return 0; \
} \
} else if (opline->opN##_type != IS_UNUSED && \
ssa->var_info && \
ssa_op->opN##_use >= 0 && \
ssa->var_info[ssa_op->opN##_use].has_range) { \
return ssa->var_info[ssa_op->opN##_use].range.underflow; \
} \
return 1; \
} \

Definition at line 88 of file zend_inference.h.

◆ MAY_BE_CLASS_GUARD

#define MAY_BE_CLASS_GUARD   (1<<27) /* needs class guard */

Definition at line 32 of file zend_inference.h.

◆ MAY_BE_GUARD

#define MAY_BE_GUARD   (1<<28) /* needs type guard */

Definition at line 33 of file zend_inference.h.

◆ MAY_BE_PACKED_GUARD

#define MAY_BE_PACKED_GUARD   (1<<27) /* needs packed array guard */

Definition at line 31 of file zend_inference.h.

◆ MAY_HAVE_DTOR

#define MAY_HAVE_DTOR
Value:
#define MAY_BE_ARRAY_OF_ARRAY
#define MAY_BE_ARRAY_OF_OBJECT
#define MAY_BE_ARRAY_OF_RESOURCE
#define MAY_BE_OBJECT
#define MAY_BE_RESOURCE

Definition at line 35 of file zend_inference.h.

◆ OP1_DATA_DEF_INFO

#define OP1_DATA_DEF_INFO ( )
Value:
(_ssa_op1_def_info(op_array, ssa, (opline+1), ssa_op ? (ssa_op+1) : NULL))
#define NULL
Definition gdcache.h:45

Definition at line 205 of file zend_inference.h.

◆ OP1_DATA_INFO

#define OP1_DATA_INFO ( )
Value:
(_ssa_op1_info(op_array, ssa, (opline+1), ssa_op ? (ssa_op+1) : NULL))

Definition at line 200 of file zend_inference.h.

◆ OP1_DEF_INFO

#define OP1_DEF_INFO ( )
Value:
(_ssa_op1_def_info(op_array, ssa, opline, ssa_op))

Definition at line 203 of file zend_inference.h.

◆ OP1_HAS_RANGE

#define OP1_HAS_RANGE ( )
Value:
(_ssa_op1_has_range (op_array, ssa, opline, ssa_op))

Definition at line 133 of file zend_inference.h.

◆ OP1_INFO

#define OP1_INFO ( )
Value:
(_ssa_op1_info(op_array, ssa, opline, ssa_op))

Definition at line 198 of file zend_inference.h.

◆ OP1_MAX_RANGE

#define OP1_MAX_RANGE ( )
Value:
(_ssa_op1_max_range (op_array, ssa, opline, ssa_op))

Definition at line 135 of file zend_inference.h.

◆ OP1_MIN_RANGE

#define OP1_MIN_RANGE ( )
Value:
(_ssa_op1_min_range (op_array, ssa, opline, ssa_op))

Definition at line 134 of file zend_inference.h.

◆ OP1_RANGE_OVERFLOW

#define OP1_RANGE_OVERFLOW ( )
Value:
(_ssa_op1_range_overflow (op_array, ssa, opline, ssa_op))

Definition at line 137 of file zend_inference.h.

◆ OP1_RANGE_UNDERFLOW

#define OP1_RANGE_UNDERFLOW ( )
Value:
(_ssa_op1_range_underflow (op_array, ssa, opline, ssa_op))

Definition at line 136 of file zend_inference.h.

◆ OP2_DATA_DEF_INFO

#define OP2_DATA_DEF_INFO ( )
Value:
(_ssa_op2_def_info(op_array, ssa, (opline+1), ssa_op ? (ssa_op+1) : NULL))

Definition at line 206 of file zend_inference.h.

◆ OP2_DATA_INFO

#define OP2_DATA_INFO ( )
Value:
(_ssa_op2_info(op_array, ssa, (opline+1), ssa_op ? (ssa_op+1) : NULL))

Definition at line 201 of file zend_inference.h.

◆ OP2_DEF_INFO

#define OP2_DEF_INFO ( )
Value:
(_ssa_op2_def_info(op_array, ssa, opline, ssa_op))

Definition at line 204 of file zend_inference.h.

◆ OP2_HAS_RANGE

#define OP2_HAS_RANGE ( )
Value:
(_ssa_op2_has_range (op_array, ssa, opline, ssa_op))

Definition at line 138 of file zend_inference.h.

◆ OP2_INFO

#define OP2_INFO ( )
Value:
(_ssa_op2_info(op_array, ssa, opline, ssa_op))

Definition at line 199 of file zend_inference.h.

◆ OP2_MAX_RANGE

#define OP2_MAX_RANGE ( )
Value:
(_ssa_op2_max_range (op_array, ssa, opline, ssa_op))

Definition at line 140 of file zend_inference.h.

◆ OP2_MIN_RANGE

#define OP2_MIN_RANGE ( )
Value:
(_ssa_op2_min_range (op_array, ssa, opline, ssa_op))

Definition at line 139 of file zend_inference.h.

◆ OP2_RANGE_OVERFLOW

#define OP2_RANGE_OVERFLOW ( )
Value:
(_ssa_op2_range_overflow (op_array, ssa, opline, ssa_op))

Definition at line 142 of file zend_inference.h.

◆ OP2_RANGE_UNDERFLOW

#define OP2_RANGE_UNDERFLOW ( )
Value:
(_ssa_op2_range_underflow (op_array, ssa, opline, ssa_op))

Definition at line 141 of file zend_inference.h.

◆ RES_INFO

#define RES_INFO ( )
Value:
(_ssa_result_def_info(op_array, ssa, opline, ssa_op))

Definition at line 207 of file zend_inference.h.

◆ RES_USE_INFO

#define RES_USE_INFO ( )
Value:
(_ssa_result_info(op_array, ssa, opline, ssa_op))

Definition at line 202 of file zend_inference.h.

Function Documentation

◆ zend_array_element_type()

ZEND_API uint32_t zend_array_element_type ( uint32_t t1,
uint8_t op_type,
int write,
int insert )

Definition at line 2128 of file zend_inference.c.

◆ zend_array_type_info()

ZEND_API uint32_t ZEND_FASTCALL zend_array_type_info ( const zval * zv)

Definition at line 2094 of file zend_inference.c.

◆ zend_fetch_arg_info_type()

ZEND_API uint32_t zend_fetch_arg_info_type ( const zend_script * script,
const zend_arg_info * arg_info,
zend_class_entry ** pce )

Definition at line 2401 of file zend_inference.c.

◆ zend_get_return_info_from_signature_only()

uint32_t zend_get_return_info_from_signature_only ( const zend_function * func,
const zend_script * script,
zend_class_entry ** ce,
bool * ce_is_instanceof,
bool use_tentative_return_info )

Definition at line 4511 of file zend_inference.c.

◆ zend_inference_propagate_range()

ZEND_API bool zend_inference_propagate_range ( const zend_op_array * op_array,
const zend_ssa * ssa,
const zend_op * opline,
const zend_ssa_op * ssa_op,
int var,
zend_ssa_range * tmp )

Definition at line 1252 of file zend_inference.c.

◆ zend_init_func_return_info()

ZEND_API void zend_init_func_return_info ( const zend_op_array * op_array,
const zend_script * script,
zend_ssa_var_info * ret )

Definition at line 4538 of file zend_inference.c.

◆ zend_may_throw()

ZEND_API bool zend_may_throw ( const zend_op * opline,
const zend_ssa_op * ssa_op,
const zend_op_array * op_array,
const zend_ssa * ssa )

Definition at line 5336 of file zend_inference.c.

◆ zend_may_throw_ex()

ZEND_API bool zend_may_throw_ex ( const zend_op * opline,
const zend_ssa_op * ssa_op,
const zend_op_array * op_array,
const zend_ssa * ssa,
uint32_t t1,
uint32_t t2 )

Definition at line 4921 of file zend_inference.c.

◆ zend_ssa_find_false_dependencies()

ZEND_API void zend_ssa_find_false_dependencies ( const zend_op_array * op_array,
zend_ssa * ssa )

Definition at line 490 of file zend_inference.c.

◆ zend_ssa_find_sccs()

ZEND_API void zend_ssa_find_sccs ( const zend_op_array * op_array,
zend_ssa * ssa )

Definition at line 443 of file zend_inference.c.

◆ zend_ssa_inference()

ZEND_API zend_result zend_ssa_inference ( zend_arena ** raena,
const zend_op_array * op_array,
const zend_script * script,
zend_ssa * ssa,
zend_long optimization_level )

Definition at line 4880 of file zend_inference.c.

◆ zend_update_type_info()

ZEND_API zend_result zend_update_type_info ( const zend_op_array * op_array,
zend_ssa * ssa,
const zend_script * script,
zend_op * opline,
zend_ssa_op * ssa_op,
const zend_op ** ssa_opcodes,
zend_long optimization_level )

Definition at line 4114 of file zend_inference.c.