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()
144 if (!zend_valid_closure_binding(closure, newthis, Z_OBJCE_P(newthis))) { in ZEND_METHOD()
148 if (closure->func.common.fn_flags & ZEND_ACC_GENERATOR) { in ZEND_METHOD()
150 …zend_create_closure(&new_closure, &closure->func, Z_OBJCE_P(newthis), closure->called_scope, newth… in ZEND_METHOD()
151 closure = (zend_closure *) Z_OBJ(new_closure); in ZEND_METHOD()
152 fci_cache.function_handler = &closure->func; in ZEND_METHOD()
154 …memcpy(&my_function, &closure->func, closure->func.type == ZEND_USER_FUNCTION ? sizeof(zend_op_arr… in ZEND_METHOD()
158 if (closure->func.type == ZEND_INTERNAL_FUNCTION) { in ZEND_METHOD()
159 my_function.internal_function.handler = closure->orig_internal_handler; in ZEND_METHOD()
165 && (closure->func.common.scope != Z_OBJCE_P(newthis) in ZEND_METHOD()
166 || (closure->func.common.fn_flags & ZEND_ACC_HEAP_RT_CACHE))) { in ZEND_METHOD()
182 ZVAL_OBJ(&fci.function_name, &closure->std); in ZEND_METHOD()
194 GC_DELREF(&closure->std); in ZEND_METHOD()
205 zend_closure *closure = (zend_closure *) Z_OBJ_P(zclosure); in do_closure_bind() local
211 ce = closure->func.common.scope; in do_closure_bind()
220 if (!zend_valid_closure_binding(closure, newthis, ce)) { in do_closure_bind()
230 zend_create_closure(return_value, &closure->func, ce, called_scope, newthis); in do_closure_bind()
397 zend_closure *closure = (zend_closure *)object; in zend_get_closure_invoke_method() local
402 invoke->common = closure->func.common; in zend_get_closure_invoke_method()
410 ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER | (closure->func.common.fn_flags & keep_flags); in zend_get_closure_invoke_method()
411 …if (closure->func.type != ZEND_INTERNAL_FUNCTION || (closure->func.common.fn_flags & ZEND_ACC_USER… in zend_get_closure_invoke_method()
425 zend_closure *closure = (zend_closure *) obj; in zend_get_closure_method_def() local
426 return &closure->func; in zend_get_closure_method_def()
432 zend_closure *closure = (zend_closure *)Z_OBJ_P(obj); in zend_get_closure_this_ptr() local
433 return &closure->this_ptr; in zend_get_closure_this_ptr()
485 zend_closure *closure = (zend_closure *)object; in zend_closure_free_storage() local
487 zend_object_std_dtor(&closure->std); in zend_closure_free_storage()
489 if (closure->func.type == ZEND_USER_FUNCTION) { in zend_closure_free_storage()
490 destroy_op_array(&closure->func.op_array); in zend_closure_free_storage()
491 } else if (closure->orig_internal_handler == zend_closure_call_magic) { in zend_closure_free_storage()
492 zend_string_release(closure->func.common.function_name); in zend_closure_free_storage()
495 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_free_storage()
496 zval_ptr_dtor(&closure->this_ptr); in zend_closure_free_storage()
503 zend_closure *closure; in zend_closure_new() local
505 closure = emalloc(sizeof(zend_closure)); in zend_closure_new()
506 memset(closure, 0, sizeof(zend_closure)); in zend_closure_new()
508 zend_object_std_init(&closure->std, class_type); in zend_closure_new()
509 closure->std.handlers = &closure_handlers; in zend_closure_new()
511 return (zend_object*)closure; in zend_closure_new()
517 zend_closure *closure = (zend_closure *)zobject; in zend_closure_clone() local
520 zend_create_closure(&result, &closure->func, in zend_closure_clone()
521 closure->func.common.scope, closure->called_scope, &closure->this_ptr); in zend_closure_clone()
528 zend_closure *closure = (zend_closure *)obj; in zend_closure_get_closure() local
529 *fptr_ptr = &closure->func; in zend_closure_get_closure()
530 *ce_ptr = closure->called_scope; in zend_closure_get_closure()
532 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_get_closure()
533 *obj_ptr = Z_OBJ(closure->this_ptr); in zend_closure_get_closure()
545 zend_closure *closure = (zend_closure *)object; in zend_closure_get_debug_info() local
547 struct _zend_arg_info *arg_info = closure->func.common.arg_info; in zend_closure_get_debug_info()
549 …zend_bool zstr_args = (closure->func.type == ZEND_USER_FUNCTION) || (closure->func.common.fn_flags… in zend_closure_get_debug_info()
555 if (closure->func.type == ZEND_USER_FUNCTION && closure->func.op_array.static_variables) { in zend_closure_get_debug_info()
558 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_get_debug_info()
584 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_get_debug_info()
585 Z_ADDREF(closure->this_ptr); in zend_closure_get_debug_info()
586 zend_hash_update(debug_info, ZSTR_KNOWN(ZEND_STR_THIS), &closure->this_ptr); in zend_closure_get_debug_info()
590 (closure->func.common.num_args || in zend_closure_get_debug_info()
591 (closure->func.common.fn_flags & ZEND_ACC_VARIADIC))) { in zend_closure_get_debug_info()
592 uint32_t i, num_args, required = closure->func.common.required_num_args; in zend_closure_get_debug_info()
596 num_args = closure->func.common.num_args; in zend_closure_get_debug_info()
597 if (closure->func.common.fn_flags & ZEND_ACC_VARIADIC) { in zend_closure_get_debug_info()
632 zend_closure *closure = (zend_closure *)obj; in zend_closure_get_gc() local
634 *table = Z_TYPE(closure->this_ptr) != IS_NULL ? &closure->this_ptr : NULL; in zend_closure_get_gc()
635 *n = Z_TYPE(closure->this_ptr) != IS_NULL ? 1 : 0; in zend_closure_get_gc()
636 return (closure->func.type == ZEND_USER_FUNCTION) ? in zend_closure_get_gc()
637 ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr) : NULL; in zend_closure_get_gc()
678 zend_closure *closure = (zend_closure*)ZEND_CLOSURE_OBJECT(EX(func)); in ZEND_NAMED_FUNCTION() local
679 closure->orig_internal_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); in ZEND_NAMED_FUNCTION()
680 OBJ_RELEASE((zend_object*)closure); in ZEND_NAMED_FUNCTION()
687 zend_closure *closure; in zend_create_closure() local
691 closure = (zend_closure *)Z_OBJ_P(res); in zend_create_closure()
700 memcpy(&closure->func, func, sizeof(zend_op_array)); in zend_create_closure()
701 closure->func.common.fn_flags |= ZEND_ACC_CLOSURE; in zend_create_closure()
702 closure->func.common.fn_flags &= ~ZEND_ACC_IMMUTABLE; in zend_create_closure()
704 if (closure->func.op_array.static_variables) { in zend_create_closure()
705 closure->func.op_array.static_variables = in zend_create_closure()
706 zend_array_dup(closure->func.op_array.static_variables); in zend_create_closure()
708 ZEND_MAP_PTR_INIT(closure->func.op_array.static_variables_ptr, in zend_create_closure()
709 &closure->func.op_array.static_variables); in zend_create_closure()
712 if (!ZEND_MAP_PTR_GET(closure->func.op_array.run_time_cache) in zend_create_closure()
727 closure->func.op_array.fn_flags &= ~ZEND_ACC_HEAP_RT_CACHE; in zend_create_closure()
730 ZEND_MAP_PTR_SET(closure->func.op_array.run_time_cache, ptr); in zend_create_closure()
733 closure->func.op_array.fn_flags |= ZEND_ACC_HEAP_RT_CACHE; in zend_create_closure()
735 ZEND_MAP_PTR_INIT(closure->func.op_array.run_time_cache, ptr); in zend_create_closure()
737 ZEND_MAP_PTR_SET(closure->func.op_array.run_time_cache, ptr); in zend_create_closure()
741 zend_string_addref(closure->func.op_array.function_name); in zend_create_closure()
742 if (closure->func.op_array.refcount) { in zend_create_closure()
743 (*closure->func.op_array.refcount)++; in zend_create_closure()
746 memcpy(&closure->func, func, sizeof(zend_internal_function)); in zend_create_closure()
747 closure->func.common.fn_flags |= ZEND_ACC_CLOSURE; in zend_create_closure()
749 if (UNEXPECTED(closure->func.internal_function.handler == zend_closure_internal_handler)) { in zend_create_closure()
753 closure->orig_internal_handler = nested->orig_internal_handler; in zend_create_closure()
755 closure->orig_internal_handler = closure->func.internal_function.handler; in zend_create_closure()
757 closure->func.internal_function.handler = zend_closure_internal_handler; in zend_create_closure()
765 ZVAL_UNDEF(&closure->this_ptr); in zend_create_closure()
768 closure->func.common.scope = scope; in zend_create_closure()
769 closure->called_scope = called_scope; in zend_create_closure()
771 closure->func.common.fn_flags |= ZEND_ACC_PUBLIC; in zend_create_closure()
772 …if (this_ptr && Z_TYPE_P(this_ptr) == IS_OBJECT && (closure->func.common.fn_flags & ZEND_ACC_STATI… in zend_create_closure()
773 ZVAL_OBJ_COPY(&closure->this_ptr, Z_OBJ_P(this_ptr)); in zend_create_closure()
781 zend_closure *closure; in zend_create_fake_closure() local
785 closure = (zend_closure *)Z_OBJ_P(res); in zend_create_fake_closure()
786 closure->func.common.fn_flags |= ZEND_ACC_FAKE_CLOSURE; in zend_create_fake_closure()
792 zend_closure *closure = (zend_closure *) Z_OBJ_P(closure_zv); in zend_closure_bind_var() local
793 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_bind_var()
800 zend_closure *closure = (zend_closure *) Z_OBJ_P(closure_zv); in zend_closure_bind_var_ex() local
801 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_bind_var_ex()