From 490d42b5f89563a94994505c75e24086b0a487e6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 24 Sep 2020 13:26:51 -0300 Subject: Correct handling of 'luaV_execute' invocations The previous stackless implementations marked all 'luaV_execute' invocations as fresh. However, re-entering 'luaV_execute' when resuming a coroutine should not be a fresh invocation. (It works because 'unroll' called 'luaV_execute' for each call entry, but it was slower than letting 'luaV_execute' finish all non-fresh invocations.) --- lstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lstate.c') diff --git a/lstate.c b/lstate.c index bd1b5120..13c1ff0f 100644 --- a/lstate.c +++ b/lstate.c @@ -172,7 +172,7 @@ void luaE_checkcstack (lua_State *L) { LUAI_FUNC void luaE_incCstack (lua_State *L) { L->nCcalls++; - if (getCcalls(L) >= LUAI_MAXCCALLS) + if (unlikely(getCcalls(L) >= LUAI_MAXCCALLS)) luaE_checkcstack(L); } -- cgit v1.2.3-55-g6feb