Lines Matching refs:tp

92 copy_pattern(int pat, TREE *tp)  in copy_pattern()  argument
95 size_t sz = SIZE(tp) / sizeof (uint64_t); in copy_pattern()
97 uint64_t *datap = (uint64_t *)DATA(tp); in copy_pattern()
115 TREE *tp; in smalloc() local
137 tp = np; in smalloc()
138 SIZE(tp) = size; in smalloc()
139 copy_pattern(FREEPAT, tp); in smalloc()
141 Last[i] = tp; in smalloc()
145 np = NEXT(tp); in smalloc()
147 AFTER(tp) = np; in smalloc()
148 protect(tp); in smalloc()
153 tp = List[i]; in smalloc()
154 unprotect(tp); in smalloc()
155 if ((List[i] = AFTER(tp)) == NULL) in smalloc()
157 copy_pattern(LIVEPAT, tp); in smalloc()
158 SETBIT0(SIZE(tp)); in smalloc()
159 protect(tp); in smalloc()
160 return (DATA(tp)); in smalloc()
177 TREE *tp, *sp, *tmp; in malloc_unlocked() local
198 tp = Root; in malloc_unlocked()
200 unprotect(tp); in malloc_unlocked()
201 if (SIZE(tp) >= size) { /* branch left */ in malloc_unlocked()
202 if (n == 0 || n >= SIZE(tp)) { in malloc_unlocked()
203 sp = tp; in malloc_unlocked()
204 n = SIZE(tp); in malloc_unlocked()
206 if ((tmp = LEFT(tp)) != NULL) { in malloc_unlocked()
207 protect(tp); in malloc_unlocked()
208 tp = tmp; in malloc_unlocked()
210 protect(tp); in malloc_unlocked()
214 if ((tmp = RIGHT(tp)) != NULL) { in malloc_unlocked()
215 protect(tp); in malloc_unlocked()
216 tp = tmp; in malloc_unlocked()
218 protect(tp); in malloc_unlocked()
227 } else if (tp != Root) { in malloc_unlocked()
229 unprotect(tp); in malloc_unlocked()
230 t_splay(tp); in malloc_unlocked()
231 protect(tp); in malloc_unlocked()
232 Root = tp; in malloc_unlocked()
268 tp = NEXT(sp); in malloc_unlocked()
269 SIZE(tp) = n | BIT0; in malloc_unlocked()
270 realfree(DATA(tp)); in malloc_unlocked()
289 TREE *tp, *np; in realloc() local
313 tp = BLOCK(old); in realloc()
314 unprotect(tp); in realloc()
315 ts = SIZE(tp); in realloc()
320 protect(tp); in realloc()
326 CLRBITS01(SIZE(tp)); in realloc()
327 if (size == SIZE(tp)) { /* nothing to do */ in realloc()
328 SIZE(tp) = ts; in realloc()
329 protect(tp); in realloc()
335 if (size < MINSIZE || SIZE(tp) < MINSIZE) { in realloc()
337 SETOLD01(SIZE(tp), ts); in realloc()
346 if (size > SIZE(tp)) { in realloc()
348 np = NEXT(tp); in realloc()
356 SIZE(tp) += SIZE(np) + WORDSIZE; in realloc()
369 if (size > SIZE(tp) && BOTTOM(tp) && GETCORE(0) == Baddr) { in realloc()
370 Bottom = tp; in realloc()
372 if ((tp = morecore(size)) == NULL) { in realloc()
373 tp = Bottom; in realloc()
375 unprotect(tp); in realloc()
381 if (size <= SIZE(tp)) { in realloc()
384 if ((n = (SIZE(tp) - size)) >= MINSIZE + WORDSIZE) { in realloc()
386 SIZE(tp) = size; in realloc()
388 np = NEXT(tp); in realloc()
391 } else if (BOTTOM(tp)) in realloc()
395 SETOLD01(SIZE(tp), ts); in realloc()
396 protect(tp); in realloc()
402 SETOLD01(SIZE(tp), ts); in realloc()
430 CLRBITS01(SIZE(tp)); in realloc()
431 if (SIZE(tp) < MINSIZE) { in realloc()
432 if (size < SIZE(tp)) /* case 1. */ { in realloc()
433 SETOLD01(SIZE(tp), ts); in realloc()
434 protect(tp); in realloc()
445 np = LAST(tp); in realloc()
447 if ((SIZE(np) + SIZE(tp) + WORDSIZE) >= size) { in realloc()
450 SIZE(np) += SIZE(tp) + WORDSIZE; in realloc()
454 (void) memmove(DATA(np), old, SIZE(tp)); in realloc()
456 tp = np; in realloc()
462 SETOLD01(SIZE(tp), ts); in realloc()
463 protect(tp); in realloc()
482 TREE *tp, *sp, *np, *tmp; in realfree() local
489 tp = BLOCK(old); in realfree()
490 unprotect(tp); in realfree()
491 ts = SIZE(tp); in realfree()
493 protect(tp); /* force a watchpoint trap */ in realfree()
494 CLRBIT0(SIZE(tp)); in realfree()
497 CLRBITS01(SIZE(tp)); in realfree()
498 copy_pattern(FREEPAT, tp); in realfree()
501 if (SIZE(tp) < MINSIZE) { in realfree()
502 ASSERT(SIZE(tp) / WORDSIZE >= 1); in realfree()
503 ts = SIZE(tp) / WORDSIZE - 1; in realfree()
504 AFTER(tp) = NULL; in realfree()
505 protect(tp); in realfree()
507 List[ts] = tp; in realfree()
508 Last[ts] = tp; in realfree()
512 AFTER(sp) = tp; in realfree()
514 Last[ts] = tp; in realfree()
521 np = NEXT(tp); in realfree()
528 SIZE(tp) += SIZE(np) + WORDSIZE; in realfree()
533 np = LAST(tp); in realfree()
538 SIZE(np) += SIZE(tp) + WORDSIZE; in realfree()
539 tp = np; in realfree()
543 PARENT(tp) = LEFT(tp) = RIGHT(tp) = LINKFOR(tp) = NULL; in realfree()
546 if (BOTTOM(tp)) in realfree()
547 Bottom = tp; in realfree()
551 size = SIZE(tp); in realfree()
560 LEFT(np) = tp; in realfree()
561 PARENT(tp) = np; in realfree()
570 RIGHT(np) = tp; in realfree()
571 PARENT(tp) = np; in realfree()
579 LEFT(sp) = tp; in realfree()
581 RIGHT(sp) = tp; in realfree()
582 PARENT(tp) = sp; in realfree()
585 Root = tp; in realfree()
590 PARENT(sp) = tp; in realfree()
593 LEFT(tp) = sp; in realfree()
597 PARENT(sp) = tp; in realfree()
600 RIGHT(tp) = sp; in realfree()
603 LINKFOR(tp) = np; in realfree()
604 LINKBAK(np) = tp; in realfree()
612 Root = tp; in realfree()
621 tmp = NEXT(tp); in realfree()
624 *(SELFP(tp)) = tp; in realfree()
628 protect(tp); in realfree()
637 TREE *tp; in morecore() local
642 tp = Bottom; in morecore()
656 if (tp) in morecore()
657 unprotect(tp); in morecore()
662 if (tp != NULL) in morecore()
663 n -= SIZE(tp); in morecore()
672 if (tp) in morecore()
673 protect(tp); in morecore()
691 if (tp) in morecore()
692 protect(tp); in morecore()
701 if (tp) in morecore()
702 protect(tp); in morecore()
709 if (tp) { in morecore()
710 addr = ((char *)tp); in morecore()
711 n += SIZE(tp) + 2 * WORDSIZE; in morecore()
725 tp = ((TREE *)addr); in morecore()
726 SIZE(tp) = n - 2 * WORDSIZE; in morecore()
727 ASSERT((SIZE(tp) % ALIGN) == 0); in morecore()
731 SETBIT0(SIZE(NEXT(tp))); in morecore()
734 if (Bottom && Bottom != tp) { in morecore()
739 return (tp); in morecore()
747 in_list(TREE *tp, TREE **npp) in in_list() argument
752 if (tp == sp) in in_list()
768 TREE *tp; in LEFT1() local
786 while ((tp = *npp++) != NULL) in LEFT1()
787 if (tp != x && tp != y && !in_list(tp, npp)) in LEFT1()
788 protect(tp); in LEFT1()
796 TREE *tp; in RIGHT1() local
814 while ((tp = *npp++) != NULL) in RIGHT1()
815 if (tp != x && tp != y && !in_list(tp, npp)) in RIGHT1()
816 protect(tp); in RIGHT1()
824 TREE *tp; in BULEFT2() local
848 while ((tp = *npp++) != NULL) in BULEFT2()
849 if (tp != x && tp != y && tp != z && !in_list(tp, npp)) in BULEFT2()
850 protect(tp); in BULEFT2()
858 TREE *tp; in BURIGHT2() local
882 while ((tp = *npp++) != NULL) in BURIGHT2()
883 if (tp != x && tp != y && tp != z && !in_list(tp, npp)) in BURIGHT2()
884 protect(tp); in BURIGHT2()
892 TREE *tp; in TDLEFT2() local
910 while ((tp = *npp++) != NULL) in TDLEFT2()
911 if (tp != x && tp != y && tp != z && !in_list(tp, npp)) in TDLEFT2()
912 protect(tp); in TDLEFT2()
921 TREE *tp;
939 while ((tp = *npp++) != NULL)
940 if (tp != x && tp != y && tp != z && !in_list(tp, npp))
941 protect(tp);
951 TREE *tp, *sp, *gp; in t_delete() local
955 tp = LINKBAK(op); in t_delete()
956 unprotect(tp); in t_delete()
959 LINKBAK(sp) = tp; in t_delete()
962 LINKFOR(tp) = sp; in t_delete()
963 protect(tp); in t_delete()
972 if ((tp = LINKFOR(op)) != NULL) { in t_delete()
973 unprotect(tp); in t_delete()
974 PARENT(tp) = NULL; in t_delete()
977 PARENT(sp) = tp; in t_delete()
980 LEFT(tp) = sp; in t_delete()
984 PARENT(sp) = tp; in t_delete()
987 RIGHT(tp) = sp; in t_delete()
989 Root = tp; in t_delete()
990 protect(tp); in t_delete()
995 if ((tp = LEFT(op)) != NULL) { in t_delete()
996 unprotect(tp); in t_delete()
997 PARENT(tp) = NULL; in t_delete()
1000 while ((sp = RIGHT(tp)) != NULL) { in t_delete()
1004 TDLEFT2(tp, sp, gp); in t_delete()
1006 protect(tp); in t_delete()
1007 tp = gp; in t_delete()
1009 LEFT1(tp, sp); in t_delete()
1010 protect(tp); in t_delete()
1011 tp = sp; in t_delete()
1016 RIGHT(tp) = sp = RIGHT(op); in t_delete()
1018 PARENT(sp) = tp; in t_delete()
1021 protect(tp); in t_delete()
1022 } else if ((tp = RIGHT(op)) != NULL) { /* no left subtree */ in t_delete()
1023 unprotect(tp); in t_delete()
1024 PARENT(tp) = NULL; in t_delete()
1025 protect(tp); in t_delete()
1028 Root = tp; in t_delete()
1037 t_splay(TREE *tp) in t_splay() argument
1042 while ((pp = PARENT(tp)) != NULL) { in t_splay()
1050 if (LEFT(pp) == tp) { in t_splay()
1052 BURIGHT2(gp, pp, tp); in t_splay()
1057 RIGHT1(pp, tp); in t_splay()
1060 ASSERT(RIGHT(pp) == tp); in t_splay()
1062 BULEFT2(gp, pp, tp); in t_splay()
1067 LEFT1(pp, tp); in t_splay()
1071 unprotect(tp); /* just in case */ in t_splay()
1404 protect(TREE *tp) in protect() argument
1411 if (tp == NULL || DATA(tp) == Baddr) in protect()
1414 sz = size = SIZE(tp); in protect()
1421 ctl.prwatch.pr_vaddr = (uintptr_t)tp; in protect()
1428 unprotect(TREE *tp) in unprotect() argument
1434 if (tp == NULL || DATA(tp) == Baddr) in unprotect()
1438 ctl.prwatch.pr_vaddr = (uintptr_t)tp; in unprotect()