Using 'inline' in some functions

According to ISO C, "making a function an inline function suggests that
calls to the function be as fast as possible." (Not available in C89.)
This commit is contained in:
Roberto Ierusalimschy
2021-09-15 11:18:41 -03:00
parent 9db4bfed6b
commit 2ff3471722
5 changed files with 32 additions and 15 deletions

12
lapi.c
View File

@@ -86,10 +86,12 @@ static TValue *index2value (lua_State *L, int idx) {
}
}
/*
** Convert a valid actual index (not a pseudo-index) to its address.
*/
static StkId index2stack (lua_State *L, int idx) {
l_sinline StkId index2stack (lua_State *L, int idx) {
CallInfo *ci = L->ci;
if (idx > 0) {
StkId o = ci->func + idx;
@@ -226,7 +228,7 @@ LUA_API void lua_closeslot (lua_State *L, int idx) {
** Note that we move(copy) only the value inside the stack.
** (We do not move additional fields that may exist.)
*/
static void reverse (lua_State *L, StkId from, StkId to) {
l_sinline void reverse (lua_State *L, StkId from, StkId to) {
for (; from < to; from++, to--) {
TValue temp;
setobj(L, &temp, s2v(from));
@@ -446,7 +448,7 @@ LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {
}
static void *touserdata (const TValue *o) {
l_sinline void *touserdata (const TValue *o) {
switch (ttype(o)) {
case LUA_TUSERDATA: return getudatamem(uvalue(o));
case LUA_TLIGHTUSERDATA: return pvalue(o);
@@ -638,7 +640,7 @@ LUA_API int lua_pushthread (lua_State *L) {
*/
static int auxgetstr (lua_State *L, const TValue *t, const char *k) {
l_sinline int auxgetstr (lua_State *L, const TValue *t, const char *k) {
const TValue *slot;
TString *str = luaS_new(L, k);
if (luaV_fastget(L, t, str, slot, luaH_getstr)) {
@@ -713,7 +715,7 @@ LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) {
}
static int finishrawget (lua_State *L, const TValue *val) {
l_sinline int finishrawget (lua_State *L, const TValue *val) {
if (isempty(val)) /* avoid copying empty items to the stack */
setnilvalue(s2v(L->top));
else