Lines Matching refs:closure

73 		zend_closure *closure, zval *newthis, zend_class_entry *scope) /* {{{ */  in zend_valid_closure_binding()  argument
75 zend_function *func = &closure->func; in zend_valid_closure_binding()
96 } else if (!is_fake_closure && !Z_ISUNDEF(closure->this_ptr) in zend_valid_closure_binding()
126 zend_closure *closure; in ZEND_METHOD() local
140 closure = (zend_closure *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
145 if (!zend_valid_closure_binding(closure, newthis, newclass)) { in ZEND_METHOD()
153 ZVAL_OBJ(&fci.function_name, &closure->std); in ZEND_METHOD()
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()
160 closure = (zend_closure *) Z_OBJ(new_closure); in ZEND_METHOD()
161 fci_cache.function_handler = &closure->func; in ZEND_METHOD()
166 GC_DELREF(&closure->std); 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()
186 my_function->internal_function.handler = closure->orig_internal_handler; 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()
224 zend_closure *closure = (zend_closure *) Z_OBJ_P(zclosure); in do_closure_bind() local
230 ce = closure->func.common.scope; in do_closure_bind()
239 if (!zend_valid_closure_binding(closure, newthis, ce)) { in do_closure_bind()
249 zend_create_closure(return_value, &closure->func, ce, called_scope, newthis); in do_closure_bind()
464 zend_closure *closure = (zend_closure *)object; in zend_get_closure_invoke_method() local
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()
493 zend_closure *closure = (zend_closure *) obj; in zend_get_closure_method_def() local
494 return &closure->func; in zend_get_closure_method_def()
500 zend_closure *closure = (zend_closure *)Z_OBJ_P(obj); in zend_get_closure_this_ptr() local
501 return &closure->this_ptr; in zend_get_closure_this_ptr()
517 zend_closure *closure = (zend_closure *)object; in zend_closure_free_storage() local
519 zend_object_std_dtor(&closure->std); in zend_closure_free_storage()
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()
532 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_free_storage()
533 zval_ptr_dtor(&closure->this_ptr); in zend_closure_free_storage()
540 zend_closure *closure; in zend_closure_new() local
542 closure = emalloc(sizeof(zend_closure)); in zend_closure_new()
543 memset(closure, 0, sizeof(zend_closure)); in zend_closure_new()
545 zend_object_std_init(&closure->std, class_type); in zend_closure_new()
547 return (zend_object*)closure; in zend_closure_new()
553 zend_closure *closure = (zend_closure *)zobject; in zend_closure_clone() local
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()
564 zend_closure *closure = (zend_closure*)obj; in zend_closure_get_closure() local
566 *fptr_ptr = &closure->func; in zend_closure_get_closure()
567 *ce_ptr = closure->called_scope; in zend_closure_get_closure()
569 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_get_closure()
570 *obj_ptr = Z_OBJ(closure->this_ptr); in zend_closure_get_closure()
582 zend_closure *closure = (zend_closure *)object; in zend_closure_get_debug_info() local
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()
642 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_get_debug_info()
643 Z_ADDREF(closure->this_ptr); in zend_closure_get_debug_info()
644 zend_hash_update(debug_info, ZSTR_KNOWN(ZEND_STR_THIS), &closure->this_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()
685 zend_closure *closure = (zend_closure *)obj; in zend_closure_get_gc() local
687 *table = Z_TYPE(closure->this_ptr) != IS_NULL ? &closure->this_ptr : NULL; in zend_closure_get_gc()
688 *n = Z_TYPE(closure->this_ptr) != IS_NULL ? 1 : 0; in zend_closure_get_gc()
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() local
724 closure->orig_internal_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); in ZEND_NAMED_FUNCTION()
727 Z_OBJ(EX(This)) = &closure->std; in ZEND_NAMED_FUNCTION()
733 zend_closure *closure; in zend_create_closure_ex() local
738 closure = (zend_closure *)Z_OBJ_P(res); 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()
771 ZEND_MAP_PTR_INIT(closure->func.op_array.static_variables_ptr, ht); in zend_create_closure_ex()
791 closure->func.op_array.fn_flags &= ~ZEND_ACC_HEAP_RT_CACHE; in zend_create_closure_ex()
795 closure->func.op_array.fn_flags |= ZEND_ACC_HEAP_RT_CACHE; 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()
808 closure->orig_internal_handler = nested->orig_internal_handler; 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()
821 ZVAL_UNDEF(&closure->this_ptr); in zend_create_closure_ex()
824 closure->func.common.scope = scope; in zend_create_closure_ex()
825 closure->called_scope = called_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()
829 ZVAL_OBJ_COPY(&closure->this_ptr, Z_OBJ_P(this_ptr)); in zend_create_closure_ex()
843 zend_closure *closure; in zend_create_fake_closure() local
847 closure = (zend_closure *)Z_OBJ_P(res); in zend_create_fake_closure()
848 closure->func.common.fn_flags |= ZEND_ACC_FAKE_CLOSURE; in zend_create_fake_closure()
902 zend_closure *closure = (zend_closure *) Z_OBJ_P(closure_zv); in zend_closure_bind_var() local
903 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_bind_var()
910 zend_closure *closure = (zend_closure *) Z_OBJ_P(closure_zv); in zend_closure_bind_var_ex() local
911 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_bind_var_ex()