From b8e66976962fa8442bc428fc4c254f8f897e4cee Mon Sep 17 00:00:00 2001 From: John Polstra Date: Fri, 5 Sep 1997 05:34:11 +0000 Subject: Portability improvements for the thread-safe malloc. --- lang/modula-3-lib/files/patch-bg | 44 ++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 15 deletions(-) (limited to 'lang') diff --git a/lang/modula-3-lib/files/patch-bg b/lang/modula-3-lib/files/patch-bg index 68c5bfddee82..e24999a68549 100644 --- a/lang/modula-3-lib/files/patch-bg +++ b/lang/modula-3-lib/files/patch-bg @@ -43,9 +43,9 @@ Index: m3/m3core/src/runtime/FreeBSD2/m3makefile %% s_source (RTStackASM) Index: m3/m3core/src/runtime/FreeBSD2/malloc.c ---- malloc.c.orig Fri Jul 11 07:48:55 1997 -+++ malloc.c Fri Jul 25 18:03:33 1997 -@@ -0,0 +1,1139 @@ +--- malloc.c.orig Mon Jul 28 14:36:20 1997 ++++ malloc.c Thu Sep 4 22:15:00 1997 +@@ -0,0 +1,1153 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): @@ -54,7 +54,7 @@ Index: m3/m3core/src/runtime/FreeBSD2/malloc.c + * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp + * ---------------------------------------------------------------------------- + * -+ * From FreeBSD: malloc.c,v 1.28 1997/07/02 19:33:23 phk Exp ++ * From FreeBSD: malloc.c,v 1.32 1997/08/31 05:59:39 phk Exp + * Modified for Modula-3 thread safety by jdp@polstra.com (John Polstra). + * + */ @@ -93,15 +93,15 @@ Index: m3/m3core/src/runtime/FreeBSD2/malloc.c + * + */ + -+#if defined(__FreeBSD__) || defined(__linux__) ++#if defined(__FreeBSD__) +# if defined(__i386__) +# define malloc_pageshift 12U +# define malloc_minsize 16U +# endif -+#endif /* __FreeBSD__ || __linux__ */ ++#endif /* __FreeBSD__ */ + +#if defined(__sparc__) && defined(sun) -+# define malloc_pageshirt 12U ++# define malloc_pageshift 12U +# define malloc_minsize 16U +# define MAP_ANON (0) + static int fdzero; @@ -112,6 +112,18 @@ Index: m3/m3core/src/runtime/FreeBSD2/malloc.c +# define MADV_FREE MADV_DONTNEED +#endif /* __sparc__ */ + ++#if defined(__linux__) ++# if defined(__i386__) ++# define malloc_pageshift 12U ++# define malloc_minsize 16U ++# endif ++#endif /* __linux__ */ ++ ++#if defined(__alpha) ++# define malloc_pageshift 13U ++# define malloc_minsize 16U ++#endif /* __alpha */ ++ +/* Insert your combination here... */ +#if defined(__FOOCPU__) && defined(__BAROS__) +# define malloc_pageshift 12U @@ -126,6 +138,7 @@ Index: m3/m3core/src/runtime/FreeBSD2/malloc.c +#include +#include +#include ++#include +#include +#include +#include @@ -181,7 +194,7 @@ Index: m3/m3core/src/runtime/FreeBSD2/malloc.c +#endif + +#if !defined(malloc_pagesize) -+#define malloc_pagesize (1U<bits[0] * + (((malloc_pagesize >> bits)+MALLOC_BITS-1) / MALLOC_BITS); + + /* Don't waste more than two chunks on this */ -- cgit v1.2.3