changeset 2600:6ce7e16a4a69

Change: increasing the default stack size to 160k. This change allows EarleyBoyer benchmark from arewefastyet/benchmarks/v8-v7 to pass with default settings. Previous commit 5e9a6d5 (v0.7.9) reduced the stack size to prevent stack overflow when compiling with -O0 in computed goto mode, where native stack frames for njs_vmcode_interpreter() consume ~80KB each. To address this, we now set a lower maximum stack size specifically for unit tests. This fixes #939 issue on Github.
author Dmitry Volyntsev <xeioex@nginx.com>
date Mon, 11 Aug 2025 16:25:47 -0700
parents 1df8f6b4bc36
children cf86eb67f0a2
files src/njs_vm.h src/test/njs_unit_test.c
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/njs_vm.h	Thu Aug 07 17:41:09 2025 -0700
+++ b/src/njs_vm.h	Mon Aug 11 16:25:47 2025 -0700
@@ -8,7 +8,7 @@
 #define _NJS_VM_H_INCLUDED_
 
 
-#define NJS_MAX_STACK_SIZE       (64 * 1024)
+#define NJS_MAX_STACK_SIZE       (160 * 1024)
 
 
 typedef struct njs_frame_s            njs_frame_t;
--- a/src/test/njs_unit_test.c	Thu Aug 07 17:41:09 2025 -0700
+++ b/src/test/njs_unit_test.c	Mon Aug 11 16:25:47 2025 -0700
@@ -21856,6 +21856,7 @@
         options.module = opts->module;
         options.unsafe = opts->unsafe;
         options.backtrace = opts->backtrace;
+        options.max_stack_size = 64 * 1024;
         options.addons = opts->externals ? njs_unit_test_addon_external_modules
                                          : njs_unit_test_addon_modules;
 
@@ -22008,6 +22009,7 @@
         options.init = 1;
         options.interactive = 1;
         options.backtrace = 1;
+        options.max_stack_size = 64 * 1024;
         options.addons = opts->externals ? njs_unit_test_addon_external_modules
                                          : njs_unit_test_addon_modules;