]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Use an initial shared memory size of 256 GB on Apple.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 17 Jan 2021 18:13:20 +0000 (19:13 +0100)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 17 Jan 2021 18:13:20 +0000 (19:13 +0100)
This implements an idea that Nicolas had to overcome the Darwin
problem that it is not possible to extend a shared memory segment
on that system.

The remedy is simple: Use a memory segment that is larger than
what can reasonably be used. This should only waste a few page
table entries, while providing the functionality, at least for
further testing.

libgfortran/ChangeLog:

* caf_shared/shared_memory.c (shared_memory_init): On Apple,
use an initial size of 256 GB.

libgfortran/caf_shared/shared_memory.c

index b64e40a3dedea65d2d977434578964e8b5601b6b..0c0b36c663db7921b7df38f6d4006d0f87befeb7 100644 (file)
@@ -190,7 +190,16 @@ shared_memory_init (shared_memory_act **pmem)
 {
   shared_memory_act *mem;
   int fd;
+
+  /* Darwin does not appear to be able to grow shared memory segments.  Choose
+     256 GB; that will likely be enough.  If not, the ftruncate will fail
+     noisily.  */
+
+#ifdef __APPLE__
+  size_t initial_size = ((size_t) 1) << 38;
+#else
   size_t initial_size = round_to_pagesize (sizeof (global_shared_memory_meta));
+#endif
 
   mem = malloc (get_shared_memory_act_size (1));
   fd = get_shmem_fd ();