ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/State.xs
(Generate patch)

Comparing Coro/Coro/State.xs (file contents):
Revision 1.131 by root, Fri Dec 29 11:37:49 2006 UTC vs.
Revision 1.132 by root, Fri Dec 29 13:03:05 2006 UTC

137 /* the stack */ 137 /* the stack */
138 void *sptr; 138 void *sptr;
139 long ssize; /* positive == mmap, otherwise malloc */ 139 long ssize; /* positive == mmap, otherwise malloc */
140 140
141 /* cpu state */ 141 /* cpu state */
142 void *idle_sp; /* sp of top-level transfer/schedule/cede call */ 142 void *idle_sp; /* sp of top-level transfer/schedule/cede call */
143 JMPENV *idle_te; /* same as idle_sp, but for top_env, TODO: remove once stable */
143 JMPENV *top_env; 144 JMPENV *top_env;
144 coro_context cctx; 145 coro_context cctx;
145 146
146 int inuse; 147 int inuse;
147 148
708 709
709 /* sometimes transfer is only called to set idle_sp */ 710 /* sometimes transfer is only called to set idle_sp */
710 if (!next) 711 if (!next)
711 { 712 {
712 ((coro_cctx *)prev)->idle_sp = STACKLEVEL; 713 ((coro_cctx *)prev)->idle_sp = STACKLEVEL;
713 assert (((coro_cctx *)prev)->top_env = PL_top_env); /* just for the side effetc when assert is enabled */ 714 assert (((coro_cctx *)prev)->idle_te = PL_top_env); /* just for the side-effect when asserts are enabled */
714 } 715 }
715 else if (prev != next) 716 else if (prev != next)
716 { 717 {
717 coro_cctx *prev__cctx; 718 coro_cctx *prev__cctx;
718 719
759 760
760 /* possibly "free" the cctx */ 761 /* possibly "free" the cctx */
761 if (prev__cctx->idle_sp == STACKLEVEL) 762 if (prev__cctx->idle_sp == STACKLEVEL)
762 { 763 {
763 /* I assume that STACKLEVEL is a stronger indicator than PL_top_env changes */ 764 /* I assume that STACKLEVEL is a stronger indicator than PL_top_env changes */
764 assert (PL_top_env == prev__cctx->top_env); 765 assert (("ERROR: current top_env must equal previous top_env", PL_top_env == prev__cctx->idle_te));
765 766
766 prev->cctx = 0; 767 prev->cctx = 0;
767 768
768 cctx_put (prev__cctx); 769 cctx_put (prev__cctx);
769 prev__cctx->inuse = 0; 770 prev__cctx->inuse = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines