Upstream luaconf.h is contrib/lua/src/luaconf.h.dist, while userland lua and loader lua have copies in lib/liblua/luaconf.h and stand/liblua/luaconf.h.
Adjust whitespace, VCS tags, etc. to match upstream's version, for ease of comparison.
Differential D38206
lua: reduce diffs between luaconf.h copies emaste on Jan 25 2023, 10:04 PM. Authored by Tags None Referenced Files
Subscribers
Details Upstream luaconf.h is contrib/lua/src/luaconf.h.dist, while userland lua and loader lua have copies in lib/liblua/luaconf.h and stand/liblua/luaconf.h. Adjust whitespace, VCS tags, etc. to match upstream's version, for ease of comparison.
Diff Detail
Event TimelineComment Actions After this change userland luaconf.h vs upstream is: --- contrib/lua/src/luaconf.h.dist 2023-01-25 16:40:13.062497000 -0500 +++ lib/liblua/luaconf.h 2023-01-25 17:00:32.223331000 -0500 @@ -69,6 +69,13 @@ #define LUA_USE_DLOPEN /* MacOS does not need -ldl */ #endif +/* Local modifications: need io.popen */ +#ifdef __FreeBSD__ +#define LUA_USE_POSIX +#ifndef BOOTSTRAPPING +#define LUA_USE_DLOPEN +#endif +#endif /* @@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits. @@ -213,9 +220,9 @@ #else /* }{ */ -#define LUA_ROOT "/usr/local/" -#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" -#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" +#define LUA_ROOT "/usr/" +#define LUA_LDIR LUA_ROOT "share/flua/" +#define LUA_CDIR LUA_ROOT "lib/flua/" #if !defined(LUA_PATH_DEFAULT) #define LUA_PATH_DEFAULT \ while loader is a little more extensive: --- contrib/lua/src/luaconf.h.dist 2023-01-25 16:40:13.062497000 -0500 +++ stand/liblua/luaconf.h 2023-01-25 17:00:34.114426000 -0500 @@ -213,9 +213,9 @@ #else /* }{ */ -#define LUA_ROOT "/usr/local/" -#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" -#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" +#define LUA_ROOT LUA_PATH "/" LUA_VDIR "/" +#define LUA_LDIR LUA_ROOT "share/" +#define LUA_CDIR LUA_ROOT "lib/" #if !defined(LUA_PATH_DEFAULT) #define LUA_PATH_DEFAULT \ @@ -412,9 +412,7 @@ ** may have an ill-defined value.) */ #define lua_numbertointeger(n,p) \ - ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ - (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \ - (*(p) = (LUA_INTEGER)(n), 1)) + (*(p) = (LUA_INTEGER)(n), 1) /* now the variable definitions */ @@ -465,6 +463,32 @@ #define lua_str2number(s,p) strtod((s), (p)) +#elif LUA_FLOAT_TYPE == LUA_FLOAT_INT64 /* }{ int64 */ + +#include "lstd.h" + +#include <machine/_inttypes.h> + +#define panic lua_panic +/* Hack to use int64 as the LUA_NUMBER from ZFS code, kinda */ + +#define LUA_NUMBER int64_t + +#define l_mathlim(n) (LUA_FLOAT_INT_HACK_##n) +#define LUA_FLOAT_INT_HACK_MANT_DIG 32 +#define LUA_FLOAT_INT_HACK_MAX_10_EXP 32 + +#define LUAI_UACNUMBER int64_t + +#define LUA_NUMBER_FRMLEN "" +#define LUA_NUMBER_FMT "%" PRId64 + +#define l_mathop(x) (lstd_ ## x) + +#define lua_str2number(s,p) strtoll((s), (p), 0) + +#define lua_getlocaledecpoint() '.' + #else /* }{ */ #error "numeric float type not defined" @@ -732,14 +756,14 @@ /* @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. */ -#define LUAL_BUFFERSIZE ((int)(16 * sizeof(void*) * sizeof(lua_Number))) +#define LUAL_BUFFERSIZE 128 /* @@ LUAI_MAXALIGN defines fields that, when used in a union, ensure ** maximum alignment for the other items in that union. */ -#define LUAI_MAXALIGN lua_Number n; double u; void *s; lua_Integer i; long l +#define LUAI_MAXALIGN lua_Number n; void *s; lua_Integer i; long l /* }================================================================== */
Comment Actions You could likely do this with #ifdef LUA_LOADER #ifdef LUA_FLUA to a large degere. is what I had to say on IRC as far as rolling the versions forward. The tl;dr: the above changes were needed when we can't use float/double *at*all* and the default lua code just avoids using them, but when float is completely disabled, we need to not reference them at all. Also, it helps with the size of the BIOS boot loader.
Comment Actions
Yeah, I'm thinking of something like that. This change is a small improvement independent of that work IMO. Comment Actions I actually like the idea of this being completely stock, with the suggested change. Unless you want me to push the alternative in https://reviews.freebsd.org/D38207
|