2 * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
3 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
4 * Copyright (c) 1996 by Silicon Graphics. All rights reserved.
5 * Copyright (c) 2000-2004 Hewlett-Packard Development Company, L.P.
7 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
10 * Permission is hereby granted to use or copy this program
11 * for any purpose, provided the above notices are retained on all copies.
12 * Permission to modify the code and to distribute modified code is granted,
13 * provided the above notices are retained, and a notice that the code was
14 * modified is included with the above copyright notice.
18 * This header is private to the gc. It is almost always included from
19 * gc_priv.h. However it is possible to include it by itself if just the
20 * configuration macros are needed. In that
21 * case, a few declarations relying on types declared in gc_priv.h will be
30 /* Fake ptr_t declaration, just to avoid compilation errors. */
31 /* This avoids many instances if "ifndef GC_PRIVATE_H" below. */
32 typedef struct GC_undefined_struct * ptr_t;
35 /* Machine dependent parameters. Some tuning parameters can be found */
36 /* near the top of gc_private.h. */
38 /* Machine specific parts contributed by various people. See README file. */
40 /* First a unified test for Linux: */
41 # if defined(linux) || defined(__linux__)
47 /* And one for NetBSD: */
48 # if defined(__NetBSD__)
52 /* And one for OpenBSD: */
53 # if defined(__OpenBSD__)
57 /* And one for FreeBSD: */
58 # if defined(__FreeBSD__) && !defined(FREEBSD)
62 /* Determine the machine type: */
63 # if defined(__arm__) || defined(__thumb__)
65 # if !defined(LINUX) && !defined(NETBSD)
67 # define mach_type_known
70 # if defined(sun) && defined(mc68000)
73 # define mach_type_known
75 # if defined(hp9000s300)
78 # define mach_type_known
80 # if defined(OPENBSD) && defined(m68k)
82 # define mach_type_known
84 # if defined(OPENBSD) && defined(__sparc__)
86 # define mach_type_known
88 # if defined(NETBSD) && (defined(m68k) || defined(__m68k__))
90 # define mach_type_known
92 # if defined(NETBSD) && defined(__powerpc__)
94 # define mach_type_known
96 # if defined(NETBSD) && (defined(__arm32__) || defined(__arm__))
98 # define mach_type_known
100 # if defined(NETBSD) && defined(__sh__)
102 # define mach_type_known
111 # define mach_type_known
113 # if defined(__NetBSD__) && defined(__vax__)
115 # define mach_type_known
117 # if defined(mips) || defined(__mips) || defined(_mips)
119 # if defined(nec_ews) || defined(_nec_ews)
122 # if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD)
123 # if defined(ultrix) || defined(__ultrix)
126 # if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) \
127 || defined(__SYSTYPE_SVR4__)
128 # define IRIX5 /* or IRIX 6.X */
130 # define RISCOS /* or IRIX 4.X */
134 # if defined(__NetBSD__) && defined(__MIPSEL__)
137 # define mach_type_known
139 # if defined(DGUX) && (defined(i386) || defined(__i386__))
144 # define mach_type_known
146 # if defined(sequent) && (defined(i386) || defined(__i386__))
149 # define mach_type_known
151 # if defined(sun) && (defined(i386) || defined(__i386__))
154 # define mach_type_known
156 # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
159 # define mach_type_known
163 # define mach_type_known
165 # if defined(sun) && (defined(sparc) || defined(__sparc))
167 /* Test for SunOS 5.x */
174 # define mach_type_known
176 # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
177 && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__)
180 # define mach_type_known
184 # define mach_type_known
186 # if defined(__NetBSD__) && defined(__sparc__)
188 # define mach_type_known
190 # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
191 /* The above test may need refinement */
193 # if defined(_SCO_ELF)
198 # define mach_type_known
200 # if defined(_AUX_SOURCE)
203 # define mach_type_known
205 # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
206 || defined(hppa) || defined(__hppa__)
208 # if !defined(LINUX) && !defined(HPUX)
211 # define mach_type_known
213 # if defined(__ia64) && defined(_HPUX_SOURCE)
218 # define mach_type_known
220 # if defined(__BEOS__) && defined(_X86_)
223 # define mach_type_known
225 # if defined(LINUX) && (defined(i386) || defined(__i386__))
227 # define mach_type_known
229 # if defined(LINUX) && defined(__x86_64__)
231 # define mach_type_known
233 # if defined(LINUX) && (defined(__ia64__) || defined(__ia64))
235 # define mach_type_known
237 # if defined(LINUX) && defined(__arm__)
239 # define mach_type_known
241 # if defined(LINUX) && defined(__cris__)
245 # define mach_type_known
247 # if defined(LINUX) && (defined(powerpc) || defined(__powerpc__) || \
248 defined(powerpc64) || defined(__powerpc64__))
250 # define mach_type_known
252 # if defined(FREEBSD) && (defined(powerpc) || defined(__powerpc__))
254 # define mach_type_known
256 # if defined(LINUX) && defined(__mc68000__)
258 # define mach_type_known
260 # if defined(LINUX) && (defined(sparc) || defined(__sparc__))
262 # define mach_type_known
264 # if defined(LINUX) && defined(__arm__)
266 # define mach_type_known
268 # if defined(LINUX) && defined(__sh__)
270 # define mach_type_known
272 # if defined(LINUX) && defined(__m32r__)
274 # define mach_type_known
276 # if defined(__alpha) || defined(__alpha__)
278 # if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) && !defined(FREEBSD)
279 # define OSF1 /* a.k.a Digital Unix */
281 # define mach_type_known
283 # if defined(_AMIGA) && !defined(AMIGA)
288 # define mach_type_known
290 # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
293 # define mach_type_known
295 # if defined(__MWERKS__) && defined(__powerc) && !defined(__MACH__)
298 # define mach_type_known
300 # if defined(macosx) || (defined(__APPLE__) && defined(__MACH__))
302 # if defined(__ppc__) || defined(__ppc64__)
304 # define mach_type_known
305 # elif defined(__i386__)
307 # define mach_type_known
308 # define DARWIN_DONT_PARSE_STACK
309 # define OS_TYPE "DARWIN"
310 # define DYNAMIC_LOADING
311 /* XXX: see get_end(3), get_etext() and get_end() should not be used.
312 These aren't used when dyld support is enabled (it is by default) */
313 # define DATASTART ((ptr_t) get_etext())
314 # define DATAEND ((ptr_t) get_end())
315 # define STACKBOTTOM ((ptr_t) 0xc0000000)
317 # define USE_MMAP_ANON
318 # define USE_ASM_PUSH_REGS
319 /* This is potentially buggy. It needs more testing. See the comments in
320 os_dep.c. It relies on threads to track writes. */
321 # ifdef GC_DARWIN_THREADS
322 /* # define MPROTECT_VDB -- diabled for now. May work for some apps. */
325 # define GETPAGESIZE() getpagesize()
326 /* There seems to be some issues with trylock hanging on darwin. This
327 should be looked into some more */
328 # define NO_PTHREAD_TRYLOCK
331 # if defined(NeXT) && defined(mc68000)
334 # define mach_type_known
336 # if defined(NeXT) && (defined(i386) || defined(__i386__))
339 # define mach_type_known
341 # if defined(__OpenBSD__) && (defined(i386) || defined(__i386__))
344 # define mach_type_known
346 # if defined(FREEBSD) && (defined(i386) || defined(__i386__))
348 # define mach_type_known
350 # if defined(FREEBSD) && defined(__x86_64__)
352 # define mach_type_known
354 # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
356 # define mach_type_known
358 # if defined(__NetBSD__) && defined(__x86_64__)
360 # define mach_type_known
362 # if defined(FREEBSD) && defined(__sparc__)
364 # define mach_type_known
366 # if defined(bsdi) && (defined(i386) || defined(__i386__))
369 # define mach_type_known
371 # if !defined(mach_type_known) && defined(__386BSD__)
374 # define mach_type_known
376 # if defined(_CX_UX) && defined(_M88K)
379 # define mach_type_known
381 # if defined(DGUX) && defined(m88k)
384 # define mach_type_known
386 # if defined(_WIN32_WCE)
387 /* SH3, SH4, MIPS already defined for corresponding architectures */
388 # if defined(SH3) || defined(SH4)
398 # define mach_type_known
400 # if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
401 || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
403 # define MSWIN32 /* or Win32s */
404 # define mach_type_known
406 # if defined(_MSC_VER) && defined(_M_IA64)
408 # define MSWIN32 /* Really win64, but we don't treat 64-bit */
409 /* variants as a differnt platform. */
412 # if defined(__DJGPP__)
415 # define DJGPP /* MSDOS running the DJGPP port of GCC */
417 # define mach_type_known
419 # if defined(__CYGWIN32__) || defined(__CYGWIN__)
422 # define mach_type_known
424 # if defined(__MINGW32__)
427 # define mach_type_known
429 # if defined(__BORLANDC__)
432 # define mach_type_known
434 # if defined(_UTS) && !defined(mach_type_known)
437 # define mach_type_known
441 # define mach_type_known
443 # if defined(__embedded__) && defined(PPC)
446 # define mach_type_known
449 # if defined(__WATCOMC__) && defined(__386__)
451 # if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
452 # if defined(__OS2__)
455 # if defined(__WINDOWS_386__) || defined(__NT__)
462 # define mach_type_known
464 # if defined(__s390__) && defined(LINUX)
466 # define mach_type_known
468 # if defined(__GNU__)
469 # if defined(__i386__)
470 /* The Debian Hurd running on generic PC */
473 # define mach_type_known
477 /* Feel free to add more clauses here */
479 /* Or manually define the machine type here. A machine type is */
480 /* characterized by the architecture. Some */
481 /* machine types are further subdivided by OS. */
482 /* the macros ULTRIX, RISCOS, and BSD to distinguish. */
483 /* Note that SGI IRIX is treated identically to RISCOS. */
484 /* SYSV on an M68K actually means A/UX. */
485 /* The distinction in these cases is usually the stack starting address */
486 # ifndef mach_type_known
487 --> unknown machine type
489 /* Mapping is: M68K ==> Motorola 680X0 */
490 /* (SUNOS4,HP,NEXT, and SYSV (A/UX), */
491 /* MACOS and AMIGA variants) */
492 /* I386 ==> Intel 386 */
493 /* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
494 /* FREEBSD, THREE86BSD, MSWIN32, */
495 /* BSDI,SUNOS5, NEXT, other variants) */
496 /* NS32K ==> Encore Multimax */
497 /* MIPS ==> R2000 or R3000 */
498 /* (RISCOS, ULTRIX variants) */
499 /* VAX ==> DEC VAX */
500 /* (BSD, ULTRIX variants) */
501 /* RS6000 ==> IBM RS/6000 AIX3.X */
502 /* RT ==> IBM PC/RT */
503 /* HP_PA ==> HP9000/700 & /800 */
505 /* SPARC ==> SPARC v7/v8/v9 */
506 /* (SUNOS4, SUNOS5, LINUX, */
507 /* DRSNX variants) */
508 /* ALPHA ==> DEC Alpha */
509 /* (OSF1 and LINUX variants) */
510 /* M88K ==> Motorola 88XX0 */
511 /* (CX_UX and DGUX) */
512 /* S370 ==> 370-like machine */
513 /* running Amdahl UTS4 */
514 /* S390 ==> 390-like machine */
516 /* ARM32 ==> Intel StrongARM */
517 /* IA64 ==> Intel IPF */
519 /* (LINUX and HPUX) */
520 /* SH ==> Hitachi SuperH */
521 /* (LINUX & MSWINCE) */
522 /* X86_64 ==> AMD x86-64 */
523 /* POWERPC ==> IBM/Apple PowerPC */
524 /* (MACOS(<=9),DARWIN(incl.MACOSX),*/
525 /* LINUX, NETBSD, NOSYS variants) */
526 /* Handles 32 and 64-bit variants. */
527 /* AIX should be handled here, but */
528 /* that's called an RS6000. */
529 /* CRIS ==> Axis Etrax */
530 /* M32R ==> Renesas M32R */
534 * For each architecture and OS, the following need to be defined:
536 * CPP_WORDSZ is a simple integer constant representing the word size.
537 * in bits. We assume byte addressibility, where a byte has 8 bits.
538 * We also assume CPP_WORDSZ is either 32 or 64.
539 * (We care about the length of pointers, not hardware
540 * bus widths. Thus a 64 bit processor with a C compiler that uses
541 * 32 bit pointers should use CPP_WORDSZ of 32, not 64. Default is 32.)
543 * MACH_TYPE is a string representation of the machine type.
544 * OS_TYPE is analogous for the OS.
546 * ALIGNMENT is the largest N, such that
547 * all pointer are guaranteed to be aligned on N byte boundaries.
548 * defining it to be 1 will always work, but perform poorly.
550 * DATASTART is the beginning of the data segment.
551 * On some platforms SEARCH_FOR_DATA_START is defined.
552 * SEARCH_FOR_DATASTART will cause GC_data_start to
553 * be set to an address determined by accessing data backwards from _end
554 * until an unmapped page is found. DATASTART will be defined to be
556 * On UNIX-like systems, the collector will scan the area between DATASTART
557 * and DATAEND for root pointers.
559 * DATAEND, if not `end' where `end' is defined as ``extern int end[];''.
560 * RTH suggests gaining access to linker script synth'd values with
561 * this idiom instead of `&end' where `end' is defined as ``extern int end;'' .
562 * Otherwise, ``GCC will assume these are in .sdata/.sbss'' and it will, e.g.,
563 * cause failures on alpha*-*-* with ``-msmall-data or -fpic'' or mips-*-*
564 * without any special options.
566 * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
569 * STACKBOTTOM is the cool end of the stack, which is usually the
570 * highest address in the stack.
571 * Under PCR or OS/2, we have other ways of finding thread stacks.
572 * For each machine, the following should:
573 * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
574 * 2) define exactly one of
575 * STACKBOTTOM (should be defined to be an expression)
579 * If STACKBOTTOM is defined, then it's value will be used directly as the
580 * stack base. If LINUX_STACKBOTTOM is defined, then it will be determined
581 * with a method appropriate for most Linux systems. Currently we look
582 * first for __libc_stack_end, and if that fails read it from /proc.
583 * If either of the last two macros are defined, then STACKBOTTOM is computed
584 * during collector startup using one of the following two heuristics:
585 * HEURISTIC1: Take an address inside GC_init's frame, and round it up to
586 * the next multiple of STACK_GRAN.
587 * HEURISTIC2: Take an address inside GC_init's frame, increment it repeatedly
588 * in small steps (decrement if STACK_GROWS_UP), and read the value
589 * at each location. Remember the value when the first
590 * Segmentation violation or Bus error is signalled. Round that
591 * to the nearest plausible page boundary, and use that instead
594 * Gustavo Rodriguez-Rivera points out that on most (all?) Unix machines,
595 * the value of environ is a pointer that can serve as STACKBOTTOM.
596 * I expect that HEURISTIC2 can be replaced by this approach, which
597 * interferes far less with debugging. However it has the disadvantage
598 * that it's confused by a putenv call before the collector is initialized.
599 * This could be dealt with by intercepting putenv ...
601 * If no expression for STACKBOTTOM can be found, and neither of the above
602 * heuristics are usable, the collector can still be used with all of the above
603 * undefined, provided one of the following is done:
604 * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
605 * without reference to STACKBOTTOM. This is appropriate for use in
606 * conjunction with thread packages, since there will be multiple stacks.
607 * (Allocating thread stacks in the heap, and treating them as ordinary
608 * heap data objects is also possible as a last resort. However, this is
609 * likely to introduce significant amounts of excess storage retention
610 * unless the dead parts of the thread stacks are periodically cleared.)
611 * 2) Client code may set GC_stackbottom before calling any GC_ routines.
612 * If the author of the client code controls the main program, this is
613 * easily accomplished by introducing a new main program, setting
614 * GC_stackbottom to the address of a local variable, and then calling
615 * the original main program. The new main program would read something
618 * # include "gc_private.h"
620 * main(argc, argv, envp)
622 * char **argv, **envp;
626 * GC_stackbottom = (ptr_t)(&dummy);
627 * return(real_main(argc, argv, envp));
631 * Each architecture may also define the style of virtual dirty bit
632 * implementation to be used:
633 * MPROTECT_VDB: Write protect the heap and catch faults.
634 * PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
636 * An architecture may define DYNAMIC_LOADING if dynamic_load.c
637 * defined GC_register_dynamic_libraries() for the architecture.
639 * An architecture may define PREFETCH(x) to preload the cache with *x.
640 * This defaults to a no-op.
642 * PREFETCH_FOR_WRITE(x) is used if *x is about to be written.
644 * An architecture may also define CLEAR_DOUBLE(x) to be a fast way to
645 * clear the two words at GC_malloc-aligned address x. By default,
646 * word stores of 0 are used instead.
648 * HEAP_START may be defined as the initial address hint for mmap-based
652 /* If we are using a recent version of gcc, we can use __builtin_unwind_init()
653 * to push the relevant registers onto the stack. This generally makes
654 * USE_GENERIC_PUSH_REGS the preferred approach for marking from registers.
656 # if defined(__GNUC__) && ((__GNUC__ >= 3) || \
657 (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) \
658 && !defined(__INTEL_COMPILER) \
659 && !defined(__PATHCC__)
660 # define HAVE_BUILTIN_UNWIND_INIT
663 # define STACK_GRAN 0x1000000
665 # define MACH_TYPE "M68K"
668 # define OS_TYPE "OPENBSD"
671 # define DATASTART GC_data_start
672 # define DYNAMIC_LOADING
675 # define DATASTART ((ptr_t)(etext))
677 # define USE_GENERIC_PUSH_REGS
680 # define OS_TYPE "NETBSD"
683 # define DATASTART GC_data_start
684 # define DYNAMIC_LOADING
687 # define DATASTART ((ptr_t)(etext))
689 # define USE_GENERIC_PUSH_REGS
692 # define OS_TYPE "LINUX"
693 # define STACKBOTTOM ((ptr_t)0xf0000000)
694 # define USE_GENERIC_PUSH_REGS
695 /* We never got around to the assembly version. */
696 /* # define MPROTECT_VDB - Reported to not work 9/17/01 */
698 # define DYNAMIC_LOADING
699 # include <features.h>
700 # if defined(__GLIBC__)&& __GLIBC__>=2
701 # define SEARCH_FOR_DATA_START
703 extern char **__environ;
704 # define DATASTART ((ptr_t)(&__environ))
705 /* hideous kludge: __environ is the first */
706 /* word in crt0.o, and delimits the start */
707 /* of the data segment, no matter which */
708 /* ld options were passed through. */
709 /* We could use _etext instead, but that */
710 /* would include .rodata, which may */
711 /* contain large read-only data tables */
712 /* that we'd rather not scan. */
713 # endif /* !GLIBC2 */
715 # define DATAEND (_end)
718 # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
722 # define OS_TYPE "SUNOS4"
724 # define DATASTART ((ptr_t)((((word) (etext)) + 0x1ffff) & ~0x1ffff))
725 # define HEURISTIC1 /* differs */
726 # define DYNAMIC_LOADING
729 # define OS_TYPE "HP"
731 # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
732 # define STACKBOTTOM ((ptr_t) 0xffeffffc)
733 /* empirically determined. seems to work. */
735 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
738 # define OS_TYPE "SYSV"
740 # define DATASTART ((ptr_t)((((word) (etext)) + 0x3fffff) \
742 +((word)etext & 0x1fff))
743 /* This only works for shared-text binaries with magic number 0413.
744 The other sorts of SysV binaries put the data at the end of the text,
745 in which case the default of etext would work. Unfortunately,
746 handling both would require having the magic-number available.
749 # define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
750 /* The stack starts at the top of memory, but */
751 /* 0x0 cannot be used as setjump_test complains */
752 /* that the stack direction is incorrect. Two */
753 /* bytes down from 0x0 should be safe enough. */
755 # include <sys/mmu.h>
756 # define GETPAGESIZE() PAGESIZE /* Is this still right? */
759 # define OS_TYPE "AMIGA"
760 /* STACKBOTTOM and DATASTART handled specially */
762 # define DATAEND /* not needed */
763 # define GETPAGESIZE() 4096
769 # define OS_TYPE "MACOS"
770 /* see os_dep.c for details of global data segments. */
771 # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
772 # define DATAEND /* not needed */
773 # define GETPAGESIZE() 4096
776 # define OS_TYPE "NEXT"
777 # define DATASTART ((ptr_t) get_etext())
778 # define STACKBOTTOM ((ptr_t) 0x4000000)
779 # define DATAEND /* not needed */
783 # if defined(POWERPC)
784 # define MACH_TYPE "POWERPC"
786 # define ALIGNMENT 2 /* Still necessary? Could it be 4? */
790 # define OS_TYPE "MACOS"
791 /* see os_dep.c for details of global data segments. */
792 # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
793 # define DATAEND /* not needed */
796 # if defined(__powerpc64__)
798 # define CPP_WORDSZ 64
800 # define HBLKSIZE 4096
805 # define OS_TYPE "LINUX"
806 /* HEURISTIC1 has been reliably reported to fail for a 32-bit */
807 /* executable on a 64 bit kernel. */
808 # define LINUX_STACKBOTTOM
809 # define DYNAMIC_LOADING
810 # define SEARCH_FOR_DATA_START
812 # define DATAEND (_end)
817 # define CPP_WORDSZ 64
821 # define OS_TYPE "DARWIN"
822 # define DYNAMIC_LOADING
823 /* XXX: see get_end(3), get_etext() and get_end() should not be used.
824 These aren't used when dyld support is enabled (it is by default) */
825 # define DATASTART ((ptr_t) get_etext())
826 # define DATAEND ((ptr_t) get_end())
827 # define STACKBOTTOM ((ptr_t) 0xc0000000)
829 # define USE_MMAP_ANON
830 # define USE_ASM_PUSH_REGS
831 /* This is potentially buggy. It needs more testing. See the comments in
832 os_dep.c. It relies on threads to track writes. */
833 # ifdef GC_DARWIN_THREADS
834 /* # define MPROTECT_VDB -- diabled for now. May work for some apps. */
837 # define GETPAGESIZE() getpagesize()
838 # if defined(USE_PPC_PREFETCH) && defined(__GNUC__)
839 /* The performance impact of prefetches is untested */
840 # define PREFETCH(x) \
841 __asm__ __volatile__ ("dcbt 0,%0" : : "r" ((const void *) (x)))
842 # define PREFETCH_FOR_WRITE(x) \
843 __asm__ __volatile__ ("dcbtst 0,%0" : : "r" ((const void *) (x)))
845 /* There seems to be some issues with trylock hanging on darwin. This
846 should be looked into some more */
847 # define NO_PTHREAD_TRYLOCK
851 # define OS_TYPE "FREEBSD"
852 # ifndef GC_FREEBSD_THREADS
853 # define MPROTECT_VDB
855 # define SIG_SUSPEND SIGUSR1
856 # define SIG_THR_RESTART SIGUSR2
857 # define FREEBSD_STACKBOTTOM
859 # define DYNAMIC_LOADING
862 extern char * GC_FreeBSDGetDataStart();
863 # define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
867 # define OS_TYPE "NETBSD"
870 # define DATASTART GC_data_start
871 # define DYNAMIC_LOADING
875 # define OS_TYPE "NOSYS"
876 extern void __end[], __dso_handle[];
877 # define DATASTART (__dso_handle) /* OK, that's ugly. */
878 # define DATAEND (__end)
879 /* Stack starts at 0xE0000000 for the simulator. */
881 # define STACK_GRAN 0x10000000
887 # define MACH_TYPE "VAX"
888 # define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */
890 # define DATASTART ((ptr_t)(etext))
892 # define OS_TYPE "BSD"
894 /* HEURISTIC2 may be OK, but it's hard to test. */
897 # define OS_TYPE "ULTRIX"
898 # define STACKBOTTOM ((ptr_t) 0x7fffc800)
903 # define MACH_TYPE "RT"
905 # define DATASTART ((ptr_t) 0x10000000)
906 # define STACKBOTTOM ((ptr_t) 0x1fffd800)
910 # define MACH_TYPE "SPARC"
911 # if defined(__arch64__) || defined(__sparcv9)
913 # define CPP_WORDSZ 64
914 # define ELF_CLASS ELFCLASS64
916 # define ALIGNMENT 4 /* Required by hardware */
917 # define CPP_WORDSZ 32
919 # define ALIGN_DOUBLE
920 # ifdef _FILE_OFFSET_BITS
921 # undef _FILE_OFFSET_BITS /* libelf.h & procfs.h doesn't compile with large file support */
922 # define _FILE_OFFSET_BITS 32
925 # define OS_TYPE "SUNOS5"
928 extern ptr_t GC_SysVGetDataStart();
929 # define DATASTART GC_SysVGetDataStart(0x10000, _etext)
930 # define DATAEND (_end)
931 # if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
933 /* Otherwise we now use calloc. Mmap may result in the */
934 /* heap interleaved with thread stacks, which can result in */
935 /* excessive blacklisting. Sbrk is unusable since it */
936 /* doesn't interact correctly with the system malloc. */
939 # define HEAP_START (ptr_t)0x40000000
941 # define HEAP_START DATAEND
944 /* HEURISTIC1 reportedly no longer works under 2.7. */
945 /* HEURISTIC2 probably works, but this appears to be preferable. */
946 /* Apparently USRSTACK is defined to be USERLIMIT, but in some */
947 /* installations that's undefined. We work around this with a */
949 # include <sys/vmparam.h>
951 /* This should work everywhere, but doesn't. */
952 # define STACKBOTTOM USRSTACK
957 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
958 /* getpagesize() appeared to be missing from at least one */
959 /* Solaris 5.4 installation. Weird. */
960 # define DYNAMIC_LOADING
963 # define OS_TYPE "SUNOS4"
964 /* [If you have a weak stomach, don't read this.] */
965 /* We would like to use: */
966 /* # define DATASTART ((ptr_t)((((word) (etext)) + 0x1fff) & ~0x1fff)) */
967 /* This fails occasionally, due to an ancient, but very */
968 /* persistent ld bug. etext is set 32 bytes too high. */
969 /* We instead read the text segment size from the a.out */
970 /* header, which happens to be mapped into our address space */
971 /* at the start of the text segment. The detective work here */
972 /* was done by Robert Ehrlich, Manuel Serrano, and Bernard */
973 /* Serpette of INRIA. */
974 /* This assumes ZMAGIC, i.e. demand-loadable executables. */
975 # define TEXTSTART 0x2000
976 # define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
977 # define MPROTECT_VDB
979 # define DYNAMIC_LOADING
982 # define OS_TYPE "DRSNX"
983 extern ptr_t GC_SysVGetDataStart();
985 # define DATASTART GC_SysVGetDataStart(0x10000, etext)
986 # define MPROTECT_VDB
987 # define STACKBOTTOM ((ptr_t) 0xdfff0000)
988 # define DYNAMIC_LOADING
991 # define OS_TYPE "LINUX"
993 # define DYNAMIC_LOADING
995 Linux Sparc/a.out not supported
998 # include <features.h>
999 # if defined(__GLIBC__) && __GLIBC__ >= 2
1000 # define SEARCH_FOR_DATA_START
1002 extern char **__environ;
1003 # define DATASTART ((ptr_t)(&__environ))
1004 /* hideous kludge: __environ is the first */
1005 /* word in crt0.o, and delimits the start */
1006 /* of the data segment, no matter which */
1007 /* ld options were passed through. */
1008 /* We could use _etext instead, but that */
1009 /* would include .rodata, which may */
1010 /* contain large read-only data tables */
1011 /* that we'd rather not scan. */
1014 # define DATAEND (_end)
1015 # define LINUX_STACKBOTTOM
1018 # define OS_TYPE "OPENBSD"
1019 # define STACKBOTTOM ((ptr_t) 0xf8000000)
1021 # define DATASTART ((ptr_t)(etext))
1024 # define OS_TYPE "NETBSD"
1027 # define DATASTART GC_data_start
1028 # define DYNAMIC_LOADING
1030 extern char etext[];
1031 # define DATASTART ((ptr_t)(etext))
1035 # define OS_TYPE "FREEBSD"
1036 # define SIG_SUSPEND SIGUSR1
1037 # define SIG_THR_RESTART SIGUSR2
1038 # define FREEBSD_STACKBOTTOM
1040 # define DYNAMIC_LOADING
1042 extern char etext[];
1043 extern char edata[];
1045 # define NEED_FIND_LIMIT
1046 # define DATASTART ((ptr_t)(&etext))
1047 # define DATAEND (GC_find_limit (DATASTART, TRUE))
1048 # define DATASTART2 ((ptr_t)(&edata))
1049 # define DATAEND2 ((ptr_t)(&end))
1054 # define MACH_TYPE "I386"
1055 # if defined(__LP64__) || defined(_WIN64)
1056 # define CPP_WORDSZ 64
1057 # define ALIGNMENT 8
1059 # define CPP_WORDSZ 32
1060 # define ALIGNMENT 4
1061 /* Appears to hold for all "32 bit" compilers */
1062 /* except Borland. The -a4 option fixes */
1064 /* Ivan Demakov: For Watcom the option is -zp4. */
1066 # ifndef SMALL_CONFIG
1067 # define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */
1068 /* improvement on Pentiums. */
1070 # ifdef HAVE_BUILTIN_UNWIND_INIT
1071 # define USE_GENERIC_PUSH_REGS
1074 # define OS_TYPE "SEQUENT"
1076 # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
1077 # define STACKBOTTOM ((ptr_t) 0x3ffff000)
1080 # define OS_TYPE "BEOS"
1082 # define GETPAGESIZE() B_PAGE_SIZE
1084 # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
1087 # define OS_TYPE "SUNOS5"
1088 extern int _etext[], _end[];
1089 extern ptr_t GC_SysVGetDataStart();
1090 # define DATASTART GC_SysVGetDataStart(0x1000, _etext)
1091 # define DATAEND (_end)
1092 /* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */
1093 /* but reportedly breaks under 2.8. It appears that the stack */
1094 /* base is a property of the executable, so this should not break */
1095 /* old executables. */
1096 /* HEURISTIC2 probably works, but this appears to be preferable. */
1097 # include <sys/vm.h>
1098 # define STACKBOTTOM USRSTACK
1099 /* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
1100 /* It appears to be fixed in 2.8 and 2.9. */
1101 # ifdef SOLARIS25_PROC_VDB_BUG_FIXED
1102 /* Reading of dirty bits doesn't seem to work even in solaris 10 */
1103 /*# define PROC_VDB */
1105 # define DYNAMIC_LOADING
1106 # if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
1108 /* Otherwise we now use calloc. Mmap may result in the */
1109 /* heap interleaved with thread stacks, which can result in */
1110 /* excessive blacklisting. Sbrk is unusable since it */
1111 /* doesn't interact correctly with the system malloc. */
1114 # define HEAP_START (ptr_t)0x40000000
1116 # define HEAP_START DATAEND
1120 # define OS_TYPE "SCO"
1122 # define DATASTART ((ptr_t)((((word) (etext)) + 0x3fffff) \
1124 +((word)etext & 0xfff))
1125 # define STACKBOTTOM ((ptr_t) 0x7ffffffc)
1128 # define OS_TYPE "SCO_ELF"
1130 # define DATASTART ((ptr_t)(etext))
1131 # define STACKBOTTOM ((ptr_t) 0x08048000)
1132 # define DYNAMIC_LOADING
1133 # define ELF_CLASS ELFCLASS32
1136 # define OS_TYPE "DGUX"
1137 extern int _etext, _end;
1138 extern ptr_t GC_SysVGetDataStart();
1139 # define DATASTART GC_SysVGetDataStart(0x1000, &_etext)
1140 # define DATAEND (&_end)
1141 # define STACK_GROWS_DOWN
1143 # include <unistd.h>
1144 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
1145 # define DYNAMIC_LOADING
1148 # endif /* USE_MMAP */
1149 # define MAP_FAILED (void *) -1
1151 # define HEAP_START (ptr_t)0x40000000
1152 # else /* USE_MMAP */
1153 # define HEAP_START DATAEND
1154 # endif /* USE_MMAP */
1159 /* The Intel compiler doesn't like inline assembly */
1160 # define USE_GENERIC_PUSH_REGS
1162 # define OS_TYPE "LINUX"
1163 # define LINUX_STACKBOTTOM
1167 # define STACK_GRAN 0x10000000
1168 /* STACKBOTTOM is usually 0xc0000000, but this changes with */
1169 /* different kernel configurations. In particular, systems */
1170 /* with 2GB physical memory will usually move the user */
1171 /* address space limit, and hence initial SP to 0x80000000. */
1173 # if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)
1174 # define MPROTECT_VDB
1176 /* We seem to get random errors in incremental mode, */
1177 /* possibly because Linux threads is itself a malloc client */
1178 /* and can't deal with the signals. */
1180 # define HEAP_START (ptr_t)0x1000
1181 /* This encourages mmap to give us low addresses, */
1182 /* thus allowing the heap to grow to ~3GB */
1184 # define DYNAMIC_LOADING
1185 # ifdef UNDEFINED /* includes ro data */
1186 extern int _etext[];
1187 # define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
1189 # include <features.h>
1190 # if defined(__GLIBC__) && __GLIBC__ >= 2
1191 # define SEARCH_FOR_DATA_START
1193 extern char **__environ;
1194 # define DATASTART ((ptr_t)(&__environ))
1195 /* hideous kludge: __environ is the first */
1196 /* word in crt0.o, and delimits the start */
1197 /* of the data segment, no matter which */
1198 /* ld options were passed through. */
1199 /* We could use _etext instead, but that */
1200 /* would include .rodata, which may */
1201 /* contain large read-only data tables */
1202 /* that we'd rather not scan. */
1205 # define DATAEND (_end)
1208 # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
1210 # ifdef USE_I686_PREFETCH
1211 /* FIXME: Thus should use __builtin_prefetch, but we'll leave that */
1212 /* for the next rtelease. */
1213 # define PREFETCH(x) \
1214 __asm__ __volatile__ (" prefetchnta %0": : "m"(*(char *)(x)))
1215 /* Empirically prefetcht0 is much more effective at reducing */
1216 /* cache miss stalls for the targetted load instructions. But it */
1217 /* seems to interfere enough with other cache traffic that the net */
1218 /* result is worse than prefetchnta. */
1220 /* Using prefetches for write seems to have a slight negative */
1221 /* impact on performance, at least for a PIII/500. */
1222 # define PREFETCH_FOR_WRITE(x) \
1223 __asm__ __volatile__ (" prefetcht0 %0": : "m"(*(char *)(x)))
1226 # ifdef USE_3DNOW_PREFETCH
1227 # define PREFETCH(x) \
1228 __asm__ __volatile__ (" prefetch %0": : "m"(*(char *)(x)))
1229 # define PREFETCH_FOR_WRITE(x) \
1230 __asm__ __volatile__ (" prefetchw %0": : "m"(*(char *)(x)))
1234 # define OS_TYPE "CYGWIN32"
1235 # define DATASTART ((ptr_t)GC_DATASTART) /* From gc.h */
1236 # define DATAEND ((ptr_t)GC_DATAEND)
1238 # define STACK_GRAN 0x10000
1242 # define OS_TYPE "OS2"
1243 /* STACKBOTTOM and DATASTART are handled specially in */
1244 /* os_dep.c. OS2 actually has the right */
1246 # define DATAEND /* not needed */
1247 # define USE_GENERIC_PUSH_REGS
1250 # define OS_TYPE "MSWIN32"
1251 /* STACKBOTTOM and DATASTART are handled specially in */
1253 # ifndef __WATCOMC__
1254 # define MPROTECT_VDB
1256 # define DATAEND /* not needed */
1259 # define OS_TYPE "MSWINCE"
1260 # define DATAEND /* not needed */
1263 # define OS_TYPE "DJGPP"
1264 # include "stubinfo.h"
1267 extern int __djgpp_stack_limit;
1268 # define DATASTART ((ptr_t)((((word) (etext)) + 0x1ff) & ~0x1ff))
1269 /* # define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
1271 # define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
1272 /* This may not be right. */
1275 # define OS_TYPE "OPENBSD"
1278 # define OS_TYPE "FREEBSD"
1279 # ifndef GC_FREEBSD_THREADS
1280 # define MPROTECT_VDB
1282 # define SIG_SUSPEND SIGTSTP
1283 # define SIG_THR_RESTART SIGCONT
1284 # define FREEBSD_STACKBOTTOM
1286 # define DYNAMIC_LOADING
1288 extern char etext[];
1289 extern char * GC_FreeBSDGetDataStart();
1290 # define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
1293 # define OS_TYPE "NETBSD"
1295 # define DYNAMIC_LOADING
1299 # define OS_TYPE "THREE86BSD"
1302 # define OS_TYPE "BSDI"
1304 # if defined(OPENBSD) || defined(NETBSD) \
1305 || defined(THREE86BSD) || defined(BSDI)
1307 extern char etext[];
1308 # define DATASTART ((ptr_t)(etext))
1311 # define OS_TYPE "NEXT"
1312 # define DATASTART ((ptr_t) get_etext())
1313 # define STACKBOTTOM ((ptr_t)0xc0000000)
1314 # define DATAEND /* not needed */
1317 # define OS_TYPE "DOS4GW"
1318 extern long __nullarea;
1320 extern char *_STACKTOP;
1321 /* Depending on calling conventions Watcom C either precedes
1322 or does not precedes with undescore names of C-variables.
1323 Make sure startup code variables always have the same names. */
1324 #pragma aux __nullarea "*";
1325 #pragma aux _end "*";
1326 # define STACKBOTTOM ((ptr_t) _STACKTOP)
1327 /* confused? me too. */
1328 # define DATASTART ((ptr_t) &__nullarea)
1329 # define DATAEND ((ptr_t) &_end)
1332 # define OS_TYPE "HURD"
1333 # define STACK_GROWS_DOWN
1335 extern int __data_start[];
1336 # define DATASTART ( (ptr_t) (__data_start))
1338 # define DATAEND ( (ptr_t) (_end))
1339 /* # define MPROTECT_VDB Not quite working yet? */
1340 # define DYNAMIC_LOADING
1345 # define MACH_TYPE "NS32K"
1346 # define ALIGNMENT 4
1347 extern char **environ;
1348 # define DATASTART ((ptr_t)(&environ))
1349 /* hideous kludge: environ is the first */
1350 /* word in crt0.o, and delimits the start */
1351 /* of the data segment, no matter which */
1352 /* ld options were passed through. */
1353 # define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
1357 # define MACH_TYPE "MIPS"
1359 /* This was developed for a linuxce style platform. Probably */
1360 /* needs to be tweaked for workstation class machines. */
1361 # define OS_TYPE "LINUX"
1362 # define DYNAMIC_LOADING
1364 # define DATAEND (_end)
1365 extern int __data_start[];
1366 # define DATASTART ((ptr_t)(__data_start))
1367 # define ALIGNMENT 4
1368 # define USE_GENERIC_PUSH_REGS
1369 # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2 || __GLIBC__ > 2
1370 # define LINUX_STACKBOTTOM
1372 # define STACKBOTTOM 0x80000000
1377 # if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64)
1378 extern int _fdata[], _end[];
1379 # define DATASTART ((ptr_t)_fdata)
1380 # define DATAEND ((ptr_t)_end)
1381 # define CPP_WORDSZ _MIPS_SZPTR
1382 # define ALIGNMENT (_MIPS_SZPTR/8)
1384 extern int etext[], edata[], end[];
1385 extern int _DYNAMIC_LINKING[], _gp[];
1386 # define DATASTART ((ptr_t)((((word)etext + 0x3ffff) & ~0x3ffff) \
1387 + ((word)etext & 0xffff)))
1388 # define DATAEND (edata)
1389 # define DATASTART2 (_DYNAMIC_LINKING \
1390 ? (ptr_t)(((word)_gp + 0x8000 + 0x3ffff) & ~0x3ffff) \
1392 # define DATAEND2 (end)
1393 # define ALIGNMENT 4
1395 # define OS_TYPE "EWS4800"
1396 # define USE_GENERIC_PUSH_REGS 1
1400 # define DATASTART (ptr_t)0x10000000
1401 /* Could probably be slightly higher since */
1402 /* startup code allocates lots of stuff. */
1403 # define OS_TYPE "ULTRIX"
1404 # define ALIGNMENT 4
1408 # define DATASTART (ptr_t)0x10000000
1409 # define OS_TYPE "RISCOS"
1410 # define ALIGNMENT 4 /* Required by hardware */
1414 extern int _fdata[];
1415 # define DATASTART ((ptr_t)(_fdata))
1417 # define HEAP_START (ptr_t)0x30000000
1419 # define HEAP_START DATASTART
1421 /* Lowest plausible heap address. */
1422 /* In the MMAP case, we map there. */
1423 /* In either case it is used to identify */
1424 /* heap sections so they're not */
1425 /* considered as roots. */
1426 # define OS_TYPE "IRIX5"
1427 /*# define MPROTECT_VDB DOB: this should work, but there is evidence */
1428 /* of recent breakage. */
1430 # define CPP_WORDSZ _MIPS_SZPTR
1431 # define ALIGNMENT (_MIPS_SZPTR/8)
1432 # if CPP_WORDSZ != 64
1433 # define ALIGN_DOUBLE
1436 # define ALIGNMENT 4
1437 # define ALIGN_DOUBLE
1439 # define DYNAMIC_LOADING
1442 # define OS_TYPE "MSWINCE"
1443 # define ALIGNMENT 4
1444 # define DATAEND /* not needed */
1446 # if defined(NETBSD)
1447 # define ALIGNMENT 4
1448 # define OS_TYPE "NETBSD"
1450 # define USE_GENERIC_PUSH_REGS
1453 # define DATASTART GC_data_start
1454 # define NEED_FIND_LIMIT
1455 # define DYNAMIC_LOADING
1457 # define DATASTART ((ptr_t) 0x10000000)
1458 # define STACKBOTTOM ((ptr_t) 0x7ffff000)
1464 # define MACH_TYPE "RS6000"
1469 # undef IA64 /* DOB: some AIX installs stupidly define IA64 in /usr/include/sys/systemcfg.h */
1472 # define ALIGNMENT 8
1473 # define CPP_WORDSZ 64
1474 # define STACKBOTTOM ((ptr_t)0x1000000000000000)
1476 # define ALIGNMENT 4
1477 # define CPP_WORDSZ 32
1478 # define STACKBOTTOM ((ptr_t)((ulong)&errno))
1481 # define USE_MMAP_ANON
1482 /* From AIX linker man page:
1483 _text Specifies the first location of the program.
1484 _etext Specifies the first location after the program.
1485 _data Specifies the first location of the data.
1486 _edata Specifies the first location after the initialized data
1487 _end or end Specifies the first location after all data.
1489 extern int _data[], _end[];
1490 # define DATASTART ((ptr_t)((ulong)_data))
1491 # define DATAEND ((ptr_t)((ulong)_end))
1493 # define USE_GENERIC_PUSH_REGS
1494 # define DYNAMIC_LOADING
1495 /* For really old versions of AIX, this may have to be removed. */
1499 # define MACH_TYPE "HP_PA"
1501 # define CPP_WORDSZ 64
1502 # define ALIGNMENT 8
1504 # define CPP_WORDSZ 32
1505 # define ALIGNMENT 4
1506 # define ALIGN_DOUBLE
1508 # if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS)
1509 # ifndef LINUX /* For now. */
1510 # define MPROTECT_VDB
1513 # define GENERIC_COMPARE_AND_SWAP
1514 /* No compare-and-swap instruction. Use pthread mutexes */
1515 /* when we absolutely have to. */
1516 # ifdef PARALLEL_MARK
1517 # define USE_MARK_BYTES
1518 /* Minimize compare-and-swap usage. */
1521 # define STACK_GROWS_UP
1523 # define OS_TYPE "HPUX"
1524 extern int __data_start[];
1525 # define DATASTART ((ptr_t)(__data_start))
1527 /* The following appears to work for 7xx systems running HP/UX */
1528 /* 9.xx Furthermore, it might result in much faster */
1529 /* collections than HEURISTIC2, which may involve scanning */
1530 /* segments that directly precede the stack. It is not the */
1531 /* default, since it may not work on older machine/OS */
1532 /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
1534 # define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
1536 /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */
1537 /* to this. Note that the GC must be initialized before the */
1538 /* first putenv call. */
1539 extern char ** environ;
1540 # define STACKBOTTOM ((ptr_t)environ)
1542 # define DYNAMIC_LOADING
1543 # include <unistd.h>
1544 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
1546 # define PREFETCH(x) { \
1547 register long addr = (long)(x); \
1548 (void) _asm ("LDW", 0, 0, addr, 0); \
1553 # define OS_TYPE "LINUX"
1554 # define LINUX_STACKBOTTOM
1555 # define DYNAMIC_LOADING
1556 # define SEARCH_FOR_DATA_START
1558 # define DATAEND (&_end)
1563 # define MACH_TYPE "ALPHA"
1564 # define ALIGNMENT 8
1565 # define CPP_WORDSZ 64
1567 # define USE_GENERIC_PUSH_REGS
1568 /* Gcc and probably the DEC/Compaq compiler spill pointers to preserved */
1569 /* fp registers in some cases when the target is a 21264. The assembly */
1570 /* code doesn't handle that yet, and version dependencies make that a */
1571 /* bit tricky. Do the easy thing for now. */
1574 # define OS_TYPE "NETBSD"
1576 # define DATASTART GC_data_start
1577 # define ELFCLASS32 32
1578 # define ELFCLASS64 64
1579 # define ELF_CLASS ELFCLASS64
1580 # define DYNAMIC_LOADING
1583 # define OS_TYPE "OPENBSD"
1585 # ifdef __ELF__ /* since OpenBSD/Alpha 2.9 */
1586 # define DATASTART GC_data_start
1587 # define ELFCLASS32 32
1588 # define ELFCLASS64 64
1589 # define ELF_CLASS ELFCLASS64
1590 # else /* ECOFF, until OpenBSD/Alpha 2.7 */
1591 # define DATASTART ((ptr_t) 0x140000000)
1595 # define OS_TYPE "FREEBSD"
1596 /* MPROTECT_VDB is not yet supported at all on FreeBSD/alpha. */
1597 # define SIG_SUSPEND SIGTSTP
1598 # define SIG_THR_RESTART SIGCONT
1599 # define FREEBSD_STACKBOTTOM
1601 # define DYNAMIC_LOADING
1603 /* Handle unmapped hole alpha*-*-freebsd[45]* puts between etext and edata. */
1604 extern char etext[];
1605 extern char edata[];
1607 # define NEED_FIND_LIMIT
1608 # define DATASTART ((ptr_t)(&etext))
1609 # define DATAEND (GC_find_limit (DATASTART, TRUE))
1610 # define DATASTART2 ((ptr_t)(&edata))
1611 # define DATAEND2 ((ptr_t)(&end))
1614 # define OS_TYPE "OSF1"
1615 # define DATASTART ((ptr_t) 0x140000000)
1617 # define DATAEND ((ptr_t) &_end)
1618 extern char ** environ;
1619 /* round up from the value of environ to the nearest page boundary */
1620 /* Probably breaks if putenv is called before collector */
1621 /* initialization. */
1622 # define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1))
1623 /* # define HEURISTIC2 */
1624 /* Normally HEURISTIC2 is too conervative, since */
1625 /* the text segment immediately follows the stack. */
1626 /* Hence we give an upper pound. */
1627 /* This is currently unused, since we disabled HEURISTIC2 */
1628 extern int __start[];
1629 # define HEURISTIC2_LIMIT ((ptr_t)((word)(__start) & ~(getpagesize()-1)))
1630 # ifndef GC_OSF1_THREADS
1631 /* Unresolved signal issues with threads. */
1632 # define MPROTECT_VDB
1634 # define DYNAMIC_LOADING
1637 # define OS_TYPE "LINUX"
1638 # define LINUX_STACKBOTTOM
1640 # define SEARCH_FOR_DATA_START
1641 # define DYNAMIC_LOADING
1643 # define DATASTART ((ptr_t) 0x140000000)
1646 # define DATAEND (_end)
1647 # define MPROTECT_VDB
1648 /* Has only been superficially tested. May not */
1649 /* work on all versions. */
1654 # define MACH_TYPE "IA64"
1655 # define USE_GENERIC_PUSH_REGS
1656 /* We need to get preserved registers in addition to register */
1657 /* windows. That's easiest to do with setjmp. */
1658 # ifdef PARALLEL_MARK
1659 # define USE_MARK_BYTES
1660 /* Compare-and-exchange is too expensive to use for */
1661 /* setting mark bits. */
1665 # define CPP_WORDSZ 32
1666 # define ALIGN_DOUBLE
1667 /* Requires 8 byte alignment for malloc */
1668 # define ALIGNMENT 4
1673 # define CPP_WORDSZ 64
1674 # define ALIGN_DOUBLE
1675 /* Requires 16 byte alignment for malloc */
1676 # define ALIGNMENT 8
1678 # define OS_TYPE "HPUX"
1679 extern int __data_start[];
1680 # define DATASTART ((ptr_t)(__data_start))
1681 /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */
1682 /* to this. Note that the GC must be initialized before the */
1683 /* first putenv call. */
1684 extern char ** environ;
1685 # define STACKBOTTOM ((ptr_t)environ)
1686 # define HPUX_STACKBOTTOM
1687 # define DYNAMIC_LOADING
1688 # include <unistd.h>
1689 # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
1690 /* The following was empirically determined, and is probably */
1691 /* not very robust. */
1692 /* Note that the backing store base seems to be at a nice */
1693 /* address minus one page. */
1694 # define BACKING_STORE_DISPLACEMENT 0x1000000
1695 # define BACKING_STORE_ALIGNMENT 0x1000
1696 extern ptr_t GC_register_stackbottom;
1697 # define BACKING_STORE_BASE GC_register_stackbottom
1698 /* Known to be wrong for recent HP/UX versions!!! */
1701 # define CPP_WORDSZ 64
1702 # define ALIGN_DOUBLE
1703 /* Requires 16 byte alignment for malloc */
1704 # define ALIGNMENT 8
1705 # define OS_TYPE "LINUX"
1706 /* The following works on NUE and older kernels: */
1707 /* # define STACKBOTTOM ((ptr_t) 0xa000000000000000l) */
1708 /* This does not work on NUE: */
1709 # define LINUX_STACKBOTTOM
1710 /* We also need the base address of the register stack */
1711 /* backing store. This is computed in */
1712 /* GC_linux_register_stack_base based on the following */
1714 # define BACKING_STORE_ALIGNMENT 0x100000
1715 # define BACKING_STORE_DISPLACEMENT 0x80000000
1716 extern ptr_t GC_register_stackbottom;
1717 # define BACKING_STORE_BASE GC_register_stackbottom
1718 # define SEARCH_FOR_DATA_START
1720 # define DYNAMIC_LOADING
1722 /* In the Intel compiler environment, we seem to end up with */
1723 /* statically linked executables and an undefined reference */
1726 # define MPROTECT_VDB
1727 /* Requires Linux 2.3.47 or later. */
1729 # define DATAEND (_end)
1731 # ifndef __INTEL_COMPILER
1732 # define PREFETCH(x) \
1733 __asm__ (" lfetch [%0]": : "r"(x))
1734 # define PREFETCH_FOR_WRITE(x) \
1735 __asm__ (" lfetch.excl [%0]": : "r"(x))
1736 # define CLEAR_DOUBLE(x) \
1737 __asm__ (" stf.spill [%0]=f0": : "r"((void *)(x)))
1739 # include <ia64intrin.h>
1740 # define PREFETCH(x) \
1741 __lfetch(__lfhint_none, (x))
1742 # define PREFETCH_FOR_WRITE(x) \
1743 __lfetch(__lfhint_nta, (x))
1744 # define CLEAR_DOUBLE(x) \
1745 __stf_spill((void *)(x), 0)
1746 # endif // __INTEL_COMPILER
1750 /* FIXME: This is a very partial guess. There is no port, yet. */
1751 # define OS_TYPE "MSWIN32"
1752 /* STACKBOTTOM and DATASTART are handled specially in */
1754 # define DATAEND /* not needed */
1755 # if defined(_WIN64)
1756 # define CPP_WORDSZ 64
1758 # define CPP_WORDSZ 32 /* Is this possible? */
1760 # define ALIGNMENT 8
1765 # define MACH_TYPE "M88K"
1766 # define ALIGNMENT 4
1767 # define ALIGN_DOUBLE
1770 # define OS_TYPE "CX_UX"
1771 # define DATASTART ((((word)etext + 0x3fffff) & ~0x3fffff) + 0x10000)
1774 # define OS_TYPE "DGUX"
1775 extern ptr_t GC_SysVGetDataStart();
1776 # define DATASTART GC_SysVGetDataStart(0x10000, etext)
1778 # define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
1782 /* If this still works, and if anyone cares, this should probably */
1783 /* be moved to the S390 category. */
1784 # define MACH_TYPE "S370"
1785 # define ALIGNMENT 4 /* Required by hardware */
1786 # define USE_GENERIC_PUSH_REGS
1788 # define OS_TYPE "UTS4"
1790 extern int _etext[];
1792 extern ptr_t GC_SysVGetDataStart();
1793 # define DATASTART GC_SysVGetDataStart(0x10000, _etext)
1794 # define DATAEND (_end)
1800 # define MACH_TYPE "S390"
1801 # define USE_GENERIC_PUSH_REGS
1803 # define ALIGNMENT 4
1804 # define CPP_WORDSZ 32
1806 # define ALIGNMENT 8
1807 # define CPP_WORDSZ 64
1810 # define HBLKSIZE 4096
1813 # define OS_TYPE "LINUX"
1814 # define LINUX_STACKBOTTOM
1815 # define DYNAMIC_LOADING
1816 extern int __data_start[];
1817 # define DATASTART ((ptr_t)(__data_start))
1819 # define DATAEND (_end)
1820 # define CACHE_LINE_SIZE 256
1821 # define GETPAGESIZE() 4096
1826 # define ALIGNMENT 4
1827 extern int _etext[];
1828 # define DATASTART ((ptr_t)(_etext))
1833 # define CPP_WORDSZ 32
1834 # define MACH_TYPE "ARM32"
1835 # define ALIGNMENT 4
1837 # define OS_TYPE "NETBSD"
1840 # define DATASTART GC_data_start
1841 # define DYNAMIC_LOADING
1843 extern char etext[];
1844 # define DATASTART ((ptr_t)(etext))
1846 # define USE_GENERIC_PUSH_REGS
1849 # define OS_TYPE "LINUX"
1850 # define LINUX_STACKBOTTOM
1852 # define STACK_GRAN 0x10000000
1853 # define USE_GENERIC_PUSH_REGS
1855 # define DYNAMIC_LOADING
1856 # include <features.h>
1857 # if defined(__GLIBC__) && __GLIBC__ >= 2
1858 # define SEARCH_FOR_DATA_START
1860 extern char **__environ;
1861 # define DATASTART ((ptr_t)(&__environ))
1862 /* hideous kludge: __environ is the first */
1863 /* word in crt0.o, and delimits the start */
1864 /* of the data segment, no matter which */
1865 /* ld options were passed through. */
1866 /* We could use _etext instead, but that */
1867 /* would include .rodata, which may */
1868 /* contain large read-only data tables */
1869 /* that we'd rather not scan. */
1872 # define DATAEND (_end)
1875 # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
1879 # define OS_TYPE "MSWINCE"
1880 # define DATAEND /* not needed */
1883 /* __data_start is usually defined in the target linker script. */
1884 extern int __data_start[];
1885 # define DATASTART (ptr_t)(__data_start)
1886 # define USE_GENERIC_PUSH_REGS
1887 /* __stack_base__ is set in newlib/libc/sys/arm/crt0.S */
1888 extern void *__stack_base__;
1889 # define STACKBOTTOM ((ptr_t) (__stack_base__))
1894 # define MACH_TYPE "CRIS"
1895 # define CPP_WORDSZ 32
1896 # define ALIGNMENT 1
1897 # define OS_TYPE "LINUX"
1898 # define DYNAMIC_LOADING
1899 # define LINUX_STACKBOTTOM
1900 # define USE_GENERIC_PUSH_REGS
1901 # define SEARCH_FOR_DATA_START
1903 # define DATAEND (_end)
1907 # define MACH_TYPE "SH"
1908 # define ALIGNMENT 4
1910 # define OS_TYPE "MSWINCE"
1911 # define DATAEND /* not needed */
1914 # define OS_TYPE "LINUX"
1915 # define LINUX_STACKBOTTOM
1916 # define USE_GENERIC_PUSH_REGS
1917 # define DYNAMIC_LOADING
1918 # define SEARCH_FOR_DATA_START
1920 # define DATAEND (_end)
1923 # define OS_TYPE "NETBSD"
1925 # define DATASTART GC_data_start
1926 # define USE_GENERIC_PUSH_REGS
1927 # define DYNAMIC_LOADING
1932 # define MACH_TYPE "SH4"
1933 # define OS_TYPE "MSWINCE"
1934 # define ALIGNMENT 4
1935 # define DATAEND /* not needed */
1939 # define CPP_WORDSZ 32
1940 # define MACH_TYPE "M32R"
1941 # define ALIGNMENT 4
1943 # define OS_TYPE "LINUX"
1944 # define LINUX_STACKBOTTOM
1946 # define STACK_GRAN 0x10000000
1947 # define USE_GENERIC_PUSH_REGS
1948 # define DYNAMIC_LOADING
1949 # define SEARCH_FOR_DATA_START
1951 # define DATAEND (_end)
1956 # define MACH_TYPE "X86_64"
1957 # define ALIGNMENT 8
1958 # define CPP_WORDSZ 64
1960 # define HBLKSIZE 4096
1962 # define CACHE_LINE_SIZE 64
1963 # define USE_GENERIC_PUSH_REGS
1965 # define OS_TYPE "LINUX"
1966 # define LINUX_STACKBOTTOM
1968 # define FALLBACK_TO_MMAP
1970 # if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)
1971 # define MPROTECT_VDB
1973 /* We seem to get random errors in incremental mode, */
1974 /* possibly because Linux threads is itself a malloc client */
1975 /* and can't deal with the signals. */
1978 # define DYNAMIC_LOADING
1979 # ifdef UNDEFINED /* includes ro data */
1980 extern int _etext[];
1981 # define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
1983 # include <features.h>
1984 # define SEARCH_FOR_DATA_START
1986 # define DATAEND (_end)
1989 # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
1991 # if defined(__GNUC__) && __GNUC >= 3
1992 # define PREFETCH(x) __builtin_prefetch((x), 0, 0)
1993 # define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
1997 # define OS_TYPE "FREEBSD"
1998 # ifndef GC_FREEBSD_THREADS
1999 # define MPROTECT_VDB
2001 # define SIG_SUSPEND SIGTSTP
2002 # define SIG_THR_RESTART SIGCONT
2003 # define NEED_FIND_LIMIT
2004 # define FREEBSD_STACKBOTTOM
2006 # define DYNAMIC_LOADING
2008 extern char etext[];
2009 extern char * GC_FreeBSDGetDataStart();
2010 # define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
2013 # define OS_TYPE "NETBSD"
2015 # define DYNAMIC_LOADING
2018 extern char etext[];
2019 # define SEARCH_FOR_DATA_START
2023 #if defined(LINUX) && defined(USE_MMAP)
2024 /* The kernel may do a somewhat better job merging mappings etc. */
2025 /* with anonymous mappings. */
2026 # define USE_MMAP_ANON
2029 #if defined(LINUX) && defined(REDIRECT_MALLOC)
2030 /* Rld appears to allocate some memory with its own allocator, and */
2031 /* some through malloc, which might be redirected. To make this */
2032 /* work with collectable memory, we have to scan memory allocated */
2033 /* by rld's internal malloc. */
2034 # define USE_PROC_FOR_LIBRARIES
2037 # ifndef STACK_GROWS_UP
2038 # define STACK_GROWS_DOWN
2042 # define CPP_WORDSZ 32
2051 # define DATAEND (end)
2054 # if defined(SVR4) && !defined(GETPAGESIZE)
2055 # include <unistd.h>
2056 # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
2059 # ifndef GETPAGESIZE
2060 # if defined(SUNOS5) || defined(IRIX5)
2061 # include <unistd.h>
2063 # define GETPAGESIZE() getpagesize()
2066 # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
2067 /* OS has SVR4 generic features. Probably others also qualify. */
2071 # if defined(SUNOS5) || defined(DRSNX)
2072 /* OS has SUNOS5 style semi-undocumented interface to dynamic */
2075 /* OS has SUNOS5 style signal handlers. */
2083 # if defined(FREEBSD) && (__FreeBSD__ >= 4)
2087 # if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \
2088 || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
2089 || defined(DGUX) || defined(BSD) || defined(SUNOS4) \
2090 || defined(_AIX) || defined(DARWIN) || defined(OSF1)
2091 # define UNIX_LIKE /* Basic Unix-like system calls work. */
2094 # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
2099 # undef DYNAMIC_LOADING
2104 # undef MPROTECT_VDB
2109 /* Postponed for now. */
2111 # undef MPROTECT_VDB
2114 # ifdef SMALL_CONFIG
2115 /* Presumably not worth the space it takes. */
2117 # undef MPROTECT_VDB
2121 # undef MPROTECT_VDB /* Can't deal with address space holes. */
2124 # ifdef PARALLEL_MARK
2125 # undef MPROTECT_VDB /* For now. */
2128 # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
2129 # define DEFAULT_VDB
2133 # define PREFETCH(x)
2134 # define NO_PREFETCH
2137 # ifndef PREFETCH_FOR_WRITE
2138 # define PREFETCH_FOR_WRITE(x)
2139 # define NO_PREFETCH_FOR_WRITE
2142 # ifndef CACHE_LINE_SIZE
2143 # define CACHE_LINE_SIZE 32 /* Wild guess */
2147 # define REGISTER_LIBRARIES_EARLY
2148 /* We sometimes use dl_iterate_phdr, which may acquire an internal */
2149 /* lock. This isn't safe after the world has stopped. So we must */
2150 /* call GC_register_dynamic_libraries before stopping the world. */
2151 /* For performance reasons, this may be beneficial on other */
2152 /* platforms as well, though it should be avoided in win32. */
2155 # if defined(SEARCH_FOR_DATA_START)
2156 extern ptr_t GC_data_start;
2157 # define DATASTART GC_data_start
2160 # ifndef CLEAR_DOUBLE
2161 # define CLEAR_DOUBLE(x) \
2162 ((word*)x)[0] = 0; \
2164 # endif /* CLEAR_DOUBLE */
2166 /* Internally we use GC_SOLARIS_THREADS to test for either old or pthreads. */
2167 # if defined(GC_SOLARIS_PTHREADS) && !defined(GC_SOLARIS_THREADS)
2168 # define GC_SOLARIS_THREADS
2171 # if defined(GC_IRIX_THREADS) && !defined(IRIX5)
2172 --> inconsistent configuration
2174 # if defined(GC_LINUX_THREADS) && !defined(LINUX)
2175 --> inconsistent configuration
2177 # if defined(GC_SOLARIS_THREADS) && !defined(SUNOS5)
2178 --> inconsistent configuration
2180 # if defined(GC_HPUX_THREADS) && !defined(HPUX)
2181 --> inconsistent configuration
2183 # if defined(GC_AIX_THREADS) && !defined(_AIX)
2184 --> inconsistent configuration
2186 # if defined(GC_WIN32_THREADS) && !defined(MSWIN32) && !defined(CYGWIN32)
2187 --> inconsistent configuration
2190 # if defined(PCR) || defined(SRC_M3) || \
2191 defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) || \
2192 defined(GC_PTHREADS)
2196 # if defined(HP_PA) || defined(M88K) \
2197 || defined(POWERPC) && !defined(DARWIN) \
2198 || defined(LINT) || defined(MSWINCE) || defined(ARM32) || defined(CRIS) \
2199 || (defined(I386) && defined(__LCC__))
2200 /* Use setjmp based hack to mark from callee-save registers. */
2201 /* The define should move to the individual platform */
2203 # define USE_GENERIC_PUSH_REGS
2206 # if defined(MSWINCE)
2211 # define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
2212 /* include assembly code to do it well. */
2215 /* Can we save call chain in objects for debugging? */
2216 /* SET NFRAMES (# of saved frames) and NARGS (#of args for each */
2217 /* frame) to reasonable values for the platform. */
2218 /* Set SAVE_CALL_CHAIN if we can. SAVE_CALL_COUNT can be specified */
2219 /* at build time, though we feel free to adjust it slightly. */
2220 /* Define NEED_CALLINFO if we either save the call stack or */
2221 /* GC_ADD_CALLER is defined. */
2222 /* GC_CAN_SAVE_CALL_STACKS is set in gc.h. */
2225 # define CAN_SAVE_CALL_ARGS
2227 #if (defined(I386) || defined(X86_64)) && defined(LINUX)
2228 /* SAVE_CALL_CHAIN is supported if the code is compiled to save */
2229 /* frame pointers by default, i.e. no -fomit-frame-pointer flag. */
2230 # define CAN_SAVE_CALL_ARGS
2233 # if defined(SAVE_CALL_COUNT) && !defined(GC_ADD_CALLER) \
2234 && defined(GC_CAN_SAVE_CALL_STACKS)
2235 # define SAVE_CALL_CHAIN
2237 # ifdef SAVE_CALL_CHAIN
2238 # if defined(SAVE_CALL_NARGS) && defined(CAN_SAVE_CALL_ARGS)
2239 # define NARGS SAVE_CALL_NARGS
2241 # define NARGS 0 /* Number of arguments to save for each call. */
2244 # ifdef SAVE_CALL_CHAIN
2245 # ifndef SAVE_CALL_COUNT
2246 # define NFRAMES 6 /* Number of frames to save. Even for */
2247 /* alignment reasons. */
2249 # define NFRAMES ((SAVE_CALL_COUNT + 1) & ~1)
2251 # define NEED_CALLINFO
2252 # endif /* SAVE_CALL_CHAIN */
2253 # ifdef GC_ADD_CALLER
2256 # define NEED_CALLINFO
2259 # if defined(MAKE_BACK_GRAPH) && !defined(DBG_HDRS_ALL)
2260 # define DBG_HDRS_ALL
2263 # if defined(POINTER_MASK) && !defined(POINTER_SHIFT)
2264 # define POINTER_SHIFT 0
2267 # if defined(POINTER_SHIFT) && !defined(POINTER_MASK)
2268 # define POINTER_MASK ((GC_word)(-1))
2271 # if !defined(FIXUP_POINTER) && defined(POINTER_MASK)
2272 # define FIXUP_POINTER(p) (p) = ((p) & (POINTER_MASK) << POINTER_SHIFT)
2275 # if defined(FIXUP_POINTER)
2276 # define NEED_FIXUP_POINTER 1
2278 # define NEED_FIXUP_POINTER 0
2279 # define FIXUP_POINTER(p)
2283 /* This relies on some type definitions from gc_priv.h, from */
2284 /* where it's normally included. */
2286 /* How to get heap memory from the OS: */
2287 /* Note that sbrk()-like allocation is preferred, since it */
2288 /* usually makes it possible to merge consecutively allocated */
2289 /* chunks. It also avoids unintented recursion with */
2290 /* -DREDIRECT_MALLOC. */
2291 /* GET_MEM() returns a HLKSIZE aligned chunk. */
2292 /* 0 is taken to mean failure. */
2293 /* In the case os USE_MMAP, the argument must also be a */
2294 /* physical page size. */
2295 /* GET_MEM is currently not assumed to retrieve 0 filled space, */
2296 /* though we should perhaps take advantage of the case in which */
2298 struct hblk; /* See gc_priv.h. */
2300 char * real_malloc();
2301 # define GET_MEM(bytes) HBLKPTR(real_malloc((size_t)bytes + GC_page_size) \
2305 void * os2_alloc(size_t bytes);
2306 # define GET_MEM(bytes) HBLKPTR((ptr_t)os2_alloc((size_t)bytes \
2310 # if defined(NEXT) || defined(DOS4GW) || \
2311 (defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC)) || \
2312 (defined(SUNOS5) && !defined(USE_MMAP))
2313 # define GET_MEM(bytes) HBLKPTR((size_t) \
2314 calloc(1, (size_t)bytes + GC_page_size) \
2318 extern ptr_t GC_win32_get_mem();
2319 # define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes)
2322 # if defined(USE_TEMPORARY_MEMORY)
2323 extern Ptr GC_MacTemporaryNewPtr(size_t size,
2324 Boolean clearMemory);
2325 # define GET_MEM(bytes) HBLKPTR( \
2326 GC_MacTemporaryNewPtr(bytes + GC_page_size, true) \
2329 # define GET_MEM(bytes) HBLKPTR( \
2330 NewPtrClear(bytes + GC_page_size) + GC_page_size-1)
2334 extern ptr_t GC_wince_get_mem();
2335 # define GET_MEM(bytes) (struct hblk *)GC_wince_get_mem(bytes)
2337 # if defined(AMIGA) && defined(GC_AMIGA_FASTALLOC)
2338 extern void *GC_amiga_get_mem(size_t size);
2339 # define GET_MEM(bytes) HBLKPTR((size_t) \
2340 GC_amiga_get_mem((size_t)bytes + GC_page_size) \
2343 extern ptr_t GC_unix_get_mem();
2344 # define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)
2353 #endif /* GC_PRIVATE_H */
2355 #if defined(_AIX) && !defined(__GNUC__) && !defined(__STDC__)
2356 /* IBMs xlc compiler doesn't appear to follow the convention of */
2357 /* defining __STDC__ to be zero in extended mode. */
2361 # endif /* GCCONFIG_H */