From be65484febc5441576e6d49ea6c97eeabc74e44a Mon Sep 17 00:00:00 2001 From: annelin Date: Thu, 20 May 2021 09:17:37 +0300 Subject: [PATCH] Removed RAVI_DEFER_STATEMENT define (there are no reasons to disable it) --- include/lua.h | 3 --- include/luaconf.h | 1 - ravicomp/src/codegen.c | 20 -------------- src/lcorolib.c | 2 -- src/ldo.c | 14 ---------- src/lfunc.c | 26 ------------------- src/lfunc.h | 6 ----- src/llex.c | 4 --- src/llex.h | 4 --- src/lobject.h | 4 --- src/lopcodes.c | 4 --- src/lopcodes.h | 6 ----- src/lparser.c | 59 ------------------------------------------ src/lstate.c | 10 ------- src/lvm.c | 21 --------------- src/lvm.h | 2 -- src/ravi_jitshared.c | 4 --- src/ravi_mirjit.c | 2 -- 18 files changed, 192 deletions(-) diff --git a/include/lua.h b/include/lua.h index d369b83..2b97350 100644 --- a/include/lua.h +++ b/include/lua.h @@ -226,10 +226,7 @@ extern const char lua_ident[]; LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); LUA_API void (lua_close) (lua_State *L); LUA_API lua_State *(lua_newthread) (lua_State *L); -#ifdef RAVI_DEFER_STATEMENT LUA_API int (lua_resetthread) (lua_State *L); -#endif -LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); LUA_API const lua_Number *(lua_version) (lua_State *L); diff --git a/include/luaconf.h b/include/luaconf.h index 2a7ddb1..dcc5660 100644 --- a/include/luaconf.h +++ b/include/luaconf.h @@ -852,7 +852,6 @@ /* Following cause the first hash lookup to be inlined, and if value is 2 then the second hash lookup is also inlined. */ #define RAVI_USE_INLINE_SHORTSTR_TGET 1 -#define RAVI_DEFER_STATEMENT #endif diff --git a/ravicomp/src/codegen.c b/ravicomp/src/codegen.c index 469caa4..1cc5829 100644 --- a/ravicomp/src/codegen.c +++ b/ravicomp/src/codegen.c @@ -578,12 +578,8 @@ static const char Lua_header[] = "};\n" "struct UpVal {\n" " TValue *v;\n" -#ifdef RAVI_DEFER_STATEMENT " unsigned int refcount;\n" " unsigned int flags;\n" -#else - " lu_mem refcount;\n" -#endif " union {\n" " struct {\n" " UpVal *next;\n" @@ -613,11 +609,7 @@ static const char Lua_header[] = " (ttisinteger(o) ? (*(i) = ivalue(o), 1) : luaV_tointeger(o,i,LUA_FLOORN2I))\n" "extern int luaV_tonumber_(const TValue *obj, lua_Number *n);\n" "extern int luaV_tointeger(const TValue *obj, lua_Integer *p, int mode);\n" -#ifdef RAVI_DEFER_STATEMENT "extern int luaF_close (lua_State *L, StkId level, int status);\n" -#else - "extern void luaF_close (lua_State *L, StkId level);\n" -#endif "extern int luaD_poscall (lua_State *L, CallInfo *ci, StkId firstResult, int nres);\n" "extern void luaD_growstack (lua_State *L, int n);\n" "extern int luaV_equalobj(lua_State *L, const TValue *t1, const TValue *t2);\n" @@ -654,9 +646,7 @@ static const char Lua_header[] = "extern void raviV_settable_sskey(lua_State *L, const TValue *t, TValue *key, TValue *val);\n" "extern void raviV_gettable_i(lua_State *L, const TValue *t, TValue *key, TValue *val);\n" "extern void raviV_settable_i(lua_State *L, const TValue *t, TValue *key, TValue *val);\n" -#ifdef RAVI_DEFER_STATEMENT "extern void raviV_op_defer(lua_State *L, TValue *ra);\n" -#endif "extern lua_Integer luaV_shiftl(lua_Integer x, lua_Integer y);\n" "extern void ravi_dump_value(lua_State *L, const struct lua_TValue *v);\n" "extern void raviV_op_bnot(lua_State *L, TValue *ra, TValue *rb);\n" @@ -1180,17 +1170,11 @@ static int emit_op_mov(struct function *fn, Instruction *insn) static int emit_op_ret(struct function *fn, Instruction *insn) { // TODO Only call luaF_close if needed (i.e. some variable escaped) -#ifdef RAVI_DEFER_STATEMENT if (raviX_ptrlist_size((const PtrList *)fn->proc->procs) > 0) { raviX_buffer_add_string(&fn->body, "{\nluaF_close(L, base, LUA_OK);\n"); raviX_buffer_add_string(&fn->body, "base = ci->u.l.base;\n"); raviX_buffer_add_string(&fn->body, "}\n"); } -#else - if (raviX_ptrlist_size((const PtrList *)fn->proc->procs) > 0) { - raviX_buffer_add_string(&fn->body, "luaF_close(L, base);\n"); - } -#endif raviX_buffer_add_string(&fn->body, "{\n"); /* Results are copied to stack position given by ci->func and above. * stackbase is set here so S(n) refers to (stackbase+n) @@ -1919,12 +1903,8 @@ static int emit_op_close(struct function *fn, Instruction *insn) raviX_buffer_add_string(&fn->body, "{\n TValue *clsvar = "); emit_reg_accessor(fn, pseudo, 0); raviX_buffer_add_string(&fn->body, ";\n"); -#ifdef RAVI_DEFER_STATEMENT raviX_buffer_add_string(&fn->body, " luaF_close(L, clsvar, LUA_OK);\n"); emit_reload_base(fn); -#else - raviX_buffer_add_string(&fn->body, " luaF_close(L, clsvar);\n"); -#endif raviX_buffer_add_string(&fn->body, "}\n"); return 0; } diff --git a/src/lcorolib.c b/src/lcorolib.c index 8e71d50..c0ef009 100644 --- a/src/lcorolib.c +++ b/src/lcorolib.c @@ -75,11 +75,9 @@ static int luaB_auxwrap (lua_State *L) { lua_State *co = lua_tothread(L, lua_upvalueindex(1)); int r = auxresume(L, co, lua_gettop(L)); if (r < 0) { -#ifdef RAVI_DEFER_STATEMENT int stat = lua_status(co); if (stat != LUA_OK && stat != LUA_YIELD) lua_resetthread(co); /* close variables in case of errors */ -#endif if (lua_type(L, -1) == LUA_TSTRING) { /* error object is a string? */ luaL_where(L, 1); /* add extra info, if available */ lua_insert(L, -2); diff --git a/src/ldo.c b/src/ldo.c index e7e63b1..8a17593 100644 --- a/src/ldo.c +++ b/src/ldo.c @@ -104,12 +104,10 @@ void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); break; } -#ifdef RAVI_DEFER_STATEMENT case CLOSEPROTECT: { setnilvalue(oldtop); /* no error message */ break; } -#endif default: { setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ break; @@ -126,9 +124,7 @@ l_noret luaD_throw (lua_State *L, int errcode) { } else { /* thread has no error handler */ global_State *g = G(L); -#ifdef RAVI_DEFER_STATEMENT errcode = luaF_close(L, L->stack, errcode); /* close all upvalues */ -#endif L->status = cast_byte(errcode); /* mark it as dead */ if (g->mainthread->errorJmp) { /* main thread has a handler? */ setobjs2s(L, g->mainthread->top++, L->top - 1); /* copy error obj. */ @@ -690,11 +686,7 @@ static int recover (lua_State *L, int status) { if (ci == NULL) return 0; /* no recovery point */ /* "finish" luaD_pcall */ oldtop = restorestack(L, ci->extra); -#ifdef RAVI_DEFER_STATEMENT luaF_close(L, oldtop, status); -#else - luaF_close(L, oldtop); -#endif luaD_seterrorobj(L, status, oldtop); L->ci = ci; L->allowhook = getoah(ci->callstatus); /* restore original 'allowhook' */ @@ -837,18 +829,12 @@ int luaD_pcall (lua_State *L, Pfunc func, void *u, status = luaD_rawrunprotected(L, func, u); if (status != LUA_OK) { /* an error occurred? */ StkId oldtop = restorestack(L, old_top); -#ifndef RAVI_DEFER_STATEMENT - luaF_close(L, oldtop); /* close possible pending closures */ - luaD_seterrorobj(L, status, oldtop); -#endif L->ci = old_ci; L->allowhook = old_allowhooks; L->nny = old_nny; -#ifdef RAVI_DEFER_STATEMENT status = luaF_close(L, oldtop, status); /* close possible pending closures */ oldtop = restorestack(L, old_top); luaD_seterrorobj(L, status, oldtop); -#endif luaD_shrinkstack(L); } L->errfunc = old_errfunc; diff --git a/src/lfunc.c b/src/lfunc.c index 927169c..1e12ecd 100644 --- a/src/lfunc.c +++ b/src/lfunc.c @@ -68,22 +68,15 @@ UpVal *luaF_findupval (lua_State *L, StkId level) { lua_assert(isintwups(L) || L->openupval == NULL); while (*pp != NULL && (p = *pp)->v >= level) { lua_assert(upisopen(p)); -#ifdef RAVI_DEFER_STATEMENT if (p->v == level && !p->flags) /* found a corresponding upvalue that is not a deferred value? */ { return p; /* return it */ } -#else - if (p->v == level) /* found a corresponding upvalue? */ - return p; /* return it */ -#endif pp = &p->u.open.next; } /* not found: create a new upvalue */ uv = luaM_new(L, UpVal); uv->refcount = 0; -#ifdef RAVI_DEFER_STATEMENT uv->flags = 0; -#endif uv->u.open.next = *pp; /* link it to list of open upvalues */ uv->u.open.touched = 1; *pp = uv; @@ -95,7 +88,6 @@ UpVal *luaF_findupval (lua_State *L, StkId level) { return uv; } -#ifdef RAVI_DEFER_STATEMENT static void calldeferred(lua_State *L, void *ud) { UNUSED(ud); luaD_callnoyield(L, L->top - 2, 0); @@ -176,24 +168,6 @@ int luaF_close (lua_State *L, StkId level, int status) { } return status; } -#else -void luaF_close (lua_State *L, StkId level) { - UpVal *uv; - while (L->openupval != NULL && (uv = L->openupval)->v >= level) { - lua_assert(upisopen(uv)); - L->openupval = uv->u.open.next; /* remove from 'open' list */ - if (uv->refcount == 0) /* no references? */ - luaM_free(L, uv); /* free upvalue */ - else { - TValue* slot = &uv->u.value; /* new position for value */ - setobj(L, slot, uv->v); /* move value to upvalue slot */ - uv->v = slot; /* now current value lives here */ - luaC_upvalbarrier(L, uv, slot); - } - } -} -#endif - Proto *luaF_newproto (lua_State *L) { GCObject *o = luaC_newobj(L, LUA_TPROTO, sizeof(Proto)); diff --git a/src/lfunc.h b/src/lfunc.h index 7f7b50d..271e521 100644 --- a/src/lfunc.h +++ b/src/lfunc.h @@ -32,7 +32,6 @@ #define upisopen(up) ((up)->v != &(up)->u.value) -#ifdef RAVI_DEFER_STATEMENT /* ** Special "status" for 'luaF_close' */ @@ -42,18 +41,13 @@ /* close upvalues running all closing methods in protected mode */ #define CLOSEPROTECT (-2) -#endif LUAI_FUNC Proto *luaF_newproto (lua_State *L); LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems); LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems); LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); -#ifdef RAVI_DEFER_STATEMENT LUAI_FUNC int luaF_close (lua_State *L, StkId level, int status); -#else -LUAI_FUNC void luaF_close (lua_State *L, StkId level); -#endif LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); /* The additional type argument is a Ravi extension */ LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, diff --git a/src/llex.c b/src/llex.c index 84eec88..cfb2737 100644 --- a/src/llex.c +++ b/src/llex.c @@ -40,11 +40,7 @@ static const char *const luaX_tokens [] = { "and", "break", "do", "else", "elseif", "end", "false", "for", "function", "goto", "if", -#ifdef RAVI_DEFER_STATEMENT "in", "local", "defer", "nil", "not", "or", "repeat", -#else - "in", "local", "nil", "not", "or", "repeat", -#endif "return", "then", "true", "until", "while", "//", "..", "...", "==", ">=", "<=", "~=", "<<", ">>", "::", "", diff --git a/src/llex.h b/src/llex.h index 6b66fa9..4dc619f 100644 --- a/src/llex.h +++ b/src/llex.h @@ -27,11 +27,7 @@ enum RESERVED { /* terminal symbols denoted by reserved words */ TK_AND = FIRST_RESERVED, TK_BREAK, TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, -#ifdef RAVI_DEFER_STATEMENT TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_DEFER, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, -#else - TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, -#endif TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, /* other terminal symbols */ TK_IDIV, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, diff --git a/src/lobject.h b/src/lobject.h index 182ecfc..492019c 100644 --- a/src/lobject.h +++ b/src/lobject.h @@ -648,12 +648,8 @@ typedef struct Proto { typedef struct UpVal { TValue *v; /* points to stack or to its own value */ -#ifdef RAVI_DEFER_STATEMENT unsigned int refcount; /* reference counter */ unsigned int flags; /* Used to mark deferred values */ -#else - lu_mem refcount; /* reference counter */ -#endif union { struct { /* (when open) */ struct UpVal *next; /* linked list */ diff --git a/src/lopcodes.c b/src/lopcodes.c index 4379075..c7d0388 100644 --- a/src/lopcodes.c +++ b/src/lopcodes.c @@ -165,9 +165,7 @@ LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = { "SELF_SK", /* _SK*/ /* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */ "SETFIELD", /*_SK */ /* A B C R(A)[RK(B)] := RK(C), string key */ "GETTABUP_SK", -#ifdef RAVI_DEFER_STATEMENT "DEFER", -#endif NULL }; @@ -319,9 +317,7 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_RAVI_SELF_SK */ ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_RAVI_SETFIELD */ ,opmode(0, 1, OpArgU, OpArgK, iABC) /* OP_RAVI_GETTABUP_SK */ -#ifdef RAVI_DEFER_STATEMENT ,opmode(0, 1, OpArgN, OpArgN, iABC) /* OP_RAVI_DEFER */ -#endif }; diff --git a/src/lopcodes.h b/src/lopcodes.h index a1cbde2..948d9d5 100644 --- a/src/lopcodes.h +++ b/src/lopcodes.h @@ -290,16 +290,10 @@ OP_RAVI_GETFIELD, /* A B C R(A) := R(B)[RK(C)], string key */ OP_RAVI_SELF_SK, /* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)], string key */ OP_RAVI_SETFIELD, /* A B C R(A)[RK(B)] := RK(C), string key */ OP_RAVI_GETTABUP_SK, /* A B C R(A) := UpValue[B][RK(C)], string key */ -#ifdef RAVI_DEFER_STATEMENT OP_RAVI_DEFER, /* A mark variable A "deferred" */ -#endif } OpCode; -#ifdef RAVI_DEFER_STATEMENT #define NUM_OPCODES (cast(int, OP_RAVI_DEFER) + 1) -#else -#define NUM_OPCODES (cast(int, OP_RAVI_GETTABUP_SK) + 1) -#endif /*=========================================================================== Notes: diff --git a/src/lparser.c b/src/lparser.c index 8b11aed..1a2d7af 100644 --- a/src/lparser.c +++ b/src/lparser.c @@ -981,7 +981,6 @@ static Proto *addprototype (LexState *ls) { ** so that, if it invokes the GC, the GC knows which registers ** are in use at that time. */ -#ifdef RAVI_DEFER_STATEMENT static void codeclosure (LexState *ls, expdesc *v, int deferred) { FuncState *fs = ls->fs->prev; int pc = -1; @@ -995,14 +994,6 @@ static void codeclosure (LexState *ls, expdesc *v, int deferred) { } DEBUG_VARS(raviY_printf(ls->fs, "codeclosure -> closure created %e\n", v)); } -#else -static void codeclosure (LexState *ls, expdesc *v) { - FuncState *fs = ls->fs->prev; - init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np - 1), RAVI_TM_FUNCTION, NULL); - luaK_exp2nextreg(fs, v); /* fix it at the last register */ - DEBUG_VARS(raviY_printf(ls->fs, "codeclosure -> closure created %e\n", v)); -} -#endif static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) { @@ -1363,7 +1354,6 @@ static void parlist (LexState *ls) { } } -#ifdef RAVI_DEFER_STATEMENT static void body (LexState *ls, expdesc *e, int ismethod, int line, int deferred) { /* body -> '(' parlist ')' block END */ FuncState new_fs; @@ -1386,28 +1376,6 @@ static void body (LexState *ls, expdesc *e, int ismethod, int line, int deferred codeclosure(ls, e, deferred); close_func(ls); } -#else -static void body (LexState *ls, expdesc *e, int ismethod, int line) { - /* body -> '(' parlist ')' block END */ - FuncState new_fs; - BlockCnt bl; - new_fs.f = addprototype(ls); - new_fs.f->linedefined = line; - open_func(ls, &new_fs, &bl); - checknext(ls, '('); - if (ismethod) { - new_localvarliteral(ls, "self"); /* create 'self' parameter */ - adjustlocalvars(ls, 1); - } - parlist(ls); - checknext(ls, ')'); - statlist(ls); - new_fs.f->lastlinedefined = ls->linenumber; - check_match(ls, TK_END, TK_FUNCTION, line); - codeclosure(ls, e); - close_func(ls); -} -#endif /* parse expression list */ static int explist (LexState *ls, expdesc *v) { @@ -1699,11 +1667,7 @@ static void simpleexp (LexState *ls, expdesc *v) { } case TK_FUNCTION: { luaX_next(ls); -#ifdef RAVI_DEFER_STATEMENT body(ls, v, 0, ls->linenumber, 0); -#else - body(ls, v, 0, ls->linenumber); -#endif return; } default: { @@ -2277,7 +2241,6 @@ static void ifstat (LexState *ls, int line) { } /* parse a local function statement - called from statement() */ -#ifdef RAVI_DEFER_STATEMENT static void localfunc (LexState *ls, int defer) { expdesc b = {.ravi_type_map = RAVI_TM_ANY, .pc = -1}; FuncState *fs = ls->fs; @@ -2295,18 +2258,6 @@ static void localfunc (LexState *ls, int defer) { /* debug information will only see the variable after this point! */ getlocvar(fs, b.u.info)->startpc = fs->pc; } -#else -static void localfunc (LexState *ls) { - expdesc b = {.ravi_type = RAVI_TANY, .pc = -1}; - FuncState *fs = ls->fs; - /* RAVI change - add type */ - new_localvar(ls, str_checkname(ls), RAVI_TFUNCTION, NULL); /* new local variable */ - adjustlocalvars(ls, 1); /* enter its scope */ - body(ls, &b, 0, ls->linenumber); /* function created in next register */ - /* debug information will only see the variable after this point! */ - getlocvar(fs, b.u.info)->startpc = fs->pc; -} -#endif /* parse a local variable declaration statement - called from statement() */ static void localstat (LexState *ls) { @@ -2366,11 +2317,7 @@ static void funcstat (LexState *ls, int line) { luaX_next(ls); /* skip FUNCTION */ ismethod = funcname(ls, &v); DEBUG_VARS(raviY_printf(ls->fs, "funcstat -> declaring function %e\n", &v)); -#ifdef RAVI_DEFER_STATEMENT body(ls, &b, ismethod, line, 0); -#else - body(ls, &b, ismethod, line); -#endif luaK_storevar(ls->fs, &v, &b); luaK_fixline(ls->fs, line); /* definition "happens" in the first line */ } @@ -2463,22 +2410,16 @@ static void statement (LexState *ls) { case TK_LOCAL: { /* stat -> localstat */ luaX_next(ls); /* skip LOCAL */ if (testnext(ls, TK_FUNCTION)) /* local function? */ -#ifdef RAVI_DEFER_STATEMENT localfunc(ls, 0); -#else - localfunc(ls); -#endif else localstat(ls); break; } -#ifdef RAVI_DEFER_STATEMENT case TK_DEFER: { /* stat -> deferstat */ luaX_next(ls); /* skip DEFER */ localfunc(ls, 1); break; } -#endif case TK_DBCOLON: { /* stat -> label */ luaX_next(ls); /* skip double colon */ labelstat(ls, str_checkname(ls), line); diff --git a/src/lstate.c b/src/lstate.c index 52d4a0a..89e52f3 100644 --- a/src/lstate.c +++ b/src/lstate.c @@ -258,11 +258,7 @@ void *ravi_alloc_f(void *msp, void *ptr, size_t osize, size_t nsize) static void close_state (lua_State *L) { global_State *g = G(L); -#ifdef RAVI_DEFER_STATEMENT luaF_close(L, L->stack, CLOSEPROTECT); /* close all upvalues for this thread */ -#else - luaF_close(L, L->stack); /* close all upvalues for this thread */ -#endif luaC_freeallobjects(L); /* collect all objects */ if (g->version) /* closing a fully built state? */ luai_userstateclose(L); @@ -310,18 +306,13 @@ LUA_API lua_State *lua_newthread (lua_State *L) { void luaE_freethread (lua_State *L, lua_State *L1) { LX *l = fromstate(L1); -#ifdef RAVI_DEFER_STATEMENT luaF_close(L1, L1->stack, NOCLOSINGMETH); /* close all upvalues for this thread */ -#else - luaF_close(L1, L1->stack); /* close all upvalues for this thread */ -#endif lua_assert(L1->openupval == NULL); luai_userstatefree(L, L1); freestack(L1); luaM_free(L, l); } -#ifdef RAVI_DEFER_STATEMENT int lua_resetthread (lua_State *L) { CallInfo *ci; int status; @@ -342,7 +333,6 @@ int lua_resetthread (lua_State *L) { lua_unlock(L); return status; } -#endif /* TODO following should probably not live here*/ diff --git a/src/lvm.c b/src/lvm.c index f223300..371bb47 100644 --- a/src/lvm.c +++ b/src/lvm.c @@ -1090,7 +1090,6 @@ void luaV_finishOp (lua_State *L) { ** Execute a jump instruction. The 'updatemask' allows signals to stop ** tight loops. (Without it, the local copy of 'mask' could never change.) */ -#ifdef RAVI_DEFER_STATEMENT #define dojump(ci, i, e) \ { \ int a = GETARG_A(i); \ @@ -1099,12 +1098,6 @@ void luaV_finishOp (lua_State *L) { pc += GETARG_sBx(i) + e; \ updatemask(L); \ } -#else -#define dojump(ci,i,e) \ - { int a = GETARG_A(i); \ - if (a != 0) luaF_close(L, ci->u.l.base + a - 1); \ - pc += GETARG_sBx(i) + e; updatemask(L); } -#endif /* for test instructions, execute the jump instruction that follows it */ #define donextjump(ci) { i = *pc; dojump(ci, i, 1); } @@ -1382,9 +1375,7 @@ int luaV_execute (lua_State *L) { &&vmlabel(OP_RAVI_SELF_SK), &&vmlabel(OP_RAVI_SETFIELD), &&vmlabel(OP_RAVI_GETTABUP_SK), -#ifdef RAVI_DEFER_STATEMENT &&vmlabel(OP_RAVI_DEFER), -#endif }; #endif @@ -1829,12 +1820,8 @@ int luaV_execute (lua_State *L) { StkId lim = nci->u.l.base + getproto(nfunc)->numparams; int aux; /* close all upvalues from previous call */ -#ifdef RAVI_DEFER_STATEMENT if (cl->p->sizep > 0) Protect_base(luaF_close(L, oci->u.l.base, NOCLOSINGMETH)); -#else - if (cl->p->sizep > 0) luaF_close(L, oci->u.l.base); -#endif /* move new frame into old one */ for (aux = 0; nfunc + aux < lim; aux++) setobjs2s(L, ofunc + aux, nfunc + aux); @@ -1851,14 +1838,10 @@ int luaV_execute (lua_State *L) { } vmcase(OP_RETURN) { int b = GETARG_B(i); -#ifdef RAVI_DEFER_STATEMENT if (cl->p->sizep > 0) { Protect_base(luaF_close(L, base, LUA_OK)); ra = RA(i); } -#else - if (cl->p->sizep > 0) luaF_close(L, base); -#endif savepc(L); int nres = (b != 0 ? b - 1 : cast_int(L->top - ra)); b = luaD_poscall(L, ci, ra, nres); @@ -2663,14 +2646,12 @@ int luaV_execute (lua_State *L) { luaG_runerror(L, "number[] expected"); vmbreak; } -#ifdef RAVI_DEFER_STATEMENT vmcase(OP_RAVI_DEFER) { UpVal *up = luaF_findupval(L, ra); /* create new upvalue */ up->flags = 1; /* mark it as deferred */ setnilvalue(ra); /* initialize it with nil */ vmbreak; } -#endif } } } @@ -3207,7 +3188,6 @@ void raviV_op_totype(lua_State *L, TValue *ra, TValue *rb) { luaG_runerror(L, "type mismatch: expected %s", getstr(key)); } -#ifdef RAVI_DEFER_STATEMENT /* ** OP_RAVI_DEFER */ @@ -3216,7 +3196,6 @@ void raviV_op_defer(lua_State *L, TValue *ra) { up->flags = 1; /* mark it as deferred */ setnilvalue(ra); /* initialize it with nil */ } -#endif /* }================================================================== */ diff --git a/src/lvm.h b/src/lvm.h index 2d66c5a..31d2e5c 100644 --- a/src/lvm.h +++ b/src/lvm.h @@ -174,9 +174,7 @@ LUAI_FUNC void raviV_settable_i(lua_State *L, const TValue *t, TValue *key, StkI LUAI_FUNC void raviV_op_totype(lua_State *L, TValue *ra, TValue *rb); LUAI_FUNC int raviV_checktype(lua_State *L, TValue *input, ravi_type_map type, TString *usertype); LUAI_FUNC int raviV_check_usertype(lua_State *L, TString *name, const TValue *o); -#ifdef RAVI_DEFER_STATEMENT LUAI_FUNC void raviV_op_defer(lua_State *L, TValue *ra); -#endif LUAI_FUNC void raviV_debug_trace(lua_State *L, int opCode, int pc); #endif diff --git a/src/ravi_jitshared.c b/src/ravi_jitshared.c index d940710..851289f 100644 --- a/src/ravi_jitshared.c +++ b/src/ravi_jitshared.c @@ -565,12 +565,8 @@ static const char Lua_header[] = "};\n" "struct UpVal {\n" " TValue *v;\n" -#ifdef RAVI_DEFER_STATEMENT " unsigned int refcount;\n" " unsigned int flags;\n" -#else - " lu_mem refcount;\n" -#endif " union {\n" " struct {\n" " UpVal *next;\n" diff --git a/src/ravi_mirjit.c b/src/ravi_mirjit.c index dc7baec..58a62bc 100644 --- a/src/ravi_mirjit.c +++ b/src/ravi_mirjit.c @@ -83,9 +83,7 @@ static LuaFunc Lua_functions[] = { { "raviV_settable_sskey", raviV_settable_sskey }, { "raviV_gettable_i", raviV_gettable_i }, { "raviV_settable_i", raviV_settable_i }, -#ifdef RAVI_DEFER_STATEMENT { "raviV_op_defer", raviV_op_defer }, -#endif { "raviV_op_bnot", raviV_op_bnot}, { "lua_absindex", lua_absindex },