Lines Matching refs:node

163 static zend_generator *zend_generator_get_child(zend_generator_node *node, zend_generator *leaf);
178 if (EXPECTED(generator->node.children == 0)) { in zend_generator_dtor_storage()
179 zend_generator *root = generator->node.ptr.root, *next; in zend_generator_dtor_storage()
181 next = zend_generator_get_child(&root->node, generator); in zend_generator_dtor_storage()
182 generator->node.ptr.root = next; in zend_generator_dtor_storage()
183 next->node.parent = NULL; in zend_generator_dtor_storage()
247 if (UNEXPECTED(generator->node.children > 4)) { in zend_generator_free_storage()
248 zend_hash_destroy(&generator->node.child.ht); in zend_generator_free_storage()
297 if (generator->node.children == 0) { in calc_gc_buffer_size()
298 zend_generator *root = generator->node.ptr.root; in calc_gc_buffer_size()
300 root = zend_generator_get_child(&root->node, generator); in calc_gc_buffer_size()
379 if (generator->node.children == 0) { in zend_generator_get_gc()
380 zend_generator *root = generator->node.ptr.root; in zend_generator_get_gc()
383 root = zend_generator_get_child(&root->node, generator); in zend_generator_get_gc()
409 generator->node.parent = NULL; in zend_generator_create()
410 generator->node.children = 0; in zend_generator_create()
411 generator->node.ptr.root = generator; in zend_generator_create()
433 …zend_generator *root = (generator->node.children < 1 ? generator : generator->node.ptr.leaf)->node in zend_generator_check_placeholder_frame()
435 if (generator->node.parent != root) { in zend_generator_check_placeholder_frame()
439 generator = generator->node.parent; in zend_generator_check_placeholder_frame()
440 } while (generator->node.parent != root); in zend_generator_check_placeholder_frame()
472 static zend_generator *zend_generator_get_child(zend_generator_node *node, zend_generator *leaf) in zend_generator_get_child() argument
474 switch (node->children) { in zend_generator_get_child()
478 return node->child.array[0].child; in zend_generator_get_child()
481 if (node->child.array[x].leaf == leaf) { \ in zend_generator_get_child()
482 return node->child.array[x].child; \ in zend_generator_get_child()
494 return zend_hash_index_find_ptr(&node->child.ht, (zend_ulong) leaf); in zend_generator_get_child()
497 static zend_generator_node *zend_generator_search_multi_children_node(zend_generator_node *node) in zend_generator_search_multi_children_node() argument
499 while (node->children == 1) { in zend_generator_search_multi_children_node()
500 node = &node->child.array[0].child->node; in zend_generator_search_multi_children_node()
502 return node->children > 1 ? node : NULL; in zend_generator_search_multi_children_node()
505 static void zend_generator_add_single_child(zend_generator_node *node, zend_generator *child, zend_… in zend_generator_add_single_child() argument
507 if (node->children < 4) { in zend_generator_add_single_child()
508 node->child.array[node->children].leaf = leaf; in zend_generator_add_single_child()
509 node->child.array[node->children].child = child; in zend_generator_add_single_child()
510 } else if (node->children > 4) { in zend_generator_add_single_child()
511 zend_hash_index_add_ptr(&node->child.ht, (zend_ulong) leaf, child); in zend_generator_add_single_child()
519 memcpy(&array, &node->child.array, sizeof(array)); in zend_generator_add_single_child()
520 zend_hash_init(&node->child.ht, 5, sigh, NULL, 0); in zend_generator_add_single_child()
522 zend_hash_index_add_ptr(&node->child.ht, (zend_ulong) array[i].leaf, array[i].child); in zend_generator_add_single_child()
524 zend_hash_index_add_ptr(&node->child.ht, (zend_ulong) leaf, child); in zend_generator_add_single_child()
527 node->children++; in zend_generator_add_single_child()
548 zend_generator *leaf = child->node.children ? child->node.ptr.leaf : child; in zend_generator_add_child()
550 zend_bool was_leaf = generator->node.children == 0; in zend_generator_add_child()
553 zend_generator *next = generator->node.parent; in zend_generator_add_child()
554 leaf->node.ptr.root = generator->node.ptr.root; in zend_generator_add_child()
556 generator->node.ptr.leaf = leaf; in zend_generator_add_child()
559 if (next->node.children > 1) { in zend_generator_add_child()
560 if (next->node.children > 4) { in zend_generator_add_child()
561 zend_generator *child = zend_hash_index_find_ptr(&next->node.child.ht, (zend_ulong) generator); in zend_generator_add_child()
562 zend_hash_index_del(&next->node.child.ht, (zend_ulong) generator); in zend_generator_add_child()
563 zend_hash_index_add_ptr(&next->node.child.ht, (zend_ulong) leaf, child); in zend_generator_add_child()
565 switch (next->node.children) { in zend_generator_add_child()
567 if (next->node.child.array[x].leaf == generator) { \ in zend_generator_add_child()
568 next->node.child.array[x].leaf = leaf; \ in zend_generator_add_child()
583 next->node.ptr.leaf = leaf; in zend_generator_add_child()
584 next = next->node.parent; in zend_generator_add_child()
587 zend_generator_add_single_child(&generator->node, child, leaf); in zend_generator_add_child()
588 } else if (generator->node.children == 1) { in zend_generator_add_child()
589 multi_children_node = zend_generator_search_multi_children_node(&generator->node); in zend_generator_add_child()
591 generator->node.children = 0; in zend_generator_add_child()
592 …zend_generator_merge_child_nodes(&generator->node, multi_children_node, generator->node.child.arra… in zend_generator_add_child()
597 multi_children_node = zend_generator_search_multi_children_node(&child->node); in zend_generator_add_child()
603 zend_generator *parent = generator->node.parent, *cur = generator; in zend_generator_add_child()
606 zend_generator_merge_child_nodes(&generator->node, multi_children_node, child); in zend_generator_add_child()
608 zend_generator_add_single_child(&generator->node, child, leaf); in zend_generator_add_child()
611 if (parent->node.children > 1) { in zend_generator_add_child()
613 multi_children_node = zend_generator_search_multi_children_node(&child->node); in zend_generator_add_child()
616 zend_generator_merge_child_nodes(&parent->node, multi_children_node, cur); in zend_generator_add_child()
618 zend_generator_add_single_child(&parent->node, cur, leaf); in zend_generator_add_child()
622 parent = parent->node.parent; in zend_generator_add_child()
631 generator->node.parent = from; in zend_generator_yield_from()
638 zend_generator *old_root, *root = leaf->node.ptr.root; in zend_generator_update_current()
643 root = zend_generator_get_child(&root->node, leaf); in zend_generator_update_current()
652 root = zend_generator_get_child(&root->node, leaf); in zend_generator_update_current()
655 if (root->node.parent) { in zend_generator_update_current()
656 if (root->node.parent->execute_data == NULL) { in zend_generator_update_current()
661 if (Z_ISUNDEF(root->node.parent->retval)) { in zend_generator_update_current()
679 leaf->node.ptr.root = root; in zend_generator_update_current()
680 root->node.parent = NULL; in zend_generator_update_current()
685 return leaf->node.ptr.root; /* this may be updated during zend_generator_resume! */ in zend_generator_update_current()
689 ZVAL_COPY(&root->value, &root->node.parent->value); in zend_generator_update_current()
690 … ZVAL_COPY(ZEND_CALL_VAR(root->execute_data, yield_from->result.var), &root->node.parent->retval); in zend_generator_update_current()
695 root->node.parent = NULL; in zend_generator_update_current()
698 root = root->node.parent; in zend_generator_update_current()
700 } while (root->node.parent); in zend_generator_update_current()
704 leaf->node.ptr.root = root; in zend_generator_update_current()
893 …e) == IS_UNDEF) && EXPECTED(generator->execute_data) && EXPECTED(generator->node.parent == NULL)) { in zend_generator_ensure_initialized()