git: f2348b342e63 - main - lang/smalltalk: use modern memory management
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 11 Dec 2023 17:42:39 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/ports/commit/?id=f2348b342e632aa2974ec09ff067b3bcbd0a2f50
commit f2348b342e632aa2974ec09ff067b3bcbd0a2f50
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-12-11 17:40:40 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-12-11 17:42:26 +0000
lang/smalltalk: use modern memory management
The memory allocator defaults to some horrifying complex code to manage
mmap'd allocations. On system where MAP_NORESERVE is defined (Linux) it
uses a much simpler approach relying on memory overcommit. Enable this
code on FreeBSD by defining MAP_NORESERVE to 0 (all allocations
are MAP_NORESERVE on FreeBSD unless a sysctl is set).
Entierly disable the other code path as it (somewhat gratutiously) uses
sbrk.
Approved by: danfe (maintainer)
Sponsord by: DARPA
Differential Revision: https://reviews.freebsd.org/D42974
---
lang/smalltalk/Makefile | 5 +-
.../files/patch-libgst_sysdep_posix_mem.c | 59 ++++++++++++++++++++++
2 files changed, 60 insertions(+), 4 deletions(-)
diff --git a/lang/smalltalk/Makefile b/lang/smalltalk/Makefile
index 591a27d6302b..64a6dfd1f13d 100644
--- a/lang/smalltalk/Makefile
+++ b/lang/smalltalk/Makefile
@@ -1,6 +1,6 @@
PORTNAME= smalltalk
PORTVERSION= 3.2.5
-PORTREVISION= 17
+PORTREVISION= 18
CATEGORIES= lang
MASTER_SITES= GNU
@@ -10,10 +10,7 @@ WWW= https://smalltalk.gnu.org/
LICENSE= GPLv2+
-BROKEN_aarch64= Fails to link: undefined reference to sbrk
BROKEN_powerpc64= Fails to build: gst-package: did not understand #~
-BROKEN_riscv64= Fails to link: undefined reference to sbrk
-BROKEN_sparc64= Fails to install
BUILD_DEPENDS= zip:archivers/zip \
gawk:lang/gawk
diff --git a/lang/smalltalk/files/patch-libgst_sysdep_posix_mem.c b/lang/smalltalk/files/patch-libgst_sysdep_posix_mem.c
new file mode 100644
index 000000000000..a9514dea3ca0
--- /dev/null
+++ b/lang/smalltalk/files/patch-libgst_sysdep_posix_mem.c
@@ -0,0 +1,59 @@
+--- libgst/sysdep/posix/mem.c.orig
++++ libgst/sysdep/posix/mem.c
+@@ -92,20 +92,27 @@
+ #if defined MAP_AUTORESRV && !defined MAP_NORESERVE
+ # define MAP_NORESERVE MAP_AUTORESRV
+ #endif
++#if !defined(MAP_NORESERVE) && defined(__FreeBSD__)
++#define MAP_NORESERVE 0 /* always true */
++#endif
+ #ifdef MAP_NORESERVE
+ static PTR noreserve_reserve (PTR, size_t);
+ static void noreserve_decommit (PTR, size_t);
+ #endif
++#ifndef __FreeBSD__
+ static mst_Boolean anon_mmap_check (void);
+ static PTR anon_mmap_reserve (PTR, size_t);
+ static void anon_mmap_release (PTR, size_t);
++#endif
+ static PTR anon_mmap_commit (PTR, size_t);
+
+ struct heap_implementation heap_impl_tab[] = {
+ #ifdef MAP_NORESERVE
+ { NULL, noreserve_reserve, _gst_osmem_free, anon_mmap_commit, noreserve_decommit },
+ #endif
++#ifndef __FreeBSD__
+ { anon_mmap_check, anon_mmap_reserve, anon_mmap_release, anon_mmap_commit, _gst_osmem_free },
++#endif
+ { NULL, NULL, NULL, NULL, NULL }
+ };
+
+@@ -195,6 +202,7 @@
+
+ static char *baseaddr;
+
++#ifndef __FreeBSD__
+ PTR
+ anon_mmap_reserve (PTR address, size_t size)
+ {
+@@ -220,6 +228,7 @@
+ if ((char *) baseaddr == (char *) base + size)
+ baseaddr = base;
+ }
++#endif
+
+ PTR
+ anon_mmap_commit (PTR base, size_t size)
+@@ -231,6 +240,7 @@
+ return UNCOMMON (result == MAP_FAILED) ? NULL : result;
+ }
+
++#ifndef __FreeBSD__
+ /* This is hairy and a hack. We have to find a place for our heaps... */
+
+ /* This signal handler is used if it is the only means to decide if
+@@ -360,3 +370,4 @@
+ return (true);
+ }
+ }
++#endif