473
470
/* Or manually define the machine type here. A machine type is */
474
471
/* characterized by the architecture. Some */
475
472
/* machine types are further subdivided by OS. */
476
/* the macros ULTRIX, RISCOS, and BSD to distinguish. */
477
/* Note that SGI IRIX is treated identically to RISCOS. */
473
/* Macros such as LINUX, FREEBSD, etc. distinguish them. */
478
474
/* SYSV on an M68K actually means A/UX. */
479
475
/* The distinction in these cases is usually the stack starting address */
480
476
# ifndef mach_type_known
481
--> unknown machine type
477
# error "The collector has not been ported to this machine/OS combination."
483
479
/* Mapping is: M68K ==> Motorola 680X0 */
484
/* (SUNOS4,HP,NEXT, and SYSV (A/UX), */
480
/* (NEXT, and SYSV (A/UX), */
485
481
/* MACOS and AMIGA variants) */
486
482
/* I386 ==> Intel 386 */
487
483
/* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
488
484
/* FREEBSD, THREE86BSD, MSWIN32, */
489
/* BSDI,SUNOS5, NEXT, other variants) */
485
/* BSDI,SOLARIS, NEXT, other variants) */
490
486
/* NS32K ==> Encore Multimax */
491
/* MIPS ==> R2000 through R14K */
487
/* MIPS ==> R2000 through R14K */
492
488
/* (many variants) */
493
489
/* VAX ==> DEC VAX */
494
490
/* (BSD, ULTRIX variants) */
495
/* RS6000 ==> IBM RS/6000 AIX3.X */
496
/* RT ==> IBM PC/RT */
497
491
/* HP_PA ==> HP9000/700 & /800 */
498
492
/* HP/UX, LINUX */
499
493
/* SPARC ==> SPARC v7/v8/v9 */
500
/* (SUNOS4, SUNOS5, LINUX, */
501
/* DRSNX variants) */
494
/* (SOLARIS, LINUX, DRSNX variants) */
502
495
/* ALPHA ==> DEC Alpha */
503
496
/* (OSF1 and LINUX variants) */
504
497
/* M88K ==> Motorola 88XX0 */
516
509
/* X86_64 ==> AMD x86-64 */
517
510
/* POWERPC ==> IBM/Apple PowerPC */
518
511
/* (MACOS(<=9),DARWIN(incl.MACOSX),*/
519
/* LINUX, NETBSD, NOSYS variants) */
512
/* LINUX, NETBSD, AIX, NOSYS */
520
514
/* Handles 32 and 64-bit variants. */
521
/* AIX should be handled here, but */
522
/* that's called an RS6000. */
523
515
/* CRIS ==> Axis Etrax */
524
516
/* M32R ==> Renesas M32R */
573
562
* If STACKBOTTOM is defined, then it's value will be used directly as the
574
563
* stack base. If LINUX_STACKBOTTOM is defined, then it will be determined
575
564
* with a method appropriate for most Linux systems. Currently we look
576
* first for __libc_stack_end, and if that fails read it from /proc.
565
* first for __libc_stack_end (currently only id USE_LIBC_PRIVATES is
566
* defined), and if that fails read it from /proc. (If USE_LIBC_PRIVATES
567
* is not defined and NO_PROC_STAT is defined, we revert to HEURISTIC2.)
577
568
* If either of the last two macros are defined, then STACKBOTTOM is computed
578
569
* during collector startup using one of the following two heuristics:
579
570
* HEURISTIC1: Take an address inside GC_init's frame, and round it up to
625
616
* Each architecture may also define the style of virtual dirty bit
626
617
* implementation to be used:
627
618
* MPROTECT_VDB: Write protect the heap and catch faults.
619
* GWW_VDB: Use win32 GetWriteWatch primitive.
628
620
* PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
622
* The first and second one may be combined, in which case a runtime
623
* selection will be made, based on GetWriteWatch availability.
630
625
* An architecture may define DYNAMIC_LOADING if dynamic_load.c
631
626
* defined GC_register_dynamic_libraries() for the architecture.
646
641
/* If we are using a recent version of gcc, we can use __builtin_unwind_init()
647
* to push the relevant registers onto the stack. This generally makes
648
* USE_GENERIC_PUSH_REGS the preferred approach for marking from registers.
642
* to push the relevant registers onto the stack.
650
644
# if defined(__GNUC__) && ((__GNUC__ >= 3) || \
651
645
(__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) \
652
&& !defined(__INTEL_COMPILER) \
653
&& !defined(__PATHCC__)
646
&& !defined(__INTEL_COMPILER) && !defined(__PATHCC__)
654
647
# define HAVE_BUILTIN_UNWIND_INIT
712
701
# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
716
# define OS_TYPE "SUNOS4"
718
# define DATASTART ((ptr_t)((((word) (etext)) + 0x1ffff) & ~0x1ffff))
719
# define HEURISTIC1 /* differs */
720
# define DYNAMIC_LOADING
723
# define OS_TYPE "HP"
725
# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
726
# define STACKBOTTOM ((ptr_t) 0xffeffffc)
727
/* empirically determined. seems to work. */
729
# define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
732
# define OS_TYPE "SYSV"
734
# define DATASTART ((ptr_t)((((word) (etext)) + 0x3fffff) \
736
+((word)etext & 0x1fff))
737
/* This only works for shared-text binaries with magic number 0413.
738
The other sorts of SysV binaries put the data at the end of the text,
739
in which case the default of etext would work. Unfortunately,
740
handling both would require having the magic-number available.
743
# define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
744
/* The stack starts at the top of memory, but */
745
/* 0x0 cannot be used as setjump_test complains */
746
/* that the stack direction is incorrect. Two */
747
/* bytes down from 0x0 should be safe enough. */
749
# include <sys/mmu.h>
750
# define GETPAGESIZE() PAGESIZE /* Is this still right? */
753
705
# define OS_TYPE "AMIGA"
754
706
/* STACKBOTTOM and DATASTART handled specially */
806
758
# define DATAEND (_end)
761
# define OS_TYPE "DARWIN"
762
# define DYNAMIC_LOADING
763
# if defined(__ppc64__)
810
764
# define ALIGNMENT 8
811
765
# define CPP_WORDSZ 64
766
# define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
767
# define CACHE_LINE_SIZE 64
769
# define HBLKSIZE 4096
813
772
# define ALIGNMENT 4
773
# define STACKBOTTOM ((ptr_t) 0xc0000000)
815
# define OS_TYPE "DARWIN"
816
# define DYNAMIC_LOADING
817
775
/* XXX: see get_end(3), get_etext() and get_end() should not be used.
818
These aren't used when dyld support is enabled (it is by default) */
776
These aren't used when dyld support is enabled (it is by default) */
819
777
# define DATASTART ((ptr_t) get_etext())
820
778
# define DATAEND ((ptr_t) get_end())
821
# define STACKBOTTOM ((ptr_t) 0xc0000000)
822
779
# define USE_MMAP
823
780
# define USE_MMAP_ANON
824
# define USE_ASM_PUSH_REGS
825
/* This is potentially buggy. It needs more testing. See the comments in
826
os_dep.c. It relies on threads to track writes. */
827
781
# ifdef GC_DARWIN_THREADS
828
/* # define MPROTECT_VDB -- diabled for now. May work for some apps. */
782
# define MPROTECT_VDB
830
784
# include <unistd.h>
831
785
# define GETPAGESIZE() getpagesize()
864
818
# define DATASTART GC_data_start
865
819
# define DYNAMIC_LOADING
822
# define OS_TYPE "AIX"
823
# undef ALIGNMENT /* in case it's defined */
826
/* DOB: some AIX installs stupidly define IA64 in */
827
/* /usr/include/sys/systemcfg.h */
831
# define CPP_WORDSZ 64
832
# define STACKBOTTOM ((ptr_t)0x1000000000000000)
835
# define CPP_WORDSZ 32
836
# define STACKBOTTOM ((ptr_t)((ulong)&errno))
839
# define USE_MMAP_ANON
840
/* From AIX linker man page:
841
_text Specifies the first location of the program.
842
_etext Specifies the first location after the program.
843
_data Specifies the first location of the data.
844
_edata Specifies the first location after the initialized data
845
_end or end Specifies the first location after all data.
847
extern int _data[], _end[];
848
# define DATASTART ((ptr_t)((ulong)_data))
849
# define DATAEND ((ptr_t)((ulong)_end))
851
# define DYNAMIC_LOADING
852
/* For really old versions of AIX, this may have to be removed. */
868
856
# define ALIGNMENT 4
869
857
# define OS_TYPE "NOSYS"
910
891
# define ALIGNMENT 4 /* Required by hardware */
911
892
# define CPP_WORDSZ 32
913
# define ALIGN_DOUBLE
915
# define OS_TYPE "SUNOS5"
894
/* Don't define USE_ASM_PUSH_REGS. We do use an asm helper, but */
895
/* not to push the registers on the mark stack. */
897
# define OS_TYPE "SOLARIS"
916
898
extern int _etext[];
917
899
extern int _end[];
918
extern ptr_t GC_SysVGetDataStart();
919
# define DATASTART GC_SysVGetDataStart(0x10000, _etext)
900
extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
901
# define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)_etext)
920
902
# define DATAEND (_end)
921
903
# if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
922
904
# define USE_MMAP
949
931
/* Solaris 5.4 installation. Weird. */
950
932
# define DYNAMIC_LOADING
953
# define OS_TYPE "SUNOS4"
954
/* [If you have a weak stomach, don't read this.] */
955
/* We would like to use: */
956
/* # define DATASTART ((ptr_t)((((word) (etext)) + 0x1fff) & ~0x1fff)) */
957
/* This fails occasionally, due to an ancient, but very */
958
/* persistent ld bug. etext is set 32 bytes too high. */
959
/* We instead read the text segment size from the a.out */
960
/* header, which happens to be mapped into our address space */
961
/* at the start of the text segment. The detective work here */
962
/* was done by Robert Ehrlich, Manuel Serrano, and Bernard */
963
/* Serpette of INRIA. */
964
/* This assumes ZMAGIC, i.e. demand-loadable executables. */
965
# define TEXTSTART 0x2000
966
# define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
967
# define MPROTECT_VDB
969
# define DYNAMIC_LOADING
972
935
# define OS_TYPE "DRSNX"
973
extern ptr_t GC_SysVGetDataStart();
936
extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
974
937
extern int etext[];
975
# define DATASTART GC_SysVGetDataStart(0x10000, etext)
938
# define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)etext)
976
939
# define MPROTECT_VDB
977
940
# define STACKBOTTOM ((ptr_t) 0xdfff0000)
978
941
# define DYNAMIC_LOADING
988
951
extern int _etext[];
989
952
# define DATAEND (_end)
991
extern ptr_t GC_SysVGetDataStart();
954
extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
992
955
# ifdef __arch64__
993
# define DATASTART GC_SysVGetDataStart(0x100000, _etext)
956
# define DATASTART GC_SysVGetDataStart(0x100000, (ptr_t)_etext)
995
# define DATASTART GC_SysVGetDataStart(0x10000, _etext)
958
# define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)_etext)
997
960
# define LINUX_STACKBOTTOM
1065
1020
extern int etext[];
1066
1021
# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
1069
# define OS_TYPE "SUNOS5"
1024
# define OS_TYPE "SOLARIS"
1070
1025
extern int _etext[], _end[];
1071
extern ptr_t GC_SysVGetDataStart();
1072
# define DATASTART GC_SysVGetDataStart(0x1000, _etext)
1026
extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
1027
# define DATASTART GC_SysVGetDataStart(0x1000, (ptr_t)_etext)
1073
1028
# define DATAEND (_end)
1074
1029
/* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */
1075
1030
/* but reportedly breaks under 2.8. It appears that the stack */
1225
1176
/* os_dep.c. OS2 actually has the right */
1226
1177
/* system call! */
1227
1178
# define DATAEND /* not needed */
1228
# define USE_GENERIC_PUSH_REGS
1230
1180
# ifdef MSWIN32
1231
1181
# define OS_TYPE "MSWIN32"
1232
1182
/* STACKBOTTOM and DATASTART are handled specially in */
1233
1183
/* os_dep.c. */
1234
# ifndef __WATCOMC__
1184
# if !defined(__WATCOMC__)
1235
1185
# define MPROTECT_VDB
1186
/* We also avoided doing this in the past with GC_WIN32_THREADS */
1187
/* Hopefully that's fixed. */
1189
# if _MSC_VER >= 1300 /* .NET, i.e. > VisualStudio 6 */
1237
1192
# define DATAEND /* not needed */
1320
1275
# define OS_TYPE "HURD"
1321
1276
# define STACK_GROWS_DOWN
1322
1277
# define HEURISTIC2
1323
extern int __data_start[];
1324
# define DATASTART ( (ptr_t) (__data_start))
1326
# define DATAEND ( (ptr_t) (_end))
1278
# define SIG_SUSPEND SIGUSR1
1279
# define SIG_THR_RESTART SIGUSR2
1280
# define SEARCH_FOR_DATA_START
1282
# define DATAEND ((ptr_t) (_end))
1327
1283
/* # define MPROTECT_VDB Not quite working yet? */
1328
1284
# define DYNAMIC_LOADING
1332
1288
# define DARWIN_DONT_PARSE_STACK
1333
1289
# define DYNAMIC_LOADING
1334
1290
/* XXX: see get_end(3), get_etext() and get_end() should not be used.
1335
These aren't used when dyld support is enabled (it is by default) */
1291
These aren't used when dyld support is enabled (it is by default) */
1336
1292
# define DATASTART ((ptr_t) get_etext())
1337
1293
# define DATAEND ((ptr_t) get_end())
1338
1294
# define STACKBOTTOM ((ptr_t) 0xc0000000)
1339
1295
# define USE_MMAP
1340
1296
# define USE_MMAP_ANON
1341
# define USE_ASM_PUSH_REGS
1342
/* This is potentially buggy. It needs more testing. See the comments in
1343
os_dep.c. It relies on threads to track writes. */
1344
1297
# ifdef GC_DARWIN_THREADS
1345
/* # define MPROTECT_VDB -- disabled for now. May work for some apps. */
1298
# define MPROTECT_VDB
1347
1300
# include <unistd.h>
1348
1301
# define GETPAGESIZE() getpagesize()
1349
1302
/* There seems to be some issues with trylock hanging on darwin. This
1350
should be looked into some more */
1303
should be looked into some more */
1351
1304
# define NO_PTHREAD_TRYLOCK
1352
1305
# endif /* DARWIN */
1474
1419
# define OS_TYPE "NONSTOP"
1475
1420
# define ALIGNMENT 4
1476
1421
# define DATASTART ((ptr_t) 0x08000000)
1478
# define DATAEND (_end)
1422
extern char **environ;
1423
# define DATAEND ((ptr_t)(environ - 0x10))
1479
1424
# define STACKBOTTOM ((ptr_t) 0x4fffffff)
1480
# define USE_GENERIC_PUSH_REGS
1485
# define MACH_TYPE "RS6000"
1490
# undef IA64 /* DOB: some AIX installs stupidly define IA64 in /usr/include/sys/systemcfg.h */
1493
# define ALIGNMENT 8
1494
# define CPP_WORDSZ 64
1495
# define STACKBOTTOM ((ptr_t)0x1000000000000000)
1497
# define ALIGNMENT 4
1498
# define CPP_WORDSZ 32
1499
# define STACKBOTTOM ((ptr_t)((ulong)&errno))
1502
# define USE_MMAP_ANON
1503
/* From AIX linker man page:
1504
_text Specifies the first location of the program.
1505
_etext Specifies the first location after the program.
1506
_data Specifies the first location of the data.
1507
_edata Specifies the first location after the initialized data
1508
_end or end Specifies the first location after all data.
1510
extern int _data[], _end[];
1511
# define DATASTART ((ptr_t)((ulong)_data))
1512
# define DATAEND ((ptr_t)((ulong)_end))
1514
# define USE_GENERIC_PUSH_REGS
1515
# define DYNAMIC_LOADING
1516
/* For really old versions of AIX, this may have to be removed. */
1584
1489
# define MACH_TYPE "ALPHA"
1585
1490
# define ALIGNMENT 8
1586
1491
# define CPP_WORDSZ 64
1588
# define USE_GENERIC_PUSH_REGS
1589
/* Gcc and probably the DEC/Compaq compiler spill pointers to preserved */
1590
/* fp registers in some cases when the target is a 21264. The assembly */
1591
/* code doesn't handle that yet, and version dependencies make that a */
1592
/* bit tricky. Do the easy thing for now. */
1595
1493
# define OS_TYPE "NETBSD"
1596
1494
# define HEURISTIC2
1804
1690
/* be moved to the S390 category. */
1805
1691
# define MACH_TYPE "S370"
1806
1692
# define ALIGNMENT 4 /* Required by hardware */
1807
# define USE_GENERIC_PUSH_REGS
1809
1694
# define OS_TYPE "UTS4"
1810
1695
extern int etext[];
1811
1696
extern int _etext[];
1812
1697
extern int _end[];
1813
extern ptr_t GC_SysVGetDataStart();
1814
# define DATASTART GC_SysVGetDataStart(0x10000, _etext)
1698
extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
1699
# define DATASTART GC_SysVGetDataStart(0x10000, (ptr_t)_etext)
1815
1700
# define DATAEND (_end)
1816
1701
# define HEURISTIC2
1904
1779
/* __data_start is usually defined in the target linker script. */
1905
1780
extern int __data_start[];
1906
1781
# define DATASTART (ptr_t)(__data_start)
1907
# define USE_GENERIC_PUSH_REGS
1908
1782
/* __stack_base__ is set in newlib/libc/sys/arm/crt0.S */
1909
1783
extern void *__stack_base__;
1910
1784
# define STACKBOTTOM ((ptr_t) (__stack_base__))
1789
# define MACH_TYPE "AVR32"
1790
# define CPP_WORDSZ 32
1791
# define ALIGNMENT 4
1792
# define OS_TYPE "LINUX"
1793
# define DYNAMIC_LOADING
1794
# define LINUX_STACKBOTTOM
1795
# define USE_GENERIC_PUSH_REGS
1796
# define SEARCH_FOR_DATA_START
1798
# define DATAEND (_end)
1915
1802
# define MACH_TYPE "CRIS"
1916
1803
# define CPP_WORDSZ 32
2006
1888
extern int etext[];
2007
1889
# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
2009
# if defined(__GNUC__) && __GNUC >= 3
1891
# if defined(__GNUC__) && __GNUC__ >= 3
2010
1892
# define PREFETCH(x) __builtin_prefetch((x), 0, 0)
2011
1893
# define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
1897
# define OS_TYPE "DARWIN"
1898
# define DARWIN_DONT_PARSE_STACK
1899
# define DYNAMIC_LOADING
1900
/* XXX: see get_end(3), get_etext() and get_end() should not be used.
1901
These aren't used when dyld support is enabled (it is by default) */
1902
# define DATASTART ((ptr_t) get_etext())
1903
# define DATAEND ((ptr_t) get_end())
1904
# define STACKBOTTOM ((ptr_t) 0x7fff5fc00000)
1906
# define USE_MMAP_ANON
1907
# ifdef GC_DARWIN_THREADS
1908
# define MPROTECT_VDB
1910
# include <unistd.h>
1911
# define GETPAGESIZE() getpagesize()
1912
/* There seems to be some issues with trylock hanging on darwin. This
1913
should be looked into some more */
1914
# define NO_PTHREAD_TRYLOCK
2014
1916
# ifdef FREEBSD
2015
1917
# define OS_TYPE "FREEBSD"
2016
1918
# ifndef GC_FREEBSD_THREADS
2083
1985
# define HEAP_START DATAEND
1989
# define OS_TYPE "MSWIN32"
1990
/* STACKBOTTOM and DATASTART are handled specially in */
1992
# if !defined(__WATCOMC__)
1993
# define MPROTECT_VDB
1994
/* We also avoided doing this in the past with GC_WIN32_THREADS */
1995
/* Hopefully that's fixed. */
1997
# if _MSC_VER >= 1300 /* .NET, i.e. > VisualStudio 6 */
2000
# define DATAEND /* not needed */
2004
#if defined(LINUX_STACKBOTTOM) && defined(NO_PROC_STAT) \
2005
&& !defined(USE_LIBC_PRIVATES)
2006
/* This combination will fail, since we have no way to get */
2007
/* the stack base. Use HEURISTIC2 instead. */
2008
# undef LINUX_STACKBOTTOM
2010
/* This may still fail on some architectures like IA64. */
2088
2014
#if defined(LINUX) && defined(USE_MMAP)
2089
2015
/* The kernel may do a somewhat better job merging mappings etc. */
2090
2016
/* with anonymous mappings. */
2091
2017
# define USE_MMAP_ANON
2094
#if defined(LINUX) && defined(REDIRECT_MALLOC)
2095
/* Rld appears to allocate some memory with its own allocator, and */
2096
/* some through malloc, which might be redirected. To make this */
2097
/* work with collectable memory, we have to scan memory allocated */
2098
/* by rld's internal malloc. */
2020
#if defined(GC_LINUX_THREADS) && defined(REDIRECT_MALLOC)
2021
/* Nptl allocates thread stacks with mmap, which is fine. But it */
2022
/* keeps a cache of thread stacks. Thread stacks contain the */
2023
/* thread control blocks. These in turn contain a pointer to */
2024
/* (sizeof (void *) from the beginning of) the dtv for thread-local */
2025
/* storage, which is calloc allocated. If we don't scan the cached */
2026
/* thread stacks, we appear to lose the dtv. This tends to */
2027
/* result in something that looks like a bogus dtv count, which */
2028
/* tends to result in a memset call on a block that is way too */
2029
/* large. Sometimes we're lucky and the process just dies ... */
2030
/* There seems to be a similar issue with some other memory */
2031
/* allocated by the dynamic loader. */
2032
/* This should be avoidable by either: */
2033
/* - Defining USE_PROC_FOR_LIBRARIES here. */
2034
/* That performs very poorly, precisely because we end up */
2035
/* scanning cached stacks. */
2036
/* - Have calloc look at its callers. */
2037
/* In spite of the fact that it is gross and disgusting. */
2038
/* In fact neither seems to suffice, probably in part because */
2039
/* even with USE_PROC_FOR_LIBRARIES, we don't scan parts of stack */
2040
/* segments that appear to be out of bounds. Thus we actually */
2041
/* do both, which seems to yield the best results. */
2099
2043
# define USE_PROC_FOR_LIBRARIES
2102
2046
# ifndef STACK_GROWS_UP
2103
2047
# define STACK_GROWS_DOWN
2124
2068
# ifndef GETPAGESIZE
2125
# if defined(SUNOS5) || defined(IRIX5)
2069
# if defined(SOLARIS) || defined(IRIX5) || defined(LINUX) \
2070
|| defined(NETBSD) || defined(FREEBSD) || defined(HPUX)
2126
2071
# include <unistd.h>
2128
2073
# define GETPAGESIZE() getpagesize()
2131
# if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
2132
/* OS has SVR4 generic features. Probably others also qualify. */
2076
# if defined(SOLARIS) || defined(DRSNX) || defined(UTS4)
2077
/* OS has SVR4 generic features. */
2078
/* Probably others also qualify. */
2136
# if defined(SUNOS5) || defined(DRSNX)
2137
/* OS has SUNOS5 style semi-undocumented interface to dynamic */
2140
/* OS has SUNOS5 style signal handlers. */
2082
# if defined(SOLARIS) || defined(DRSNX)
2083
/* OS has SOLARIS style semi-undocumented interface */
2084
/* to dynamic loader. */
2086
/* OS has SOLARIS style signal handlers. */
2141
2087
# define SUNOS5SIGS
2158
2104
# if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \
2159
2105
|| defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
2160
|| defined(DGUX) || defined(BSD) || defined(SUNOS4) \
2161
|| defined(_AIX) || defined(DARWIN) || defined(OSF1)
2106
|| defined(DGUX) || defined(BSD) \
2107
|| defined(AIX) || defined(DARWIN) || defined(OSF1) \
2162
2109
# define UNIX_LIKE /* Basic Unix-like system calls work. */
2234
2176
((word*)x)[1] = 0;
2235
2177
# endif /* CLEAR_DOUBLE */
2237
/* Internally we use GC_SOLARIS_THREADS to test for either old or pthreads. */
2238
# if defined(GC_SOLARIS_PTHREADS) && !defined(GC_SOLARIS_THREADS)
2239
# define GC_SOLARIS_THREADS
2179
# if defined(GC_LINUX_THREADS) && defined(REDIRECT_MALLOC) \
2180
&& !defined(INCLUDE_LINUX_THREAD_DESCR)
2181
/* Will not work, since libc and the dynamic loader use thread */
2182
/* locals, sometimes as the only reference. */
2183
# define INCLUDE_LINUX_THREAD_DESCR
2242
2186
# if defined(GC_IRIX_THREADS) && !defined(IRIX5)
2248
2192
# if defined(GC_NETBSD_THREADS) && !defined(NETBSD)
2249
2193
--> inconsistent configuration
2251
# if defined(GC_SOLARIS_THREADS) && !defined(SUNOS5)
2195
# if defined(GC_FREEBSD_THREADS) && !defined(FREEBSD)
2196
--> inconsistent configuration
2198
# if defined(GC_SOLARIS_THREADS) && !defined(SOLARIS)
2252
2199
--> inconsistent configuration
2254
2201
# if defined(GC_HPUX_THREADS) && !defined(HPUX)
2257
2204
# if defined(GC_AIX_THREADS) && !defined(_AIX)
2258
2205
--> inconsistent configuration
2207
# if defined(GC_GNU_THREADS) && !defined(HURD)
2208
--> inconsistent configuration
2260
2210
# if defined(GC_WIN32_THREADS) && !defined(MSWIN32) && !defined(CYGWIN32)
2261
2211
--> inconsistent configuration
2264
# if defined(PCR) || defined(SRC_M3) || \
2265
defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) || \
2266
defined(GC_PTHREADS)
2214
# if defined(PCR) || defined(GC_WIN32_THREADS) || defined(GC_PTHREADS)
2267
2215
# define THREADS
2270
# if defined(HP_PA) || defined(M88K) \
2271
|| defined(POWERPC) && !defined(DARWIN) \
2272
|| defined(LINT) || defined(MSWINCE) || defined(ARM32) || defined(CRIS) \
2273
|| (defined(I386) && defined(__LCC__))
2274
/* Use setjmp based hack to mark from callee-save registers. */
2275
/* The define should move to the individual platform */
2277
# define USE_GENERIC_PUSH_REGS
2218
# if !defined(USE_MARK_BITS) && !defined(USE_MARK_BYTES)
2219
# if defined(THREADS) && defined(PARALLEL_MARK)
2220
# define USE_MARK_BYTES
2222
# define USE_MARK_BITS
2280
2226
# if defined(MSWINCE)
2353
2299
# define FIXUP_POINTER(p)
2302
# if !defined(MARK_BIT_PER_GRANULE) && !defined(MARK_BIT_PER_OBJ)
2303
# define MARK_BIT_PER_GRANULE /* Usually faster */
2306
/* Some static sanity tests. */
2307
# if defined(MARK_BIT_PER_GRANULE) && defined(MARK_BIT_PER_OBJ)
2308
# error Define only one of MARK_BIT_PER_GRANULE and MARK_BIT_PER_OBJ.
2311
# if defined(STACK_GROWS_UP) && defined(STACK_GROWS_DOWN)
2312
# error "Only one of STACK_GROWS_UP and STACK_GROWS_DOWN should be defd."
2314
# if !defined(STACK_GROWS_UP) && !defined(STACK_GROWS_DOWN)
2315
# error "One of STACK_GROWS_UP and STACK_GROWS_DOWN should be defd."
2318
# if defined(REDIRECT_MALLOC) && defined(THREADS) && !defined(LINUX)
2319
# error "REDIRECT_MALLOC with THREADS works at most on Linux."
2356
2322
#ifdef GC_PRIVATE_H
2357
2323
/* This relies on some type definitions from gc_priv.h, from */
2358
2324
/* where it's normally included. */
2370
2336
/* though we should perhaps take advantage of the case in which */
2372
2338
struct hblk; /* See gc_priv.h. */
2374
char * real_malloc();
2340
char * real_malloc();
2375
2341
# define GET_MEM(bytes) HBLKPTR(real_malloc((size_t)bytes + GC_page_size) \
2376
2342
+ GC_page_size-1)
2379
void * os2_alloc(size_t bytes);
2380
# define GET_MEM(bytes) HBLKPTR((ptr_t)os2_alloc((size_t)bytes \
2344
void * os2_alloc(size_t bytes);
2345
# define GET_MEM(bytes) HBLKPTR((ptr_t)os2_alloc((size_t)bytes \
2381
2346
+ GC_page_size) \
2382
2347
+ GC_page_size-1)
2384
# if defined(NEXT) || defined(DOS4GW) || defined(NONSTOP) || \
2348
# elif defined(NEXT) || defined(DOS4GW) || defined(NONSTOP) || \
2385
2349
(defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC)) || \
2386
(defined(SUNOS5) && !defined(USE_MMAP))
2387
# define GET_MEM(bytes) HBLKPTR((size_t) \
2388
calloc(1, (size_t)bytes + GC_page_size) \
2392
extern ptr_t GC_win32_get_mem();
2393
# define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes)
2396
# if defined(USE_TEMPORARY_MEMORY)
2397
extern Ptr GC_MacTemporaryNewPtr(size_t size,
2398
Boolean clearMemory);
2399
# define GET_MEM(bytes) HBLKPTR( \
2350
(defined(SOLARIS) && !defined(USE_MMAP))
2351
# define GET_MEM(bytes) HBLKPTR((size_t) calloc(1, (size_t)bytes + GC_page_size) \
2353
# elif defined(MSWIN32)
2354
extern ptr_t GC_win32_get_mem();
2355
# define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes)
2356
# elif defined(MACOS)
2357
# if defined(USE_TEMPORARY_MEMORY)
2358
extern Ptr GC_MacTemporaryNewPtr(size_t size, Boolean clearMemory);
2359
# define GET_MEM(bytes) HBLKPTR( \
2400
2360
GC_MacTemporaryNewPtr(bytes + GC_page_size, true) \
2401
2361
+ GC_page_size-1)
2403
# define GET_MEM(bytes) HBLKPTR( \
2363
# define GET_MEM(bytes) HBLKPTR( \
2404
2364
NewPtrClear(bytes + GC_page_size) + GC_page_size-1)
2408
extern ptr_t GC_wince_get_mem();
2409
# define GET_MEM(bytes) (struct hblk *)GC_wince_get_mem(bytes)
2411
# if defined(AMIGA) && defined(GC_AMIGA_FASTALLOC)
2412
extern void *GC_amiga_get_mem(size_t size);
2413
# define GET_MEM(bytes) HBLKPTR((size_t) \
2366
# elif defined(MSWINCE)
2367
extern ptr_t GC_wince_get_mem();
2368
# define GET_MEM(bytes) (struct hblk *)GC_wince_get_mem(bytes)
2369
# elif defined(AMIGA) && defined(GC_AMIGA_FASTALLOC)
2370
extern void *GC_amiga_get_mem(size_t size);
2371
# define GET_MEM(bytes) HBLKPTR((size_t) \
2414
2372
GC_amiga_get_mem((size_t)bytes + GC_page_size) \
2415
2373
+ GC_page_size-1)
2417
extern ptr_t GC_unix_get_mem();
2418
# define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)
2375
extern ptr_t GC_unix_get_mem();
2376
# define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)
2427
2379
#endif /* GC_PRIVATE_H */
2429
#if defined(_AIX) && !defined(__GNUC__) && !defined(__STDC__)
2430
/* IBMs xlc compiler doesn't appear to follow the convention of */
2431
/* defining __STDC__ to be zero in extended mode. */
2435
2381
# endif /* GCCONFIG_H */