lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

attached is a bug fix for a problem with lua_vyield() found by
Jody Belka (thanks a lot!). It's relative to the lua51w5-rvm1 patch.

The Wiki has been updated with a modified patch, too. If you want to
know more about this patch then please have a look at:

http://lua-users.org/wiki/ResumableVmPatch

Bye,
     Mike

--- lua51w5-rvm1/src/ldo.c	2005-03-06 22:57:13.000000000 +0100
+++ lua51w5-rvm2/src/ldo.c	2005-03-20 22:00:29.499030912 +0100
@@ -474,10 +474,11 @@
   }
   else {  /* resumable yield from C */
     StkId rbase = L->base;
-    if (rbase < base)
+    if (rbase < base) {
       while (base < L->top)
         setobjs2s(L, rbase++, base++);  /* move results down */
-    L->top = rbase;
+      L->top = rbase;
+    }
     L->base = L->ci->base;  /* restore invariant */
   }
   return f_continue(L, (void *)(ptrdiff_t)0);  /* resume remaining frames */