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
136 closure = (zend_closure *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
141 if (!zend_valid_closure_binding(closure, newthis, newclass)) { in ZEND_METHOD()
145 if (closure->func.common.fn_flags & ZEND_ACC_GENERATOR) { in ZEND_METHOD()
147 zend_create_closure(&new_closure, &closure->func, newclass, closure->called_scope, newthis); in ZEND_METHOD()
148 closure = (zend_closure *) Z_OBJ(new_closure); in ZEND_METHOD()
149 fci_cache.function_handler = &closure->func; in ZEND_METHOD()
151 …memcpy(&my_function, &closure->func, closure->func.type == ZEND_USER_FUNCTION ? sizeof(zend_op_arr… in ZEND_METHOD()
155 if (closure->func.type == ZEND_INTERNAL_FUNCTION) { in ZEND_METHOD()
156 my_function.internal_function.handler = closure->orig_internal_handler; in ZEND_METHOD()
162 && (closure->func.common.scope != newclass in ZEND_METHOD()
163 || (closure->func.common.fn_flags & ZEND_ACC_HEAP_RT_CACHE))) { in ZEND_METHOD()
179 ZVAL_OBJ(&fci.function_name, &closure->std); in ZEND_METHOD()
191 GC_DELREF(&closure->std); in ZEND_METHOD()
202 zend_closure *closure = (zend_closure *) Z_OBJ_P(zclosure); in do_closure_bind() local
208 ce = closure->func.common.scope; in do_closure_bind()
217 if (!zend_valid_closure_binding(closure, newthis, ce)) { in do_closure_bind()
227 zend_create_closure(return_value, &closure->func, ce, called_scope, newthis); in do_closure_bind()
430 zend_closure *closure = (zend_closure *)object; in zend_get_closure_invoke_method() local
435 invoke->common = closure->func.common; in zend_get_closure_invoke_method()
443 ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER | (closure->func.common.fn_flags & keep_flags); in zend_get_closure_invoke_method()
444 …if (closure->func.type != ZEND_INTERNAL_FUNCTION || (closure->func.common.fn_flags & ZEND_ACC_USER… in zend_get_closure_invoke_method()
458 zend_closure *closure = (zend_closure *) obj; in zend_get_closure_method_def() local
459 return &closure->func; in zend_get_closure_method_def()
465 zend_closure *closure = (zend_closure *)Z_OBJ_P(obj); in zend_get_closure_this_ptr() local
466 return &closure->this_ptr; in zend_get_closure_this_ptr()
482 zend_closure *closure = (zend_closure *)object; in zend_closure_free_storage() local
484 zend_object_std_dtor(&closure->std); in zend_closure_free_storage()
486 if (closure->func.type == ZEND_USER_FUNCTION) { in zend_closure_free_storage()
488 if (!(closure->func.op_array.fn_flags & ZEND_ACC_FAKE_CLOSURE)) { in zend_closure_free_storage()
489 zend_destroy_static_vars(&closure->func.op_array); in zend_closure_free_storage()
491 destroy_op_array(&closure->func.op_array); in zend_closure_free_storage()
492 } else if (closure->func.type == ZEND_INTERNAL_FUNCTION) { in zend_closure_free_storage()
493 zend_string_release(closure->func.common.function_name); in zend_closure_free_storage()
496 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_free_storage()
497 zval_ptr_dtor(&closure->this_ptr); in zend_closure_free_storage()
504 zend_closure *closure; in zend_closure_new() local
506 closure = emalloc(sizeof(zend_closure)); in zend_closure_new()
507 memset(closure, 0, sizeof(zend_closure)); in zend_closure_new()
509 zend_object_std_init(&closure->std, class_type); in zend_closure_new()
510 closure->std.handlers = &closure_handlers; in zend_closure_new()
512 return (zend_object*)closure; in zend_closure_new()
518 zend_closure *closure = (zend_closure *)zobject; in zend_closure_clone() local
521 zend_create_closure(&result, &closure->func, in zend_closure_clone()
522 closure->func.common.scope, closure->called_scope, &closure->this_ptr); in zend_closure_clone()
529 zend_closure *closure = (zend_closure*)obj; in zend_closure_get_closure() local
531 *fptr_ptr = &closure->func; in zend_closure_get_closure()
532 *ce_ptr = closure->called_scope; in zend_closure_get_closure()
534 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_get_closure()
535 *obj_ptr = Z_OBJ(closure->this_ptr); in zend_closure_get_closure()
547 zend_closure *closure = (zend_closure *)object; in zend_closure_get_debug_info() local
549 struct _zend_arg_info *arg_info = closure->func.common.arg_info; in zend_closure_get_debug_info()
551 …bool zstr_args = (closure->func.type == ZEND_USER_FUNCTION) || (closure->func.common.fn_flags & ZE… in zend_closure_get_debug_info()
557 if (closure->func.type == ZEND_USER_FUNCTION && closure->func.op_array.static_variables) { in zend_closure_get_debug_info()
560 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_get_debug_info()
586 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_get_debug_info()
587 Z_ADDREF(closure->this_ptr); in zend_closure_get_debug_info()
588 zend_hash_update(debug_info, ZSTR_KNOWN(ZEND_STR_THIS), &closure->this_ptr); in zend_closure_get_debug_info()
592 (closure->func.common.num_args || in zend_closure_get_debug_info()
593 (closure->func.common.fn_flags & ZEND_ACC_VARIADIC))) { in zend_closure_get_debug_info()
594 uint32_t i, num_args, required = closure->func.common.required_num_args; in zend_closure_get_debug_info()
598 num_args = closure->func.common.num_args; in zend_closure_get_debug_info()
599 if (closure->func.common.fn_flags & ZEND_ACC_VARIADIC) { in zend_closure_get_debug_info()
629 zend_closure *closure = (zend_closure *)obj; in zend_closure_get_gc() local
631 *table = Z_TYPE(closure->this_ptr) != IS_NULL ? &closure->this_ptr : NULL; in zend_closure_get_gc()
632 *n = Z_TYPE(closure->this_ptr) != IS_NULL ? 1 : 0; in zend_closure_get_gc()
634 return (closure->func.type == ZEND_USER_FUNCTION in zend_closure_get_gc()
635 && !(closure->func.op_array.fn_flags & ZEND_ACC_FAKE_CLOSURE)) ? in zend_closure_get_gc()
636 ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr) : NULL; in zend_closure_get_gc()
666 zend_closure *closure = (zend_closure*)ZEND_CLOSURE_OBJECT(EX(func)); in ZEND_NAMED_FUNCTION() local
667 closure->orig_internal_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); in ZEND_NAMED_FUNCTION()
668 OBJ_RELEASE((zend_object*)closure); in ZEND_NAMED_FUNCTION()
675 zend_closure *closure; in zend_create_closure_ex() local
679 closure = (zend_closure *)Z_OBJ_P(res); in zend_create_closure_ex()
688 memcpy(&closure->func, func, sizeof(zend_op_array)); in zend_create_closure_ex()
689 closure->func.common.fn_flags |= ZEND_ACC_CLOSURE; in zend_create_closure_ex()
690 closure->func.common.fn_flags &= ~ZEND_ACC_IMMUTABLE; in zend_create_closure_ex()
692 zend_string_addref(closure->func.op_array.function_name); in zend_create_closure_ex()
693 if (closure->func.op_array.refcount) { in zend_create_closure_ex()
694 (*closure->func.op_array.refcount)++; in zend_create_closure_ex()
699 if (closure->func.op_array.static_variables) { in zend_create_closure_ex()
700 closure->func.op_array.static_variables = in zend_create_closure_ex()
701 zend_array_dup(closure->func.op_array.static_variables); in zend_create_closure_ex()
703 ZEND_MAP_PTR_INIT(closure->func.op_array.static_variables_ptr, in zend_create_closure_ex()
704 &closure->func.op_array.static_variables); in zend_create_closure_ex()
710 ZEND_MAP_PTR_SET(closure->func.op_array.static_variables_ptr, ht); in zend_create_closure_ex()
715 if (!ZEND_MAP_PTR_GET(closure->func.op_array.run_time_cache) in zend_create_closure_ex()
732 ZEND_MAP_PTR_SET(closure->func.op_array.run_time_cache, ptr); in zend_create_closure_ex()
733 closure->func.op_array.fn_flags &= ~ZEND_ACC_HEAP_RT_CACHE; in zend_create_closure_ex()
737 ZEND_MAP_PTR_INIT(closure->func.op_array.run_time_cache, ptr); in zend_create_closure_ex()
739 ZEND_MAP_PTR_SET(closure->func.op_array.run_time_cache, ptr); in zend_create_closure_ex()
740 closure->func.op_array.fn_flags |= ZEND_ACC_HEAP_RT_CACHE; in zend_create_closure_ex()
745 memcpy(&closure->func, func, sizeof(zend_internal_function)); in zend_create_closure_ex()
746 closure->func.common.fn_flags |= ZEND_ACC_CLOSURE; in zend_create_closure_ex()
748 if (UNEXPECTED(closure->func.internal_function.handler == zend_closure_internal_handler)) { in zend_create_closure_ex()
752 closure->orig_internal_handler = nested->orig_internal_handler; in zend_create_closure_ex()
754 closure->orig_internal_handler = closure->func.internal_function.handler; in zend_create_closure_ex()
756 closure->func.internal_function.handler = zend_closure_internal_handler; in zend_create_closure_ex()
757 zend_string_addref(closure->func.op_array.function_name); in zend_create_closure_ex()
765 ZVAL_UNDEF(&closure->this_ptr); in zend_create_closure_ex()
768 closure->func.common.scope = scope; in zend_create_closure_ex()
769 closure->called_scope = called_scope; in zend_create_closure_ex()
771 closure->func.common.fn_flags |= ZEND_ACC_PUBLIC; in zend_create_closure_ex()
772 …if (this_ptr && Z_TYPE_P(this_ptr) == IS_OBJECT && (closure->func.common.fn_flags & ZEND_ACC_STATI… in zend_create_closure_ex()
773 ZVAL_OBJ_COPY(&closure->this_ptr, Z_OBJ_P(this_ptr)); in zend_create_closure_ex()
787 zend_closure *closure; in zend_create_fake_closure() local
791 closure = (zend_closure *)Z_OBJ_P(res); in zend_create_fake_closure()
792 closure->func.common.fn_flags |= ZEND_ACC_FAKE_CLOSURE; in zend_create_fake_closure()
839 zend_closure *closure = (zend_closure *) Z_OBJ_P(closure_zv); in zend_closure_bind_var() local
840 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_bind_var()
847 zend_closure *closure = (zend_closure *) Z_OBJ_P(closure_zv); in zend_closure_bind_var_ex() local
848 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_bind_var_ex()