Skip to content
Permalink
Browse files
Changes
  • Loading branch information
SoniEx2 committed Feb 1, 2015
1 parent 6e78ccc commit cbc51ad
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
@@ -35,3 +35,4 @@ This is a list of (to-be-)implemented features.

Use an array and dynamically put C functions in it as they're being
accessed. Patch OP_GETTABLE to mangle them on read.
- [x] OP_ME
@@ -55,6 +55,7 @@ LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = {
"CLOSURE",
"VARARG",
"EXTRAARG",
"ME",
NULL
};

@@ -103,5 +104,6 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */
,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */
,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */
,opmode(0, 1, OpArgN, OpArgN, iABx) /* OP_ME */
};

@@ -221,11 +221,13 @@ OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */

OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-2) = vararg */

OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */
OP_EXTRAARG,/* Ax extra (larger) argument for previous opcode */

OP_ME/* A R(A) := currently running function */
} OpCode;


#define NUM_OPCODES (cast(int, OP_EXTRAARG) + 1)
#define NUM_OPCODES (cast(int, OP_ME) + 1)



@@ -889,6 +889,12 @@ static void primaryexp (LexState *ls, expdesc *v) {
singlevar(ls, v);
return;
}
case '@': {
init_exp(v, VRELOCABLE, luaK_codeABx(ls->fs, OP_ME, ls->fs->freereg, 0));
luaK_exp2nextreg(ls->fs, v);
luaX_next(ls);
return;
}
default: {
luaX_syntaxerror(ls, "unexpected symbol");
}
@@ -861,6 +861,10 @@ void luaV_execute (lua_State *L) {
vmcase(OP_EXTRAARG,
lua_assert(0);
)
vmcase(OP_ME,
setobjs2s(L, ra, ci->func);
checkGC(L, ra + 1);
)
}
}
}

0 comments on commit cbc51ad

Please sign in to comment.