diff --git a/include/lopcodes.h b/include/lopcodes.h index 7e17cf7..48b95e0 100644 --- a/include/lopcodes.h +++ b/include/lopcodes.h @@ -269,7 +269,7 @@ OP_RAVI_LE_FF,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ done on a table and the key is known type */ OP_RAVI_TABLE_GETFIELD,/* A B C R(A) := R(B)[RK(C)], string key, known table */ OP_RAVI_TABLE_SETFIELD,/* A B C R(A)[RK(B)] := RK(C), string key, known table */ -OP_RAVI_SELF_S,/* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)], string key, known table */ +OP_RAVI_TABLE_SELF_SK,/* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)], string key, known table */ /* Following opcodes are specialized for indexing where the key is known to be string but the variable may or may not be diff --git a/include/ravi_llvmcodegen.h b/include/ravi_llvmcodegen.h index f79194b..9cec63d 100644 --- a/include/ravi_llvmcodegen.h +++ b/include/ravi_llvmcodegen.h @@ -1262,7 +1262,7 @@ class RaviCodeGenerator { void emit_SELF(RaviFunctionDef *def, int A, int B, int C, int pc); - void emit_SELF_S(RaviFunctionDef *def, int A, int B, int C, int pc, + void emit_TABLE_SELF_SK(RaviFunctionDef *def, int A, int B, int C, int pc, TString *key); void emit_SELF_SK(RaviFunctionDef *def, int A, int B, int C, int pc); diff --git a/ravi-tests/ravi_tests1.ravi b/ravi-tests/ravi_tests1.ravi index 71fc39c..3beb56f 100644 --- a/ravi-tests/ravi_tests1.ravi +++ b/ravi-tests/ravi_tests1.ravi @@ -116,7 +116,7 @@ opcodes_coverage.GETFIELD = 0 opcodes_coverage.TOTAB = 0 opcodes_coverage.MOVETAB = 0 opcodes_coverage.SETUPVALT = 0 -opcodes_coverage.SELF_S = 0 +opcodes_coverage.TABLE_SELF_SK = 0 opcodes_coverage.TOTYPE = 0 opcodes_coverage.TOSTRING = 0 opcodes_coverage.TOCLOSURE = 0 @@ -1150,7 +1150,7 @@ function test_self_s() return t:name() end check(test_self_s, 'NEWTABLE', 'TABLE_SETFIELD', 'CLOSURE', - 'TABLE_SETFIELD', 'GETTABUP_SK', 'SELF_S', 'CALL', 'CALL', 'SELF_S', 'TAILCALL', + 'TABLE_SETFIELD', 'GETTABUP_SK', 'TABLE_SELF_SK', 'CALL', 'CALL', 'TABLE_SELF_SK', 'TAILCALL', 'RETURN') assert(test_self_s() == 'dibyendu majumdar') compile(test_self_s) diff --git a/ravi-tests/ravi_tests2.ravi b/ravi-tests/ravi_tests2.ravi index 5e8228d..dedd4f9 100644 --- a/ravi-tests/ravi_tests2.ravi +++ b/ravi-tests/ravi_tests2.ravi @@ -118,7 +118,7 @@ opcodes_coverage.GETFIELD = 0 opcodes_coverage.TOTAB = 0 opcodes_coverage.MOVETAB = 0 opcodes_coverage.SETUPVALT = 0 -opcodes_coverage.SELF_S = 0 +opcodes_coverage.TABLE_SELF_SK = 0 opcodes_coverage.TOTYPE = 0 opcodes_coverage.TOSTRING = 0 opcodes_coverage.TOCLOSURE = 0 diff --git a/readthedocs/ravi-jit-status.rst b/readthedocs/ravi-jit-status.rst index 00f79fc..69193c4 100644 --- a/readthedocs/ravi-jit-status.rst +++ b/readthedocs/ravi-jit-status.rst @@ -292,7 +292,7 @@ Note that if a Lua functions contains a bytecode that cannot be be JITed then th +-------------------------+----------+--------------------------------------------------+ | OP_RAVI_SELF_SK | YES | R(A+1) := R(B); R(A) := R(B)[RK(C)] | +-------------------------+----------+--------------------------------------------------+ -| OP_RAVI_SELF_S | YES | R(A+1) := R(B); R(A) := R(B)[RK(C)] | +| OP_RAVI_TABLE_SELF_SK | YES | R(A+1) := R(B); R(A) := R(B)[RK(C)] | +-------------------------+----------+--------------------------------------------------+ | OP_RAVI_GETTABUP_SK | YES | R(A) := UpValue[B][RK(C)] | +-------------------------+----------+--------------------------------------------------+ diff --git a/src/lcode.c b/src/lcode.c index 696002e..b405cca 100644 --- a/src/lcode.c +++ b/src/lcode.c @@ -1041,7 +1041,7 @@ void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { If we only know the key is a string constant we emit specialized bytecode OP_RAVI_SELF_SK If we also know that the variable is a table - then we emit OP_RAVI_SELF_S + then we emit OP_RAVI_TABLE_SELF_SK */ int is_string_constant_key = key->k == VK && @@ -1058,7 +1058,7 @@ void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { e->u.info = fs->freereg; /* base register for op_self */ e->k = VNONRELOC; /* self expression has a fixed register */ luaK_reserveregs(fs, 2); /* function and 'self' produced by op_self */ - luaK_codeABC(fs, table_and_string ? OP_RAVI_SELF_S : + luaK_codeABC(fs, table_and_string ? OP_RAVI_TABLE_SELF_SK : (is_string_constant_key ? OP_RAVI_SELF_SK : OP_SELF), e->u.info, ereg, luaK_exp2RK(fs, key)); freeexp(fs, key); diff --git a/src/ldebug.c b/src/ldebug.c index 0f740e9..16d2971 100644 --- a/src/ldebug.c +++ b/src/ldebug.c @@ -508,7 +508,7 @@ static const char *getobjname (Proto *p, int lastpc, int reg, break; } case OP_RAVI_SELF_SK: - case OP_RAVI_SELF_S: + case OP_RAVI_TABLE_SELF_SK: case OP_SELF: { int k = GETARG_C(i); /* key index */ kname(p, pc, k, name); diff --git a/src/lopcodes.c b/src/lopcodes.c index b107ea9..e4aed53 100644 --- a/src/lopcodes.c +++ b/src/lopcodes.c @@ -155,7 +155,7 @@ LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = { "TABLE_GETFIELD", /* A B C R(A) := R(B)[RK(C)], string key */ "TABLE_SETFIELD", /* A B C R(A)[RK(B)] := RK(C), string key */ - "SELF_S", /* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */ + "TABLE_SELF_SK", /* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */ "GETI", /* A B C R(A) := R(B)[RK(C)], integer key */ "SETI", /* A B C R(A)[RK(B)] := RK(C), integer key */ @@ -296,7 +296,7 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_RAVI_TABLE_GETFIELD */ ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_RAVI_TABLE_SETFIELD */ - ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_RAVI_SELF_S */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_RAVI_TABLE_SELF_SK */ ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_RAVI_GETI */ ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_RAVI_SETI */ @@ -472,7 +472,7 @@ static void PrintCode(const Proto* f) case OP_RAVI_IARRAY_GET: case OP_SELF: case OP_RAVI_GETFIELD: - case OP_RAVI_SELF_S: + case OP_RAVI_TABLE_SELF_SK: case OP_RAVI_SELF_SK: if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); } break; diff --git a/src/lvm.c b/src/lvm.c index bdb4845..7384e0a 100644 --- a/src/lvm.c +++ b/src/lvm.c @@ -947,7 +947,7 @@ void luaV_finishOp (lua_State *L) { case OP_UNM: case OP_BNOT: case OP_LEN: case OP_RAVI_GETTABUP_SK: case OP_RAVI_GETFIELD: case OP_RAVI_GETI: case OP_RAVI_TABLE_GETFIELD: - case OP_RAVI_SELF_SK: case OP_RAVI_SELF_S: + case OP_RAVI_SELF_SK: case OP_RAVI_TABLE_SELF_SK: case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: { setobjs2s(L, base + GETARG_A(inst), --L->top); break; @@ -1263,7 +1263,7 @@ int luaV_execute (lua_State *L) { &&vmlabel(OP_RAVI_LE_FF), &&vmlabel(OP_RAVI_TABLE_GETFIELD), &&vmlabel(OP_RAVI_TABLE_SETFIELD), - &&vmlabel(OP_RAVI_SELF_S), + &&vmlabel(OP_RAVI_TABLE_SELF_SK), &&vmlabel(OP_RAVI_GETI), &&vmlabel(OP_RAVI_SETI), &&vmlabel(OP_RAVI_GETFIELD), @@ -2122,14 +2122,14 @@ int luaV_execute (lua_State *L) { GETTABLE_INLINE_SSKEY_PROTECTED(L, rb, rc, ra); vmbreak; } - vmcase(OP_RAVI_SELF_S) + vmcase(OP_RAVI_TABLE_SELF_SK) vmcase(OP_RAVI_TABLE_GETFIELD) { /* This opcode is used when the key is known to be short string and the variable is known to be a table */ StkId rb = RB(i); - if (op == OP_RAVI_SELF_S) { setobjs2s(L, ra + 1, rb); } + if (op == OP_RAVI_TABLE_SELF_SK) { setobjs2s(L, ra + 1, rb); } { lua_assert(ISK(GETARG_C(i))); TValue *rc = k + INDEXK(GETARG_C(i)); diff --git a/src/ravi_jitshared.c b/src/ravi_jitshared.c index 77fe9c7..f050f50 100644 --- a/src/ravi_jitshared.c +++ b/src/ravi_jitshared.c @@ -634,7 +634,7 @@ bool raviJ_cancompile(Proto *p) { case OP_RAVI_GETI: case OP_GETTABLE: case OP_SELF: - case OP_RAVI_SELF_S: + case OP_RAVI_TABLE_SELF_SK: case OP_RAVI_SELF_SK: case OP_RAVI_SETFIELD: case OP_RAVI_TABLE_SETFIELD: @@ -2186,7 +2186,7 @@ bool raviJ_codegen(struct lua_State *L, struct Proto *p, emit_op_setlist(&fn, A, B, C, pc); } break; case OP_SELF: - case OP_RAVI_SELF_S: + case OP_RAVI_TABLE_SELF_SK: case OP_RAVI_SELF_SK: { int B = GETARG_B(i); int C = GETARG_C(i); diff --git a/src/ravi_llvmcodegen.cpp b/src/ravi_llvmcodegen.cpp index f092578..542e953 100644 --- a/src/ravi_llvmcodegen.cpp +++ b/src/ravi_llvmcodegen.cpp @@ -1654,14 +1654,14 @@ bool RaviCodeGenerator::compile(lua_State *L, Proto *p, emit_GETTABLE_S(def, A, B, C, pc, key); } break; - case OP_RAVI_SELF_S: { + case OP_RAVI_TABLE_SELF_SK: { int C = GETARG_C(i); int B = GETARG_B(i); lua_assert(ISK(C)); TValue *kv = k + INDEXK(C); TString *key = tsvalue(kv); lua_assert(key->tt == LUA_TSHRSTR); - emit_SELF_S(def, A, B, C, pc, key); + emit_TABLE_SELF_SK(def, A, B, C, pc, key); } break; case OP_RAVI_GETI: { int B = GETARG_B(i); diff --git a/src/ravi_llvmtable.cpp b/src/ravi_llvmtable.cpp index 72797b0..4222bfc 100644 --- a/src/ravi_llvmtable.cpp +++ b/src/ravi_llvmtable.cpp @@ -61,7 +61,7 @@ void RaviCodeGenerator::emit_SELF_SK(RaviFunctionDef *def, int A, int B, int C, } // R(A+1) := R(B); R(A) := R(B)[RK(C)] -void RaviCodeGenerator::emit_SELF_S(RaviFunctionDef *def, int A, int B, int C, +void RaviCodeGenerator::emit_TABLE_SELF_SK(RaviFunctionDef *def, int A, int B, int C, int pc, TString *key) { // StkId rb = RB(i); // setobjs2s(L, ra + 1, rb); @@ -69,7 +69,7 @@ void RaviCodeGenerator::emit_SELF_S(RaviFunctionDef *def, int A, int B, int C, // TString *key = tsvalue(kv); // const TValue *v = luaH_getstr(hvalue(rb), key); // setobj2s(L, ra, v); - emit_debug_trace(def, OP_RAVI_SELF_S, pc); + emit_debug_trace(def, OP_RAVI_TABLE_SELF_SK, pc); emit_load_base(def); llvm::Value *rb = emit_gep_register(def, B); llvm::Value *ra1 = emit_gep_register(def, A + 1); diff --git a/vmbuilder/src/buildvm.c b/vmbuilder/src/buildvm.c index 6dd45b1..1267476 100644 --- a/vmbuilder/src/buildvm.c +++ b/vmbuilder/src/buildvm.c @@ -539,7 +539,7 @@ LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES + 1] = "TABLE_GETFIELD", /* A B C R(A) := R(B)[RK(C)], string key */ "TABLE_SETFIELD", /* A B C R(A)[RK(B)] := RK(C), string key */ - "SELF_S", /* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */ + "TABLE_SELF_SK", /* A B C R(A+1) := R(B); R(A) := R(B)[RK(C)] */ "GETI", /* A B C R(A) := R(B)[RK(C)], integer key */ "SETI", /* A B C R(A)[RK(B)] := RK(C), integer key */