]> git.proxmox.com Git - mirror_zfs.git/commitdiff
FreeBSD: Reduce stack usage of Lua
authorRyan Moeller <ryan@iXsystems.com>
Tue, 22 Sep 2020 23:03:11 +0000 (19:03 -0400)
committerGitHub <noreply@github.com>
Tue, 22 Sep 2020 23:03:11 +0000 (16:03 -0700)
Use the same reduced buffer size for lauxlib that is used on Linux.

Fixes panic on HEAD in lua gsub test designed to exhaust stack space.

With this we can remove the special case to reserve more stack space
on FreeBSD.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #10959

include/sys/lua/luaconf.h
module/lua/llimits.h

index ce99f339fe3499d1b0a4ac77a09267bfc5985132..83202d71c27b8092f6fe7ff552ad287973542198 100644 (file)
@@ -368,11 +368,7 @@ extern int lcompat_hashnum(int64_t);
 @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
 ** CHANGE it if it uses too much C-stack space.
 */
-#ifdef __linux__
 #define LUAL_BUFFERSIZE                512
-#else
-#define LUAL_BUFFERSIZE                1024
-#endif
 
 
 /*
index 25466f14edca1f32e314f5fbda323f32c92ac198..177092fbc228dce716cb4802b0e9441c350fe136 100644 (file)
@@ -126,16 +126,7 @@ typedef LUAI_UACNUMBER l_uacNumber;
  * Minimum amount of available stack space (in bytes) to make a C call.  With
  * gsub() recursion, the stack space between each luaD_call() is 1256 bytes.
  */
-#if defined(__FreeBSD__)
-/*
- * FreeBSD needs a few extra bytes in unoptimized debug builds to avoid a
- * double-fault handling the error when the max call depth is exceeded just
- * before the C stack runs out.  64 bytes seems to do the trick.
- */
-#define LUAI_MINCSTACK         4160
-#else
 #define LUAI_MINCSTACK         4096
-#endif
 
 /*
 ** maximum number of upvalues in a closure (both C and Lua). (Value