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()
463 zend_closure *closure = (zend_closure *)object; in zend_get_closure_invoke_method() local
468 invoke->common = closure->func.common; in zend_get_closure_invoke_method()
476 ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER | (closure->func.common.fn_flags & keep_flags); in zend_get_closure_invoke_method()
477 …if (closure->func.type != ZEND_INTERNAL_FUNCTION || (closure->func.common.fn_flags & ZEND_ACC_USER… in zend_get_closure_invoke_method()
491 zend_closure *closure = (zend_closure *) obj; in zend_get_closure_method_def() local
492 return &closure->func; in zend_get_closure_method_def()
498 zend_closure *closure = (zend_closure *)Z_OBJ_P(obj); in zend_get_closure_this_ptr() local
499 return &closure->this_ptr; in zend_get_closure_this_ptr()
515 zend_closure *closure = (zend_closure *)object; in zend_closure_free_storage() local
517 zend_object_std_dtor(&closure->std); in zend_closure_free_storage()
519 if (closure->func.type == ZEND_USER_FUNCTION) { in zend_closure_free_storage()
521 if (!(closure->func.op_array.fn_flags & ZEND_ACC_FAKE_CLOSURE)) { in zend_closure_free_storage()
522 zend_destroy_static_vars(&closure->func.op_array); in zend_closure_free_storage()
523 closure->func.op_array.static_variables = NULL; in zend_closure_free_storage()
525 destroy_op_array(&closure->func.op_array); in zend_closure_free_storage()
526 } else if (closure->func.type == ZEND_INTERNAL_FUNCTION) { in zend_closure_free_storage()
527 zend_string_release(closure->func.common.function_name); in zend_closure_free_storage()
530 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_free_storage()
531 zval_ptr_dtor(&closure->this_ptr); in zend_closure_free_storage()
538 zend_closure *closure; in zend_closure_new() local
540 closure = emalloc(sizeof(zend_closure)); in zend_closure_new()
541 memset(closure, 0, sizeof(zend_closure)); in zend_closure_new()
543 zend_object_std_init(&closure->std, class_type); in zend_closure_new()
545 return (zend_object*)closure; in zend_closure_new()
551 zend_closure *closure = (zend_closure *)zobject; in zend_closure_clone() local
554 zend_create_closure(&result, &closure->func, in zend_closure_clone()
555 closure->func.common.scope, closure->called_scope, &closure->this_ptr); in zend_closure_clone()
562 zend_closure *closure = (zend_closure*)obj; in zend_closure_get_closure() local
564 *fptr_ptr = &closure->func; in zend_closure_get_closure()
565 *ce_ptr = closure->called_scope; in zend_closure_get_closure()
567 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_get_closure()
568 *obj_ptr = Z_OBJ(closure->this_ptr); in zend_closure_get_closure()
580 zend_closure *closure = (zend_closure *)object; in zend_closure_get_debug_info() local
582 struct _zend_arg_info *arg_info = closure->func.common.arg_info; in zend_closure_get_debug_info()
584 …bool zstr_args = (closure->func.type == ZEND_USER_FUNCTION) || (closure->func.common.fn_flags & ZE… in zend_closure_get_debug_info()
590 if (closure->func.op_array.fn_flags & ZEND_ACC_FAKE_CLOSURE) { in zend_closure_get_debug_info()
591 if (closure->func.common.scope) { in zend_closure_get_debug_info()
592 zend_string *class_name = closure->func.common.scope->name; in zend_closure_get_debug_info()
593 zend_string *func_name = closure->func.common.function_name; in zend_closure_get_debug_info()
601 ZVAL_STR_COPY(&val, closure->func.common.function_name); in zend_closure_get_debug_info()
606 if (closure->func.type == ZEND_USER_FUNCTION && closure->func.op_array.static_variables) { in zend_closure_get_debug_info()
609 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_get_debug_info()
631 if (Z_TYPE(closure->this_ptr) != IS_UNDEF) { in zend_closure_get_debug_info()
632 Z_ADDREF(closure->this_ptr); in zend_closure_get_debug_info()
633 zend_hash_update(debug_info, ZSTR_KNOWN(ZEND_STR_THIS), &closure->this_ptr); in zend_closure_get_debug_info()
637 (closure->func.common.num_args || in zend_closure_get_debug_info()
638 (closure->func.common.fn_flags & ZEND_ACC_VARIADIC))) { in zend_closure_get_debug_info()
639 uint32_t i, num_args, required = closure->func.common.required_num_args; in zend_closure_get_debug_info()
643 num_args = closure->func.common.num_args; in zend_closure_get_debug_info()
644 if (closure->func.common.fn_flags & ZEND_ACC_VARIADIC) { in zend_closure_get_debug_info()
674 zend_closure *closure = (zend_closure *)obj; in zend_closure_get_gc() local
676 *table = Z_TYPE(closure->this_ptr) != IS_NULL ? &closure->this_ptr : NULL; in zend_closure_get_gc()
677 *n = Z_TYPE(closure->this_ptr) != IS_NULL ? 1 : 0; in zend_closure_get_gc()
679 return (closure->func.type == ZEND_USER_FUNCTION in zend_closure_get_gc()
680 && !(closure->func.op_array.fn_flags & ZEND_ACC_FAKE_CLOSURE)) ? in zend_closure_get_gc()
681 ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr) : NULL; in zend_closure_get_gc()
712 zend_closure *closure = (zend_closure*)ZEND_CLOSURE_OBJECT(EX(func)); in ZEND_NAMED_FUNCTION() local
713 closure->orig_internal_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); in ZEND_NAMED_FUNCTION()
716 Z_OBJ(EX(This)) = &closure->std; in ZEND_NAMED_FUNCTION()
722 zend_closure *closure; in zend_create_closure_ex() local
727 closure = (zend_closure *)Z_OBJ_P(res); in zend_create_closure_ex()
736 memcpy(&closure->func, func, sizeof(zend_op_array)); in zend_create_closure_ex()
737 closure->func.common.fn_flags |= ZEND_ACC_CLOSURE; in zend_create_closure_ex()
738 closure->func.common.fn_flags &= ~ZEND_ACC_IMMUTABLE; in zend_create_closure_ex()
740 zend_string_addref(closure->func.op_array.function_name); in zend_create_closure_ex()
741 if (closure->func.op_array.refcount) { in zend_create_closure_ex()
742 (*closure->func.op_array.refcount)++; in zend_create_closure_ex()
747 if (closure->func.op_array.static_variables) { in zend_create_closure_ex()
748 closure->func.op_array.static_variables = in zend_create_closure_ex()
749 zend_array_dup(closure->func.op_array.static_variables); in zend_create_closure_ex()
751 ZEND_MAP_PTR_INIT(closure->func.op_array.static_variables_ptr, in zend_create_closure_ex()
752 closure->func.op_array.static_variables); in zend_create_closure_ex()
760 ZEND_MAP_PTR_INIT(closure->func.op_array.static_variables_ptr, ht); in zend_create_closure_ex()
780 closure->func.op_array.fn_flags &= ~ZEND_ACC_HEAP_RT_CACHE; in zend_create_closure_ex()
784 closure->func.op_array.fn_flags |= ZEND_ACC_HEAP_RT_CACHE; in zend_create_closure_ex()
788 ZEND_MAP_PTR_INIT(closure->func.op_array.run_time_cache, ptr); in zend_create_closure_ex()
790 memcpy(&closure->func, func, sizeof(zend_internal_function)); in zend_create_closure_ex()
791 closure->func.common.fn_flags |= ZEND_ACC_CLOSURE; in zend_create_closure_ex()
793 if (UNEXPECTED(closure->func.internal_function.handler == zend_closure_internal_handler)) { in zend_create_closure_ex()
797 closure->orig_internal_handler = nested->orig_internal_handler; in zend_create_closure_ex()
799 closure->orig_internal_handler = closure->func.internal_function.handler; in zend_create_closure_ex()
801 closure->func.internal_function.handler = zend_closure_internal_handler; in zend_create_closure_ex()
802 zend_string_addref(closure->func.op_array.function_name); in zend_create_closure_ex()
810 ZVAL_UNDEF(&closure->this_ptr); in zend_create_closure_ex()
813 closure->func.common.scope = scope; in zend_create_closure_ex()
814 closure->called_scope = called_scope; in zend_create_closure_ex()
816 closure->func.common.fn_flags |= ZEND_ACC_PUBLIC; in zend_create_closure_ex()
817 …if (this_ptr && Z_TYPE_P(this_ptr) == IS_OBJECT && (closure->func.common.fn_flags & ZEND_ACC_STATI… in zend_create_closure_ex()
818 ZVAL_OBJ_COPY(&closure->this_ptr, Z_OBJ_P(this_ptr)); in zend_create_closure_ex()
832 zend_closure *closure; in zend_create_fake_closure() local
836 closure = (zend_closure *)Z_OBJ_P(res); in zend_create_fake_closure()
837 closure->func.common.fn_flags |= ZEND_ACC_FAKE_CLOSURE; in zend_create_fake_closure()
890 zend_closure *closure = (zend_closure *) Z_OBJ_P(closure_zv); in zend_closure_bind_var() local
891 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_bind_var()
898 zend_closure *closure = (zend_closure *) Z_OBJ_P(closure_zv); in zend_closure_bind_var_ex() local
899 HashTable *static_variables = ZEND_MAP_PTR_GET(closure->func.op_array.static_variables_ptr); in zend_closure_bind_var_ex()