Skip to content

Commit c598ac2

Browse files
poechselmshinwell
authored andcommitted
Revert #373 (#393)
1 parent 048688d commit c598ac2

File tree

7 files changed

+6
-77
lines changed

7 files changed

+6
-77
lines changed

ocaml/configure

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ocaml/configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,13 +1905,13 @@ AS_CASE([$host],
19051905
flexlink_flags="-chain $flexdll_chain -stack 16777216"],
19061906
[x86_64-w64-mingw32],
19071907
[flexdll_chain='mingw64'
1908-
flexlink_flags="-chain $flexdll_chain -stack 67108864"],
1908+
flexlink_flags="-chain $flexdll_chain -stack 33554432"],
19091909
[i686-pc-windows],
19101910
[flexdll_chain='msvc'
19111911
flexlink_flags="-merge-manifest -stack 16777216"],
19121912
[x86_64-pc-windows],
19131913
[flexdll_chain='msvc64'
1914-
flexlink_flags="-x64 -merge-manifest -stack 67108864"])
1914+
flexlink_flags="-x64 -merge-manifest -stack 33554432"])
19151915

19161916
# Define default prefix correctly for the different Windows ports
19171917
AS_IF([test x"$prefix" = "xNONE"],

ocaml/manual/manual/cmds/native.etex

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -206,48 +206,13 @@ the following environment variables are also consulted:
206206
\begin{options}
207207
\item["OCAMLRUNPARAM"] Same usage as in "ocamlrun"
208208
(see section~\ref{s:ocamlrun-options}), except that option "l"
209-
is ignored. (How to control the stack size is explained in
210-
section~\ref{s:native:stacksize}.)
209+
is ignored (the operating system's stack size limit
210+
is used instead).
211211
\item["CAMLRUNPARAM"] If "OCAMLRUNPARAM" is not found in the
212212
environment, then "CAMLRUNPARAM" will be used instead. If
213213
"CAMLRUNPARAM" is not found, then the default values will be used.
214214
\end{options}
215215

216-
\section{s:native:stacksize}{Size of the stack}
217-
218-
Native-code executables produced by the "ocamlopt" compiler use the
219-
stack managed by the operating system to implement function calls in
220-
non-tail positions. The system stack grows on demand up to a certain
221-
size limit maintained by the operating system. We now explain how this
222-
size limit is determined and can be controlled.
223-
224-
\begin{unix}
225-
Linux, macOS, and other Unix-like operating systems maintain two
226-
limits for the stack size: a current limit and a hard limit. These
227-
limits can be modified (as long as the hard limit is not exceeded)
228-
with the "ulimit -s" shell command or the "setrlimit" system call.
229-
At start-up, executables generated by "ocamlopt" try to set a
230-
comfortable limit for the stack size, as follows:
231-
\begin{itemize}
232-
\item If the current limit is already at the hard limit, as happens if
233-
a "ulimit -s" command was issued in the shell that starts the
234-
executable, the stack size limit is unchanged.
235-
\item If the hard limit is ``unlimited'', as in many Linux
236-
distributions, the stack size limit is raised to 1 Gibytes for 64-bit
237-
platforms and 16 Mibytes for 32-bit platforms.
238-
\item Otherwise, the stack size limit is raised to the hard limit.
239-
For example, this gives a limit of 64 Mibytes under macOS and 512
240-
Mibytes under FreeBSD 64 bits.
241-
\end{itemize}
242-
\end{unix}
243-
244-
\begin{windows}
245-
By default, the maximal size of the system stack is 64 Mibytes for 64-bit
246-
executables and 16 Mibytes for 32-bit executables. It cannot be
247-
changed dynamically. It can be changed at link-time by passing the
248-
appropriate "-stack" option to the "flexlink" linker.
249-
\end{windows}
250-
251216
\section{s:compat-native-bytecode}{Compatibility with the bytecode compiler}
252217

253218
This section lists the known incompatibilities between the bytecode

ocaml/runtime/caml/osdeps.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ extern char_os *caml_secure_getenv(char_os const *var);
106106
cannot be determined, return -1. */
107107
extern int caml_num_rows_fd(int fd);
108108

109-
/* Try to increase the size of the native stack */
110-
extern void caml_increase_native_stack_size(void);
111-
112109
#ifdef _WIN32
113110

114111
extern int caml_win32_rename(const wchar_t *, const wchar_t *);

ocaml/runtime/startup_nat.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ value caml_startup_common(char_os **argv, int pooling)
124124
if (!caml_startup_aux(pooling))
125125
return Val_unit;
126126

127-
caml_increase_native_stack_size();
128127
caml_init_frame_descriptors();
129128
caml_init_locale();
130129
#if defined(_MSC_VER) && __STDC_SECURE_LIB__ >= 200411L

ocaml/runtime/unix.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
#include <errno.h>
3030
#include <sys/ioctl.h>
3131
#include <fcntl.h>
32-
#include <sys/time.h>
33-
#include <sys/resource.h>
3432
#include "caml/config.h"
3533
#ifdef SUPPORT_DYNAMIC_LINKING
3634
#ifdef __CYGWIN__
@@ -435,29 +433,3 @@ int caml_num_rows_fd(int fd)
435433
return -1;
436434
#endif
437435
}
438-
439-
void caml_increase_native_stack_size(void)
440-
{
441-
#ifdef RLIMIT_STACK
442-
struct rlimit lim;
443-
rlim_t newlim;
444-
if (getrlimit(RLIMIT_STACK, &lim) == -1) return;
445-
newlim = lim.rlim_max;
446-
if (newlim == RLIM_INFINITY) {
447-
#ifdef ARCH_SIXTYFOUR
448-
newlim = 1024*1024*1024; /* 1G */
449-
#else
450-
newlim = 16*1024*1024; /* 16M */
451-
#endif
452-
}
453-
if (lim.rlim_cur >= newlim) return;
454-
lim.rlim_cur = newlim;
455-
if (setrlimit(RLIMIT_STACK, &lim) == -1) {
456-
caml_gc_message(0x08, "Failed to increase native stack size\n");
457-
} else {
458-
caml_gc_message(0x08, "Increased native stack size to "
459-
"%"ARCH_INT64_PRINTF_FORMAT"u\n",
460-
(ARCH_UINT64_TYPE) newlim);
461-
}
462-
#endif
463-
}

ocaml/runtime/win32.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,3 @@ int caml_num_rows_fd(int fd)
10141014
{
10151015
return -1;
10161016
}
1017-
1018-
void caml_increase_native_stack_size(void)
1019-
{
1020-
}

0 commit comments

Comments
 (0)