浏览代码

OP_LEN OP_CONCAT

Hugo Musso Gualandi 5 年之前
父节点
当前提交
5472e50a72
共有 1 个文件被更改,包括 11 次插入2 次删除
  1. 11 2
      src/luaot.c

+ 11 - 2
src/luaot.c

@@ -830,8 +830,17 @@ void create_function(Proto *p)
                 println("    setbvalue(s2v(ra), nrb);");
                 break;
             }
-            // case OP_LEN
-            // case OP_CONCAT
+            case OP_LEN: {
+                println("    Protect(luaV_objlen(L, ra, vRB(i)));");
+                break;
+            }
+            case OP_CONCAT: {
+                println("    int n = GETARG_B(i);  /* number of elements to concatenate */");
+                println("    L->top = ra + n;  /* mark the end of concat operands */");
+                println("    ProtectNT(luaV_concat(L, n));");
+                println("    checkGC(L, L->top); /* 'luaV_concat' ensures correct top */");
+                break;
+            }
             // case OP_CLOSE
             // case OP_TBC
             // case OP_JMP