Download src/php/php-src/Zend/Optimizer/zend_inference.h from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 10.5 kB
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/Optimizer/zend_inference.h
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/Optimizer/zend_inference.h
-
curl -L -o zend_inference.h https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/Optimizer/zend_inference.h
10.5 kB
| /* | |
| +----------------------------------------------------------------------+ | |
| | Zend Engine, e-SSA based Type & Range Inference | | |
| +----------------------------------------------------------------------+ | |
| | Copyright (c) The PHP Group | | |
| +----------------------------------------------------------------------+ | |
| | This source file is subject to version 3.01 of the PHP license, | | |
| | that is bundled with this package in the file LICENSE, and is | | |
| | available through the world-wide-web at the following url: | | |
| | https://www.php.net/license/3_01.txt | | |
| | If you did not receive a copy of the PHP license and are unable to | | |
| | obtain it through the world-wide-web, please send a note to | | |
| | license@php.net so we can mail you a copy immediately. | | |
| +----------------------------------------------------------------------+ | |
| | Authors: Dmitry Stogov <dmitry@php.net> | | |
| +----------------------------------------------------------------------+ | |
| */ | |
| /* Bitmask for type inference (zend_ssa_var_info.type) */ | |
| DEFINE_SSA_OP_HAS_RANGE(op1) | |
| DEFINE_SSA_OP_MIN_RANGE(op1) | |
| DEFINE_SSA_OP_MAX_RANGE(op1) | |
| DEFINE_SSA_OP_RANGE_UNDERFLOW(op1) | |
| DEFINE_SSA_OP_RANGE_OVERFLOW(op1) | |
| DEFINE_SSA_OP_HAS_RANGE(op2) | |
| DEFINE_SSA_OP_MIN_RANGE(op2) | |
| DEFINE_SSA_OP_MAX_RANGE(op2) | |
| DEFINE_SSA_OP_RANGE_UNDERFLOW(op2) | |
| DEFINE_SSA_OP_RANGE_OVERFLOW(op2) | |
| BEGIN_EXTERN_C() | |
| ZEND_API uint32_t ZEND_FASTCALL zend_array_type_info(const zval *zv); | |
| END_EXTERN_C() | |
| static zend_always_inline uint32_t _const_op_type(const zval *zv) { | |
| if (Z_TYPE_P(zv) == IS_CONSTANT_AST) { | |
| return MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY; | |
| } else if (Z_TYPE_P(zv) == IS_ARRAY) { | |
| return zend_array_type_info(zv); | |
| } else { | |
| uint32_t tmp = (1 << Z_TYPE_P(zv)); | |
| if (Z_REFCOUNTED_P(zv)) { | |
| tmp |= MAY_BE_RC1 | MAY_BE_RCN; | |
| } else if (Z_TYPE_P(zv) == IS_STRING) { | |
| tmp |= MAY_BE_RCN; | |
| } | |
| return tmp; | |
| } | |
| } | |
| static zend_always_inline uint32_t get_ssa_var_info(const zend_ssa *ssa, int ssa_var_num) | |
| { | |
| if (ssa->var_info && ssa_var_num >= 0) { | |
| return ssa->var_info[ssa_var_num].type; | |
| } else { | |
| return MAY_BE_UNDEF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_INDIRECT | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; | |
| } | |
| } | |
| DEFINE_SSA_OP_INFO(op1) | |
| DEFINE_SSA_OP_INFO(op2) | |
| DEFINE_SSA_OP_INFO(result) | |
| DEFINE_SSA_OP_DEF_INFO(op1) | |
| DEFINE_SSA_OP_DEF_INFO(op2) | |
| DEFINE_SSA_OP_DEF_INFO(result) | |
| static zend_always_inline bool zend_add_will_overflow(zend_long a, zend_long b) { | |
| return (b > 0 && a > ZEND_LONG_MAX - b) | |
| || (b < 0 && a < ZEND_LONG_MIN - b); | |
| } | |
| static zend_always_inline bool zend_sub_will_overflow(zend_long a, zend_long b) { | |
| return (b > 0 && a < ZEND_LONG_MIN + b) | |
| || (b < 0 && a > ZEND_LONG_MAX + b); | |
| } | |
| BEGIN_EXTERN_C() | |
| 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); | |
| END_EXTERN_C() | |