summaryrefslogtreecommitdiff
path: root/src/lib_string.c
diff options
context:
space:
mode:
authorMike Pall <mike>2009-12-08 20:35:29 +0100
committerMike Pall <mike>2009-12-08 20:35:29 +0100
commit3f1f9e11f4f699ae94182d4cba158092f434a7f6 (patch)
tree88fbb674a21a1d554d4b1ee9d4ef2c5fed6a1d88 /src/lib_string.c
parent5287b9326479ea2b7dddd6f642673e58e5a7f354 (diff)
downloadluajit-3f1f9e11f4f699ae94182d4cba158092f434a7f6.tar.gz
luajit-3f1f9e11f4f699ae94182d4cba158092f434a7f6.tar.bz2
luajit-3f1f9e11f4f699ae94182d4cba158092f434a7f6.zip
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.
Diffstat (limited to 'src/lib_string.c')
-rw-r--r--src/lib_string.c10
1 files changed, 6 insertions, 4 deletions
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)
776{ 776{
777 GCtab *mt; 777 GCtab *mt;
778 GCstr *mmstr; 778 GCstr *mmstr;
779 global_State *g;
779 LJ_LIB_REG(L, string); 780 LJ_LIB_REG(L, string);
780#if defined(LUA_COMPAT_GFIND) 781#if defined(LUA_COMPAT_GFIND)
781 lua_getfield(L, -1, "gmatch"); 782 lua_getfield(L, -1, "gmatch");
782 lua_setfield(L, -2, "gfind"); 783 lua_setfield(L, -2, "gfind");
783#endif 784#endif
784 mt = lj_tab_new(L, 0, 1); 785 mt = lj_tab_new(L, 0, 1);
785 /* NOBARRIER: G(L)->mmname[] is a GC root. */ 786 /* NOBARRIER: basemt is a GC root. */
786 setgcref(G(L)->basemt[~LJ_TSTR], obj2gco(mt)); 787 g = G(L);
787 mmstr = strref(G(L)->mmname[MM_index]); 788 setgcref(basemt_it(g, LJ_TSTR), obj2gco(mt));
788 if (isdead(G(L), obj2gco(mmstr))) flipwhite(obj2gco(mmstr)); 789 mmstr = strref(g->mmname[MM_index]);
790 if (isdead(g, obj2gco(mmstr))) flipwhite(obj2gco(mmstr));
789 settabV(L, lj_tab_setstr(L, mt, mmstr), tabV(L->top-1)); 791 settabV(L, lj_tab_setstr(L, mt, mmstr), tabV(L->top-1));
790 mt->nomm = cast_byte(~(1u<<MM_index)); 792 mt->nomm = cast_byte(~(1u<<MM_index));
791 return 1; 793 return 1;