Lines Matching refs:node
181 static void zend_generator_remove_child(zend_generator_node *node, zend_generator *child) in zend_generator_remove_child() argument
183 ZEND_ASSERT(node->children >= 1); in zend_generator_remove_child()
184 if (node->children == 1) { in zend_generator_remove_child()
185 node->child.single = NULL; in zend_generator_remove_child()
187 HashTable *ht = node->child.ht; in zend_generator_remove_child()
189 if (node->children == 2) { in zend_generator_remove_child()
192 node->child.single = other_child; in zend_generator_remove_child()
199 node->children--; in zend_generator_remove_child()
203 ZEND_ASSERT(!generator->node.parent); in clear_link_to_leaf()
204 zend_generator *leaf = generator->node.ptr.leaf; in clear_link_to_leaf()
206 leaf->node.ptr.root = NULL; in clear_link_to_leaf()
207 generator->node.ptr.leaf = NULL; in clear_link_to_leaf()
214 ZEND_ASSERT(generator->node.parent); in clear_link_to_root()
215 if (generator->node.ptr.root) { in clear_link_to_root()
216 generator->node.ptr.root->node.ptr.leaf = NULL; in clear_link_to_root()
217 generator->node.ptr.root = NULL; in clear_link_to_root()
229 if (EXPECTED(generator->node.children == 0)) { in check_node_running_in_fiber()
233 if (generator->node.children == 1) { in check_node_running_in_fiber()
234 return check_node_running_in_fiber(generator->node.child.single); in check_node_running_in_fiber()
238 ZEND_HASH_FOREACH_PTR(generator->node.child.ht, child) { in check_node_running_in_fiber()
278 zend_generator *parent = generator->node.parent; in zend_generator_dtor_storage()
280 zend_generator_remove_child(&parent->node, generator); in zend_generator_dtor_storage()
282 generator->node.parent = NULL; in zend_generator_dtor_storage()
379 if (UNEXPECTED(generator->node.children > 1)) { in zend_generator_free_storage()
380 zend_hash_destroy(generator->node.child.ht); in zend_generator_free_storage()
381 efree(generator->node.child.ht); in zend_generator_free_storage()
409 if (generator->node.parent) { in zend_generator_frame_gc()
410 zend_get_gc_buffer_add_obj(gc_buffer, &generator->node.parent->std); in zend_generator_frame_gc()
461 generator->node.parent = NULL; in zend_generator_create()
462 generator->node.children = 0; in zend_generator_create()
463 generator->node.ptr.root = NULL; in zend_generator_create()
486 ZEND_ASSERT(generator->node.parent && "Placeholder only used with delegation"); in zend_generator_check_placeholder_frame()
487 while (generator->node.parent->node.parent) { in zend_generator_check_placeholder_frame()
490 generator = generator->node.parent; in zend_generator_check_placeholder_frame()
530 zend_generator_node *node = &generator->node; in zend_generator_add_child() local
532 if (node->children == 0) { in zend_generator_add_child()
533 node->child.single = child; in zend_generator_add_child()
535 if (node->children == 1) { in zend_generator_add_child()
539 (zend_ulong) node->child.single, node->child.single); in zend_generator_add_child()
540 node->child.ht = ht; in zend_generator_add_child()
543 zend_hash_index_add_new_ptr(node->child.ht, (zend_ulong) child, child); in zend_generator_add_child()
546 ++node->children; in zend_generator_add_child()
551 ZEND_ASSERT(!generator->node.parent && "Already has parent?"); in zend_generator_yield_from()
553 if (leaf && !from->node.parent && !from->node.ptr.leaf) { in zend_generator_yield_from()
554 from->node.ptr.leaf = leaf; in zend_generator_yield_from()
555 leaf->node.ptr.root = from; in zend_generator_yield_from()
557 generator->node.parent = from; in zend_generator_yield_from()
564 zend_generator *root = generator->node.parent; in zend_generator_update_root()
565 while (root->node.parent) { in zend_generator_update_root()
566 root = root->node.parent; in zend_generator_update_root()
570 root->node.ptr.leaf = generator; in zend_generator_update_root()
571 generator->node.ptr.root = root; in zend_generator_update_root()
577 while (!root->execute_data && root->node.children == 1) { in get_new_root()
578 root = root->node.child.single; in get_new_root()
587 while (generator->node.parent->execute_data) { in get_new_root()
588 generator = generator->node.parent; in get_new_root()
596 zend_generator *old_root = generator->node.ptr.root; in zend_generator_update_current()
601 ZEND_ASSERT(old_root->node.ptr.leaf == generator); in zend_generator_update_current()
602 generator->node.ptr.root = new_root; in zend_generator_update_current()
603 new_root->node.ptr.leaf = generator; in zend_generator_update_current()
604 old_root->node.ptr.leaf = NULL; in zend_generator_update_current()
606 zend_generator *new_root_parent = new_root->node.parent; in zend_generator_update_current()
608 zend_generator_remove_child(&new_root_parent->node, new_root); in zend_generator_update_current()
633 new_root->node.parent = NULL; in zend_generator_update_current()
646 new_root->node.parent = NULL; in zend_generator_update_current()
881 …e) == IS_UNDEF) && EXPECTED(generator->execute_data) && EXPECTED(generator->node.parent == NULL)) { in zend_generator_ensure_initialized()