diff options
Diffstat (limited to 'src/lj_api.c')
-rw-r--r-- | src/lj_api.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lj_api.c b/src/lj_api.c index 5a0bd07a..8d35e0d0 100644 --- a/src/lj_api.c +++ b/src/lj_api.c | |||
@@ -1103,6 +1103,9 @@ LUA_API int lua_yield(lua_State *L, int nresults) | |||
1103 | while (--nresults >= 0) copyTV(L, t++, f++); | 1103 | while (--nresults >= 0) copyTV(L, t++, f++); |
1104 | L->top = t; | 1104 | L->top = t; |
1105 | } | 1105 | } |
1106 | L->cframe = NULL; | ||
1107 | L->status = LUA_YIELD; | ||
1108 | return -1; | ||
1106 | } else { /* Yield from hook: add a pseudo-frame. */ | 1109 | } else { /* Yield from hook: add a pseudo-frame. */ |
1107 | TValue *top = L->top; | 1110 | TValue *top = L->top; |
1108 | hook_leave(g); | 1111 | hook_leave(g); |
@@ -1112,14 +1115,14 @@ LUA_API int lua_yield(lua_State *L, int nresults) | |||
1112 | setframe_gc(top+2, obj2gco(L)); | 1115 | setframe_gc(top+2, obj2gco(L)); |
1113 | setframe_ftsz(top+2, (int)((char *)(top+3)-(char *)L->base)+FRAME_CONT); | 1116 | setframe_ftsz(top+2, (int)((char *)(top+3)-(char *)L->base)+FRAME_CONT); |
1114 | L->top = L->base = top+3; | 1117 | L->top = L->base = top+3; |
1115 | } | ||
1116 | #if LJ_TARGET_X64 | 1118 | #if LJ_TARGET_X64 |
1117 | lj_err_throw(L, LUA_YIELD); | 1119 | lj_err_throw(L, LUA_YIELD); |
1118 | #else | 1120 | #else |
1119 | L->cframe = NULL; | 1121 | L->cframe = NULL; |
1120 | L->status = LUA_YIELD; | 1122 | L->status = LUA_YIELD; |
1121 | lj_vm_unwind_c(cf, LUA_YIELD); | 1123 | lj_vm_unwind_c(cf, LUA_YIELD); |
1122 | #endif | 1124 | #endif |
1125 | } | ||
1123 | } | 1126 | } |
1124 | lj_err_msg(L, LJ_ERR_CYIELD); | 1127 | lj_err_msg(L, LJ_ERR_CYIELD); |
1125 | return 0; /* unreachable */ | 1128 | return 0; /* unreachable */ |