Lines Matching refs:node
103 static zend_generator *zend_generator_get_child(zend_generator_node *node, zend_generator *leaf);
118 if (EXPECTED(generator->node.children == 0)) { in zend_generator_dtor_storage()
119 zend_generator *root = generator->node.ptr.root, *next; in zend_generator_dtor_storage()
121 next = zend_generator_get_child(&root->node, generator); in zend_generator_dtor_storage()
125 generator->node.parent = NULL; in zend_generator_dtor_storage()
185 if (UNEXPECTED(generator->node.children > 4)) { in zend_generator_free_storage()
186 zend_hash_destroy(&generator->node.child.ht); in zend_generator_free_storage()
220 generator->node.parent = NULL; in zend_generator_create()
221 generator->node.children = 0; in zend_generator_create()
222 generator->node.ptr.root = generator; in zend_generator_create()
282 …zend_generator *root = (generator->node.children < 1 ? generator : generator->node.ptr.leaf)->node… in zend_generator_check_placeholder_frame()
284 if (generator->node.parent != root) { in zend_generator_check_placeholder_frame()
288 generator = generator->node.parent; in zend_generator_check_placeholder_frame()
289 } while (generator->node.parent != root); in zend_generator_check_placeholder_frame()
321 static zend_generator *zend_generator_get_child(zend_generator_node *node, zend_generator *leaf) in zend_generator_get_child() argument
323 switch (node->children) { in zend_generator_get_child()
327 return node->child.array[0].child; in zend_generator_get_child()
330 if (node->child.array[x].leaf == leaf) { \ in zend_generator_get_child()
331 return node->child.array[x].child; \ in zend_generator_get_child()
343 return zend_hash_index_find_ptr(&node->child.ht, (zend_ulong) leaf); in zend_generator_get_child()
346 static zend_generator_node *zend_generator_search_multi_children_node(zend_generator_node *node) in zend_generator_search_multi_children_node() argument
348 while (node->children == 1) { in zend_generator_search_multi_children_node()
349 node = &node->child.array[0].child->node; in zend_generator_search_multi_children_node()
351 return node->children > 1 ? node : NULL; in zend_generator_search_multi_children_node()
354 static void zend_generator_add_single_child(zend_generator_node *node, zend_generator *child, zend_… in zend_generator_add_single_child() argument
356 if (node->children < 4) { in zend_generator_add_single_child()
357 node->child.array[node->children].leaf = leaf; in zend_generator_add_single_child()
358 node->child.array[node->children].child = child; in zend_generator_add_single_child()
359 } else if (node->children > 4) { in zend_generator_add_single_child()
360 zend_hash_index_add_ptr(&node->child.ht, (zend_ulong) leaf, child); in zend_generator_add_single_child()
368 memcpy(&array, &node->child.array, sizeof(array)); in zend_generator_add_single_child()
369 zend_hash_init(&node->child.ht, 5, sigh, NULL, 0); in zend_generator_add_single_child()
371 zend_hash_index_add_ptr(&node->child.ht, (zend_ulong) array[i].leaf, array[i].child); in zend_generator_add_single_child()
373 zend_hash_index_add_ptr(&node->child.ht, (zend_ulong) leaf, child); in zend_generator_add_single_child()
376 node->children++; in zend_generator_add_single_child()
397 zend_generator *leaf = child->node.children ? child->node.ptr.leaf : child; in zend_generator_add_child()
399 zend_bool was_leaf = generator->node.children == 0; in zend_generator_add_child()
402 zend_generator *next = generator->node.parent; in zend_generator_add_child()
403 leaf->node.ptr.root = generator->node.ptr.root; in zend_generator_add_child()
405 generator->node.ptr.leaf = leaf; in zend_generator_add_child()
408 if (next->node.children > 1) { in zend_generator_add_child()
409 if (next->node.children > 4) { in zend_generator_add_child()
410 zend_generator *child = zend_hash_index_find_ptr(&next->node.child.ht, (zend_ulong) generator); in zend_generator_add_child()
411 zend_hash_index_del(&next->node.child.ht, (zend_ulong) generator); in zend_generator_add_child()
412 zend_hash_index_add_ptr(&next->node.child.ht, (zend_ulong) leaf, child); in zend_generator_add_child()
414 switch (next->node.children) { in zend_generator_add_child()
416 if (next->node.child.array[x].leaf == generator) { \ in zend_generator_add_child()
417 next->node.child.array[x].leaf = leaf; \ in zend_generator_add_child()
432 next->node.ptr.leaf = leaf; in zend_generator_add_child()
433 next = next->node.parent; in zend_generator_add_child()
436 zend_generator_add_single_child(&generator->node, child, leaf); in zend_generator_add_child()
437 } else if (generator->node.children == 1) { in zend_generator_add_child()
438 multi_children_node = zend_generator_search_multi_children_node(&generator->node); in zend_generator_add_child()
440 generator->node.children = 0; in zend_generator_add_child()
441 …zend_generator_merge_child_nodes(&generator->node, multi_children_node, generator->node.child.arra… in zend_generator_add_child()
446 multi_children_node = zend_generator_search_multi_children_node(&child->node); in zend_generator_add_child()
452 zend_generator *parent = generator->node.parent, *cur = generator; in zend_generator_add_child()
455 zend_generator_merge_child_nodes(&generator->node, multi_children_node, child); in zend_generator_add_child()
457 zend_generator_add_single_child(&generator->node, child, leaf); in zend_generator_add_child()
460 if (parent->node.children > 1) { in zend_generator_add_child()
462 multi_children_node = zend_generator_search_multi_children_node(&child->node); in zend_generator_add_child()
465 zend_generator_merge_child_nodes(&parent->node, multi_children_node, cur); in zend_generator_add_child()
467 zend_generator_add_single_child(&parent->node, cur, leaf); in zend_generator_add_child()
471 parent = parent->node.parent; in zend_generator_add_child()
480 generator->node.parent = from; in zend_generator_yield_from()
487 zend_generator *old_root, *root = leaf->node.ptr.root; in zend_generator_update_current()
492 root = zend_generator_get_child(&root->node, leaf); in zend_generator_update_current()
501 root = zend_generator_get_child(&root->node, leaf); in zend_generator_update_current()
504 if (root->node.parent) { in zend_generator_update_current()
505 if (root->node.parent->execute_data == NULL) { in zend_generator_update_current()
510 if (Z_ISUNDEF(root->node.parent->retval)) { in zend_generator_update_current()
528 leaf->node.ptr.root = root; in zend_generator_update_current()
529 root->node.parent = NULL; in zend_generator_update_current()
534 return leaf->node.ptr.root; /* this may be updated during zend_generator_resume! */ in zend_generator_update_current()
538 ZVAL_COPY(&root->value, &root->node.parent->value); in zend_generator_update_current()
539 … ZVAL_COPY(ZEND_CALL_VAR(root->execute_data, yield_from->result.var), &root->node.parent->retval); in zend_generator_update_current()
544 root->node.parent = NULL; in zend_generator_update_current()
547 root = root->node.parent; in zend_generator_update_current()
549 } while (root->node.parent); in zend_generator_update_current()
557 return leaf->node.ptr.root = root; in zend_generator_update_current()
746 …e) == IS_UNDEF) && EXPECTED(generator->execute_data) && EXPECTED(generator->node.parent == NULL)) { in zend_generator_ensure_initialized()