Lines Matching refs:closure

68 		zend_closure *closure, zval *newthis, zend_class_entry *scope) /* {{{ */  in zend_valid_closure_binding()  argument
70 zend_function *func = &closure->func; in zend_valid_closure_binding()
91 } else if (!is_fake_closure && !Z_ISUNDEF(closure->this_ptr) in zend_valid_closure_binding()
121 zend_closure *closure; in ZEND_METHOD() local
135 closure = (zend_closure *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
140 if (!zend_valid_closure_binding(closure, newthis, newclass)) { in ZEND_METHOD()
148 ZVAL_OBJ(&fci.function_name, &closure->std); in ZEND_METHOD()
152 if (closure->func.common.fn_flags & ZEND_ACC_GENERATOR) { in ZEND_METHOD()
154 zend_create_closure(&new_closure, &closure->func, newclass, closure->called_scope, newthis); in ZEND_METHOD()
155 closure = (zend_closure *) Z_OBJ(new_closure); in ZEND_METHOD()
156 fci_cache.function_handler = &closure->func; in ZEND_METHOD()
161 GC_DELREF(&closure->std); in ZEND_METHOD()
173 if (ZEND_USER_CODE(closure->func.type)) { in ZEND_METHOD()
174 memcpy(my_function, &closure->func, sizeof(zend_op_array)); in ZEND_METHOD()
176 memcpy(my_function, &closure->func, sizeof(zend_internal_function)); in ZEND_METHOD()
180 if (closure->func.type == ZEND_INTERNAL_FUNCTION) { in ZEND_METHOD()
181 my_function->internal_function.handler = closure->orig_internal_handler; in ZEND_METHOD()
187 && (closure->func.common.scope != newclass in ZEND_METHOD()
188 || (closure->func.common.fn_flags & ZEND_ACC_HEAP_RT_CACHE))) { in ZEND_METHOD()
219 zend_closure *closure = (zend_closure *) Z_OBJ_P(zclosure); in do_closure_bind() local
225 ce = closure->func.common.scope; in do_closure_bind()
234 if (!zend_valid_closure_binding(closure, newthis, ce)) { in do_closure_bind()
244 zend_create_closure(return_value, &closure->func, ce, called_scope, newthis); in do_closure_bind()
447 zend_closure *closure = (zend_closure *)object; in zend_get_closure_invoke_method() local
452 invoke->common = closure->func.common; in zend_get_closure_invoke_method()
460 ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER | (closure->func.common.fn_flags & keep_flags); in zend_get_closure_invoke_method()
461 …if (closure->func.type != ZEND_INTERNAL_FUNCTION || (closure->func.common.fn_flags & ZEND_ACC_USER… in zend_get_closure_invoke_method()
475 zend_closure *closure = (zend_closure *) obj; in zend_get_closure_method_def() local
476 return &closure->func; in zend_get_closure_method_def()
482 zend_closure *closure = (zend_closure *)Z_OBJ_P(obj); in zend_get_closure_this_ptr() local
483 return &closure->this_ptr; in zend_get_closure_this_ptr()
499 zend_closure *closure = (zend_closure *)object; in zend_closure_free_storage() local
501 zend_object_std_dtor(&closure->std); in zend_closure_free_storage()
503 if (closure->func.type == ZEND_USER_FUNCTION) { in zend_closure_free_storage()
505 if (!(closure->func.op_array.fn_flags & ZEND_ACC_FAKE_CLOSURE)) { in zend_closure_free_storage()
506 zend_destroy_static_vars(&closure->func.op_array); in zend_closure_free_storage()
507 closure->func.op_array.static_variables = NULL; in zend_closure_free_storage()
509 destroy_op_array(&closure->func.op_array); in zend_closure_free_storage()
510 } else if (closure->func.type == ZEND_INTERNAL_FUNCTION) { in zend_closure_free_storage()
511 zend_string_release(closure->func.common.function_name); in zend_closure_free_storage()
514 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_free_storage()
515 zval_ptr_dtor(&closure->this_ptr); in zend_closure_free_storage()
522 zend_closure *closure; in zend_closure_new() local
524 closure = emalloc(sizeof(zend_closure)); in zend_closure_new()
525 memset(closure, 0, sizeof(zend_closure)); in zend_closure_new()
527 zend_object_std_init(&closure->std, class_type); in zend_closure_new()
528 closure->std.handlers = &closure_handlers; in zend_closure_new()
530 return (zend_object*)closure; in zend_closure_new()
536 zend_closure *closure = (zend_closure *)zobject; in zend_closure_clone() local
539 zend_create_closure(&result, &closure->func, in zend_closure_clone()
540 closure->func.common.scope, closure->called_scope, &closure->this_ptr); in zend_closure_clone()
547 zend_closure *closure = (zend_closure*)obj; in zend_closure_get_closure() local
549 *fptr_ptr = &closure->func; in zend_closure_get_closure()
550 *ce_ptr = closure->called_scope; in zend_closure_get_closure()
552 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_get_closure()
553 *obj_ptr = Z_OBJ(closure->this_ptr); in zend_closure_get_closure()
565 zend_closure *closure = (zend_closure *)object; in zend_closure_get_debug_info() local
567 struct _zend_arg_info *arg_info = closure->func.common.arg_info; in zend_closure_get_debug_info()
569 …bool zstr_args = (closure->func.type == ZEND_USER_FUNCTION) || (closure->func.common.fn_flags & ZE… in zend_closure_get_debug_info()
575 if (closure->func.op_array.fn_flags & ZEND_ACC_FAKE_CLOSURE) { in zend_closure_get_debug_info()
576 if (closure->func.common.scope) { in zend_closure_get_debug_info()
577 zend_string *class_name = closure->func.common.scope->name; in zend_closure_get_debug_info()
578 zend_string *func_name = closure->func.common.function_name; in zend_closure_get_debug_info()
586 ZVAL_STR_COPY(&val, closure->func.common.function_name); in zend_closure_get_debug_info()
591 if (closure->func.type == ZEND_USER_FUNCTION && closure->func.op_array.static_variables) { in zend_closure_get_debug_info()
594 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_get_debug_info()
620 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_get_debug_info()
621 Z_ADDREF(closure->this_ptr); in zend_closure_get_debug_info()
622 zend_hash_update(debug_info, ZSTR_KNOWN(ZEND_STR_THIS), &closure->this_ptr); in zend_closure_get_debug_info()
626 (closure->func.common.num_args || in zend_closure_get_debug_info()
627 (closure->func.common.fn_flags & ZEND_ACC_VARIADIC))) { in zend_closure_get_debug_info()
628 uint32_t i, num_args, required = closure->func.common.required_num_args; in zend_closure_get_debug_info()
632 num_args = closure->func.common.num_args; in zend_closure_get_debug_info()
633 if (closure->func.common.fn_flags & ZEND_ACC_VARIADIC) { in zend_closure_get_debug_info()
663 zend_closure *closure = (zend_closure *)obj; in zend_closure_get_gc() local
665 *table = Z_TYPE(closure->this_ptr) != IS_NULL ? &closure->this_ptr : NULL; in zend_closure_get_gc()
666 *n = Z_TYPE(closure->this_ptr) != IS_NULL ? 1 : 0; in zend_closure_get_gc()
668 return (closure->func.type == ZEND_USER_FUNCTION in zend_closure_get_gc()
669 && !(closure->func.op_array.fn_flags & ZEND_ACC_FAKE_CLOSURE)) ? in zend_closure_get_gc()
670 ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr) : NULL; in zend_closure_get_gc()
700 zend_closure *closure = (zend_closure*)ZEND_CLOSURE_OBJECT(EX(func)); in ZEND_NAMED_FUNCTION() local
701 closure->orig_internal_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); in ZEND_NAMED_FUNCTION()
704 Z_OBJ(EX(This)) = &closure->std; in ZEND_NAMED_FUNCTION()
710 zend_closure *closure; in zend_create_closure_ex() local
715 closure = (zend_closure *)Z_OBJ_P(res); in zend_create_closure_ex()
724 memcpy(&closure->func, func, sizeof(zend_op_array)); in zend_create_closure_ex()
725 closure->func.common.fn_flags |= ZEND_ACC_CLOSURE; in zend_create_closure_ex()
726 closure->func.common.fn_flags &= ~ZEND_ACC_IMMUTABLE; in zend_create_closure_ex()
728 zend_string_addref(closure->func.op_array.function_name); in zend_create_closure_ex()
729 if (closure->func.op_array.refcount) { in zend_create_closure_ex()
730 (*closure->func.op_array.refcount)++; in zend_create_closure_ex()
735 if (closure->func.op_array.static_variables) { in zend_create_closure_ex()
736 closure->func.op_array.static_variables = in zend_create_closure_ex()
737 zend_array_dup(closure->func.op_array.static_variables); in zend_create_closure_ex()
739 ZEND_MAP_PTR_INIT(closure->func.op_array.static_variables_ptr, in zend_create_closure_ex()
740 closure->func.op_array.static_variables); in zend_create_closure_ex()
748 ZEND_MAP_PTR_INIT(closure->func.op_array.static_variables_ptr, ht); in zend_create_closure_ex()
768 closure->func.op_array.fn_flags &= ~ZEND_ACC_HEAP_RT_CACHE; in zend_create_closure_ex()
772 closure->func.op_array.fn_flags |= ZEND_ACC_HEAP_RT_CACHE; in zend_create_closure_ex()
776 ZEND_MAP_PTR_INIT(closure->func.op_array.run_time_cache, ptr); in zend_create_closure_ex()
778 memcpy(&closure->func, func, sizeof(zend_internal_function)); in zend_create_closure_ex()
779 closure->func.common.fn_flags |= ZEND_ACC_CLOSURE; in zend_create_closure_ex()
781 if (UNEXPECTED(closure->func.internal_function.handler == zend_closure_internal_handler)) { in zend_create_closure_ex()
785 closure->orig_internal_handler = nested->orig_internal_handler; in zend_create_closure_ex()
787 closure->orig_internal_handler = closure->func.internal_function.handler; in zend_create_closure_ex()
789 closure->func.internal_function.handler = zend_closure_internal_handler; in zend_create_closure_ex()
790 zend_string_addref(closure->func.op_array.function_name); in zend_create_closure_ex()
798 ZVAL_UNDEF(&closure->this_ptr); in zend_create_closure_ex()
801 closure->func.common.scope = scope; in zend_create_closure_ex()
802 closure->called_scope = called_scope; in zend_create_closure_ex()
804 closure->func.common.fn_flags |= ZEND_ACC_PUBLIC; in zend_create_closure_ex()
805 …if (this_ptr && Z_TYPE_P(this_ptr) == IS_OBJECT && (closure->func.common.fn_flags & ZEND_ACC_STATI… in zend_create_closure_ex()
806 ZVAL_OBJ_COPY(&closure->this_ptr, Z_OBJ_P(this_ptr)); in zend_create_closure_ex()
820 zend_closure *closure; in zend_create_fake_closure() local
824 closure = (zend_closure *)Z_OBJ_P(res); in zend_create_fake_closure()
825 closure->func.common.fn_flags |= ZEND_ACC_FAKE_CLOSURE; in zend_create_fake_closure()
872 zend_closure *closure = (zend_closure *) Z_OBJ_P(closure_zv); in zend_closure_bind_var() local
873 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_bind_var()
880 zend_closure *closure = (zend_closure *) Z_OBJ_P(closure_zv); in zend_closure_bind_var_ex() local
881 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_bind_var_ex()