• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /barrelfish-2018-10-04/usr/eclipseclp/Kernel/src/

Lines Matching defs:self

1403 /* Covention: the subject node/leaf, often named as 'self', has been locked,
1410 static void sch_msg_hdl_backtrack(self, leaf)
1411 st_id_t *self, *leaf;
1415 Smsg_Hdl_Notify(SMSG_BACKTRACK,self,leaf);
1416 if (Alive(Trunk(self))) {
1417 sch_msg_hdl_backtrack_(self, leaf);
1420 assert(Chopped(Trunk(self)));
1421 Sch_Unlock(self);
1426 void sch_msg_hdl_backtrack_(self, leaf)
1427 st_id_t *self, *leaf;
1429 int alt = Bk_NextClause(self); alt = Tk_NextClause(self);
1430 UpdateLmp(self);
1431 AliveTwigs(self)--;
1432 SetNalive(Twig(self),ST_LODGED);
1438 if (alt && (AliveTwigs(self) || !Exhausted(self))) {
1439 Quit_Chain(Twig(self));
1440 Join_Chain_Next(Twig(self),Trunk(self)->prev);
1441 SetAlive(Twig(self));
1442 AliveTwigs(self)++;
1443 SetPoor(Twig(self));
1444 Smsg_ShortCut_End(self, leaf,
1445 sch_msg_hdl_js_success(leaf, self, alt, Twig(self)->info),
1446 sch_msg_snd_js_success(leaf, self, alt, Twig(self)->info)
1449 } else if (alt || (!AliveTwigs(self)&&(ComnSite(self,leaf)||!Local(self)))) {
1450 assert(!SchRoot(self));
1451 SetNalive(Trunk(self), ST_DYING);
1452 if (!alt && Hybrid(self)) alt = -1;
1453 Smsg_ShortCut_End(self, SupTree(self),
1454 sch_msg_hdl_straighten(SupTree(self),self,leaf,self,alt),
1455 sch_msg_snd_straighten(SupTree(self),self,leaf,self,alt)
1458 } else if (!AliveTwigs(self) && Suspended(self)) {
1459 st_susp_t **x = &Suspended(self);
1462 if (ComnSite(self,&((*x)->leaf))) {
1465 SetNalive(Trunk(self), ST_DYING);
1466 if (Hybrid(self)) alt = -1;
1467 Smsg_ShortCut_Mid(self, SupTree(self),
1468 sch_msg_hdl_straighten(SupTree(self),self,&(y->leaf),self,alt),
1469 sch_msg_snd_straighten(SupTree(self),self,&(y->leaf),self,alt)
1471 Sch_Gc_Suspended(Site(self),y);
1479 if (ComnSite(self,SupTree(self)) && !PoorSpine(self) && !JsRoot(self) &&
1480 !(Local(self)&&ComnSite(self,leaf))) {
1481 Smsg_ShortCut_End(self,SupTree(self),
1482 sch_msg_hdl_js_prologue(SupTree(self),self,leaf),
1483 sch_msg_snd_js_prologue(SupTree(self),self,leaf)
1486 st_id_t *coma = self;
1487 SetPoorSpine(self);
1488 Sch_JS_Trav_Down(self,coma,leaf);
1489 Sch_JS_Trav_Up(self,coma,leaf);
1495 static void sch_msg_hdl_straighten(self,child,leaf,parent,alt)
1496 st_id_t *self, *child, *leaf, *parent;
1500 Smsg_Hdl_Notify(SMSG_STRAIGHTEN,self,child);
1501 if (Alive(Twig(self))) {
1502 AliveTwigs(self)--;
1503 if (!Exhausted(self)||(AliveTwigs(self)||PsRoot(self)||SchRoot(self))) {
1505 Add_Alive_Twig_Next(&twig,leaf,Knot(self),Twig(self));
1506 Twig(&twig)->info = Twig(self)->info;
1507 if (JsRoot(self) && Monad(self) && !Suspended(self)) {
1524 } else if (!Exhausted(self)) {
1525 alt = Bk_NextClause(self);
1526 alt = Tk_NextClause(self);
1527 if (!Exhausted(self)||(AliveTwigs(self)||PsRoot(self)||SchRoot(self))) {
1528 Add_Alive_Twig_Next(&twig,leaf,Knot(self),Twig(self));
1529 Twig(&twig)->info = Twig(self)->info;
1530 SetPoor(Twig(self));
1536 SetNalive(Trunk(self),ST_DYING);
1537 Smsg_ShortCut_Mid(self, SupTree(self),
1538 sch_msg_hdl_straighten(SupTree(self),self,leaf,self,alt),
1539 sch_msg_snd_straighten(SupTree(self),self,leaf,self,alt)
1542 } else if (PsRoot(self) && !AliveTwigs(self)) {
1543 if (!Local(self) || ComnSite(self,leaf)) {
1544 SetNalive(Trunk(self),ST_DYING);
1545 if (Hybrid(self)) alt = -1;
1546 Smsg_ShortCut_Mid(self, SupTree(self),
1547 sch_msg_hdl_straighten(SupTree(self),self,leaf,self,alt),
1548 sch_msg_snd_straighten(SupTree(self),self,leaf,self,alt)
1551 if (Suspended(self)) {
1552 st_susp_t **x = &Suspended(self);
1555 if (ComnSite(self,&((*x)->leaf))) {
1558 SetNalive(Trunk(self), ST_DYING);
1559 if (Hybrid(self)) alt = -1;
1560 Smsg_ShortCut_Mid(self, SupTree(self),
1561 sch_msg_hdl_straighten(SupTree(self),self,&(y->leaf),self,alt),
1562 sch_msg_snd_straighten(SupTree(self),self,&(y->leaf),self,alt)
1564 Sch_Gc_Suspended(Site(self),y);
1571 Add_Lodge_Twig(&twig,leaf,Knot(self));
1577 } else if (Local(self)&&ComnSite(self,leaf)) {
1579 Sch_Alloc_Suspended(Site(self), x);
1580 x->next = Suspended(self);
1582 x->coma = *(self);
1583 Suspended(self) = x;
1584 } else if (!JsRoot(self) && !PoorSpine(self)
1585 && ComnSite(self,leaf)
1586 && ComnSite(self,SubTree(self))
1587 && ComnSite(self,SupTree(self))) {
1588 Smsg_ShortCut_Mid(self, SupTree(self),
1589 sch_msg_hdl_js_prologue(SupTree(self),self,leaf),
1590 sch_msg_snd_js_prologue(SupTree(self),self,leaf)
1593 Add_Lodge_Twig(&twig,leaf,Knot(self));
1599 SetNalive(Twig(self),ST_CHOPPED);
1600 Smsg_ShortCut_End(self, SubTree(self),
1601 sch_msg_hdl_chop(SubTree(self),self,self),
1602 sch_msg_snd_chop(SubTree(self),self,self)
1606 SetNalive(Trunk(self),ST_DYING);
1607 SetNalive(Twig(self),ST_DYING);
1608 if (!alt && Hybrid(self)) alt = -1;
1609 Smsg_ShortCut_End(self, SupTree(self),
1610 sch_msg_hdl_straighten(SupTree(self),self,leaf,parent,alt),
1611 sch_msg_snd_straighten(SupTree(self),self,leaf,parent,alt)
1616 assert(!Alive(Trunk(self))); /* i.e. whole subtree chopped */
1617 if (ComnSite(self,SupTree(self)) && ComnSite(self,leaf) &&
1618 !PoorSpine(self) && !PoorSpine(SupTree(self))) {
1619 Smsg_ShortCut_End(self, SupTree(self),
1620 sch_msg_hdl_js_prologue(SupTree(self),self,leaf),
1621 sch_msg_snd_js_prologue(SupTree(self),self,leaf)
1624 Smsg_ShortCut_End(self,SupTree(self),
1625 sch_msg_hdl_lodge(SupTree(self),self,leaf),
1626 sch_msg_snd_lodge(SupTree(self),self,leaf)
1633 static void sch_msg_hdl_js_prologue(self, child, leaf)
1634 st_id_t *self, *child, *leaf;
1636 Smsg_Hdl_Notify(SMSG_JS_PROLOGUE, self, child);
1637 if (!Exhausted(self)) { /* it does not care about the twig state */
1639 int alt = Bk_NextClause(self); /* value not interesting */
1640 alt = Tk_NextClause(self);
1641 Add_Alive_Twig_Next(&twig,leaf,Knot(self),Trunk(self)->prev);
1650 if (Alive(Trunk(self)) && (JsRoot(self) || PoorSpine(self) ||
1651 !ComnSite((self),SupTree(self)) || PoorSpine(SupTree(self)) ||
1652 (ComnSite(self,leaf) && Local(self)))) {
1653 Smsg_ShortCut_End(self,leaf,
1654 sch_msg_hdl_js_in_vain(leaf,self),
1655 sch_msg_snd_js_in_vain(leaf,self)
1658 } else if (ComnSite((self),SupTree(self))) {
1659 Smsg_ShortCut_End(self, SupTree(self),
1660 sch_msg_hdl_js_prologue(SupTree(self),self,leaf),
1661 sch_msg_snd_js_prologue(SupTree(self),self,leaf)
1665 Smsg_ShortCut_End(self, SupTree(self),
1666 sch_msg_hdl_lodge(SupTree(self),self,leaf),
1667 sch_msg_snd_lodge(SupTree(self),self,leaf)
1761 static void sch_msg_hdl_cut(self, olf, leaf)
1762 st_id_t *self, *olf, *leaf;
1765 Smsg_Hdl_Notify(SMSG_CUT, self, olf);
1766 if (Alive(Twig(self))) { /* the cut wins */
1767 AliveTwigs(self)--;
1768 Add_Alive_Twig_Next(&twig,leaf,Knot(self),Twig(self));
1769 Twig(&twig)->info = Twig(self)->info;
1770 if (JsRoot(self) && Monad(self) && !Suspended(self)) {
1787 SetNalive(Twig(self),ST_CHOPPED);
1788 Smsg_ShortCut_End(self, SubTree(self),
1789 sch_msg_hdl_chop(SubTree(self), self, self),
1790 sch_msg_snd_chop(SubTree(self), self, self)
1793 } else if (Exhausted(self)) {
1794 Add_Lodge_Twig(&twig,leaf,Knot(self));
1801 int alt = Bk_NextClause(self);
1802 alt = Tk_NextClause(self);
1803 Add_Alive_Twig_Next(&twig,leaf,Knot(self), Trunk(self)->prev);
1847 static void sch_msg_hdl_lodge(self, child, leaf)
1848 st_id_t *self, *child, *leaf;
1850 Smsg_Hdl_Notify(SMSG_LODGE, self, child);
1851 if (AliveTwigs(self)) {
1853 if (Exhausted(self)) {
1854 Add_Lodge_Twig(&twig,leaf,Knot(self));
1861 int alt = Bk_NextClause(self); /* value not interesting */
1862 alt = Tk_NextClause(self);
1863 Add_Alive_Twig_Next(&twig,leaf,Knot(self),Trunk(self)->prev);
1872 } else if (Alive(Trunk(self))&&Local(self)&&ComnSite(self,leaf)) {
1873 int alt = Hybrid(self) ? (-1):0;
1874 SetNalive(Trunk(self), ST_DYING);
1875 Smsg_ShortCut_End(self,SupTree(self),
1876 sch_msg_hdl_straighten(SupTree(self),self,leaf,self,alt),
1877 sch_msg_snd_straighten(SupTree(self),self,leaf,self,alt)
1881 Smsg_ShortCut_End(self, SupTree(self),
1882 sch_msg_hdl_lodge(SupTree(self), self, leaf),
1883 sch_msg_snd_lodge(SupTree(self), self, leaf)
1938 static void sch_msg_hdl_withered(self,child)
1939 st_id_t *self, *child;
1941 Smsg_Hdl_Notify(SMSG_WITHERED, self,child);
1942 assert(Chopped(Twig(self)) || Lodged(Twig(self)));
1943 Quit_Chain(Twig(self));
1944 Sch_Gc_Edge(Site(self),Twig(self));
1945 if (Twigless(self)) {
1946 if (Chopped(Trunk(self))) {
1947 Smsg_ShortCut_End(self, SupTree(self),
1948 sch_msg_hdl_withered(SupTree(self),self),
1949 sch_msg_snd_withered(SupTree(self),self)
1951 Sch_Gc_Knot(self);
1954 assert(Dying(Trunk(self)));
1957 Sch_Unlock(self);
1963 static void sch_msg_hdl_chop(self,parent,ancestor)
1964 st_id_t *self, *parent, *ancestor;
1966 Smsg_Hdl_Notify(SMSG_CHOP,self,parent);
1969 if (IsNode(self)) {
1970 st_edge_t *x = Trunk(self)->next;
1972 st_id_t twig; twig = *self;
1974 SetNalive(Trunk(self),ST_CHOPPED);
1975 SetExhausted(self);
1977 if (Suspended(self)) {
1979 assert(JsRoot(self) || Local(self));
1980 relocate_suspended(self);
1983 while (x != Trunk(self)) {
1985 if (Alive(x)) AliveTwigs(self)--;
1987 if (!y && ComnSite(self,&(x->tree)))
1999 assert(!AliveTwigs(self));
2007 if (Twigless(self)) {
2008 Smsg_ShortCut_End(self,SupTree(self),
2009 sch_msg_hdl_withered(SupTree(self),self),
2010 sch_msg_snd_withered(SupTree(self),self)
2014 Sch_Unlock(self);
2021 switch (Life(Trunk(self))) {
2024 assert(!Suspended(self));
2025 Scheduler(Site(self))->lmp = 0;
2026 eng_stop(LeafEngine(self));
2028 if (!Scheduler(Site(self))->idling) {
2029 SetNalive(Trunk(self),ST_LODGED);
2030 if (ComnSite(SupTree(self),ancestor)) {
2031 Smsg_ShortCut_End(self, ancestor,
2032 sch_msg_hdl_js_prologue(ancestor, self, self),
2033 sch_msg_snd_js_prologue(ancestor, self, self)
2037 Smsg_ShortCut_End(self, ancestor,
2038 sch_msg_hdl_js_again(ancestor,self),
2039 sch_msg_snd_js_again(ancestor,self)
2044 Scheduler(Site(self))->idling = 0;
2046 SetNalive(Trunk(self),ST_LODGED);
2047 Smsg_ShortCut_End(self,ancestor,
2048 sch_msg_hdl_lodge_idle(ancestor,self,self),
2049 sch_msg_snd_lodge_idle(ancestor,self,self)
2053 SetNalive(Trunk(self),ST_CHOPPED);
2054 Sch_Unlock(self);
2058 gb = *self;
2059 Smsg_ShortCut_End(self, SupTree(self),
2060 sch_msg_hdl_withered(SupTree(self), self),
2061 sch_msg_snd_withered(SupTree(self), self)
2071 void relocate_suspended(self)
2072 st_id_t *self;
2076 while (s = Suspended(self)) {
2077 ncoma = ComnNode(self, &(s->coma)) ? SupTree(self) : &(s->coma);
2078 Smsg_ShortCut_Mid((self),SupTree(self),
2079 sch_msg_hdl_js_trav_up(SupTree(self), self, ncoma, &(s->leaf)),
2080 sch_msg_snd_js_trav_up(SupTree(self), self, ncoma, &(s->leaf))
2082 Suspended(self) = s->next;
2083 Sch_Gc_Suspended(Site(self),s);
2116 static void sch_msg_hdl_js_again(self,leaf)
2117 st_id_t *self, *leaf;
2120 Smsg_Hdl_Notify(SMSG_JS_AGAIN, self, leaf);
2121 if (Alive(Trunk(self))) {
2122 sch_msg_hdl_js_trav_up_(self,self,leaf);
2125 Smsg_ShortCut_End(self, SupTree(self),
2126 sch_msg_hdl_lodge(SupTree(self), self, leaf),
2127 sch_msg_snd_lodge(SupTree(self), self, leaf)
2134 static void sch_msg_hdl_js_trav_dn(self,parent,coma,leaf)
2135 st_id_t *self, *parent, *coma, *leaf;
2137 unsigned root_first = Scheduler(Site(self))->root_first;
2138 Smsg_Hdl_Notify(SMSG_JS_TRAV_DN, self,parent);
2141 if (Alive(Trunk(self))) {
2142 if (IsNode(self)) {
2144 if (Knot(self)->nxtcls_b) {
2148 Sch_JS_Trav_Down(self,coma,leaf);
2150 st_edge_t *x = Trunk(self)->prev;
2151 while (x != Trunk(self)) {
2152 if (ComnSite(self,&(x->tree))) {
2156 Sch_Unlock(self);
2157 self = &(x->tree);
2158 x = Trunk(self)->prev;
2169 Bk_NextClause0(self);
2170 Add_Lodge_Twig(&lodge, leaf, Knot(self));
2171 Sch_JS_Install(self, &lodge, coma, leaf);
2176 SetPoorSpine(self);
2178 Sch_JS_Trav_Down(self,coma,leaf);
2181 if (Rich(Trunk(self))) {
2182 int max = (root_first) ? Scheduler(Site(self))->max_to_publish
2185 if (!eng_publish(LeafEngine(self), max, &left)) {
2186 st_id_t *nlf = SiteLeaf(Site(self));
2199 assert(!JsRoot(self)||!Suspended(self));
2200 nlf = *SiteLeaf(Site(self));
2206 st_id_t *last = self;
2217 Scheduler(Site(self))->state_donate++;
2229 if (Sch_Lock(self)) {
2238 Sch_JS_Trav_Up(self,coma,leaf);
2241 void sch_msg_hdl_js_trav_up_(self, coma, leaf)
2242 st_id_t *self, *coma, *leaf;
2244 unsigned root_first = Scheduler(Site(self))->root_first;
2245 if (Alive(Trunk(self))) {
2247 Sch_JS_Trav_Down(self,coma,leaf);
2249 if (!Exhausted(self) && ComnNode(self,coma)) {
2251 int alt = Bk_NextClause(self); /* value not interesting */
2252 alt = Tk_NextClause(self);
2253 Add_Alive_Twig_Next(&twig,leaf,Knot(self),Trunk(self)->prev);
2262 if (Bk_NextClause(self)) {
2264 Add_Lodge_Twig(&lodge,leaf,Knot(self));
2265 Sch_JS_Install(self, &lodge, coma, leaf);
2270 SetPoorSpine(self);
2271 Sch_JS_Trav_Down(self,coma,leaf);
2273 assert(!Rich(Trunk(self)) || JsRoot(self));
2275 Sch_JS_Trav_Up(self,coma,leaf);
2279 static void sch_msg_hdl_js_trav_up(self, child, coma, leaf)
2280 st_id_t *self, *child, *coma, *leaf;
2282 SetPoor(Twig(self));
2283 Smsg_Hdl_Notify(SMSG_JS_TRAV_UP, self, child);
2284 sch_msg_hdl_js_trav_up_(self, coma, leaf);
2287 static void sch_msg_hdl_js_install(self,parent,lodge,coma,leaf)
2288 st_id_t *self, *parent, *lodge, *coma, *leaf;
2290 Smsg_Hdl_Notify(SMSG_JS_INSTALL, self,parent);
2291 if (IsNode(self)) {
2292 Sch_JS_Install(self, lodge, coma, leaf);
2294 } else if (Alive(Trunk(self))||Idle(Trunk(self))) {
2296 eng_donate_state(LeafEngine(self),(st_handle_t *)lodge,
2298 Scheduler(Site(self))->state_donate++;
2299 Sch_Unlock(self);
2302 Smsg_ShortCut_End(self, lodge,
2303 sch_msg_hdl_js_install_fl(lodge, self, coma, leaf),
2304 sch_msg_snd_js_install_fl(lodge, self, coma, leaf)
2310 static void sch_msg_hdl_engine_migrate(self, leaf)
2311 st_id_t *self, *leaf;
2313 Smsg_Hdl_Notify(SMSG_ENGINE_MIGRATE, self, leaf);
2314 assert(ComnNode(SubTree(self),leaf) && Lodged(Twig(self)));
2315 if (Exhausted(self)) {
2316 if (ComnSite(self,SupTree(self)) && !PoorSpine(self) && !JsRoot(self)) {
2317 Smsg_ShortCut_End(self,SupTree(self),
2318 sch_msg_hdl_js_prologue(SupTree(self),self,leaf),
2319 sch_msg_snd_js_prologue(SupTree(self),self,leaf)
2324 st_id_t coma; coma = *self;
2325 sch_msg_hdl_js_trav_up_(self,&coma,leaf);
2329 int alt = Tk_NextClause(self);
2330 Quit_Chain(Twig(self));
2331 Join_Chain_Next(Twig(self),Trunk(self)->prev);
2332 AliveTwigs(self)++;
2333 SetAlive(Twig(self));
2334 SetPoor(Twig(self));
2335 CheckLmp(self);
2336 Smsg_ShortCut_End(self,leaf,
2337 sch_msg_hdl_js_success(leaf,self,alt,Twig(self)->info),
2338 sch_msg_snd_js_success(leaf,self,alt,Twig(self)->info)
2344 static void sch_msg_hdl_js_install_fl(self, child, coma, leaf)
2345 st_id_t *self, *child, *coma, *leaf;
2347 Smsg_Hdl_Notify(SMSG_JS_INSTALL_FL, self, child);
2348 if (Exhausted(self)) {
2349 st_id_t garbage; garbage = *self;
2350 Quit_Chain(Twig(self));
2351 Sch_JS_Trav_Down(self,coma,leaf);
2352 Sch_JS_Trav_Up(self,coma,leaf);
2355 st_edge_t *x = Trunk(self)->prev;
2356 while (x != Trunk(self)) {
2358 st_id_t twig; twig = *self;
2360 sch_msg_snd_js_install(SubTree(&twig),&twig,self,coma,leaf);
2361 Sch_Unlock(self);
2371 static void sch_msg_hdl_load_report(self, child)
2372 st_id_t *self, *child;
2374 Smsg_Hdl_Notify(SMSG_LOAD_REPORT, self, child);
2375 if (!Alive(Twig(self))) {
2376 Sch_Unlock(self);
2385 /*assert(!Rich(Twig(self)));*/
2386 SetRich(Twig(self));
2387 if (JsRoot(self) && Monad(self) && Exhausted(self)) {
2388 assert(Rich(Trunk(self)));
2389 Smsg_ShortCut_Mid(self, SubTree(self),
2390 sch_msg_hdl_set_js_root(SubTree(self), self),
2391 sch_msg_snd_set_js_root(SubTree(self), self)
2394 if (Suspended(self)) {
2396 assert(JsRoot(self) || Local(self));
2397 while (x = Suspended(self)) {
2398 Smsg_ShortCut_Mid((self),SubTree(self),
2399 sch_msg_hdl_js_trav_dn(SubTree(self), self, &(x->coma), &(x->leaf)),
2400 sch_msg_snd_js_trav_dn(SubTree(self), self, &(x->coma), &(x->leaf))
2402 Suspended(self) = x->next;
2403 Sch_Gc_Suspended(Site(self),x);
2406 if (!Rich(Trunk(self))) { /* further report up */
2407 assert(!JsRoot(self));
2408 SetRich(Trunk(self));
2409 Smsg_ShortCut_End(self, SupTree(self),
2410 sch_msg_hdl_load_report(SupTree(self), self),
2411 sch_msg_snd_load_report(SupTree(self), self)
2415 Sch_Unlock(self);
2421 static void sch_msg_hdl_set_js_root(self, parent)
2422 st_id_t *self, *parent;
2424 Smsg_Hdl_Notify(SMSG_SET_JS_ROOT, self, parent);
2425 if (Rich(Trunk(self))) {
2426 SetJsRoot(self);
2427 /* assert(!Suspended(self) || Local(self)); */
2428 if (Monad(self) && Exhausted(self) && !Suspended(self)) {
2430 st_edge_t *x = Trunk(self)->next;
2431 while (x != Trunk(self)) {
2433 twig = *self;
2446 Sch_Unlock(self);
2451 static void sch_msg_hdl_stop_idle(self,leaf)
2452 st_id_t *self, *leaf;
2454 Smsg_Hdl_Notify(SMSG_STOP_IDLE, self, leaf);
2455 if (!Alive(Trunk(self))) {
2456 if (Chopped(Trunk(self))) {
2457 Sch_Unlock(self);
2460 assert(Dying(Trunk(self)));
2461 assert(Idle(Twig(self)));
2462 SetNalive(Twig(self),ST_LODGED);
2463 if (ComnSite(self,SupTree(self)) && !PoorSpine(self) &&
2464 !PoorSpine(SupTree(self))) {
2465 Smsg_ShortCut_End(self, SupTree(self),
2466 sch_msg_hdl_js_prologue(SupTree(self),self,leaf),
2467 sch_msg_snd_js_prologue(SupTree(self),self,leaf)
2471 Smsg_ShortCut_End(self, SupTree(self),
2472 sch_msg_hdl_lodge(SupTree(self),self,leaf),
2473 sch_msg_snd_lodge(SupTree(self),self,leaf)
2479 int alt = Bk_NextClause(self);
2480 alt = Tk_NextClause(self);
2484 assert(alt || AliveTwigs(self) || Local(self));
2485 assert(Idle(Twig(self)));
2486 SetNalive(Twig(self),ST_LODGED);
2487 if (alt && (AliveTwigs(self)||!Exhausted(self))) {
2488 Quit_Chain(Twig(self));
2489 Join_Chain_Next(Twig(self),Trunk(self)->prev);
2490 AliveTwigs(self)++;
2491 SetAlive(Twig(self));
2492 SetPoor(Twig(self));
2493 Smsg_ShortCut_End(self, leaf,
2494 sch_msg_hdl_js_success(leaf, self, alt, Twig(self)->info),
2495 sch_msg_snd_js_success(leaf, self, alt, Twig(self)->info)
2498 } else if (alt || (!AliveTwigs(self)&&ComnSite(self,leaf))) {
2499 SetNalive(Trunk(self),ST_DYING);
2500 if (!alt && Hybrid(self)) alt = -1;
2501 Smsg_ShortCut_End(self, SupTree(self),
2502 sch_msg_hdl_straighten(SupTree(self),self,leaf,self,alt),
2503 sch_msg_snd_straighten(SupTree(self),self,leaf,self,alt)
2506 } else if (ComnSite(self,SupTree(self)) && !PoorSpine(self) &&
2507 !PoorSpine(SupTree(self))) {
2508 Smsg_ShortCut_End(self, SupTree(self),
2509 sch_msg_hdl_js_prologue(SupTree(self),self,leaf),
2510 sch_msg_snd_js_prologue(SupTree(self),self,leaf)
2514 st_id_t *coma = self;
2515 SetPoorSpine(self);
2516 Sch_JS_Trav_Down(self,coma,leaf);
2517 Sch_JS_Trav_Up(self,coma,leaf);
2523 static void sch_msg_hdl_tell_idle(self,leaf)
2524 st_id_t *self, *leaf;
2526 Smsg_Hdl_Notify(SMSG_TELL_IDLE, self, leaf);
2527 if (Alive(Twig(self))) {
2528 if (Monad(self) && Exhausted(self)) {
2531 sch_msg_hdl_backtrack_(self,leaf);
2534 UpdateLmp(self);
2535 AliveTwigs(self)--;
2536 SetNalive(Twig(self),ST_IDLE);
2537 Smsg_ShortCut_End(self, leaf,
2538 sch_msg_hdl_idle_told(leaf, self),
2539 sch_msg_snd_idle_told(leaf, self)
2543 Sch_Unlock(self);
2549 static void sch_msg_hdl_lodge_idle(self,child,leaf)
2550 st_id_t *self, *child, *leaf;
2552 Smsg_Hdl_Notify(SMSG_LODGE_IDLE,self,child);
2553 if (Alive(Trunk(self))) {
2555 Add_Lodge_Twig(&idle,leaf,Knot(self));
2563 assert(!SchRoot(self));
2564 Smsg_ShortCut_End(self,SupTree(self),
2565 sch_msg_hdl_lodge_idle(SupTree(self),self,leaf),
2566 sch_msg_snd_lodge_idle(SupTree(self),self,leaf)
2663 static void sch_msg_hdl_reduce_wk_up(self,child)
2664 st_id_t *self, *child;
2666 Smsg_Hdl_Notify(SMSG_REDUCE_WK_UP,self,child);
2667 if (Alive(Trunk(self)) && JsRoot(self)) {
2668 if (Suspended(self)) {
2669 Sch_WakeUp_Suspended(self);
2670 Sch_Unlock(self);
2673 if (!Alive(Twig(self)) && Monad(self) && Exhausted(self)) {
2674 st_edge_t *x = Trunk(self)->next;
2675 while (x != Trunk(self)) {
2680 twig = *self;
2692 Sch_Unlock(self);
2695 assert(!Suspended(self));
2696 Smsg_ShortCut_End(self,SupTree(self),
2697 sch_msg_hdl_reduce_wk_up(SupTree(self),self),
2698 sch_msg_snd_reduce_wk_up(SupTree(self),self)
2704 static void sch_msg_hdl_reduce_wk_dn(self, parent)
2705 st_id_t *self, *parent;
2707 Smsg_Hdl_Notify(SMSG_REDUCE_WK_DN, self, parent);
2708 if (!Alive(Trunk(self))) {
2709 Smsg_ShortCut_End(self,SupTree(self),
2710 sch_msg_hdl_reduce_wk_up(SupTree(self),self),
2711 sch_msg_snd_reduce_wk_up(SupTree(self),self)
2715 if (JsRoot(self)) {
2716 if (Suspended(self)) {
2717 Sch_WakeUp_Suspended(self);
2718 Sch_Unlock(self);
2721 if (Monad(self) && Exhausted(self)) {
2722 st_edge_t *x = Trunk(self)->next;
2723 while (x != Trunk(self)) {
2728 twig = *self;
2741 Sch_Unlock(self);
2786 static void sch_msg_hdl_lmp(self, parent)
2787 st_id_t *self, *parent;
2789 Smsg_Hdl_Notify(SMSG_LMP, self, parent);
2790 if (Alive(Trunk(self))) {
2791 SetEldest(Trunk(self));
2792 if (IsLeaf(self)) {
2793 if (Scheduler(Site(self))->lmp) {
2794 Scheduler(Site(self))->lmp = 0;
2795 eng_lmp(LeafEngine(self));
2797 } else if (AliveTwigs(self)) {
2800 st_edge_t *x = Trunk(self)->next;
2801 while (x != Trunk(self)) {
2803 twig = *self;
2817 Sch_Unlock(self);