Lines Matching refs:func

33 	zend_function     func;  member
45 zend_function *func = EX(func); in ZEND_METHOD() local
59 zend_string_release_ex(func->internal_function.function_name, 0); in ZEND_METHOD()
60 efree(func); in ZEND_METHOD()
68 execute_data->func = NULL; in ZEND_METHOD()
75 zend_function *func = &closure->func; in zend_valid_closure_binding() local
76 bool is_fake_closure = (func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE) != 0; in zend_valid_closure_binding()
78 if (func->common.fn_flags & ZEND_ACC_STATIC) { in zend_valid_closure_binding()
83 if (is_fake_closure && func->common.scope && in zend_valid_closure_binding()
84 !instanceof_function(Z_OBJCE_P(newthis), func->common.scope)) { in zend_valid_closure_binding()
87 ZSTR_VAL(func->common.scope->name), in zend_valid_closure_binding()
88 ZSTR_VAL(func->common.function_name), in zend_valid_closure_binding()
92 } else if (is_fake_closure && func->common.scope in zend_valid_closure_binding()
93 && !(func->common.fn_flags & ZEND_ACC_STATIC)) { in zend_valid_closure_binding()
97 && (func->common.fn_flags & ZEND_ACC_USES_THIS)) { in zend_valid_closure_binding()
102 if (scope && scope != func->common.scope && scope->type == ZEND_INTERNAL_CLASS) { in zend_valid_closure_binding()
109 if (is_fake_closure && scope != func->common.scope) { in zend_valid_closure_binding()
110 if (func->common.scope == NULL) { in zend_valid_closure_binding()
157 if (closure->func.common.fn_flags & ZEND_ACC_GENERATOR) { in ZEND_METHOD()
159 zend_create_closure(&new_closure, &closure->func, newclass, closure->called_scope, newthis); in ZEND_METHOD()
161 fci_cache.function_handler = &closure->func; in ZEND_METHOD()
177 my_function = &fake_closure->func; in ZEND_METHOD()
178 if (ZEND_USER_CODE(closure->func.type)) { in ZEND_METHOD()
179 memcpy(my_function, &closure->func, sizeof(zend_op_array)); in ZEND_METHOD()
181 memcpy(my_function, &closure->func, sizeof(zend_internal_function)); in ZEND_METHOD()
185 if (closure->func.type == ZEND_INTERNAL_FUNCTION) { in ZEND_METHOD()
192 && (closure->func.common.scope != newclass in ZEND_METHOD()
193 || (closure->func.common.fn_flags & ZEND_ACC_HEAP_RT_CACHE))) { in ZEND_METHOD()
230 ce = closure->func.common.scope; in do_closure_bind()
249 zend_create_closure(return_value, &closure->func, ce, called_scope, newthis); in do_closure_bind()
296 fcc.function_handler = (EX(func)->internal_function.fn_flags & ZEND_ACC_STATIC) ? in ZEND_NAMED_FUNCTION()
297 EX(func)->internal_function.scope->__callstatic : EX(func)->internal_function.scope->__call; in ZEND_NAMED_FUNCTION()
301 ZVAL_STR(&fci.params[0], EX(func)->common.function_name); in ZEND_NAMED_FUNCTION()
430 …if (!((lhs->func.common.fn_flags & ZEND_ACC_FAKE_CLOSURE) && (rhs->func.common.fn_flags & ZEND_ACC… in zend_closure_compare()
446 if (lhs->func.type != rhs->func.type) { in zend_closure_compare()
450 if (lhs->func.common.scope != rhs->func.common.scope) { in zend_closure_compare()
454 if (!zend_string_equals(lhs->func.common.function_name, rhs->func.common.function_name)) { in zend_closure_compare()
469 invoke->common = closure->func.common; in zend_get_closure_invoke_method()
477 ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER | (closure->func.common.fn_flags & keep_flags); in zend_get_closure_invoke_method()
478 …if (closure->func.type != ZEND_INTERNAL_FUNCTION || (closure->func.common.fn_flags & ZEND_ACC_USER… in zend_get_closure_invoke_method()
494 return &closure->func; in zend_get_closure_method_def()
521 if (closure->func.type == ZEND_USER_FUNCTION) { in zend_closure_free_storage()
523 if (!(closure->func.op_array.fn_flags & ZEND_ACC_FAKE_CLOSURE)) { in zend_closure_free_storage()
524 zend_destroy_static_vars(&closure->func.op_array); in zend_closure_free_storage()
525 closure->func.op_array.static_variables = NULL; in zend_closure_free_storage()
527 destroy_op_array(&closure->func.op_array); in zend_closure_free_storage()
528 } else if (closure->func.type == ZEND_INTERNAL_FUNCTION) { in zend_closure_free_storage()
529 zend_string_release(closure->func.common.function_name); in zend_closure_free_storage()
556 zend_create_closure(&result, &closure->func, in zend_closure_clone()
557 closure->func.common.scope, closure->called_scope, &closure->this_ptr); in zend_closure_clone()
566 *fptr_ptr = &closure->func; in zend_closure_get_closure()
584 struct _zend_arg_info *arg_info = closure->func.common.arg_info; in zend_closure_get_debug_info()
586 …bool zstr_args = (closure->func.type == ZEND_USER_FUNCTION) || (closure->func.common.fn_flags & ZE… in zend_closure_get_debug_info()
592 if (closure->func.op_array.fn_flags & ZEND_ACC_FAKE_CLOSURE) { in zend_closure_get_debug_info()
593 if (closure->func.common.scope) { in zend_closure_get_debug_info()
594 zend_string *class_name = closure->func.common.scope->name; in zend_closure_get_debug_info()
595 zend_string *func_name = closure->func.common.function_name; in zend_closure_get_debug_info()
603 ZVAL_STR_COPY(&val, closure->func.common.function_name); in zend_closure_get_debug_info()
607 ZVAL_STR_COPY(&val, closure->func.common.function_name); in zend_closure_get_debug_info()
610 ZVAL_STR_COPY(&val, closure->func.op_array.filename); in zend_closure_get_debug_info()
613 ZVAL_LONG(&val, closure->func.op_array.line_start); in zend_closure_get_debug_info()
617 if (closure->func.type == ZEND_USER_FUNCTION && closure->func.op_array.static_variables) { in zend_closure_get_debug_info()
620 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_get_debug_info()
648 (closure->func.common.num_args || in zend_closure_get_debug_info()
649 (closure->func.common.fn_flags & ZEND_ACC_VARIADIC))) { in zend_closure_get_debug_info()
650 uint32_t i, num_args, required = closure->func.common.required_num_args; in zend_closure_get_debug_info()
654 num_args = closure->func.common.num_args; in zend_closure_get_debug_info()
655 if (closure->func.common.fn_flags & ZEND_ACC_VARIADIC) { in zend_closure_get_debug_info()
690 return (closure->func.type == ZEND_USER_FUNCTION in zend_closure_get_gc()
691 && !(closure->func.op_array.fn_flags & ZEND_ACC_FAKE_CLOSURE)) ? in zend_closure_get_gc()
692 ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr) : NULL; in zend_closure_get_gc()
723 zend_closure *closure = (zend_closure*)ZEND_CLOSURE_OBJECT(EX(func)); in ZEND_NAMED_FUNCTION()
731 static void zend_create_closure_ex(zval *res, zend_function *func, zend_class_entry *scope, zend_cl… in zend_create_closure_ex() argument
746 if (func->type == ZEND_USER_FUNCTION) { in zend_create_closure_ex()
747 memcpy(&closure->func, func, sizeof(zend_op_array)); in zend_create_closure_ex()
748 closure->func.common.fn_flags |= ZEND_ACC_CLOSURE; in zend_create_closure_ex()
749 closure->func.common.fn_flags &= ~ZEND_ACC_IMMUTABLE; in zend_create_closure_ex()
751 zend_string_addref(closure->func.op_array.function_name); in zend_create_closure_ex()
752 if (closure->func.op_array.refcount) { in zend_create_closure_ex()
753 (*closure->func.op_array.refcount)++; in zend_create_closure_ex()
758 if (closure->func.op_array.static_variables) { in zend_create_closure_ex()
759 closure->func.op_array.static_variables = in zend_create_closure_ex()
760 zend_array_dup(closure->func.op_array.static_variables); in zend_create_closure_ex()
762 ZEND_MAP_PTR_INIT(closure->func.op_array.static_variables_ptr, in zend_create_closure_ex()
763 closure->func.op_array.static_variables); in zend_create_closure_ex()
764 } else if (func->op_array.static_variables) { in zend_create_closure_ex()
765 HashTable *ht = ZEND_MAP_PTR_GET(func->op_array.static_variables_ptr); in zend_create_closure_ex()
768 ht = zend_array_dup(func->op_array.static_variables); in zend_create_closure_ex()
769 ZEND_MAP_PTR_SET(func->op_array.static_variables_ptr, ht); in zend_create_closure_ex()
771 ZEND_MAP_PTR_INIT(closure->func.op_array.static_variables_ptr, ht); in zend_create_closure_ex()
775 ptr = ZEND_MAP_PTR_GET(func->op_array.run_time_cache); in zend_create_closure_ex()
777 || func->common.scope != scope in zend_create_closure_ex()
778 || (func->common.fn_flags & ZEND_ACC_HEAP_RT_CACHE) in zend_create_closure_ex()
781 && (func->common.fn_flags & ZEND_ACC_CLOSURE) in zend_create_closure_ex()
782 && (func->common.scope == scope || in zend_create_closure_ex()
783 !(func->common.fn_flags & ZEND_ACC_IMMUTABLE))) { in zend_create_closure_ex()
786 if (func->common.scope != scope) { in zend_create_closure_ex()
787 func->common.scope = scope; in zend_create_closure_ex()
789 ptr = zend_arena_alloc(&CG(arena), func->op_array.cache_size); in zend_create_closure_ex()
790 ZEND_MAP_PTR_SET(func->op_array.run_time_cache, ptr); in zend_create_closure_ex()
791 closure->func.op_array.fn_flags &= ~ZEND_ACC_HEAP_RT_CACHE; in zend_create_closure_ex()
794 ptr = emalloc(func->op_array.cache_size); in zend_create_closure_ex()
795 closure->func.op_array.fn_flags |= ZEND_ACC_HEAP_RT_CACHE; in zend_create_closure_ex()
797 memset(ptr, 0, func->op_array.cache_size); in zend_create_closure_ex()
799 ZEND_MAP_PTR_INIT(closure->func.op_array.run_time_cache, ptr); in zend_create_closure_ex()
801 memcpy(&closure->func, func, sizeof(zend_internal_function)); in zend_create_closure_ex()
802 closure->func.common.fn_flags |= ZEND_ACC_CLOSURE; in zend_create_closure_ex()
804 if (UNEXPECTED(closure->func.internal_function.handler == zend_closure_internal_handler)) { in zend_create_closure_ex()
806 zend_closure *nested = (zend_closure*)((char*)func - XtOffsetOf(zend_closure, func)); in zend_create_closure_ex()
810 closure->orig_internal_handler = closure->func.internal_function.handler; in zend_create_closure_ex()
812 closure->func.internal_function.handler = zend_closure_internal_handler; in zend_create_closure_ex()
813 zend_string_addref(closure->func.op_array.function_name); in zend_create_closure_ex()
814 if (!func->common.scope) { in zend_create_closure_ex()
824 closure->func.common.scope = scope; in zend_create_closure_ex()
827 closure->func.common.fn_flags |= ZEND_ACC_PUBLIC; in zend_create_closure_ex()
828 …if (this_ptr && Z_TYPE_P(this_ptr) == IS_OBJECT && (closure->func.common.fn_flags & ZEND_ACC_STATI… in zend_create_closure_ex()
835 ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_entry *scope, zend_cla… in zend_create_closure() argument
837 zend_create_closure_ex(res, func, scope, called_scope, this_ptr, in zend_create_closure()
838 /* is_fake */ (func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE) != 0); in zend_create_closure()
841 ZEND_API void zend_create_fake_closure(zval *res, zend_function *func, zend_class_entry *scope, zen… in zend_create_fake_closure() argument
845 zend_create_closure_ex(res, func, scope, called_scope, this_ptr, /* is_fake */ true); in zend_create_fake_closure()
848 closure->func.common.fn_flags |= ZEND_ACC_FAKE_CLOSURE; in zend_create_fake_closure()
858 zend_function *mptr = call->func; in zend_closure_from_frame()
903 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_bind_var()
911 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_bind_var_ex()