LUA build system adjustments
Current LUA status for non-x86 is pretty horrible. Attached is a patch which fixes some of issues. Could someone test it? Testing on x86 should be enough.
Could someone propose a test for LUA which could be run as part of all_functional_test if lua is compiled to avoid regressions in LUA.
lua/Makefile.core.def +0 -1
@@ -28,7 +28,6 @@ module = { common = contrib/lua/lstrlib.c; common = contrib/lua/grub_main.c; common = contrib/lua/grub_lib.c; - cflags = -Wno-error; cflags = '$(CFLAGS_POSIX)'; cppflags = '$(CPPFLAGS_POSIX)';
lua/lauxlib.c +4 -2
@@ -598,12 +598,14 @@ LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) { c =grub_getc (lf.f);if (c =='#' ) {/* Unix exec. file? */ lf.extraline =1 ; -while ((c =grub_getc (lf.f)) !=GRUB_EOF && c !='\n' ) ;/* skip first line */ +while ((c =grub_getc (lf.f)) !=GRUB_EOF && c !='\n' ) + ;/* skip first line */ if (c =='\n' ) c =grub_getc (lf.f); }if (c ==LUA_SIGNATURE [0 ] && filename) {/* binary file? */ /* skip eventual `#!...' */ -while ((c =grub_getc (lf.f)) !=GRUB_EOF && c !=LUA_SIGNATURE [0 ]) ; +while ((c =grub_getc (lf.f)) !=GRUB_EOF && c !=LUA_SIGNATURE [0 ]) + ; lf.extraline =0 ; } lf.ungetc = c;
lua/lcode.c +5 -1
@@ -834,8 +834,12 @@ int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {void luaK_setlist (FuncState *fs,int base,int nelems,int tostore) { -int c = (nelems -1 )/LFIELDS_PER_FLUSH +1 ; +int c;int b = (tostore ==LUA_MULTRET ) ?0 : tostore; +if (nelems ==0 ) + c =1 ; +else + c = ((unsigned ) nelems +LFIELDS_PER_FLUSH -1 )/LFIELDS_PER_FLUSH ;lua_assert (tostore !=0 );if (c <=MAXARG_C )luaK_codeABC (fs,OP_SETLIST , base, b, c);
lua/ldo.h +4 -4
@@ -21,11 +21,11 @@#define incr_top (L ) {luaD_checkstack(L,1); L->top++;} -#define savestack (L ,p) ((char *)(p) - (char *)L->stack) -#define restorestack (L ,n) ((TValue *)((char *)L->stack + (n))) +#define savestack (L ,p) ((TValue *)(p) - (TValue *)L->stack) +#define restorestack (L ,n) ((TValue *)((TValue *)L->stack + (n))) -#define saveci (L ,p) ((char *)(p) - (char *)L->base_ci) -#define restoreci (L ,n) ((CallInfo *)((char *)L->base_ci + (n))) +#define saveci (L ,p) ((CallInfo *)(p) - (CallInfo *)L->base_ci) +#define restoreci (L ,n) ((CallInfo *)((CallInfo *)L->base_ci + (n)))/* results from luaD_precall */
lua/lobject.h +1 -1
@@ -40,7 +40,7 @@ typedef union GCObject GCObject;** Common Header for all collectable objects (in macro form, to be ** included in other objects) */ -#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked +#define CommonHeader GCObject __attribute__ ((aligned)) *next; lu_byte tt; lu_byte marked/*
lua/lstate.c +3 -3
@@ -24,9 +24,9 @@#include "ltm.h" -#define state_size (x) (sizeof(x) + LUAI_EXTRASPACE) -#define fromstate (l) (cast(lu_byte *, (l)) - LUAI_EXTRASPACE) -#define tostate (l) (cast(lua_State *, cast(lu_byte *, l) + LUAI_EXTRASPACE)) +#define state_size (x) (sizeof(x) + LUAI_EXTRASPACE * sizeof (lua_State)) +#define fromstate (l) (cast(lua_State *, (l)) - LUAI_EXTRASPACE) +#define tostate (l) (cast(lua_State *, cast(lua_State *, l) + LUAI_EXTRASPACE))/*
lua/luaconf.h +38 -3
58 lines not on this page · raw message
Quoted 6 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Current LUA status for non-x86 is pretty horrible. Attached is a patch which fixes some of issues. Could someone test it? Testing on x86 should be enough.
Could someone propose a test for LUA which could be run as part ofall_functional_testif lua is compiled to avoid regressions in LUA.
I've committed it blindly. However, lack of any response to it probbaly means that we'll have to drop lua altogether at some point in the future.