From 8269cd00762a808ac73f18a02085cc77958d6e6d Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sat, 4 Feb 2012 19:11:16 +1000 Subject: Apply LuaJIT hotfix1. --- libraries/luajit-2.0/README | 1 + libraries/luajit-2.0/src/lj_bcwrite.c | 32 ++++++++++++++++++++------------ libraries/luajit-2.0/src/lj_lex.c | 13 ++++++++----- 3 files changed, 29 insertions(+), 17 deletions(-) (limited to 'libraries') diff --git a/libraries/luajit-2.0/README b/libraries/luajit-2.0/README index 271e312..7a5189b 100644 --- a/libraries/luajit-2.0/README +++ b/libraries/luajit-2.0/README @@ -1,4 +1,5 @@ README for LuaJIT 2.0.0-beta9 +Patched with http://luajit.org/download/beta9_hotfix1.patch ----------------------------- LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language. diff --git a/libraries/luajit-2.0/src/lj_bcwrite.c b/libraries/luajit-2.0/src/lj_bcwrite.c index de9b4cf..f177465 100644 --- a/libraries/luajit-2.0/src/lj_bcwrite.c +++ b/libraries/luajit-2.0/src/lj_bcwrite.c @@ -216,19 +216,27 @@ static void bcwrite_knum(BCWriteCtx *ctx, GCproto *pt) /* Write a 33 bit ULEB128 for the int (lsb=0) or loword (lsb=1). */ if (!LJ_DUALNUM) { /* Narrow number constants to integers. */ lua_Number num = numV(o); - k = lj_num2int(num); - if (num == (lua_Number)k) { /* -0 is never a constant. */ - save_int: - bcwrite_uleb128(ctx, 2*(uint32_t)k); - if (k < 0) ctx->sb.buf[ctx->sb.n-1] |= 0x10; - continue; - } - } - bcwrite_uleb128(ctx, 1+2*o->u32.lo); - if (o->u32.lo >= 0x80000000u) ctx->sb.buf[ctx->sb.n-1] |= 0x10; - bcwrite_uleb128(ctx, o->u32.hi); + + + k = lj_num2int(num); + if (num == (lua_Number)k) { /* -0 is never a constant. */ + save_int: + bcwrite_uleb128(ctx, 2*(uint32_t)k | ((uint32_t)k & 0x80000000u)); + if (k < 0) { + char *p = &ctx->sb.buf[ctx->sb.n-1]; + *p = (*p & 7) | ((k>>27) & 0x18); + } + continue; } - } + } + bcwrite_uleb128(ctx, 1+(2*o->u32.lo | (o->u32.lo & 0x80000000u))); + if (o->u32.lo >= 0x80000000u) { + char *p = &ctx->sb.buf[ctx->sb.n-1]; + *p = (*p & 7) | ((o->u32.lo>>27) & 0x18); + } + bcwrite_uleb128(ctx, o->u32.hi); + } + } } /* Write bytecode instructions. */ diff --git a/libraries/luajit-2.0/src/lj_lex.c b/libraries/luajit-2.0/src/lj_lex.c index 00daccd..59d8225 100644 --- a/libraries/luajit-2.0/src/lj_lex.c +++ b/libraries/luajit-2.0/src/lj_lex.c @@ -137,14 +137,17 @@ static int lex_number64(LexState *ls, TValue *tv) /* Parse a number literal. */ static void lex_number(LexState *ls, TValue *tv) { - int c; + int c, xp = 'E'; lua_assert(lj_char_isdigit(ls->current)); - do { + 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); - } while (lj_char_isident(ls->current) || ls->current == '.' || - ((ls->current == '-' || ls->current == '+') && - ((c & ~0x20) == 'E' || (c & ~0x20) == 'P'))); + } #if LJ_HASFFI c &= ~0x20; if ((c == 'I' || c == 'L' || c == 'U') && !ctype_ctsG(G(ls->L))) -- cgit v1.1