diff --git a/jni/LuaJIT-2.0.1/android/armeabi-v7a/libluajit.a b/jni/LuaJIT-2.0.1/android/armeabi-v7a/libluajit.a deleted file mode 100644 index 4627726e..00000000 Binary files a/jni/LuaJIT-2.0.1/android/armeabi-v7a/libluajit.a and /dev/null differ diff --git a/jni/LuaJIT-2.0.1/android/armeabi/libluajit.a b/jni/LuaJIT-2.0.1/android/armeabi/libluajit.a deleted file mode 100644 index 0e710760..00000000 Binary files a/jni/LuaJIT-2.0.1/android/armeabi/libluajit.a and /dev/null differ diff --git a/jni/LuaJIT-2.0.1/src/lib_bit.c b/jni/LuaJIT-2.0.1/src/lib_bit.c deleted file mode 100644 index 93fead92..00000000 --- a/jni/LuaJIT-2.0.1/src/lib_bit.c +++ /dev/null @@ -1,74 +0,0 @@ -/* -** Bit manipulation library. -** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h -*/ - -#define lib_bit_c -#define LUA_LIB - -#include "lua.h" -#include "lauxlib.h" -#include "lualib.h" - -#include "lj_obj.h" -#include "lj_err.h" -#include "lj_str.h" -#include "lj_lib.h" - -/* ------------------------------------------------------------------------ */ - -#define LJLIB_MODULE_bit - -LJLIB_ASM(bit_tobit) LJLIB_REC(bit_unary IR_TOBIT) -{ - lj_lib_checknumber(L, 1); - return FFH_RETRY; -} -LJLIB_ASM_(bit_bnot) LJLIB_REC(bit_unary IR_BNOT) -LJLIB_ASM_(bit_bswap) LJLIB_REC(bit_unary IR_BSWAP) - -LJLIB_ASM(bit_lshift) LJLIB_REC(bit_shift IR_BSHL) -{ - lj_lib_checknumber(L, 1); - lj_lib_checkbit(L, 2); - return FFH_RETRY; -} -LJLIB_ASM_(bit_rshift) LJLIB_REC(bit_shift IR_BSHR) -LJLIB_ASM_(bit_arshift) LJLIB_REC(bit_shift IR_BSAR) -LJLIB_ASM_(bit_rol) LJLIB_REC(bit_shift IR_BROL) -LJLIB_ASM_(bit_ror) LJLIB_REC(bit_shift IR_BROR) - -LJLIB_ASM(bit_band) LJLIB_REC(bit_nary IR_BAND) -{ - int i = 0; - do { lj_lib_checknumber(L, ++i); } while (L->base+i < L->top); - return FFH_RETRY; -} -LJLIB_ASM_(bit_bor) LJLIB_REC(bit_nary IR_BOR) -LJLIB_ASM_(bit_bxor) LJLIB_REC(bit_nary IR_BXOR) - -/* ------------------------------------------------------------------------ */ - -LJLIB_CF(bit_tohex) -{ - uint32_t b = (uint32_t)lj_lib_checkbit(L, 1); - int32_t i, n = L->base+1 >= L->top ? 8 : lj_lib_checkbit(L, 2); - const char *hexdigits = "0123456789abcdef"; - char buf[8]; - if (n < 0) { n = -n; hexdigits = "0123456789ABCDEF"; } - if (n > 8) n = 8; - for (i = n; --i >= 0; ) { buf[i] = hexdigits[b & 15]; b >>= 4; } - lua_pushlstring(L, buf, (size_t)n); - return 1; -} - -/* ------------------------------------------------------------------------ */ - -#include "lj_libdef.h" - -LUALIB_API int luaopen_bit(lua_State *L) -{ - LJ_LIB_REG(L, LUA_BITLIBNAME, bit); - return 1; -} - diff --git a/jni/LuaJIT-2.0.1/src/lj_lex.c b/jni/LuaJIT-2.0.1/src/lj_lex.c deleted file mode 100644 index 9f2b06f8..00000000 --- a/jni/LuaJIT-2.0.1/src/lj_lex.c +++ /dev/null @@ -1,481 +0,0 @@ -/* -** Lexical analyzer. -** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h -** -** Major portions taken verbatim or adapted from the Lua interpreter. -** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h -*/ - -#define lj_lex_c -#define LUA_CORE - -#include "lj_obj.h" -#include "lj_gc.h" -#include "lj_err.h" -#include "lj_str.h" -#if LJ_HASFFI -#include "lj_tab.h" -#include "lj_ctype.h" -#include "lj_cdata.h" -#include "lualib.h" -#endif -#include "lj_state.h" -#include "lj_lex.h" -#include "lj_parse.h" -#include "lj_char.h" -#include "lj_strscan.h" - -/* Lua lexer token names. */ -static const char *const tokennames[] = { -#define TKSTR1(name) #name, -#define TKSTR2(name, sym) #sym, -TKDEF(TKSTR1, TKSTR2) -#undef TKSTR1 -#undef TKSTR2 - NULL -}; - -/* -- Buffer handling ----------------------------------------------------- */ - -#define char2int(c) ((int)(uint8_t)(c)) -#define next(ls) \ - (ls->current = (ls->n--) > 0 ? char2int(*ls->p++) : fillbuf(ls)) -#define save_and_next(ls) (save(ls, ls->current), next(ls)) -#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') -#define END_OF_STREAM (-1) - -static int fillbuf(LexState *ls) -{ - size_t sz; - const char *buf = ls->rfunc(ls->L, ls->rdata, &sz); - if (buf == NULL || sz == 0) return END_OF_STREAM; - ls->n = (MSize)sz - 1; - ls->p = buf; - return char2int(*(ls->p++)); -} - -static LJ_NOINLINE void save_grow(LexState *ls, int c) -{ - MSize newsize; - if (ls->sb.sz >= LJ_MAX_STR/2) - lj_lex_error(ls, 0, LJ_ERR_XELEM); - newsize = ls->sb.sz * 2; - lj_str_resizebuf(ls->L, &ls->sb, newsize); - ls->sb.buf[ls->sb.n++] = (char)c; -} - -static LJ_AINLINE void save(LexState *ls, int c) -{ - if (LJ_UNLIKELY(ls->sb.n + 1 > ls->sb.sz)) - save_grow(ls, c); - else - ls->sb.buf[ls->sb.n++] = (char)c; -} - -static void inclinenumber(LexState *ls) -{ - int old = ls->current; - lua_assert(currIsNewline(ls)); - next(ls); /* skip `\n' or `\r' */ - if (currIsNewline(ls) && ls->current != old) - next(ls); /* skip `\n\r' or `\r\n' */ - if (++ls->linenumber >= LJ_MAX_LINE) - lj_lex_error(ls, ls->token, LJ_ERR_XLINES); -} - -/* -- Scanner for terminals ----------------------------------------------- */ - -/* Parse a number literal. */ -static void lex_number(LexState *ls, TValue *tv) -{ - StrScanFmt fmt; - int c, xp = 'e'; - lua_assert(lj_char_isdigit(ls->current)); - if ((c = ls->current) == '0') { - save_and_next(ls); - if ((ls->current | 0x20) == 'x') xp = 'p'; - } - while (lj_char_isident(ls->current) || ls->current == '.' || - ((ls->current == '-' || ls->current == '+') && (c | 0x20) == xp)) { - c = ls->current; - save_and_next(ls); - } - save(ls, '\0'); - fmt = lj_strscan_scan((const uint8_t *)ls->sb.buf, tv, - (LJ_DUALNUM ? STRSCAN_OPT_TOINT : STRSCAN_OPT_TONUM) | - (LJ_HASFFI ? (STRSCAN_OPT_LL|STRSCAN_OPT_IMAG) : 0)); - if (LJ_DUALNUM && fmt == STRSCAN_INT) { - setitype(tv, LJ_TISNUM); - } else if (fmt == STRSCAN_NUM) { - /* Already in correct format. */ -#if LJ_HASFFI - } else if (fmt != STRSCAN_ERROR) { - lua_State *L = ls->L; - GCcdata *cd; - lua_assert(fmt == STRSCAN_I64 || fmt == STRSCAN_U64 || fmt == STRSCAN_IMAG); - if (!ctype_ctsG(G(L))) { - ptrdiff_t oldtop = savestack(L, L->top); - luaopen_ffi(L); /* Load FFI library on-demand. */ - L->top = restorestack(L, oldtop); - } - if (fmt == STRSCAN_IMAG) { - cd = lj_cdata_new_(L, CTID_COMPLEX_DOUBLE, 2*sizeof(double)); - ((double *)cdataptr(cd))[0] = 0; - ((double *)cdataptr(cd))[1] = numV(tv); - } else { - cd = lj_cdata_new_(L, fmt==STRSCAN_I64 ? CTID_INT64 : CTID_UINT64, 8); - *(uint64_t *)cdataptr(cd) = tv->u64; - } - lj_parse_keepcdata(ls, tv, cd); -#endif - } else { - lua_assert(fmt == STRSCAN_ERROR); - lj_lex_error(ls, TK_number, LJ_ERR_XNUMBER); - } -} - -static int skip_sep(LexState *ls) -{ - int count = 0; - int s = ls->current; - lua_assert(s == '[' || s == ']'); - save_and_next(ls); - while (ls->current == '=') { - save_and_next(ls); - count++; - } - return (ls->current == s) ? count : (-count) - 1; -} - -static void read_long_string(LexState *ls, TValue *tv, int sep) -{ - save_and_next(ls); /* skip 2nd `[' */ - if (currIsNewline(ls)) /* string starts with a newline? */ - inclinenumber(ls); /* skip it */ - for (;;) { - switch (ls->current) { - case END_OF_STREAM: - lj_lex_error(ls, TK_eof, tv ? LJ_ERR_XLSTR : LJ_ERR_XLCOM); - break; - case ']': - if (skip_sep(ls) == sep) { - save_and_next(ls); /* skip 2nd `]' */ - goto endloop; - } - break; - case '\n': - case '\r': - save(ls, '\n'); - inclinenumber(ls); - if (!tv) lj_str_resetbuf(&ls->sb); /* avoid wasting space */ - break; - default: - if (tv) save_and_next(ls); - else next(ls); - break; - } - } endloop: - if (tv) { - GCstr *str = lj_parse_keepstr(ls, ls->sb.buf + (2 + (MSize)sep), - ls->sb.n - 2*(2 + (MSize)sep)); - setstrV(ls->L, tv, str); - } -} - -static void read_string(LexState *ls, int delim, TValue *tv) -{ - save_and_next(ls); - while (ls->current != delim) { - switch (ls->current) { - case END_OF_STREAM: - lj_lex_error(ls, TK_eof, LJ_ERR_XSTR); - continue; - case '\n': - case '\r': - lj_lex_error(ls, TK_string, LJ_ERR_XSTR); - continue; - case '\\': { - int c = next(ls); /* Skip the '\\'. */ - switch (c) { - case 'a': c = '\a'; break; - case 'b': c = '\b'; break; - case 'f': c = '\f'; break; - case 'n': c = '\n'; break; - case 'r': c = '\r'; break; - case 't': c = '\t'; break; - case 'v': c = '\v'; break; - case 'x': /* Hexadecimal escape '\xXX'. */ - c = (next(ls) & 15u) << 4; - if (!lj_char_isdigit(ls->current)) { - if (!lj_char_isxdigit(ls->current)) goto err_xesc; - c += 9 << 4; - } - c += (next(ls) & 15u); - if (!lj_char_isdigit(ls->current)) { - if (!lj_char_isxdigit(ls->current)) goto err_xesc; - c += 9; - } - break; - case 'z': /* Skip whitespace. */ - next(ls); - while (lj_char_isspace(ls->current)) - if (currIsNewline(ls)) inclinenumber(ls); else next(ls); - continue; - case '\n': case '\r': save(ls, '\n'); inclinenumber(ls); continue; - case '\\': case '\"': case '\'': break; - case END_OF_STREAM: continue; - default: - if (!lj_char_isdigit(c)) - goto err_xesc; - c -= '0'; /* Decimal escape '\ddd'. */ - if (lj_char_isdigit(next(ls))) { - c = c*10 + (ls->current - '0'); - if (lj_char_isdigit(next(ls))) { - c = c*10 + (ls->current - '0'); - if (c > 255) { - err_xesc: - lj_lex_error(ls, TK_string, LJ_ERR_XESC); - } - next(ls); - } - } - save(ls, c); - continue; - } - save(ls, c); - next(ls); - continue; - } - default: - save_and_next(ls); - break; - } - } - save_and_next(ls); /* skip delimiter */ - setstrV(ls->L, tv, lj_parse_keepstr(ls, ls->sb.buf + 1, ls->sb.n - 2)); -} - -/* -- Main lexical scanner ------------------------------------------------ */ - -static int llex(LexState *ls, TValue *tv) -{ - lj_str_resetbuf(&ls->sb); - for (;;) { - if (lj_char_isident(ls->current)) { - GCstr *s; - if (lj_char_isdigit(ls->current)) { /* Numeric literal. */ - lex_number(ls, tv); - return TK_number; - } - /* Identifier or reserved word. */ - do { - save_and_next(ls); - } while (lj_char_isident(ls->current)); - s = lj_parse_keepstr(ls, ls->sb.buf, ls->sb.n); - setstrV(ls->L, tv, s); - if (s->reserved > 0) /* Reserved word? */ - return TK_OFS + s->reserved; - return TK_name; - } - switch (ls->current) { - case '\n': - case '\r': - inclinenumber(ls); - continue; - case ' ': - case '\t': - case '\v': - case '\f': - next(ls); - continue; - case '-': - next(ls); - if (ls->current != '-') return '-'; - /* else is a comment */ - next(ls); - if (ls->current == '[') { - int sep = skip_sep(ls); - lj_str_resetbuf(&ls->sb); /* `skip_sep' may dirty the buffer */ - if (sep >= 0) { - read_long_string(ls, NULL, sep); /* long comment */ - lj_str_resetbuf(&ls->sb); - continue; - } - } - /* else short comment */ - while (!currIsNewline(ls) && ls->current != END_OF_STREAM) - next(ls); - continue; - case '[': { - int sep = skip_sep(ls); - if (sep >= 0) { - read_long_string(ls, tv, sep); - return TK_string; - } else if (sep == -1) { - return '['; - } else { - lj_lex_error(ls, TK_string, LJ_ERR_XLDELIM); - continue; - } - } - case '=': - next(ls); - if (ls->current != '=') return '='; else { next(ls); return TK_eq; } - case '<': - next(ls); - if (ls->current != '=') return '<'; else { next(ls); return TK_le; } - case '>': - next(ls); - if (ls->current != '=') return '>'; else { next(ls); return TK_ge; } - case '~': - next(ls); - if (ls->current != '=') return '~'; else { next(ls); return TK_ne; } - case ':': - next(ls); - if (ls->current != ':') return ':'; else { next(ls); return TK_label; } - case '"': - case '\'': - read_string(ls, ls->current, tv); - return TK_string; - case '.': - save_and_next(ls); - if (ls->current == '.') { - next(ls); - if (ls->current == '.') { - next(ls); - return TK_dots; /* ... */ - } - return TK_concat; /* .. */ - } else if (!lj_char_isdigit(ls->current)) { - return '.'; - } else { - lex_number(ls, tv); - return TK_number; - } - case END_OF_STREAM: - return TK_eof; - default: { - int c = ls->current; - next(ls); - return c; /* Single-char tokens (+ - / ...). */ - } - } - } -} - -/* -- Lexer API ----------------------------------------------------------- */ - -/* Setup lexer state. */ -int lj_lex_setup(lua_State *L, LexState *ls) -{ - int header = 0; - ls->L = L; - ls->fs = NULL; - ls->n = 0; - ls->p = NULL; - ls->vstack = NULL; - ls->sizevstack = 0; - ls->vtop = 0; - ls->bcstack = NULL; - ls->sizebcstack = 0; - ls->lookahead = TK_eof; /* No look-ahead token. */ - ls->linenumber = 1; - ls->lastline = 1; - lj_str_resizebuf(ls->L, &ls->sb, LJ_MIN_SBUF); - next(ls); /* Read-ahead first char. */ - if (ls->current == 0xef && ls->n >= 2 && char2int(ls->p[0]) == 0xbb && - char2int(ls->p[1]) == 0xbf) { /* Skip UTF-8 BOM (if buffered). */ - ls->n -= 2; - ls->p += 2; - next(ls); - header = 1; - } - if (ls->current == '#') { /* Skip POSIX #! header line. */ - do { - next(ls); - if (ls->current == END_OF_STREAM) return 0; - } while (!currIsNewline(ls)); - inclinenumber(ls); - header = 1; - } - if (ls->current == LUA_SIGNATURE[0]) { /* Bytecode dump. */ - if (header) { - /* - ** Loading bytecode with an extra header is disabled for security - ** reasons. This may circumvent the usual check for bytecode vs. - ** Lua code by looking at the first char. Since this is a potential - ** security violation no attempt is made to echo the chunkname either. - */ - setstrV(L, L->top++, lj_err_str(L, LJ_ERR_BCBAD)); - lj_err_throw(L, LUA_ERRSYNTAX); - } - return 1; - } - return 0; -} - -/* Cleanup lexer state. */ -void lj_lex_cleanup(lua_State *L, LexState *ls) -{ - global_State *g = G(L); - lj_mem_freevec(g, ls->bcstack, ls->sizebcstack, BCInsLine); - lj_mem_freevec(g, ls->vstack, ls->sizevstack, VarInfo); - lj_str_freebuf(g, &ls->sb); -} - -void lj_lex_next(LexState *ls) -{ - ls->lastline = ls->linenumber; - if (LJ_LIKELY(ls->lookahead == TK_eof)) { /* No lookahead token? */ - ls->token = llex(ls, &ls->tokenval); /* Get next token. */ - } else { /* Otherwise return lookahead token. */ - ls->token = ls->lookahead; - ls->lookahead = TK_eof; - ls->tokenval = ls->lookaheadval; - } -} - -LexToken lj_lex_lookahead(LexState *ls) -{ - lua_assert(ls->lookahead == TK_eof); - ls->lookahead = llex(ls, &ls->lookaheadval); - return ls->lookahead; -} - -const char *lj_lex_token2str(LexState *ls, LexToken token) -{ - if (token > TK_OFS) - return tokennames[token-TK_OFS-1]; - else if (!lj_char_iscntrl(token)) - return lj_str_pushf(ls->L, "%c", token); - else - return lj_str_pushf(ls->L, "char(%d)", token); -} - -void lj_lex_error(LexState *ls, LexToken token, ErrMsg em, ...) -{ - const char *tok; - va_list argp; - if (token == 0) { - tok = NULL; - } else if (token == TK_name || token == TK_string || token == TK_number) { - save(ls, '\0'); - tok = ls->sb.buf; - } else { - tok = lj_lex_token2str(ls, token); - } - va_start(argp, em); - lj_err_lex(ls->L, ls->chunkname, tok, ls->linenumber, em, argp); - va_end(argp); -} - -void lj_lex_init(lua_State *L) -{ - uint32_t i; - for (i = 0; i < TK_RESERVED; i++) { - GCstr *s = lj_str_newz(L, tokennames[i]); - fixstring(s); /* Reserved words are never collected. */ - s->reserved = (uint8_t)(i+1); - } -} - diff --git a/jni/LuaJIT-2.0.1/src/lj_str.c b/jni/LuaJIT-2.0.1/src/lj_str.c deleted file mode 100644 index e63d8628..00000000 --- a/jni/LuaJIT-2.0.1/src/lj_str.c +++ /dev/null @@ -1,339 +0,0 @@ -/* -** String handling. -** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h -** -** Portions taken verbatim or adapted from the Lua interpreter. -** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h -*/ - -#include - -#define lj_str_c -#define LUA_CORE - -#include "lj_obj.h" -#include "lj_gc.h" -#include "lj_err.h" -#include "lj_str.h" -#include "lj_state.h" -#include "lj_char.h" - -/* -- String interning ---------------------------------------------------- */ - -/* Ordered compare of strings. Assumes string data is 4-byte aligned. */ -int32_t LJ_FASTCALL lj_str_cmp(GCstr *a, GCstr *b) -{ - MSize i, n = a->len > b->len ? b->len : a->len; - for (i = 0; i < n; i += 4) { - /* Note: innocuous access up to end of string + 3. */ - uint32_t va = *(const uint32_t *)(strdata(a)+i); - uint32_t vb = *(const uint32_t *)(strdata(b)+i); - if (va != vb) { -#if LJ_LE - va = lj_bswap(va); vb = lj_bswap(vb); -#endif - i -= n; - if ((int32_t)i >= -3) { - va >>= 32+(i<<3); vb >>= 32+(i<<3); - if (va == vb) break; - } - return va < vb ? -1 : 1; - } - } - return (int32_t)(a->len - b->len); -} - -/* Fast string data comparison. Caveat: unaligned access to 1st string! */ -static LJ_AINLINE int str_fastcmp(const char *a, const char *b, MSize len) -{ - MSize i = 0; - lua_assert(len > 0); - lua_assert((((uintptr_t)a + len) & (LJ_PAGESIZE-1)) <= LJ_PAGESIZE-4); - do { /* Note: innocuous access up to end of string + 3. */ - uint32_t v = lj_getu32(a+i) ^ *(const uint32_t *)(b+i); - if (v) { - i -= len; -#if LJ_LE - return (int32_t)i >= -3 ? (v << (32+(i<<3))) : 1; -#else - return (int32_t)i >= -3 ? (v >> (32+(i<<3))) : 1; -#endif - } - i += 4; - } while (i < len); - return 0; -} - -/* Resize the string hash table (grow and shrink). */ -void lj_str_resize(lua_State *L, MSize newmask) -{ - global_State *g = G(L); - GCRef *newhash; - MSize i; - if (g->gc.state == GCSsweepstring || newmask >= LJ_MAX_STRTAB-1) - return; /* No resizing during GC traversal or if already too big. */ - newhash = lj_mem_newvec(L, newmask+1, GCRef); - memset(newhash, 0, (newmask+1)*sizeof(GCRef)); - for (i = g->strmask; i != ~(MSize)0; i--) { /* Rehash old table. */ - GCobj *p = gcref(g->strhash[i]); - while (p) { /* Follow each hash chain and reinsert all strings. */ - MSize h = gco2str(p)->hash & newmask; - GCobj *next = gcnext(p); - /* NOBARRIER: The string table is a GC root. */ - setgcrefr(p->gch.nextgc, newhash[h]); - setgcref(newhash[h], p); - p = next; - } - } - lj_mem_freevec(g, g->strhash, g->strmask+1, GCRef); - g->strmask = newmask; - g->strhash = newhash; -} - -/* Intern a string and return string object. */ -GCstr *lj_str_new(lua_State *L, const char *str, size_t lenx) -{ - global_State *g; - GCstr *s; - GCobj *o; - MSize len = (MSize)lenx; - MSize a, b, h = len; - if (lenx >= LJ_MAX_STR) - lj_err_msg(L, LJ_ERR_STROV); - g = G(L); - /* Compute string hash. Constants taken from lookup3 hash by Bob Jenkins. */ - if (len >= 4) { /* Caveat: unaligned access! */ - a = lj_getu32(str); - h ^= lj_getu32(str+len-4); - b = lj_getu32(str+(len>>1)-2); - h ^= b; h -= lj_rol(b, 14); - b += lj_getu32(str+(len>>2)-1); - } else if (len > 0) { - a = *(const uint8_t *)str; - h ^= *(const uint8_t *)(str+len-1); - b = *(const uint8_t *)(str+(len>>1)); - h ^= b; h -= lj_rol(b, 14); - } else { - return &g->strempty; - } - a ^= h; a -= lj_rol(h, 11); - b ^= a; b -= lj_rol(a, 25); - h ^= b; h -= lj_rol(b, 16); - /* Check if the string has already been interned. */ - o = gcref(g->strhash[h & g->strmask]); - if (LJ_LIKELY((((uintptr_t)str + len) & (LJ_PAGESIZE-1)) <= LJ_PAGESIZE-4)) { - while (o != NULL) { - GCstr *sx = gco2str(o); - if (sx->len == len && str_fastcmp(str, strdata(sx), len) == 0) { - /* Resurrect if dead. Can only happen with fixstring() (keywords). */ - if (isdead(g, o)) flipwhite(o); - return sx; /* Return existing string. */ - } - o = gcnext(o); - } - } else { /* Slow path: end of string is too close to a page boundary. */ - while (o != NULL) { - GCstr *sx = gco2str(o); - if (sx->len == len && memcmp(str, strdata(sx), len) == 0) { - /* Resurrect if dead. Can only happen with fixstring() (keywords). */ - if (isdead(g, o)) flipwhite(o); - return sx; /* Return existing string. */ - } - o = gcnext(o); - } - } - /* Nope, create a new string. */ - s = lj_mem_newt(L, sizeof(GCstr)+len+1, GCstr); - newwhite(g, s); - s->gct = ~LJ_TSTR; - s->len = len; - s->hash = h; - s->reserved = 0; - memcpy(strdatawr(s), str, len); - strdatawr(s)[len] = '\0'; /* Zero-terminate string. */ - /* Add it to string hash table. */ - h &= g->strmask; - s->nextgc = g->strhash[h]; - /* NOBARRIER: The string table is a GC root. */ - setgcref(g->strhash[h], obj2gco(s)); - if (g->strnum++ > g->strmask) /* Allow a 100% load factor. */ - lj_str_resize(L, (g->strmask<<1)+1); /* Grow string table. */ - return s; /* Return newly interned string. */ -} - -void LJ_FASTCALL lj_str_free(global_State *g, GCstr *s) -{ - g->strnum--; - lj_mem_free(g, s, sizestring(s)); -} - -/* -- Type conversions ---------------------------------------------------- */ - -/* Print number to buffer. Canonicalizes non-finite values. */ -size_t LJ_FASTCALL lj_str_bufnum(char *s, cTValue *o) -{ - if (LJ_LIKELY((o->u32.hi << 1) < 0xffe00000)) { /* Finite? */ - lua_Number n = o->n; -#if __BIONIC__ - if (tvismzero(o)) { s[0] = '-'; s[1] = '0'; return 2; } -#endif - return (size_t)lua_number2str(s, n); - } else if (((o->u32.hi & 0x000fffff) | o->u32.lo) != 0) { - s[0] = 'n'; s[1] = 'a'; s[2] = 'n'; return 3; - } else if ((o->u32.hi & 0x80000000) == 0) { - s[0] = 'i'; s[1] = 'n'; s[2] = 'f'; return 3; - } else { - s[0] = '-'; s[1] = 'i'; s[2] = 'n'; s[3] = 'f'; return 4; - } -} - -/* Print integer to buffer. Returns pointer to start. */ -char * LJ_FASTCALL lj_str_bufint(char *p, int32_t k) -{ - uint32_t u = (uint32_t)(k < 0 ? -k : k); - p += 1+10; - do { *--p = (char)('0' + u % 10); } while (u /= 10); - if (k < 0) *--p = '-'; - return p; -} - -/* Convert number to string. */ -GCstr * LJ_FASTCALL lj_str_fromnum(lua_State *L, const lua_Number *np) -{ - char buf[LJ_STR_NUMBUF]; - size_t len = lj_str_bufnum(buf, (TValue *)np); - return lj_str_new(L, buf, len); -} - -/* Convert integer to string. */ -GCstr * LJ_FASTCALL lj_str_fromint(lua_State *L, int32_t k) -{ - char s[1+10]; - char *p = lj_str_bufint(s, k); - return lj_str_new(L, p, (size_t)(s+sizeof(s)-p)); -} - -GCstr * LJ_FASTCALL lj_str_fromnumber(lua_State *L, cTValue *o) -{ - return tvisint(o) ? lj_str_fromint(L, intV(o)) : lj_str_fromnum(L, &o->n); -} - -/* -- String formatting --------------------------------------------------- */ - -static void addstr(lua_State *L, SBuf *sb, const char *str, MSize len) -{ - char *p; - MSize i; - if (sb->n + len > sb->sz) { - MSize sz = sb->sz * 2; - while (sb->n + len > sz) sz = sz * 2; - lj_str_resizebuf(L, sb, sz); - } - p = sb->buf + sb->n; - sb->n += len; - for (i = 0; i < len; i++) p[i] = str[i]; -} - -static void addchar(lua_State *L, SBuf *sb, int c) -{ - if (sb->n + 1 > sb->sz) { - MSize sz = sb->sz * 2; - lj_str_resizebuf(L, sb, sz); - } - sb->buf[sb->n++] = (char)c; -} - -/* Push formatted message as a string object to Lua stack. va_list variant. */ -const char *lj_str_pushvf(lua_State *L, const char *fmt, va_list argp) -{ - SBuf *sb = &G(L)->tmpbuf; - lj_str_needbuf(L, sb, (MSize)strlen(fmt)); - lj_str_resetbuf(sb); - for (;;) { - const char *e = strchr(fmt, '%'); - if (e == NULL) break; - addstr(L, sb, fmt, (MSize)(e-fmt)); - /* This function only handles %s, %c, %d, %f and %p formats. */ - switch (e[1]) { - case 's': { - const char *s = va_arg(argp, char *); - if (s == NULL) s = "(null)"; - addstr(L, sb, s, (MSize)strlen(s)); - break; - } - case 'c': - addchar(L, sb, va_arg(argp, int)); - break; - case 'd': { - char buf[LJ_STR_INTBUF]; - char *p = lj_str_bufint(buf, va_arg(argp, int32_t)); - addstr(L, sb, p, (MSize)(buf+LJ_STR_INTBUF-p)); - break; - } - case 'f': { - char buf[LJ_STR_NUMBUF]; - TValue tv; - MSize len; - tv.n = (lua_Number)(va_arg(argp, LUAI_UACNUMBER)); - len = (MSize)lj_str_bufnum(buf, &tv); - addstr(L, sb, buf, len); - break; - } - case 'p': { -#define FMTP_CHARS (2*sizeof(ptrdiff_t)) - char buf[2+FMTP_CHARS]; - ptrdiff_t p = (ptrdiff_t)(va_arg(argp, void *)); - ptrdiff_t i, lasti = 2+FMTP_CHARS; - if (p == 0) { - addstr(L, sb, "NULL", 4); - break; - } -#if LJ_64 - /* Shorten output for 64 bit pointers. */ - lasti = 2+2*4+((p >> 32) ? 2+2*(lj_fls((uint32_t)(p >> 32))>>3) : 0); -#endif - buf[0] = '0'; - buf[1] = 'x'; - for (i = lasti-1; i >= 2; i--, p >>= 4) - buf[i] = "0123456789abcdef"[(p & 15)]; - addstr(L, sb, buf, (MSize)lasti); - break; - } - case '%': - addchar(L, sb, '%'); - break; - default: - addchar(L, sb, '%'); - addchar(L, sb, e[1]); - break; - } - fmt = e+2; - } - addstr(L, sb, fmt, (MSize)strlen(fmt)); - setstrV(L, L->top, lj_str_new(L, sb->buf, sb->n)); - incr_top(L); - return strVdata(L->top - 1); -} - -/* Push formatted message as a string object to Lua stack. Vararg variant. */ -const char *lj_str_pushf(lua_State *L, const char *fmt, ...) -{ - const char *msg; - va_list argp; - va_start(argp, fmt); - msg = lj_str_pushvf(L, fmt, argp); - va_end(argp); - return msg; -} - -/* -- Buffer handling ----------------------------------------------------- */ - -char *lj_str_needbuf(lua_State *L, SBuf *sb, MSize sz) -{ - if (sz > sb->sz) { - if (sz < LJ_MIN_SBUF) sz = LJ_MIN_SBUF; - lj_str_resizebuf(L, sb, sz); - } - return sb->buf; -} - diff --git a/jni/LuaJIT-2.0.1/src/lj_str.h b/jni/LuaJIT-2.0.1/src/lj_str.h deleted file mode 100644 index 3aa03662..00000000 --- a/jni/LuaJIT-2.0.1/src/lj_str.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -** String handling. -** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h -*/ - -#ifndef _LJ_STR_H -#define _LJ_STR_H - -#include - -#include "lj_obj.h" - -/* String interning. */ -LJ_FUNC int32_t LJ_FASTCALL lj_str_cmp(GCstr *a, GCstr *b); -LJ_FUNC void lj_str_resize(lua_State *L, MSize newmask); -LJ_FUNCA GCstr *lj_str_new(lua_State *L, const char *str, size_t len); -LJ_FUNC void LJ_FASTCALL lj_str_free(global_State *g, GCstr *s); - -#define lj_str_newz(L, s) (lj_str_new(L, s, strlen(s))) -#define lj_str_newlit(L, s) (lj_str_new(L, "" s, sizeof(s)-1)) - -/* Type conversions. */ -LJ_FUNC size_t LJ_FASTCALL lj_str_bufnum(char *s, cTValue *o); -LJ_FUNC char * LJ_FASTCALL lj_str_bufint(char *p, int32_t k); -LJ_FUNCA GCstr * LJ_FASTCALL lj_str_fromnum(lua_State *L, const lua_Number *np); -LJ_FUNC GCstr * LJ_FASTCALL lj_str_fromint(lua_State *L, int32_t k); -LJ_FUNCA GCstr * LJ_FASTCALL lj_str_fromnumber(lua_State *L, cTValue *o); - -#define LJ_STR_INTBUF (1+10) -#define LJ_STR_NUMBUF LUAI_MAXNUMBER2STR - -/* String formatting. */ -LJ_FUNC const char *lj_str_pushvf(lua_State *L, const char *fmt, va_list argp); -LJ_FUNC const char *lj_str_pushf(lua_State *L, const char *fmt, ...) -#if defined(__GNUC__) - __attribute__ ((format (printf, 2, 3))) -#endif - ; - -/* Resizable string buffers. Struct definition in lj_obj.h. */ -LJ_FUNC char *lj_str_needbuf(lua_State *L, SBuf *sb, MSize sz); - -#define lj_str_initbuf(sb) ((sb)->buf = NULL, (sb)->sz = 0) -#define lj_str_resetbuf(sb) ((sb)->n = 0) -#define lj_str_resizebuf(L, sb, size) \ - ((sb)->buf = (char *)lj_mem_realloc(L, (sb)->buf, (sb)->sz, (size)), \ - (sb)->sz = (size)) -#define lj_str_freebuf(g, sb) lj_mem_free(g, (void *)(sb)->buf, (sb)->sz) - -#endif diff --git a/jni/LuaJIT-2.0.1/Android.mk b/jni/LuaJIT-2.1/Android.mk similarity index 100% rename from jni/LuaJIT-2.0.1/Android.mk rename to jni/LuaJIT-2.1/Android.mk diff --git a/jni/LuaJIT-2.0.1/COPYRIGHT b/jni/LuaJIT-2.1/COPYRIGHT similarity index 98% rename from jni/LuaJIT-2.0.1/COPYRIGHT rename to jni/LuaJIT-2.1/COPYRIGHT index 83ce94da..1ef7df62 100644 --- a/jni/LuaJIT-2.0.1/COPYRIGHT +++ b/jni/LuaJIT-2.1/COPYRIGHT @@ -1,7 +1,7 @@ =============================================================================== LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/ -Copyright (C) 2005-2013 Mike Pall. All rights reserved. +Copyright (C) 2005-2015 Mike Pall. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/jni/LuaJIT-2.0.1/Makefile b/jni/LuaJIT-2.1/Makefile similarity index 84% rename from jni/LuaJIT-2.0.1/Makefile rename to jni/LuaJIT-2.1/Makefile index 7976b925..8ce773e3 100644 --- a/jni/LuaJIT-2.0.1/Makefile +++ b/jni/LuaJIT-2.1/Makefile @@ -10,13 +10,14 @@ # For MSVC, please follow the instructions given in src/msvcbuild.bat. # For MinGW and Cygwin, cd to src and run make with the Makefile there. # -# Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h +# Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h ############################################################################## MAJVER= 2 -MINVER= 0 -RELVER= 1 -VERSION= $(MAJVER).$(MINVER).$(RELVER) +MINVER= 1 +RELVER= 0 +PREREL= -beta1 +VERSION= $(MAJVER).$(MINVER).$(RELVER)$(PREREL) ABIVER= 5.1 ############################################################################## @@ -25,11 +26,12 @@ ABIVER= 5.1 # the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path! # export PREFIX= /usr/local +export MULTILIB= lib ############################################################################## DPREFIX= $(DESTDIR)$(PREFIX) INSTALL_BIN= $(DPREFIX)/bin -INSTALL_LIB= $(DPREFIX)/lib +INSTALL_LIB= $(DPREFIX)/$(MULTILIB) INSTALL_SHARE= $(DPREFIX)/share INSTALL_INC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER) @@ -73,7 +75,8 @@ INSTALL_X= install -m 0755 INSTALL_F= install -m 0644 UNINSTALL= $(RM) LDCONFIG= ldconfig -n -SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" +SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \ + -e "s|^multilib=.*|multilib=$(MULTILIB)|" FILE_T= luajit FILE_A= libluajit.a @@ -81,8 +84,9 @@ FILE_SO= libluajit.so FILE_MAN= luajit.1 FILE_PC= luajit.pc FILES_INC= lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h -FILES_JITLIB= bc.lua v.lua dump.lua dis_x86.lua dis_x64.lua dis_arm.lua \ - dis_ppc.lua dis_mips.lua dis_mipsel.lua bcsave.lua vmdef.lua +FILES_JITLIB= bc.lua bcsave.lua dump.lua p.lua v.lua zone.lua \ + dis_x86.lua dis_x64.lua dis_arm.lua dis_ppc.lua \ + dis_mips.lua dis_mipsel.lua vmdef.lua ifeq (,$(findstring Windows,$(OS))) ifeq (Darwin,$(shell uname -s)) @@ -107,7 +111,7 @@ install: $(INSTALL_DEP) $(MKDIR) $(INSTALL_DIRS) cd src && $(INSTALL_X) $(FILE_T) $(INSTALL_T) cd src && test -f $(FILE_A) && $(INSTALL_F) $(FILE_A) $(INSTALL_STATIC) || : - $(RM) $(INSTALL_TSYM) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) + $(RM) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) cd src && test -f $(FILE_SO) && \ $(INSTALL_X) $(FILE_SO) $(INSTALL_DYN) && \ $(LDCONFIG) $(INSTALL_LIB) && \ @@ -119,12 +123,18 @@ install: $(INSTALL_DEP) $(RM) $(FILE_PC).tmp cd src && $(INSTALL_F) $(FILES_INC) $(INSTALL_INC) cd src/jit && $(INSTALL_F) $(FILES_JITLIB) $(INSTALL_JITLIB) - $(SYMLINK) $(INSTALL_TNAME) $(INSTALL_TSYM) @echo "==== Successfully installed LuaJIT $(VERSION) to $(PREFIX) ====" + @echo "" + @echo "Note: the development releases deliberately do NOT install a symlink for luajit" + @echo "You can do this now by running this command (with sudo):" + @echo "" + @echo " $(SYMLINK) $(INSTALL_TNAME) $(INSTALL_TSYM)" + @echo "" + uninstall: @echo "==== Uninstalling LuaJIT $(VERSION) from $(PREFIX) ====" - $(UNINSTALL) $(INSTALL_TSYM) $(INSTALL_T) $(INSTALL_STATIC) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) $(INSTALL_MAN)/$(FILE_MAN) $(INSTALL_PC) + $(UNINSTALL) $(INSTALL_T) $(INSTALL_STATIC) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) $(INSTALL_MAN)/$(FILE_MAN) $(INSTALL_PC) for file in $(FILES_JITLIB); do \ $(UNINSTALL) $(INSTALL_JITLIB)/$$file; \ done diff --git a/jni/LuaJIT-2.0.1/README b/jni/LuaJIT-2.1/README similarity index 76% rename from jni/LuaJIT-2.0.1/README rename to jni/LuaJIT-2.1/README index e68604b7..ca70dd8e 100644 --- a/jni/LuaJIT-2.0.1/README +++ b/jni/LuaJIT-2.1/README @@ -1,11 +1,11 @@ -README for LuaJIT 2.0.1 ------------------------ +README for LuaJIT 2.1.0-beta1 +----------------------------- LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language. Project Homepage: http://luajit.org/ -LuaJIT is Copyright (C) 2005-2013 Mike Pall. +LuaJIT is Copyright (C) 2005-2015 Mike Pall. LuaJIT is free software, released under the MIT license. See full Copyright Notice in the COPYRIGHT file or in luajit.h. diff --git a/jni/LuaJIT-2.1/android/armeabi-v7a/libluajit.a b/jni/LuaJIT-2.1/android/armeabi-v7a/libluajit.a new file mode 100644 index 00000000..abf0b538 Binary files /dev/null and b/jni/LuaJIT-2.1/android/armeabi-v7a/libluajit.a differ diff --git a/jni/LuaJIT-2.1/android/armeabi/libluajit.a b/jni/LuaJIT-2.1/android/armeabi/libluajit.a new file mode 100644 index 00000000..6c982e4d Binary files /dev/null and b/jni/LuaJIT-2.1/android/armeabi/libluajit.a differ diff --git a/jni/LuaJIT-2.0.1/buildandroid.sh b/jni/LuaJIT-2.1/buildandroid.sh similarity index 96% rename from jni/LuaJIT-2.0.1/buildandroid.sh rename to jni/LuaJIT-2.1/buildandroid.sh index 2351189d..75708bab 100755 --- a/jni/LuaJIT-2.0.1/buildandroid.sh +++ b/jni/LuaJIT-2.1/buildandroid.sh @@ -26,8 +26,8 @@ if [[ x$NDK = "x" ]]; then exit 1 fi -NDKABI=8 -NDKVER=$NDK/toolchains/arm-linux-androideabi-4.6 +NDKABI=9 +NDKVER=$NDK/toolchains/arm-linux-androideabi-4.8 NDKP=$NDKVER/prebuilt/${host_os}-${host_arch}/bin/arm-linux-androideabi- NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-arm" CFLAGS="" diff --git a/jni/LuaJIT-2.0.1/doc/bluequad-print.css b/jni/LuaJIT-2.1/doc/bluequad-print.css similarity index 98% rename from jni/LuaJIT-2.0.1/doc/bluequad-print.css rename to jni/LuaJIT-2.1/doc/bluequad-print.css index 41ae7575..07f5c84a 100644 --- a/jni/LuaJIT-2.0.1/doc/bluequad-print.css +++ b/jni/LuaJIT-2.1/doc/bluequad-print.css @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2013 Mike Pall. +/* Copyright (C) 2004-2015 Mike Pall. * * You are welcome to use the general ideas of this design for your own sites. * But please do not steal the stylesheet, the layout or the color scheme. diff --git a/jni/LuaJIT-2.0.1/doc/bluequad.css b/jni/LuaJIT-2.1/doc/bluequad.css similarity index 99% rename from jni/LuaJIT-2.0.1/doc/bluequad.css rename to jni/LuaJIT-2.1/doc/bluequad.css index 5e8d5ce7..ae531430 100644 --- a/jni/LuaJIT-2.0.1/doc/bluequad.css +++ b/jni/LuaJIT-2.1/doc/bluequad.css @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2013 Mike Pall. +/* Copyright (C) 2004-2015 Mike Pall. * * You are welcome to use the general ideas of this design for your own sites. * But please do not steal the stylesheet, the layout or the color scheme. diff --git a/jni/LuaJIT-2.0.1/doc/changes.html b/jni/LuaJIT-2.1/doc/changes.html similarity index 76% rename from jni/LuaJIT-2.0.1/doc/changes.html rename to jni/LuaJIT-2.1/doc/changes.html index 1176fb5b..826cd243 100644 --- a/jni/LuaJIT-2.0.1/doc/changes.html +++ b/jni/LuaJIT-2.1/doc/changes.html @@ -4,7 +4,7 @@ LuaJIT Change History - + @@ -44,6 +44,8 @@ div.major { max-width: 600px; padding: 1em; margin: 1em 0 1em 0; } jit.* Library
  • Lua/C API +
  • +Profiler
  • Status @@ -63,7 +65,7 @@ div.major { max-width: 600px; padding: 1em; margin: 1em 0 1em 0; }

    This is a list of changes between the released versions of LuaJIT.
    -The current stable version is LuaJIT 2.0.1.
    +The current stable version is LuaJIT 2.0.4.

    Please check the @@ -72,6 +74,178 @@ to see whether newer versions are available.

    +

    LuaJIT 2.1.0-beta1 — 2015-08-25

    +

    +This is a brief summary of the major changes in LuaJIT 2.1 compared to 2.0. +Please take a look at the commit history for more details. +

    +
      +
    • Changes to the VM core: +
        +
      • Add low-overhead profiler (-jp).
      • +
      • Add LJ_GC64 mode: 64 bit GC object references (really: 47 bit). Interpreter-only for now.
      • +
      • Add LJ_FR2 mode: Two-slot frame info. Required by LJ_GC64 mode.
      • +
      • Add table.new() and table.clear().
      • +
      • Parse Unicode escape '\u{XX...}' in string literals.
      • +
      • Parse binary number literals (0bxxx).
      • +
    • +
    • Improvements to the JIT compiler: +
        +
      • Add trace stitching.
      • +
      • Compile various builtins: string.char(), string.reverse(), string.lower(), string.upper(), string.rep(), string.format(), table.concat(), bit.tohex(), getfenv(0), debug.getmetatable().
      • +
      • Compile string.find() for fixed string searches (no patterns).
      • +
      • Compile BC_TSETM, e.g. {1,2,3,f()}.
      • +
      • Compile string concatenations (BC_CAT).
      • +
      • Compile __concat metamethod.
      • +
      • Various minor optimizations.
      • +
    • +
    • Internal Changes: +
        +
      • Add support for embedding LuaJIT bytecode for builtins.
      • +
      • Replace various builtins with embedded bytecode.
      • +
      • Refactor string buffers and string formatting.
      • +
      • Remove obsolete non-truncating number to integer conversions.
      • +
    • +
    • Ports: +
        +
      • Add Xbox One port (LJ_GC64 mode).
      • +
      • ARM64: Add port of the interpreter (LJ_GC64 mode).
      • +
      • x64: Add separate port of the interpreter to LJ_GC64 mode.
      • +
      • x86/x64: Drop internal x87 math functions. Use libm functions.
      • +
      • x86: Remove x87 support from interpreter. SSE2 is mandatory now.
      • +
      • x86/x64: Add support for AES-NI, AVX and AVX2 to DynASM.
      • +
      • PPC/e500: Drop support for this architecture.
      • +
    • +
    • FFI library: +
        +
      • FFI: Add 64 bit bitwise operations.
      • +
      • FFI: Compile VLA/VLS and large cdata allocations with default initialization.
      • +
      • FFI: Compile conversions from functions to function pointers.
      • +
      • FFI: Compile lightuserdata to void * conversion.
      • +
      • FFI: Compile ffi.gc(cdata, nil), too.
      • +
      • FFI: Add ffi.typeinfo().
      • +
      • FFI: Add ssize_t declaration.
      • +
    • +
    +
    + +
    +

    LuaJIT 2.0.4 — 2015-05-14

    +
      +
    • Fix stack check in narrowing optimization.
    • +
    • Fix Lua/C API typecheck error for special indexes.
    • +
    • Fix string to number conversion.
    • +
    • Fix lexer error for chunks without tokens.
    • +
    • Don't compile IR_RETF after CALLT to ff with-side effects.
    • +
    • Fix BC_UCLO/BC_JMP join optimization in Lua parser.
    • +
    • Fix corner case in string to number conversion.
    • +
    • Gracefully handle lua_error() for a suspended coroutine.
    • +
    • Avoid error messages when building with Clang.
    • +
    • Fix snapshot #0 handling for traces with a stack check on entry.
    • +
    • Fix fused constant loads under high register pressure.
    • +
    • Invalidate backpropagation cache after DCE.
    • +
    • Fix ABC elimination.
    • +
    • Fix debug info for main chunk of stripped bytecode.
    • +
    • Fix FOLD rule for string.sub(s, ...) == k.
    • +
    • Fix FOLD rule for STRREF of SNEW.
    • +
    • Fix frame traversal while searching for error function.
    • +
    • Prevent GC estimate miscalculation due to buffer growth.
    • +
    • Prevent adding side traces for stack checks.
    • +
    • Fix top slot calculation for snapshots with continuations.
    • +
    • Fix check for reuse of SCEV results in FORL.
    • +
    • Add PS Vita port.
    • +
    • Fix compatibility issues with Illumos.
    • +
    • Fix DragonFly build (unsupported).
    • +
    • OpenBSD/x86: Better executable memory allocation for W^X mode.
    • +
    • x86: Fix argument checks for ipairs() iterator.
    • +
    • x86: lj_math_random_step() clobbers XMM regs on OSX Clang.
    • +
    • x86: Fix code generation for unused result of math.random().
    • +
    • x64: Allow building with LUAJIT_USE_SYSMALLOC and LUAJIT_USE_VALGRIND.
    • +
    • x86/x64: Fix argument check for bit shifts.
    • +
    • x86/x64: Fix code generation for fused test/arith ops.
    • +
    • ARM: Fix write barrier check in BC_USETS.
    • +
    • PPC: Fix red zone overflow in machine code generation.
    • +
    • PPC: Don't use mcrxr on PPE.
    • +
    • Various archs: Fix excess stack growth in interpreter.
    • +
    • FFI: Fix FOLD rule for TOBIT + CONV num.u32.
    • +
    • FFI: Prevent DSE across ffi.string().
    • +
    • FFI: No meta fallback when indexing pointer to incomplete struct.
    • +
    • FFI: Fix initialization of unions of subtypes.
    • +
    • FFI: Fix cdata vs. non-cdata arithmetic and comparisons.
    • +
    • FFI: Fix __index/__newindex metamethod resolution for ctypes.
    • +
    • FFI: Fix compilation of reference field access.
    • +
    • FFI: Fix frame traversal for backtraces with FFI callbacks.
    • +
    • FFI: Fix recording of indexing a struct pointer ctype object itself.
    • +
    • FFI: Allow non-scalar cdata to be compared for equality by address.
    • +
    • FFI: Fix pseudo type conversions for type punning.
    • +
    + +

    LuaJIT 2.0.3 — 2014-03-12

    +
      +
    • Add PS4 port.
    • +
    • Add support for multilib distro builds.
    • +
    • Fix OSX build.
    • +
    • Fix MinGW build.
    • +
    • Fix Xbox 360 build.
    • +
    • Improve ULOAD forwarding for open upvalues.
    • +
    • Fix GC steps threshold handling when called by JIT-compiled code.
    • +
    • Fix argument checks for math.deg() and math.rad().
    • +
    • Fix jit.flush(func|true).
    • +
    • Respect jit.off(func) when returning to a function, too.
    • +
    • Fix compilation of string.byte(s, nil, n).
    • +
    • Fix line number for relocated bytecode after closure fixup
    • +
    • Fix frame traversal for backtraces.
    • +
    • Fix ABC elimination.
    • +
    • Fix handling of redundant PHIs.
    • +
    • Fix snapshot restore for exit to function header.
    • +
    • Fix type punning alias analysis for constified pointers
    • +
    • Fix call unroll checks in the presence of metamethod frames.
    • +
    • Fix initial maxslot for down-recursive traces.
    • +
    • Prevent BASE register coalescing if parent uses IR_RETF.
    • +
    • Don't purge modified function from stack slots in BC_RET.
    • +
    • Fix recording of BC_VARG.
    • +
    • Don't access dangling reference to reallocated IR.
    • +
    • Fix frame depth display for bytecode dump in -jdump.
    • +
    • ARM: Fix register allocation when rematerializing FPRs.
    • +
    • x64: Fix store to upvalue for lightuserdata values.
    • +
    • FFI: Add missing GC steps for callback argument conversions.
    • +
    • FFI: Properly unload loaded DLLs.
    • +
    • FFI: Fix argument checks for ffi.string().
    • +
    • FFI/x64: Fix passing of vector arguments to calls.
    • +
    • FFI: Rehash finalizer table after GC cycle, if needed.
    • +
    • FFI: Fix cts->L for cdata unsinking in snapshot restore.
    • +
    + +

    LuaJIT 2.0.2 — 2013-06-03

    +
      +
    • Fix memory access check for fast string interning.
    • +
    • Fix MSVC intrinsics for older versions.
    • +
    • Add missing GC steps for io.* functions.
    • +
    • Fix spurious red zone overflows in machine code generation.
    • +
    • Fix jump-range constrained mcode allocation.
    • +
    • Inhibit DSE for implicit loads via calls.
    • +
    • Fix builtin string to number conversion for overflow digits.
    • +
    • Fix optional argument handling while recording builtins.
    • +
    • Fix optional argument handling in table.concat().
    • +
    • Add partial support for building with MingW64 GCC 4.8-SEH.
    • +
    • Add missing PHI barrier to string.sub(str, a, b) == kstr FOLD rule.
    • +
    • Fix compatibility issues with Illumos.
    • +
    • ARM: Fix cache flush/sync for exit stubs of JIT-compiled code.
    • +
    • MIPS: Fix cache flush/sync for JIT-compiled code jump area.
    • +
    • PPC: Add plt suffix for external calls from assembler code.
    • +
    • FFI: Fix snapshot substitution in SPLIT pass.
    • +
    • FFI/x86: Fix register allocation for 64 bit comparisons.
    • +
    • FFI: Fix tailcall in lowest frame to C function with bool result.
    • +
    • FFI: Ignore long type specifier in ffi.istype().
    • +
    • FFI: Fix calling conventions for 32 bit OSX and iOS simulator (struct returns).
    • +
    • FFI: Fix calling conventions for ARM hard-float EABI (nested structs).
    • +
    • FFI: Improve error messages for arithmetic and comparison operators.
    • +
    • FFI: Insert no-op type conversion for pointer to integer cast.
    • +
    • FFI: Fix unroll limit for ffi.fill().
    • +
    • FFI: Must sink XBAR together with XSTOREs.
    • +
    • FFI: Preserve intermediate string for const char * conversion.
    • +
    +

    LuaJIT 2.0.1 — 2013-02-19

    • Don't clear frame for out-of-memory error.
    • @@ -619,240 +793,11 @@ This matches the behavior of Lua 5.1, but not the specification. no point in listing differences over earlier versions.
    - -
    -

    LuaJIT 1.1.8 — 2012-04-16

    - - -

    LuaJIT 1.1.7 — 2011-05-05

    - - -

    LuaJIT 1.1.6 — 2010-03-28

    -
      -
    • Added fixes for the -» currently known bugs in Lua 5.1.4.
    • -
    • Removed wrong GC check in jit_createstate(). -Thanks to Tim Mensch.
    • -
    • Fixed bad assertions while compiling table.insert() and -table.remove().
    • -
    - -

    LuaJIT 1.1.5 — 2008-10-25

    - - -

    LuaJIT 1.1.4 — 2008-02-05

    -
      -
    • Merged with Lua 5.1.3. Fixes all -» known bugs in Lua 5.1.2.
    • -
    • Fixed possible (but unlikely) stack corruption while compiling -k^x expressions.
    • -
    • Fixed DynASM template for cmpss instruction.
    • -
    - -

    LuaJIT 1.1.3 — 2007-05-24

    -
      -
    • Merged with Lua 5.1.2. Fixes all -» known bugs in Lua 5.1.1.
    • -
    • Merged pending Lua 5.1.x fixes: "return -nil" bug, spurious count hook call.
    • -
    • Remove a (sometimes) wrong assertion in luaJIT_findpc().
    • -
    • DynASM now allows labels for displacements and .aword.
    • -
    • Fix some compiler warnings for DynASM glue (internal API change).
    • -
    • Correct naming for SSSE3 (temporarily known as SSE4) in DynASM and x86 disassembler.
    • -
    • The loadable debug modules now handle redirection to stdout -(e.g. -j trace=-).
    • -
    - -

    LuaJIT 1.1.2 — 2006-06-24

    -
      -
    • Fix MSVC inline assembly: use only local variables with -lua_number2int().
    • -
    • Fix "attempt to call a thread value" bug on Mac OS X: -make values of consts used as lightuserdata keys unique -to avoid joining by the compiler/linker.
    • -
    - -

    LuaJIT 1.1.1 — 2006-06-20

    -
      -
    • Merged with Lua 5.1.1. Fixes all -» known bugs in Lua 5.1.
    • -
    • Enforce (dynamic) linker error for EXE/DLL version mismatches.
    • -
    • Minor changes to DynASM: faster pre-processing, smaller encoding -for some immediates.
    • -
    -

    -This release is in sync with Coco 1.1.1 (see the -» Coco Change History). -

    - -

    LuaJIT 1.1.0 — 2006-03-13

    -
      -
    • Merged with Lua 5.1 (final).
    • - -
    • New JIT call frame setup: -
        -
      • The C stack is kept 16 byte aligned (faster). -Mandatory for Mac OS X on Intel, too.
      • -
      • Faster calling conventions for internal C helper functions.
      • -
      • Better instruction scheduling for function prologue, OP_CALL and -OP_RETURN.
      • -
    • - -
    • Miscellaneous optimizations: -
        -
      • Faster loads of FP constants. Remove narrow-to-wide store-to-load -forwarding stalls.
      • -
      • Use (scalar) SSE2 ops (if the CPU supports it) to speed up slot moves -and FP to integer conversions.
      • -
      • Optimized the two-argument form of OP_CONCAT (a..b).
      • -
      • Inlined OP_MOD (a%b). -With better accuracy than the C variant, too.
      • -
      • Inlined OP_POW (a^b). Unroll x^k or -use k^x = 2^(log2(k)*x) or call pow().
      • -
    • - -
    • Changes in the optimizer: -
        -
      • Improved hinting for table keys derived from table values -(t1[t2[x]]).
      • -
      • Lookup hinting now works with arbitrary object types and -supports index chains, too.
      • -
      • Generate type hints for arithmetic and comparison operators, -OP_LEN, OP_CONCAT and OP_FORPREP.
      • -
      • Remove several hint definitions in favour of a generic COMBINE hint.
      • -
      • Complete rewrite of jit.opt_inline module -(ex jit.opt_lib).
      • -
    • - -
    • Use adaptive deoptimization: -
        -
      • If runtime verification of a contract fails, the affected -instruction is recompiled and patched on-the-fly. -Regular programs will trigger deoptimization only occasionally.
      • -
      • This avoids generating code for uncommon fallback cases -most of the time. Generated code is up to 30% smaller compared to -LuaJIT 1.0.3.
      • -
      • Deoptimization is used for many opcodes and contracts: -
          -
        • OP_CALL, OP_TAILCALL: type mismatch for callable.
        • -
        • Inlined calls: closure mismatch, parameter number and type mismatches.
        • -
        • OP_GETTABLE, OP_SETTABLE: table or key type and range mismatches.
        • -
        • All arithmetic and comparison operators, OP_LEN, OP_CONCAT, -OP_FORPREP: operand type and range mismatches.
        • -
      • -
      • Complete redesign of the debug and traceback info -(bytecode ↔ mcode) to support deoptimization. -Much more flexible and needs only 50% of the space.
      • -
      • The modules jit.trace, jit.dumphints and -jit.dump handle deoptimization.
      • -
    • - -
    • Inlined many popular library functions -(for commonly used arguments only): -
        -
      • Most math.* functions (the 18 most used ones) -[2x-10x faster].
      • -
      • string.len, string.sub and string.char -[2x-10x faster].
      • -
      • table.insert, table.remove and table.getn -[3x-5x faster].
      • -
      • coroutine.yield and coroutine.resume -[3x-5x faster].
      • -
      • pairs, ipairs and the corresponding iterators -[8x-15x faster].
      • -
    • - -
    • Changes in the core and loadable modules and the stand-alone executable: -
        -
      • Added jit.version, jit.version_num -and jit.arch.
      • -
      • Reorganized some internal API functions (jit.util.*mcode*).
      • -
      • The -j dump output now shows JSUB names, too.
      • -
      • New x86 disassembler module written in pure Lua. No dependency -on ndisasm anymore. Flexible API, very compact (500 lines) -and complete (x87, MMX, SSE, SSE2, SSE3, SSSE3, privileged instructions).
      • -
      • luajit -v prints the LuaJIT version and copyright -on a separate line.
      • -
    • - -
    • Added SSE, SSE2, SSE3 and SSSE3 support to DynASM.
    • -
    • Miscellaneous doc changes. Added a section about -embedding LuaJIT.
    • -
    -

    -This release is in sync with Coco 1.1.0 (see the -» Coco Change History). -

    -
    - -
    -

    LuaJIT 1.0.3 — 2005-09-08

    -
      -
    • Even more docs.
    • -
    • Unified closure checks in jit.*.
    • -
    • Fixed some range checks in jit.util.*.
    • -
    • Fixed __newindex call originating from jit_settable_str().
    • -
    • Merged with Lua 5.1 alpha (including early bug fixes).
    • -
    -

    -This is the first public release of LuaJIT. -

    - -

    LuaJIT 1.0.2 — 2005-09-02

    -
      -
    • Add support for flushing the Valgrind translation cache
      -(MYCFLAGS= -DUSE_VALGRIND).
    • -
    • Add support for freeing executable mcode memory to the mmap()-based -variant for POSIX systems.
    • -
    • Reorganized the C function signature handling in -jit.opt_lib.
    • -
    • Changed to index-based hints for inlining C functions. -Still no support in the backend for inlining.
    • -
    • Hardcode HEAP_CREATE_ENABLE_EXECUTE value if undefined.
    • -
    • Misc. changes to the jit.* modules.
    • -
    • Misc. changes to the Makefiles.
    • -
    • Lots of new docs.
    • -
    • Complete doc reorg.
    • -
    -

    -Not released because Lua 5.1 alpha came out today. -

    - -

    LuaJIT 1.0.1 — 2005-08-31

    -
      -
    • Missing GC step in OP_CONCAT.
    • -
    • Fix result handling for C –> JIT calls.
    • -
    • Detect CPU feature bits.
    • -
    • Encode conditional moves (fucomip) only when supported.
    • -
    • Add fallback instructions for FP compares.
    • -
    • Add support for LUA_COMPAT_VARARG. Still disabled by default.
    • -
    • MSVC needs a specific place for the CALLBACK attribute -(David Burgess).
    • -
    • Misc. doc updates.
    • -
    -

    -Interim non-public release. -Special thanks to Adam D. Moss for reporting most of the bugs. -

    - -

    LuaJIT 1.0.0 — 2005-08-29

    -

    -This is the initial non-public release of LuaJIT. -

    -

  • Lua/C API +
  • +Profiler
  • Status @@ -84,7 +86,7 @@ xD("fyZKB8xv\"FJytmz8.KAB0u52D")

    Copyright

    All documentation is -Copyright © 2005-2013 Mike Pall. +Copyright © 2005-2015 Mike Pall.

    @@ -92,7 +94,7 @@ Copyright © 2005-2013 Mike Pall.
  • Lua/C API +
  • +Profiler
  • Status @@ -177,7 +179,7 @@ Also note that this mechanism is not without overhead.
  • Lua/C API +
  • +Profiler
  • Status @@ -320,7 +322,7 @@ without undue conversion penalties.
  • Lua/C API +
  • +Profiler
  • Status @@ -466,6 +468,8 @@ otherwise. The following parameters are currently defined: eabiEABI variant of the standard ABI winWindows variant of the standard ABI + +gc6464 bit GC references

    ffi.os

    @@ -542,8 +546,8 @@ corresponding ctype. The parser for Lua source code treats numeric literals with the suffixes LL or ULL as signed or unsigned 64 bit integers. Case doesn't matter, but uppercase is recommended for -readability. It handles both decimal (42LL) and hexadecimal -(0x2aLL) literals. +readability. It handles decimal (42LL), hexadecimal +(0x2aLL) and binary (0b101010LL) literals.

    The imaginary part of complex numbers can be specified by suffixing @@ -556,7 +560,7 @@ named i.

  • Lua/C API +
  • +Profiler
  • Status @@ -183,6 +185,8 @@ a typedef, except re-declarations will be ignored): uint16_t, uint32_t, uint64_t, intptr_t, uintptr_t.
  • +
  • From <unistd.h> (POSIX): ssize_t.
  • +

    You're encouraged to use these types in preference to @@ -730,6 +734,22 @@ You'll have to explicitly convert a 64 bit integer to a Lua number (e.g. for regular floating-point calculations) with tonumber(). But note this may incur a precision loss. +

  • 64 bit bitwise operations: the rules for 64 bit +arithmetic operators apply analogously.
    + +Unlike the other bit.* operations, bit.tobit() +converts a cdata number via int64_t to int32_t and +returns a Lua number.
    + +For bit.band(), bit.bor() and bit.bxor(), the +conversion to int64_t or uint64_t applies to +all arguments, if any argument is a cdata number.
    + +For all other operations, only the first argument is used to determine +the output type. This implies that a cdata number as a shift count for +shifts and rotates is accepted, but that alone does not cause +a cdata number output. +

    Comparisons of cdata objects

    @@ -1188,7 +1208,9 @@ storing and initializing them are supported, yet.
  • The volatile type qualifier is currently ignored by compiled code.
  • ffi.cdef silently -ignores all re-declarations.
  • +ignores most re-declarations. Note: avoid re-declarations which do not +conform to C99. The implementation will eventually be changed to +perform strict checks.

    The JIT compiler already handles a large subset of all FFI operations. @@ -1203,9 +1225,8 @@ suboptimal performance, especially when used in inner loops:

  • Vector operations.
  • Table initializers.
  • Initialization of nested struct/union types.
  • -
  • Allocations of variable-length arrays or structs.
  • -
  • Allocations of C types with a size > 128 bytes or an -alignment > 8 bytes.
  • +
  • Non-default initialization of VLA/VLS or large C types +(> 128 bytes or > 16 array elements.
  • Conversions from lightuserdata to void *.
  • Pointer differences for element sizes that are not a power of two.
  • @@ -1222,7 +1243,6 @@ value. Other missing features:

  • Status @@ -564,7 +566,7 @@ Thus it's not helpful and actually counter-productive to cache individual C functions like this:

    -local funca, funcb = ffi.C.funcb, ffi.C.funcb -- Not helpful!
    +local funca, funcb = ffi.C.funca, ffi.C.funcb -- Not helpful!
     local function foo(x, n)
       for i=1,n do funcb(funca(x, i), 1) end
     end
    @@ -591,7 +593,7 @@ it to a local variable in the function scope is unnecessary.
     
     
  • Lua/C API +
  • +Profiler
  • Status @@ -151,7 +153,7 @@ Contains the target OS name:

    jit.arch

    Contains the target architecture name: -"x86", "x64" or "ppcspe". +"x86", "x64", "arm", "ppc", or "mips".

    jit.opt.* — JIT compiler optimization control

    @@ -189,7 +191,7 @@ if you want to know more.
  • Lua/C API +
  • +Profiler
  • Status @@ -113,6 +115,9 @@ bit.lshift bit.rshift bit.arshift bit.rol bit.ror bit.bswap This module is a LuaJIT built-in — you don't need to download or install Lua BitOp. The Lua BitOp site has full documentation for all » Lua BitOp API functions. +The FFI adds support for +64 bit bitwise operations, +using the same API functions.

    Please make sure to require the module before using any of @@ -146,6 +151,11 @@ LuaJIT adds some extra functions to the Lua/C API.

    +

    Profiler

    +

    +LuaJIT has an integrated profiler. +

    +

    Enhanced Standard Library Functions

    xpcall(f, err [,args...]) passes arguments

    @@ -173,7 +183,7 @@ in "-inf".

    tonumber() etc. use builtin string to number conversion

    All string-to-number conversions consistently convert integer and -floating-point inputs in decimal and hexadecimal on all platforms. +floating-point inputs in decimal, hexadecimal and binary on all platforms. strtod() is not used anymore, which avoids numerous problems with poor C library implementations. The builtin conversion function provides full precision according to the IEEE-754 standard, it @@ -197,6 +207,36 @@ for dot releases (x.y.0 → x.y.1), but may change with major or minor releases (2.0 → 2.1) or between any beta release. Foreign bytecode (e.g. from Lua 5.1) is incompatible and cannot be loaded.

    +

    +Note: LJ_GC64 mode requires a different frame layout, which implies +a different, incompatible bytecode format for ports that use this mode (e.g. +ARM64). This may be rectified in the future. +

    + +

    table.new(narray, nhash) allocates a pre-sized table

    +

    +An extra library function table.new() can be made available via +require("table.new"). This creates a pre-sized table, just like +the C API equivalent lua_createtable(). This is useful for big +tables if the final table size is known and automatic table resizing is +too expensive. +

    + +

    table.clear(tab) clears a table

    +

    +An extra library function table.clear() can be made available +via require("table.clear"). This clears all keys and values +from a table, but preserves the allocated array/hash sizes. This is +useful when a table, which is linked from multiple places, needs to be +cleared and/or when recycling a table for use by the same context. This +avoids managing backlinks, saves an allocation and the overhead of +incremental array/hash part growth. +

    +

    +Please note this function is meant for very specific situations. In most +cases it's better to replace the (usually single) link with a new table +and let the GC do its work. +

    Enhanced PRNG for math.random()

    @@ -248,8 +288,9 @@ enabled:

    • goto and ::labels::.
    • Hex escapes '\x3F' and '\*' escape in strings.
    • -
    • load(string|reader, chunkname [,mode [,env]]). -loadstring() is an alias.
    • +
    • load(string|reader [, chunkname [,mode [,env]]]).
    • +
    • loadstring() is an alias for load().
    • +
    • loadfile(filename [,mode [,env]]).
    • math.log(x [,base]).
    • string.rep(s, n [,sep]).
    • string.format(): %q reversible. @@ -303,6 +344,13 @@ Lua 5.1, which prevents implementing features that would otherwise break the Lua/C API and ABI (e.g. _ENV).

      +

      Extensions from Lua 5.3

      +

      +LuaJIT supports some extensions from Lua 5.3: +

        +
      • Unicode escape '\u{XX...}' embeds the UTF-8 encoding in string literals.
      • +
      +

      C++ Exception Interoperability

      LuaJIT has built-in support for interoperating with C++ exceptions. @@ -397,7 +445,7 @@ lead to the termination of the process.

  • Status @@ -174,7 +176,7 @@ the development of certain features, if they are important to you.
  • Lua/C API +
  • +Profiler
  • Status @@ -112,39 +114,39 @@ operating systems, CPUs and compilers: x86 (32 bit) -GCC 4.x
    GCC 3.4 -GCC 4.x
    GCC 3.4 -GCC 4.x
    GCC 3.4 +GCC 4.2+ +GCC 4.2+ +XCode 5.0+
    Clang MSVC, MSVC/EE
    WinSDK
    MinGW, Cygwin x64 (64 bit) -GCC 4.x -  -GCC 4.x -MSVC + SDK v7.0
    WinSDK v7.0 +GCC 4.2+ +ORBIS (PS4) +XCode 5.0+
    Clang +MSVC + SDK v7.0
    WinSDK v7.0
    Durango (Xbox One) ARMv5+
    ARM9E+
    GCC 4.2+ -GCC 4.2+ -GCC 4.2+ +GCC 4.2+
    PSP2 (PS VITA) +XCode 5.0+
    Clang   +ARM64 +GCC 4.8+ +  +XCode 6.0+
    Clang 3.5+ +  + + PPC GCC 4.3+ GCC 4.3+
    GCC 4.1 (PS3)   XEDK (Xbox 360) - -PPC/e500v2 -GCC 4.3+ -GCC 4.3+ -  -  - MIPS GCC 4.3+ @@ -188,8 +190,8 @@ open a terminal window and change to this directory. Now unpack the archive and change to the newly created directory:

    -tar zxf LuaJIT-2.0.1.tar.gz
    -cd LuaJIT-2.0.1
    +tar zxf LuaJIT-2.0.4.tar.gz +cd LuaJIT-2.0.4

    Building LuaJIT

    The supplied Makefiles try to auto-detect the settings needed for your @@ -383,10 +385,11 @@ make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \ # ARM hard-float ABI with VFP (armhf, requires recent toolchain) make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabihf- +# ARM64 (requires x64 host) +make CROSS=aarch64-linux- + # PPC make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu- -# PPC/e500v2 (fast interpreter only) -make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe- # MIPS big-endian make HOST_CC="gcc -m32" CROSS=mips-linux- @@ -439,8 +442,7 @@ NDKF="--sysroot $NDK/platforms/android-$NDKABI/arch-x86" make HOST_CC="gcc -m32" CROSS=$NDKP TARGET_FLAGS="$NDKF"

    -You can cross-compile for iOS 3.0+ (iPhone/iPad) using the » iOS SDK. -The environment variables need to match the iOS SDK version: +You can cross-compile for iOS 3.0+ (iPhone/iPad) using the » iOS SDK:

    Note: the JIT compiler is disabled for iOS, because regular iOS Apps @@ -450,38 +452,84 @@ much slower than the JIT compiler. Please complain to Apple, not me. Or use Android. :-p

    -IXCODE=`xcode-select -print-path`
    -ISDK=$IXCODE/Platforms/iPhoneOS.platform/Developer
    -ISDKVER=iPhoneOS6.0.sdk
    -ISDKP=$ISDK/usr/bin/
    -ISDKF="-arch armv7 -isysroot $ISDK/SDKs/$ISDKVER"
    -make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \
    -     TARGET_SYS=iOS
    +# iOS/ARM (32 bit)
    +ISDKP=$(xcrun --sdk iphoneos --show-sdk-path)
    +ICC=$(xcrun --sdk iphoneos --find clang)
    +ISDKF="-arch armv7 -isysroot $ISDKP"
    +make HOST_CC="clang -m32 -arch i386" CROSS="$(dirname $ICC)/" \
    +     TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
    +
    +# iOS/ARM64
    +ISDKP=$(xcrun --sdk iphoneos --show-sdk-path)
    +ICC=$(xcrun --sdk iphoneos --find clang)
    +ISDKF="-arch arm64 -isysroot $ISDKP"
    +make CROSS="$(dirname $ICC)/" TARGET_FLAGS="$ISDKF" TARGET_SYS=iOS
     
    + +

    Cross-compiling for consoles

    -You can cross-compile for PS3 using the PS3 SDK from -a Linux host or a Windows host (requires 32 bit MinGW (GCC) on the host, -too). Due to restrictions on consoles, the JIT compiler is disabled and -only the fast interpreter is built: +Building LuaJIT for consoles requires both a supported host compiler +(x86 or x64) and a cross-compiler (to PPC or ARM) from the official +console SDK. +

    +

    +Due to restrictions on consoles, the JIT compiler is disabled and only +the fast interpreter is built. This is still faster than plain Lua, +but much slower than the JIT compiler. The FFI is disabled, too, since +it's not very useful in such an environment. +

    +

    +The following commands build a static library libluajit.a, +which can be linked against your game, just like the Lua library. +

    +

    +To cross-compile for PS3 from a Linux host (requires +32 bit GCC, i.e. multilib Linux/x64) or a Windows host (requires +32 bit MinGW), run this command:

     make HOST_CC="gcc -m32" CROSS=ppu-lv2-
     

    -You can cross-compile for Xbox 360 using the -Xbox 360 SDK (MSVC + XEDK). Due to restrictions on consoles, the -JIT compiler is disabled and only the fast interpreter is built. +To cross-compile for PS4 from a Windows host, +open a "Visual Studio .NET Command Prompt" (64 bit host compiler), +cd to the directory where you've unpacked the sources and +run the following commands:

    +
    +cd src
    +ps4build
    +

    -Open a "Visual Studio .NET Command Prompt" (32 bit host compiler), +To cross-compile for PS Vita from a Windows host, +open a "Visual Studio .NET Command Prompt" (32 bit host compiler), +cd to the directory where you've unpacked the sources and +run the following commands: +

    +
    +cd src
    +psvitabuild
    +
    +

    +To cross-compile for Xbox 360 from a Windows host, +open a "Visual Studio .NET Command Prompt" (32 bit host compiler), cd to the directory where you've unpacked the sources and run -the following commands. This builds a static library luajit20.lib, -which can be linked against your game, just like the Lua library. +the following commands:

     cd src
     xedkbuild
     
    +

    +To cross-compile for Xbox One from a Windows host, +open a "Visual Studio .NET Command Prompt" (64 bit host compiler), +cd to the directory where you've unpacked the sources and run +the following commands: +

    +
    +cd src
    +xb1build
    +

    Embedding LuaJIT

    @@ -565,9 +613,11 @@ for a regular distribution build:

    • PREFIX overrides the installation path and should usually be set to /usr. Setting this also changes the module paths and -the -rpath of the shared library.
    • +the paths needed to locate the shared library.
    • DESTDIR is an absolute path which allows you to install to a shadow tree instead of the root tree of the build system.
    • +
    • MULTILIB sets the architecture-specific library path component +for multilib systems. The default is lib.
    • Have a look at the top-level Makefile and src/Makefile for additional variables to tweak. The following variables may be overridden, but it's not recommended, except for special needs @@ -603,7 +653,7 @@ to me (the upstream) and not you (the package maintainer), anyway.
    • Lua/C API +
    • +Profiler
  • Status @@ -147,7 +152,7 @@ Lua is a powerful, dynamic and light-weight programming language. It may be embedded or used as a general-purpose, stand-alone language.

    -LuaJIT is Copyright © 2005-2013 Mike Pall, released under the +LuaJIT is Copyright © 2005-2015 Mike Pall, released under the » MIT open source license.

    @@ -158,13 +163,16 @@ LuaJIT is Copyright © 2005-2013 Mike Pall, released under the WindowsLinuxBSDOSXPOSIX - + +
    EmbeddedAndroidiOSPS3Xbox 360
    EmbeddedAndroidiOS
    + +
    PS3PS4PS VitaXbox 360Xbox One
    GCCCLANG
    LLVM
    MSVC
    - +
    x86x64ARMPPCe500MIPS
    x86x64ARMARM64PPCMIPS
    @@ -218,7 +226,7 @@ Please select a sub-topic in the navigation bar to learn more about LuaJIT.
    Lua 5.1
    API+ABI
    + JIT+ BitOp+ FFIDrop-in
    DLL/.so