Increase stack size to 128k and guard size to 16k

This improves our compatibility with Apple M1.
This commit is contained in:
Justine Tunney 2022-12-18 22:58:29 -08:00
parent 57c0dcdc29
commit dd04aeba1c
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
36 changed files with 109 additions and 125 deletions

View file

@ -24,8 +24,8 @@ int init_mparams(void) {
size_t gsize;
#if defined(__COSMOPOLITAN__)
psize = 4096;
gsize = 65536;
psize = FRAMESIZE;
gsize = FRAMESIZE;
#elif !defined(WIN32)
psize = malloc_getpagesize;
gsize = ((DEFAULT_GRANULARITY != 0)? DEFAULT_GRANULARITY : psize);

View file

@ -155,10 +155,6 @@ o/$(MODE)/third_party/lua/lvm.o: private \
OVERRIDE_CFLAGS += \
-fno-gcse
o/$(MODE)/third_party/lua/lauxlib.o: private \
OVERRIDE_CFLAGS += \
-DSTACK_FRAME_UNLIMITED
$(THIRD_PARTY_LUA_A_OBJS): private \
OVERRIDE_CFLAGS += \
-ffunction-sections \

View file

@ -22,8 +22,8 @@
#include "libc/intrin/likely.h"
#include "libc/log/log.h"
#include "libc/log/rop.h"
#include "libc/mem/mem.h"
#include "libc/mem/gc.internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/stack.h"
#include "libc/stdio/append.h"
#include "libc/stdio/strlist.internal.h"
@ -169,7 +169,7 @@ static int SerializeTable(lua_State *L, char **buf, int idx,
bool multi;
bool isarray;
lua_Unsigned n;
if (UNLIKELY(!HaveStackMemory(PAGESIZE))) {
if (UNLIKELY(!HaveStackMemory(GUARDSIZE))) {
z->reason = "out of stack";
return -1;
}

View file

@ -353,7 +353,7 @@ static int SerializeTable(lua_State *L, char **buf, int idx,
int rc;
bool multi;
intptr_t rsp, bot;
if (UNLIKELY(!HaveStackMemory(PAGESIZE))) {
if (UNLIKELY(!HaveStackMemory(GUARDSIZE))) {
z->reason = "out of stack";
return -1;
}

View file

@ -171,8 +171,8 @@ o/$(MODE)/third_party/make/hash.o: private \
$(THIRD_PARTY_MAKE_OBJS): private \
OVERRIDE_CFLAGS += \
-DNO_ARCHIVES \
-DSTACK_FRAME_UNLIMITED \
-DHAVE_CONFIG_H \
-DSTACK_FRAME_UNLIMITED \
-DINCLUDEDIR=\".\" \
-DLIBDIR=\".\" \
-DLOCALEDIR=\".\"

View file

@ -134,10 +134,6 @@ o/$(MODE)/third_party/mbedtls/test/%.com.dbg: \
o/$(MODE)/third_party/mbedtls/test/%.com.runs: o/$(MODE)/third_party/mbedtls/test/%.com
@$(COMPILE) -ACHECK -wtT$@ $< $(TESTARGS)
$(THIRD_PARTY_MBEDTLS_TEST_OBJS): private \
OVERRIDE_CFLAGS += \
-DSTACK_FRAME_UNLIMITED
o/$(MODE)/third_party/mbedtls/test/lib.o: private \
OVERRIDE_CFLAGS += \
-fdata-sections \

View file

@ -199,10 +199,6 @@ o/tiny/third_party/quickjs/call.o: private \
OVERRIDE_CFLAGS += \
-O2
o/$(MODE)/third_party/quickjs/unicode_gen.o: private \
OVERRIDE_CPPFLAGS += \
-DSTACK_FRAME_UNLIMITED
# TODO(jart): Replace alloca() calls with malloc().
o/$(MODE)/third_party/quickjs/libregexp.o \
o/$(MODE)/third_party/quickjs/quickjs.o: private \

View file

@ -22,11 +22,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "libc/mem/alg.h"
#include "libc/assert.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/log/log.h"
#include "libc/mem/alg.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"

View file

@ -60,7 +60,7 @@ $(THIRD_PARTY_STB_A_OBJS): private \
-ffunction-sections \
-fdata-sections
$(THIRD_PARTY_STB_A_OBJS): private \
o/$(MODE)/third_party/stb/stb_vorbis.o: private \
OVERRIDE_CPPFLAGS += \
-DSTACK_FRAME_UNLIMITED

View file

@ -162,13 +162,6 @@ o/$(MODE)/third_party/zip/zipup.o: private \
-DZIP64_SUPPORT \
-DBZIP2_SUPPORT
o/$(MODE)/third_party/zip/zip.o \
o/$(MODE)/third_party/zip/zipsplit.o \
o/$(MODE)/third_party/zip/fileio.o \
o/$(MODE)/third_party/zip/fileio_.o: private \
OVERRIDE_CPPFLAGS += \
-DSTACK_FRAME_UNLIMITED
.PHONY: o/$(MODE)/third_party/zip
o/$(MODE)/third_party/zip: \
$(THIRD_PARTY_ZIP_BINS) \

View file

@ -48,6 +48,9 @@
// MISSING #include "os2/os2zip.h"
#endif
#undef PAGESIZE
#define PAGESIZE FRAMESIZE
#if defined(MMAP)
#include "libc/calls/calls.h"
#include "libc/calls/weirdtypes.h"