Compile getfenv(0).

This commit is contained in:
Mike Pall
2013-10-09 20:34:40 +02:00
parent 88c7785b87
commit e6e760ca9f
5 changed files with 31 additions and 2 deletions

View File

@@ -422,6 +422,19 @@ static void LJ_FASTCALL recff_xpcall(jit_State *J, RecordFFData *rd)
} /* else: Interpreter will throw. */
}
static void LJ_FASTCALL recff_getfenv(jit_State *J, RecordFFData *rd)
{
TRef tr = J->base[0];
/* Only support getfenv(0) for now. */
if (tref_isint(tr) && tref_isk(tr) && IR(tref_ref(tr))->i == 0) {
TRef trl = emitir(IRT(IR_LREF, IRT_THREAD), 0, 0);
J->base[0] = emitir(IRT(IR_FLOAD, IRT_TAB), trl, IRFL_THREAD_ENV);
return;
}
recff_nyiu(J);
UNUSED(rd);
}
/* -- Math library fast functions ----------------------------------------- */
static void LJ_FASTCALL recff_math_abs(jit_State *J, RecordFFData *rd)