mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-27 19:25:21 +02:00
lua: remove an unnecessary check and replace switch (GET_OPCODE(i)) as well (thx, lars)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12381 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
ed04ed77c6
commit
7196f4da13
@ -10,15 +10,13 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* If 'obj' is a string, it is tried to be interpreted as a number.
|
* If 'obj' is a string, it is tried to be interpreted as a number.
|
||||||
@@ -562,12 +565,65 @@
|
@@ -562,12 +565,63 @@
|
||||||
ARITH_OP1_END
|
ARITH_OP1_END
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
+#ifdef COMPUTED_GOTO
|
+#ifdef COMPUTED_GOTO
|
||||||
+#define OPCODE_TARGET(op) DO_OP_##op:
|
+#define OPCODE_TARGET(op) DO_OP_##op:
|
||||||
+#define CALL_OPCODE(op) \
|
+#define CALL_OPCODE(op) goto *opcodes[op];
|
||||||
+ if ((op < sizeof(opcodes) / sizeof(opcodes[0])) && opcodes[op]) \
|
|
||||||
+ goto *opcodes[op];
|
|
||||||
+#define OPCODE_PTR(op) [OP_##op] = &&DO_OP_##op
|
+#define OPCODE_PTR(op) [OP_##op] = &&DO_OP_##op
|
||||||
+#else
|
+#else
|
||||||
+#define OPCODE_TARGET(op) case OP_##op:
|
+#define OPCODE_TARGET(op) case OP_##op:
|
||||||
@ -76,11 +74,13 @@
|
|||||||
reentry: /* entry point */
|
reentry: /* entry point */
|
||||||
lua_assert(isLua(L->ci));
|
lua_assert(isLua(L->ci));
|
||||||
pc = L->savedpc;
|
pc = L->savedpc;
|
||||||
@@ -593,32 +649,32 @@
|
@@ -592,33 +646,33 @@
|
||||||
|
lua_assert(base == L->base && L->base == L->ci->base);
|
||||||
lua_assert(base <= L->top && L->top <= L->stack + L->stacksize);
|
lua_assert(base <= L->top && L->top <= L->stack + L->stacksize);
|
||||||
lua_assert(L->top == L->ci->top || luaG_checkopenop(i));
|
lua_assert(L->top == L->ci->top || luaG_checkopenop(i));
|
||||||
switch (GET_OPCODE(i)) {
|
- switch (GET_OPCODE(i)) {
|
||||||
- case OP_MOVE: {
|
- case OP_MOVE: {
|
||||||
|
+ CALL_OPCODE(GET_OPCODE(i)) {
|
||||||
+ OPCODE_TARGET(MOVE) {
|
+ OPCODE_TARGET(MOVE) {
|
||||||
setobjs2s(L, ra, RB(i));
|
setobjs2s(L, ra, RB(i));
|
||||||
continue;
|
continue;
|
||||||
@ -115,7 +115,7 @@
|
|||||||
TValue g;
|
TValue g;
|
||||||
TValue *rb = KBx(i);
|
TValue *rb = KBx(i);
|
||||||
sethvalue(L, &g, cl->env);
|
sethvalue(L, &g, cl->env);
|
||||||
@@ -626,88 +682,88 @@
|
@@ -626,88 +680,88 @@
|
||||||
Protect(luaV_gettable(L, &g, rb, ra));
|
Protect(luaV_gettable(L, &g, rb, ra));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -219,7 +219,7 @@
|
|||||||
const TValue *rb = RB(i);
|
const TValue *rb = RB(i);
|
||||||
switch (ttype(rb)) {
|
switch (ttype(rb)) {
|
||||||
case LUA_TTABLE: {
|
case LUA_TTABLE: {
|
||||||
@@ -727,18 +783,18 @@
|
@@ -727,18 +781,18 @@
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -241,7 +241,7 @@
|
|||||||
TValue *rb = RKB(i);
|
TValue *rb = RKB(i);
|
||||||
TValue *rc = RKC(i);
|
TValue *rc = RKC(i);
|
||||||
Protect(
|
Protect(
|
||||||
@@ -748,7 +804,7 @@
|
@@ -748,7 +802,7 @@
|
||||||
pc++;
|
pc++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -250,7 +250,7 @@
|
|||||||
Protect(
|
Protect(
|
||||||
if (luaV_lessthan(L, RKB(i), RKC(i)) == GETARG_A(i))
|
if (luaV_lessthan(L, RKB(i), RKC(i)) == GETARG_A(i))
|
||||||
dojump(L, pc, GETARG_sBx(*pc));
|
dojump(L, pc, GETARG_sBx(*pc));
|
||||||
@@ -756,7 +812,7 @@
|
@@ -756,7 +810,7 @@
|
||||||
pc++;
|
pc++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -259,7 +259,7 @@
|
|||||||
Protect(
|
Protect(
|
||||||
if (lessequal(L, RKB(i), RKC(i)) == GETARG_A(i))
|
if (lessequal(L, RKB(i), RKC(i)) == GETARG_A(i))
|
||||||
dojump(L, pc, GETARG_sBx(*pc));
|
dojump(L, pc, GETARG_sBx(*pc));
|
||||||
@@ -764,13 +820,13 @@
|
@@ -764,13 +818,13 @@
|
||||||
pc++;
|
pc++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@
|
|||||||
TValue *rb = RB(i);
|
TValue *rb = RB(i);
|
||||||
if (l_isfalse(rb) != GETARG_C(i)) {
|
if (l_isfalse(rb) != GETARG_C(i)) {
|
||||||
setobjs2s(L, ra, rb);
|
setobjs2s(L, ra, rb);
|
||||||
@@ -779,7 +835,7 @@
|
@@ -779,7 +833,7 @@
|
||||||
pc++;
|
pc++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -284,7 +284,7 @@
|
|||||||
int b = GETARG_B(i);
|
int b = GETARG_B(i);
|
||||||
int nresults = GETARG_C(i) - 1;
|
int nresults = GETARG_C(i) - 1;
|
||||||
if (b != 0) L->top = ra+b; /* else previous instruction set top */
|
if (b != 0) L->top = ra+b; /* else previous instruction set top */
|
||||||
@@ -800,7 +856,7 @@
|
@@ -800,7 +854,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@
|
|||||||
int b = GETARG_B(i);
|
int b = GETARG_B(i);
|
||||||
if (b != 0) L->top = ra+b; /* else previous instruction set top */
|
if (b != 0) L->top = ra+b; /* else previous instruction set top */
|
||||||
L->savedpc = pc;
|
L->savedpc = pc;
|
||||||
@@ -832,7 +888,7 @@
|
@@ -832,7 +886,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -302,7 +302,7 @@
|
|||||||
int b = GETARG_B(i);
|
int b = GETARG_B(i);
|
||||||
if (b != 0) L->top = ra+b-1;
|
if (b != 0) L->top = ra+b-1;
|
||||||
if (L->openupval) luaF_close(L, base);
|
if (L->openupval) luaF_close(L, base);
|
||||||
@@ -847,7 +903,7 @@
|
@@ -847,7 +901,7 @@
|
||||||
goto reentry;
|
goto reentry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -311,7 +311,7 @@
|
|||||||
/* If start,step and limit are all integers, we don't need to check
|
/* If start,step and limit are all integers, we don't need to check
|
||||||
* against overflow in the looping.
|
* against overflow in the looping.
|
||||||
*/
|
*/
|
||||||
@@ -875,7 +931,7 @@
|
@@ -875,7 +929,7 @@
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -320,7 +320,7 @@
|
|||||||
const TValue *init = ra;
|
const TValue *init = ra;
|
||||||
const TValue *plimit = ra+1;
|
const TValue *plimit = ra+1;
|
||||||
const TValue *pstep = ra+2;
|
const TValue *pstep = ra+2;
|
||||||
@@ -898,7 +954,7 @@
|
@@ -898,7 +952,7 @@
|
||||||
dojump(L, pc, GETARG_sBx(i));
|
dojump(L, pc, GETARG_sBx(i));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -329,7 +329,7 @@
|
|||||||
StkId cb = ra + 3; /* call base */
|
StkId cb = ra + 3; /* call base */
|
||||||
setobjs2s(L, cb+2, ra+2);
|
setobjs2s(L, cb+2, ra+2);
|
||||||
setobjs2s(L, cb+1, ra+1);
|
setobjs2s(L, cb+1, ra+1);
|
||||||
@@ -914,7 +970,7 @@
|
@@ -914,7 +968,7 @@
|
||||||
pc++;
|
pc++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -338,7 +338,7 @@
|
|||||||
int n = GETARG_B(i);
|
int n = GETARG_B(i);
|
||||||
int c = GETARG_C(i);
|
int c = GETARG_C(i);
|
||||||
int last;
|
int last;
|
||||||
@@ -936,11 +992,11 @@
|
@@ -936,11 +990,11 @@
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -352,7 +352,7 @@
|
|||||||
Proto *p;
|
Proto *p;
|
||||||
Closure *ncl;
|
Closure *ncl;
|
||||||
int nup, j;
|
int nup, j;
|
||||||
@@ -960,7 +1016,7 @@
|
@@ -960,7 +1014,7 @@
|
||||||
Protect(luaC_checkGC(L));
|
Protect(luaC_checkGC(L));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user