Lines Matching refs:node
167 static zend_generator *zend_generator_get_child(zend_generator_node *node, zend_generator *leaf);
182 if (EXPECTED(generator->node.children == 0)) { in zend_generator_dtor_storage()
183 zend_generator *root = generator->node.ptr.root, *next; in zend_generator_dtor_storage()
185 next = zend_generator_get_child(&root->node, generator); in zend_generator_dtor_storage()
186 generator->node.ptr.root = next; in zend_generator_dtor_storage()
187 next->node.parent = NULL; in zend_generator_dtor_storage()
251 if (UNEXPECTED(generator->node.children > 4)) { in zend_generator_free_storage()
252 zend_hash_destroy(&generator->node.child.ht); in zend_generator_free_storage()
301 if (generator->node.children == 0) { in calc_gc_buffer_size()
302 zend_generator *root = generator->node.ptr.root; in calc_gc_buffer_size()
304 root = zend_generator_get_child(&root->node, generator); in calc_gc_buffer_size()
383 if (generator->node.children == 0) { in zend_generator_get_gc()
384 zend_generator *root = generator->node.ptr.root; in zend_generator_get_gc()
387 root = zend_generator_get_child(&root->node, generator); in zend_generator_get_gc()
413 generator->node.parent = NULL; in zend_generator_create()
414 generator->node.children = 0; in zend_generator_create()
415 generator->node.ptr.root = generator; in zend_generator_create()
437 …zend_generator *root = (generator->node.children < 1 ? generator : generator->node.ptr.leaf)->node… in zend_generator_check_placeholder_frame()
439 if (generator->node.parent != root) { in zend_generator_check_placeholder_frame()
443 generator = generator->node.parent; in zend_generator_check_placeholder_frame()
444 } while (generator->node.parent != root); in zend_generator_check_placeholder_frame()
476 static zend_generator *zend_generator_get_child(zend_generator_node *node, zend_generator *leaf) in zend_generator_get_child() argument
478 switch (node->children) { in zend_generator_get_child()
482 return node->child.array[0].child; in zend_generator_get_child()
485 if (node->child.array[x].leaf == leaf) { \ in zend_generator_get_child()
486 return node->child.array[x].child; \ in zend_generator_get_child()
498 return zend_hash_index_find_ptr(&node->child.ht, (zend_ulong) leaf); in zend_generator_get_child()
501 static zend_generator_node *zend_generator_search_multi_children_node(zend_generator_node *node) in zend_generator_search_multi_children_node() argument
503 while (node->children == 1) { in zend_generator_search_multi_children_node()
504 node = &node->child.array[0].child->node; in zend_generator_search_multi_children_node()
506 return node->children > 1 ? node : NULL; in zend_generator_search_multi_children_node()
509 static void zend_generator_add_single_child(zend_generator_node *node, zend_generator *child, zend_… in zend_generator_add_single_child() argument
511 if (node->children < 4) { in zend_generator_add_single_child()
512 node->child.array[node->children].leaf = leaf; in zend_generator_add_single_child()
513 node->child.array[node->children].child = child; in zend_generator_add_single_child()
514 } else if (node->children > 4) { in zend_generator_add_single_child()
515 zend_hash_index_add_ptr(&node->child.ht, (zend_ulong) leaf, child); in zend_generator_add_single_child()
523 memcpy(&array, &node->child.array, sizeof(array)); in zend_generator_add_single_child()
524 zend_hash_init(&node->child.ht, 5, sigh, NULL, 0); in zend_generator_add_single_child()
526 zend_hash_index_add_ptr(&node->child.ht, (zend_ulong) array[i].leaf, array[i].child); in zend_generator_add_single_child()
528 zend_hash_index_add_ptr(&node->child.ht, (zend_ulong) leaf, child); in zend_generator_add_single_child()
531 node->children++; in zend_generator_add_single_child()
552 zend_generator *leaf = child->node.children ? child->node.ptr.leaf : child; in zend_generator_add_child()
554 zend_bool was_leaf = generator->node.children == 0; in zend_generator_add_child()
557 zend_generator *next = generator->node.parent; in zend_generator_add_child()
558 leaf->node.ptr.root = generator->node.ptr.root; in zend_generator_add_child()
560 generator->node.ptr.leaf = leaf; in zend_generator_add_child()
563 if (next->node.children > 1) { in zend_generator_add_child()
564 if (next->node.children > 4) { in zend_generator_add_child()
565 zend_generator *child = zend_hash_index_find_ptr(&next->node.child.ht, (zend_ulong) generator); in zend_generator_add_child()
566 zend_hash_index_del(&next->node.child.ht, (zend_ulong) generator); in zend_generator_add_child()
567 zend_hash_index_add_ptr(&next->node.child.ht, (zend_ulong) leaf, child); in zend_generator_add_child()
569 switch (next->node.children) { in zend_generator_add_child()
571 if (next->node.child.array[x].leaf == generator) { \ in zend_generator_add_child()
572 next->node.child.array[x].leaf = leaf; \ in zend_generator_add_child()
587 next->node.ptr.leaf = leaf; in zend_generator_add_child()
588 next = next->node.parent; in zend_generator_add_child()
591 zend_generator_add_single_child(&generator->node, child, leaf); in zend_generator_add_child()
592 } else if (generator->node.children == 1) { in zend_generator_add_child()
593 multi_children_node = zend_generator_search_multi_children_node(&generator->node); in zend_generator_add_child()
595 generator->node.children = 0; in zend_generator_add_child()
596 …zend_generator_merge_child_nodes(&generator->node, multi_children_node, generator->node.child.arra… in zend_generator_add_child()
601 multi_children_node = zend_generator_search_multi_children_node(&child->node); in zend_generator_add_child()
607 zend_generator *parent = generator->node.parent, *cur = generator; in zend_generator_add_child()
610 zend_generator_merge_child_nodes(&generator->node, multi_children_node, child); in zend_generator_add_child()
612 zend_generator_add_single_child(&generator->node, child, leaf); in zend_generator_add_child()
615 if (parent->node.children > 1) { in zend_generator_add_child()
617 multi_children_node = zend_generator_search_multi_children_node(&child->node); in zend_generator_add_child()
620 zend_generator_merge_child_nodes(&parent->node, multi_children_node, cur); in zend_generator_add_child()
622 zend_generator_add_single_child(&parent->node, cur, leaf); in zend_generator_add_child()
626 parent = parent->node.parent; in zend_generator_add_child()
635 generator->node.parent = from; in zend_generator_yield_from()
642 zend_generator *old_root, *root = leaf->node.ptr.root; in zend_generator_update_current()
647 root = zend_generator_get_child(&root->node, leaf); in zend_generator_update_current()
656 root = zend_generator_get_child(&root->node, leaf); in zend_generator_update_current()
659 if (root->node.parent) { in zend_generator_update_current()
660 if (root->node.parent->execute_data == NULL) { in zend_generator_update_current()
665 if (Z_ISUNDEF(root->node.parent->retval)) { in zend_generator_update_current()
683 leaf->node.ptr.root = root; in zend_generator_update_current()
684 root->node.parent = NULL; in zend_generator_update_current()
689 return leaf->node.ptr.root; /* this may be updated during zend_generator_resume! */ in zend_generator_update_current()
693 ZVAL_COPY(&root->value, &root->node.parent->value); in zend_generator_update_current()
694 … ZVAL_COPY(ZEND_CALL_VAR(root->execute_data, yield_from->result.var), &root->node.parent->retval); in zend_generator_update_current()
699 root->node.parent = NULL; in zend_generator_update_current()
702 root = root->node.parent; in zend_generator_update_current()
704 } while (root->node.parent); in zend_generator_update_current()
708 leaf->node.ptr.root = root; in zend_generator_update_current()
897 …e) == IS_UNDEF) && EXPECTED(generator->execute_data) && EXPECTED(generator->node.parent == NULL)) { in zend_generator_ensure_initialized()