Lines Matching refs:fiber

551 	zend_fiber *fiber = zend_fiber_from_context(context);  in zend_fiber_cleanup()  local
554 EG(vm_stack) = fiber->vm_stack; in zend_fiber_cleanup()
557 fiber->execute_data = NULL; in zend_fiber_cleanup()
558 fiber->stack_bottom = NULL; in zend_fiber_cleanup()
559 fiber->caller = NULL; in zend_fiber_cleanup()
567 zend_fiber *fiber = EG(active_fiber); in zend_fiber_execute() local
585 fiber->execute_data = (zend_execute_data *) stack->top; in zend_fiber_execute()
586 fiber->stack_bottom = fiber->execute_data; in zend_fiber_execute()
588 memset(fiber->execute_data, 0, sizeof(zend_execute_data)); in zend_fiber_execute()
590 fiber->execute_data->func = &zend_fiber_function; in zend_fiber_execute()
591 fiber->stack_bottom->prev_execute_data = EG(current_execute_data); in zend_fiber_execute()
593 EG(current_execute_data) = fiber->execute_data; in zend_fiber_execute()
598 EG(stack_base) = zend_fiber_stack_base(fiber->context.stack); in zend_fiber_execute()
599 EG(stack_limit) = zend_fiber_stack_limit(fiber->context.stack); in zend_fiber_execute()
602 fiber->fci.retval = &fiber->result; in zend_fiber_execute()
604 zend_call_function(&fiber->fci, &fiber->fci_cache); in zend_fiber_execute()
607 zval_ptr_dtor(&fiber->fci.function_name); in zend_fiber_execute()
608 ZVAL_UNDEF(&fiber->fci.function_name); in zend_fiber_execute()
611 if (!(fiber->flags & ZEND_FIBER_FLAG_DESTROYED) in zend_fiber_execute()
614 fiber->flags |= ZEND_FIBER_FLAG_THREW; in zend_fiber_execute()
623 fiber->flags |= ZEND_FIBER_FLAG_BAILOUT; in zend_fiber_execute()
627 fiber->context.cleanup = &zend_fiber_cleanup; in zend_fiber_execute()
628 fiber->vm_stack = EG(vm_stack); in zend_fiber_execute()
630 transfer->context = fiber->caller; in zend_fiber_execute()
675 static zend_always_inline zend_fiber_transfer zend_fiber_resume_internal(zend_fiber *fiber, zval *v… in zend_fiber_resume_internal() argument
683 fiber->caller = EG(current_fiber_context); in zend_fiber_resume_internal()
684 EG(active_fiber) = fiber; in zend_fiber_resume_internal()
686 zend_fiber_transfer transfer = zend_fiber_switch_to(fiber->previous, value, exception); in zend_fiber_resume_internal()
693 static zend_always_inline zend_fiber_transfer zend_fiber_suspend_internal(zend_fiber *fiber, zval *… in zend_fiber_suspend_internal() argument
695 ZEND_ASSERT(!(fiber->flags & ZEND_FIBER_FLAG_DESTROYED)); in zend_fiber_suspend_internal()
696 …ZEND_ASSERT(fiber->context.status == ZEND_FIBER_STATUS_RUNNING || fiber->context.status == ZEND_FI… in zend_fiber_suspend_internal()
697 ZEND_ASSERT(fiber->caller != NULL); in zend_fiber_suspend_internal()
699 zend_fiber_context *caller = fiber->caller; in zend_fiber_suspend_internal()
700 fiber->previous = EG(current_fiber_context); in zend_fiber_suspend_internal()
701 fiber->caller = NULL; in zend_fiber_suspend_internal()
702 fiber->execute_data = EG(current_execute_data); in zend_fiber_suspend_internal()
707 ZEND_API zend_result zend_fiber_start(zend_fiber *fiber, zval *return_value) in zend_fiber_start() argument
709 ZEND_ASSERT(fiber->context.status == ZEND_FIBER_STATUS_INIT); in zend_fiber_start()
711 …if (zend_fiber_init_context(&fiber->context, zend_ce_fiber, zend_fiber_execute, EG(fiber_stack_siz… in zend_fiber_start()
715 fiber->previous = &fiber->context; in zend_fiber_start()
717 zend_fiber_transfer transfer = zend_fiber_resume_internal(fiber, NULL, false); in zend_fiber_start()
724 ZEND_API void zend_fiber_resume(zend_fiber *fiber, zval *value, zval *return_value) in zend_fiber_resume() argument
726 ZEND_ASSERT(fiber->context.status == ZEND_FIBER_STATUS_SUSPENDED && fiber->caller == NULL); in zend_fiber_resume()
728 fiber->stack_bottom->prev_execute_data = EG(current_execute_data); in zend_fiber_resume()
730 zend_fiber_transfer transfer = zend_fiber_resume_internal(fiber, value, /* exception */ false); in zend_fiber_resume()
735 ZEND_API void zend_fiber_resume_exception(zend_fiber *fiber, zval *exception, zval *return_value) in zend_fiber_resume_exception() argument
737 ZEND_ASSERT(fiber->context.status == ZEND_FIBER_STATUS_SUSPENDED && fiber->caller == NULL); in zend_fiber_resume_exception()
739 fiber->stack_bottom->prev_execute_data = EG(current_execute_data); in zend_fiber_resume_exception()
741 zend_fiber_transfer transfer = zend_fiber_resume_internal(fiber, exception, /* exception */ true); in zend_fiber_resume_exception()
746 ZEND_API void zend_fiber_suspend(zend_fiber *fiber, zval *value, zval *return_value) in zend_fiber_suspend() argument
748 fiber->stack_bottom->prev_execute_data = NULL; in zend_fiber_suspend()
750 zend_fiber_transfer transfer = zend_fiber_suspend_internal(fiber, value); in zend_fiber_suspend()
757 zend_fiber *fiber = emalloc(sizeof(zend_fiber)); in zend_fiber_object_create() local
758 memset(fiber, 0, sizeof(zend_fiber)); in zend_fiber_object_create()
760 zend_object_std_init(&fiber->std, ce); in zend_fiber_object_create()
761 return &fiber->std; in zend_fiber_object_create()
766 zend_fiber *fiber = (zend_fiber *) object; in zend_fiber_object_destroy() local
768 if (fiber->context.status != ZEND_FIBER_STATUS_SUSPENDED) { in zend_fiber_object_destroy()
778 fiber->flags |= ZEND_FIBER_FLAG_DESTROYED; in zend_fiber_object_destroy()
780 zend_fiber_transfer transfer = zend_fiber_resume_internal(fiber, &graceful_exit, true); in zend_fiber_object_destroy()
805 zend_fiber *fiber = (zend_fiber *) object; in zend_fiber_object_free() local
807 zval_ptr_dtor(&fiber->fci.function_name); in zend_fiber_object_free()
808 zval_ptr_dtor(&fiber->result); in zend_fiber_object_free()
810 zend_object_std_dtor(&fiber->std); in zend_fiber_object_free()
815 zend_fiber *fiber = (zend_fiber *) object; in zend_fiber_object_gc() local
818 zend_get_gc_buffer_add_zval(buf, &fiber->fci.function_name); in zend_fiber_object_gc()
819 zend_get_gc_buffer_add_zval(buf, &fiber->result); in zend_fiber_object_gc()
821 if (fiber->context.status != ZEND_FIBER_STATUS_SUSPENDED || fiber->caller != NULL) { in zend_fiber_object_gc()
827 zend_execute_data *ex = fiber->execute_data; in zend_fiber_object_gc()
876 zend_fiber *fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD() local
878 …if (UNEXPECTED(fiber->context.status != ZEND_FIBER_STATUS_INIT || Z_TYPE(fiber->fci.function_name)… in ZEND_METHOD()
883 fiber->fci = fci; in ZEND_METHOD()
884 fiber->fci_cache = fcc; in ZEND_METHOD()
887 Z_TRY_ADDREF(fiber->fci.function_name); in ZEND_METHOD()
892 zend_fiber *fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD() local
895 Z_PARAM_VARIADIC_WITH_NAMED(fiber->fci.params, fiber->fci.param_count, fiber->fci.named_params); in ZEND_METHOD()
903 if (fiber->context.status != ZEND_FIBER_STATUS_INIT) { in ZEND_METHOD()
908 …if (zend_fiber_init_context(&fiber->context, zend_ce_fiber, zend_fiber_execute, EG(fiber_stack_siz… in ZEND_METHOD()
912 fiber->previous = &fiber->context; in ZEND_METHOD()
914 zend_fiber_transfer transfer = zend_fiber_resume_internal(fiber, NULL, false); in ZEND_METHOD()
928 zend_fiber *fiber = EG(active_fiber); in ZEND_METHOD() local
930 if (UNEXPECTED(!fiber)) { in ZEND_METHOD()
935 if (UNEXPECTED(fiber->flags & ZEND_FIBER_FLAG_DESTROYED)) { in ZEND_METHOD()
945 …ZEND_ASSERT(fiber->context.status == ZEND_FIBER_STATUS_RUNNING || fiber->context.status == ZEND_FI… in ZEND_METHOD()
947 fiber->stack_bottom->prev_execute_data = NULL; in ZEND_METHOD()
949 zend_fiber_transfer transfer = zend_fiber_suspend_internal(fiber, value); in ZEND_METHOD()
956 zend_fiber *fiber; in ZEND_METHOD() local
969 fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
971 if (UNEXPECTED(fiber->context.status != ZEND_FIBER_STATUS_SUSPENDED || fiber->caller != NULL)) { in ZEND_METHOD()
976 fiber->stack_bottom->prev_execute_data = EG(current_execute_data); in ZEND_METHOD()
978 zend_fiber_transfer transfer = zend_fiber_resume_internal(fiber, value, false); in ZEND_METHOD()
985 zend_fiber *fiber; in ZEND_METHOD() local
997 fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
999 if (UNEXPECTED(fiber->context.status != ZEND_FIBER_STATUS_SUSPENDED || fiber->caller != NULL)) { in ZEND_METHOD()
1004 fiber->stack_bottom->prev_execute_data = EG(current_execute_data); in ZEND_METHOD()
1006 zend_fiber_transfer transfer = zend_fiber_resume_internal(fiber, exception, true); in ZEND_METHOD()
1013 zend_fiber *fiber; in ZEND_METHOD() local
1017 fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
1019 RETURN_BOOL(fiber->context.status != ZEND_FIBER_STATUS_INIT); in ZEND_METHOD()
1024 zend_fiber *fiber; in ZEND_METHOD() local
1028 fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
1030 RETURN_BOOL(fiber->context.status == ZEND_FIBER_STATUS_SUSPENDED && fiber->caller == NULL); in ZEND_METHOD()
1035 zend_fiber *fiber; in ZEND_METHOD() local
1039 fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
1041 RETURN_BOOL(fiber->context.status == ZEND_FIBER_STATUS_RUNNING || fiber->caller != NULL); in ZEND_METHOD()
1046 zend_fiber *fiber; in ZEND_METHOD() local
1050 fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
1052 RETURN_BOOL(fiber->context.status == ZEND_FIBER_STATUS_DEAD); in ZEND_METHOD()
1057 zend_fiber *fiber; in ZEND_METHOD() local
1062 fiber = (zend_fiber *) Z_OBJ_P(ZEND_THIS); in ZEND_METHOD()
1064 if (fiber->context.status == ZEND_FIBER_STATUS_DEAD) { in ZEND_METHOD()
1065 if (fiber->flags & ZEND_FIBER_FLAG_THREW) { in ZEND_METHOD()
1067 } else if (fiber->flags & ZEND_FIBER_FLAG_BAILOUT) { in ZEND_METHOD()
1070 RETURN_COPY_DEREF(&fiber->result); in ZEND_METHOD()
1072 } else if (fiber->context.status == ZEND_FIBER_STATUS_INIT) { in ZEND_METHOD()
1086 zend_fiber *fiber = EG(active_fiber); in ZEND_METHOD() local
1088 if (!fiber) { in ZEND_METHOD()
1092 RETURN_OBJ_COPY(&fiber->std); in ZEND_METHOD()