diff --git a/src/racket/sconfig.h b/src/racket/sconfig.h
index cbfaddb4f0..8b01fd2c50 100644
--- a/src/racket/sconfig.h
+++ b/src/racket/sconfig.h
@@ -532,6 +532,12 @@
# define DO_STACK_CHECK
# define WINDOWS_FIND_STACK_BOUNDS
+/* This value needs to be consistent with the
+ stack size specified at link time: */
+# define WINDOWS_DEFAULT_STACK_SIZE 8388608
+# ifdef _WIN64
+# define STACK_SAFETY_MARGIN 100000
+# endif
# ifndef _WIN64
# define USE_MZ_SETJMP
diff --git a/src/racket/src/eval.c b/src/racket/src/eval.c
index f0a367160a..1c6398c165 100644
--- a/src/racket/src/eval.c
+++ b/src/racket/src/eval.c
@@ -543,7 +543,7 @@ void scheme_init_stack_check()
# ifdef WINDOWS_FIND_STACK_BOUNDS
scheme_stack_boundary = scheme_get_current_os_thread_stack_base();
- scheme_stack_boundary += (STACK_SAFETY_MARGIN - 0x100000);
+ scheme_stack_boundary += (STACK_SAFETY_MARGIN - WINDOWS_DEFAULT_STACK_SIZE);
# endif
# ifdef MACOS_FIND_STACK_BOUNDS
diff --git a/src/worksp/gc2/make.rkt b/src/worksp/gc2/make.rkt
index a914a749d4..b50d6371c6 100644
--- a/src/worksp/gc2/make.rkt
+++ b/src/worksp/gc2/make.rkt
@@ -228,6 +228,7 @@
(map (lambda (f) (build-path "../../racket/" f))
'("include/scheme.h"
"include/schthread.h"
+ "sconfig.h"
"src/schpriv.h"
"src/stypes.h"))
(map (lambda (f) (build-path "../../racket/gc2/" f))
@@ -260,10 +261,9 @@
(> (file-or-directory-modify-seconds f)
ms))
objs)
- (unless (system- (format "~a ~a ~a /MT /Zi /Fe~a ~a ~a /link ~a~a~a"
+ (unless (system- (format "~a ~a /MT /Zi /Fe~a ~a ~a /link ~a~a~a~a~a"
cl.exe
(if exe? "" "/LD /DLL")
- (if win64? "/MACHINE:x64" "")
dll
(let loop ([objs (append objs sys-libs)])
(if (null? objs)
@@ -282,6 +282,8 @@
" "
(loop (cdr delayloads)))))
link-options
+ (if exe? " /STACK:8388608" "")
+ (if win64? " /MACHINE:x64" "")
(let ([s (regexp-match "^(.*)/([a-z0-9]*)[.]dll$" dll)])
(if s
(format " /IMPLIB:~a/msvc/~a.lib"
diff --git a/src/worksp/gracket/gracket.vcproj b/src/worksp/gracket/gracket.vcproj
index 967aad6774..b883ff0b59 100644
--- a/src/worksp/gracket/gracket.vcproj
+++ b/src/worksp/gracket/gracket.vcproj
@@ -77,6 +77,7 @@
GenerateDebugInformation="true"
ProgramDatabaseFile="..\..\..\GRacketCGC.pdb"
SubSystem="2"
+ StackReserveSize="8388608"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
@@ -157,6 +158,7 @@
GenerateDebugInformation="true"
ProgramDatabaseFile="..\..\..\GRacketCGC.pdb"
SubSystem="2"
+ StackReserveSize="8388608"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
@@ -243,6 +245,7 @@
GenerateDebugInformation="true"
ProgramDatabaseFile="..\..\..\GRacketCGC.pdb"
SubSystem="2"
+ StackReserveSize="8388608"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
@@ -325,6 +328,7 @@
GenerateDebugInformation="true"
ProgramDatabaseFile="..\..\..\GRacketCGC.pdb"
SubSystem="2"
+ StackReserveSize="8388608"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
diff --git a/src/worksp/racket/racket.vcproj b/src/worksp/racket/racket.vcproj
index 4d7701e1cb..6af2e8362c 100644
--- a/src/worksp/racket/racket.vcproj
+++ b/src/worksp/racket/racket.vcproj
@@ -75,6 +75,7 @@
GenerateDebugInformation="true"
ProgramDatabaseFile="..\..\..\RacketCGC.pdb"
SubSystem="1"
+ StackReserveSize="8388608"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
@@ -160,6 +161,7 @@
GenerateDebugInformation="true"
ProgramDatabaseFile="..\..\..\RacketCGC.pdb"
SubSystem="1"
+ StackReserveSize="8388608"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
@@ -249,6 +251,7 @@
GenerateDebugInformation="true"
ProgramDatabaseFile="..\..\..\RacketCGC.pdb"
SubSystem="1"
+ StackReserveSize="8388608"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
@@ -338,6 +341,7 @@
GenerateDebugInformation="true"
ProgramDatabaseFile="..\..\..\RacketCGC.pdb"
SubSystem="1"
+ StackReserveSize="8388608"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
@@ -427,6 +431,7 @@
GenerateDebugInformation="true"
ProgramDatabaseFile="..\..\..\RacketCGC.pdb"
SubSystem="1"
+ StackReserveSize="8388608"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
/>
@@ -516,6 +521,7 @@
GenerateDebugInformation="true"
ProgramDatabaseFile="..\..\..\RacketCGC.pdb"
SubSystem="1"
+ StackReserveSize="8388608"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
diff --git a/src/worksp10/gracket/gracket.vcxproj b/src/worksp10/gracket/gracket.vcxproj
index e684d85054..495d4eb776 100644
--- a/src/worksp10/gracket/gracket.vcxproj
+++ b/src/worksp10/gracket/gracket.vcxproj
@@ -72,6 +72,7 @@
true
..\..\..\GRacketCGC.pdb
Windows
+ 8388608
false
@@ -104,6 +105,7 @@
true
..\..\..\GRacketCGC.pdb
Windows
+ 8388608
false
@@ -142,6 +144,7 @@
true
..\..\..\GRacketCGC.pdb
Windows
+ 8388608
false
@@ -178,6 +181,7 @@
true
..\..\..\GRacketCGC.pdb
Windows
+ 8388608
false
diff --git a/src/worksp10/racket/racket.vcxproj b/src/worksp10/racket/racket.vcxproj
index 871493b3df..0cf06fa23f 100644
--- a/src/worksp10/racket/racket.vcxproj
+++ b/src/worksp10/racket/racket.vcxproj
@@ -68,6 +68,7 @@
true
..\..\..\RacketCGC.pdb
Console
+ 8388608
false
@@ -115,6 +116,7 @@
true
..\..\..\RacketCGC.pdb
Console
+ 8388608
false
@@ -163,6 +165,7 @@
true
..\..\..\RacketCGC.pdb
Console
+ 8388608
false
@@ -213,6 +216,7 @@
true
..\..\..\RacketCGC.pdb
Console
+ 8388608
false