From 3f1f9e11f4f699ae94182d4cba158092f434a7f6 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Tue, 8 Dec 2009 20:35:29 +0100 Subject: Fast forward to sync public repo. Compile math.sinh(), math.cosh(), math.tanh() and math.random(). Compile various io.*() functions. Drive the GC forward on string allocations in the parser. Improve KNUM fuse vs. load heuristics. Add abstract C call handling to IR. --- src/lib_string.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/lib_string.c') diff --git a/src/lib_string.c b/src/lib_string.c index 6c857328..e7ad12df 100644 --- a/src/lib_string.c +++ b/src/lib_string.c @@ -776,16 +776,18 @@ LUALIB_API int luaopen_string(lua_State *L) { GCtab *mt; GCstr *mmstr; + global_State *g; LJ_LIB_REG(L, string); #if defined(LUA_COMPAT_GFIND) lua_getfield(L, -1, "gmatch"); lua_setfield(L, -2, "gfind"); #endif mt = lj_tab_new(L, 0, 1); - /* NOBARRIER: G(L)->mmname[] is a GC root. */ - setgcref(G(L)->basemt[~LJ_TSTR], obj2gco(mt)); - mmstr = strref(G(L)->mmname[MM_index]); - if (isdead(G(L), obj2gco(mmstr))) flipwhite(obj2gco(mmstr)); + /* NOBARRIER: basemt is a GC root. */ + g = G(L); + setgcref(basemt_it(g, LJ_TSTR), obj2gco(mt)); + mmstr = strref(g->mmname[MM_index]); + if (isdead(g, obj2gco(mmstr))) flipwhite(obj2gco(mmstr)); settabV(L, lj_tab_setstr(L, mt, mmstr), tabV(L->top-1)); mt->nomm = cast_byte(~(1u<