]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
FFI: Fix ipairs() recording.
authorMike Pall <mike>
Sat, 24 Oct 2015 15:59:44 +0000 (17:59 +0200)
committerMike Pall <mike>
Sat, 24 Oct 2015 15:59:44 +0000 (17:59 +0200)
Thanks to Vyacheslav Egorov.

src/lj_ffrecord.c

index 69f71ab2efb686749bef8ac00c60d02661578563..308322517c5ced1ed4d553518e230f3835bd8741 100644 (file)
@@ -366,11 +366,12 @@ static void LJ_FASTCALL recff_ipairs_aux(jit_State *J, RecordFFData *rd)
 
 static void LJ_FASTCALL recff_ipairs(jit_State *J, RecordFFData *rd)
 {
-  if (!(LJ_52 && recff_metacall(J, rd, MM_ipairs))) {
-    TRef tab = J->base[0];
-    if (tref_istab(tab)) {
+  TRef tr = J->base[0];
+  if (!((LJ_52 || (LJ_HASFFI && tref_iscdata(tr))) &&
+       recff_metacall(J, rd, MM_ipairs))) {
+    if (tref_istab(tr)) {
       J->base[0] = lj_ir_kfunc(J, funcV(&J->fn->c.upvalue[0]));
-      J->base[1] = tab;
+      J->base[1] = tr;
       J->base[2] = lj_ir_kint(J, 0);
       rd->nres = 3;
     }  /* else: Interpreter will throw. */