| 1 | /*
|
|---|
| 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.
|
|---|
| 6 | *
|
|---|
| 7 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
|
|---|
| 8 | * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
|
|---|
| 9 | *
|
|---|
| 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.
|
|---|
| 15 | */
|
|---|
| 16 |
|
|---|
| 17 | /*
|
|---|
| 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
|
|---|
| 22 | * omitted.
|
|---|
| 23 | */
|
|---|
| 24 |
|
|---|
| 25 | #ifndef GCCONFIG_H
|
|---|
| 26 |
|
|---|
| 27 | # define GCCONFIG_H
|
|---|
| 28 |
|
|---|
| 29 | # ifndef GC_PRIVATE_H
|
|---|
| 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;
|
|---|
| 33 | # endif
|
|---|
| 34 |
|
|---|
| 35 | /* Machine dependent parameters. Some tuning parameters can be found */
|
|---|
| 36 | /* near the top of gc_private.h. */
|
|---|
| 37 |
|
|---|
| 38 | /* Machine specific parts contributed by various people. See README file. */
|
|---|
| 39 |
|
|---|
| 40 | /* First a unified test for Linux: */
|
|---|
| 41 | # if defined(linux) || defined(__linux__)
|
|---|
| 42 | # ifndef LINUX
|
|---|
| 43 | # define LINUX
|
|---|
| 44 | # endif
|
|---|
| 45 | # endif
|
|---|
| 46 |
|
|---|
| 47 | /* And one for NetBSD: */
|
|---|
| 48 | # if defined(__NetBSD__)
|
|---|
| 49 | # define NETBSD
|
|---|
| 50 | # endif
|
|---|
| 51 |
|
|---|
| 52 | /* And one for OpenBSD: */
|
|---|
| 53 | # if defined(__OpenBSD__)
|
|---|
| 54 | # define OPENBSD
|
|---|
| 55 | # endif
|
|---|
| 56 |
|
|---|
| 57 | /* And one for FreeBSD: */
|
|---|
| 58 | # if (defined(__FreeBSD__) || defined(__DragonFly__) || \
|
|---|
| 59 | defined(__FreeBSD_kernel__)) && !defined(FREEBSD)
|
|---|
| 60 | # define FREEBSD
|
|---|
| 61 | # endif
|
|---|
| 62 |
|
|---|
| 63 | /* Determine the machine type: */
|
|---|
| 64 | # if defined(__arm__) || defined(__thumb__)
|
|---|
| 65 | # define ARM32
|
|---|
| 66 | # if !defined(LINUX) && !defined(NETBSD)
|
|---|
| 67 | # define NOSYS
|
|---|
| 68 | # define mach_type_known
|
|---|
| 69 | # endif
|
|---|
| 70 | # endif
|
|---|
| 71 | # if defined(sun) && defined(mc68000)
|
|---|
| 72 | # define M68K
|
|---|
| 73 | # define SUNOS4
|
|---|
| 74 | # define mach_type_known
|
|---|
| 75 | # endif
|
|---|
| 76 | # if defined(hp9000s300)
|
|---|
| 77 | # define M68K
|
|---|
| 78 | # define HP
|
|---|
| 79 | # define mach_type_known
|
|---|
| 80 | # endif
|
|---|
| 81 | # if defined(OPENBSD) && defined(m68k)
|
|---|
| 82 | # define M68K
|
|---|
| 83 | # define mach_type_known
|
|---|
| 84 | # endif
|
|---|
| 85 | # if defined(OPENBSD) && defined(__sparc__)
|
|---|
| 86 | # define SPARC
|
|---|
| 87 | # define mach_type_known
|
|---|
| 88 | # endif
|
|---|
| 89 | # if defined(NETBSD) && (defined(m68k) || defined(__m68k__))
|
|---|
| 90 | # define M68K
|
|---|
| 91 | # define mach_type_known
|
|---|
| 92 | # endif
|
|---|
| 93 | # if defined(NETBSD) && defined(__powerpc__)
|
|---|
| 94 | # define POWERPC
|
|---|
| 95 | # define mach_type_known
|
|---|
| 96 | # endif
|
|---|
| 97 | # if defined(NETBSD) && (defined(__arm32__) || defined(__arm__))
|
|---|
| 98 | # define ARM32
|
|---|
| 99 | # define mach_type_known
|
|---|
| 100 | # endif
|
|---|
| 101 | # if defined(NETBSD) && defined(__sh__)
|
|---|
| 102 | # define SH
|
|---|
| 103 | # define mach_type_known
|
|---|
| 104 | # endif
|
|---|
| 105 | # if defined(vax)
|
|---|
| 106 | # define VAX
|
|---|
| 107 | # ifdef ultrix
|
|---|
| 108 | # define ULTRIX
|
|---|
| 109 | # else
|
|---|
| 110 | # define BSD
|
|---|
| 111 | # endif
|
|---|
| 112 | # define mach_type_known
|
|---|
| 113 | # endif
|
|---|
| 114 | # if defined(__NetBSD__) && defined(__vax__)
|
|---|
| 115 | # define VAX
|
|---|
| 116 | # define mach_type_known
|
|---|
| 117 | # endif
|
|---|
| 118 | # if defined(mips) || defined(__mips) || defined(_mips)
|
|---|
| 119 | # define MIPS
|
|---|
| 120 | # if defined(nec_ews) || defined(_nec_ews)
|
|---|
| 121 | # define EWS4800
|
|---|
| 122 | # endif
|
|---|
| 123 | # if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD)
|
|---|
| 124 | # if defined(ultrix) || defined(__ultrix)
|
|---|
| 125 | # define ULTRIX
|
|---|
| 126 | # else
|
|---|
| 127 | # if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) \
|
|---|
| 128 | || defined(__SYSTYPE_SVR4__)
|
|---|
| 129 | # define IRIX5 /* or IRIX 6.X */
|
|---|
| 130 | # else
|
|---|
| 131 | # define RISCOS /* or IRIX 4.X */
|
|---|
| 132 | # endif
|
|---|
| 133 | # endif
|
|---|
| 134 | # endif /* !LINUX */
|
|---|
| 135 | # if defined(__NetBSD__) && defined(__MIPSEL__)
|
|---|
| 136 | # undef ULTRIX
|
|---|
| 137 | # endif
|
|---|
| 138 | # define mach_type_known
|
|---|
| 139 | # endif
|
|---|
| 140 | # if defined(DGUX) && (defined(i386) || defined(__i386__))
|
|---|
| 141 | # define I386
|
|---|
| 142 | # ifndef _USING_DGUX
|
|---|
| 143 | # define _USING_DGUX
|
|---|
| 144 | # endif
|
|---|
| 145 | # define mach_type_known
|
|---|
| 146 | # endif
|
|---|
| 147 | # if defined(sequent) && (defined(i386) || defined(__i386__))
|
|---|
| 148 | # define I386
|
|---|
| 149 | # define SEQUENT
|
|---|
| 150 | # define mach_type_known
|
|---|
| 151 | # endif
|
|---|
| 152 | # if defined(sun) && (defined(i386) || defined(__i386__))
|
|---|
| 153 | # define I386
|
|---|
| 154 | # define SUNOS5
|
|---|
| 155 | # define mach_type_known
|
|---|
| 156 | # endif
|
|---|
| 157 | # if defined(sun) && defined(__amd64)
|
|---|
| 158 | # define X86_64
|
|---|
| 159 | # define SOLARIS
|
|---|
| 160 | # define mach_type_known
|
|---|
| 161 | # endif
|
|---|
| 162 | # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
|
|---|
| 163 | # define I386
|
|---|
| 164 | # define OS2
|
|---|
| 165 | # define mach_type_known
|
|---|
| 166 | # endif
|
|---|
| 167 | # if defined(ibm032)
|
|---|
| 168 | # define RT
|
|---|
| 169 | # define mach_type_known
|
|---|
| 170 | # endif
|
|---|
| 171 | # if defined(sun) && (defined(sparc) || defined(__sparc))
|
|---|
| 172 | # define SPARC
|
|---|
| 173 | /* Test for SunOS 5.x */
|
|---|
| 174 | # include <errno.h>
|
|---|
| 175 | # ifdef ECHRNG
|
|---|
| 176 | # define SUNOS5
|
|---|
| 177 | # else
|
|---|
| 178 | # define SUNOS4
|
|---|
| 179 | # endif
|
|---|
| 180 | # define mach_type_known
|
|---|
| 181 | # endif
|
|---|
| 182 | # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
|
|---|
| 183 | && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) \
|
|---|
| 184 | && !defined(__DragonFly__)
|
|---|
| 185 | # define SPARC
|
|---|
| 186 | # define DRSNX
|
|---|
| 187 | # define mach_type_known
|
|---|
| 188 | # endif
|
|---|
| 189 | # if defined(_IBMR2)
|
|---|
| 190 | # define RS6000
|
|---|
| 191 | # define mach_type_known
|
|---|
| 192 | # endif
|
|---|
| 193 | # if defined(__NetBSD__) && defined(__sparc__)
|
|---|
| 194 | # define SPARC
|
|---|
| 195 | # define mach_type_known
|
|---|
| 196 | # endif
|
|---|
| 197 | # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
|
|---|
| 198 | /* The above test may need refinement */
|
|---|
| 199 | # define I386
|
|---|
| 200 | # if defined(_SCO_ELF)
|
|---|
| 201 | # define SCO_ELF
|
|---|
| 202 | # else
|
|---|
| 203 | # define SCO
|
|---|
| 204 | # endif
|
|---|
| 205 | # define mach_type_known
|
|---|
| 206 | # endif
|
|---|
| 207 | # if defined(_AUX_SOURCE)
|
|---|
| 208 | # define M68K
|
|---|
| 209 | # define SYSV
|
|---|
| 210 | # define mach_type_known
|
|---|
| 211 | # endif
|
|---|
| 212 | # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
|
|---|
| 213 | || defined(hppa) || defined(__hppa__)
|
|---|
| 214 | # define HP_PA
|
|---|
| 215 | # if !defined(LINUX) && !defined(HPUX)
|
|---|
| 216 | # define HPUX
|
|---|
| 217 | # endif
|
|---|
| 218 | # define mach_type_known
|
|---|
| 219 | # endif
|
|---|
| 220 | # if defined(__ia64) && defined(_HPUX_SOURCE)
|
|---|
| 221 | # define IA64
|
|---|
| 222 | # ifndef HPUX
|
|---|
| 223 | # define HPUX
|
|---|
| 224 | # endif
|
|---|
| 225 | # define mach_type_known
|
|---|
| 226 | # endif
|
|---|
| 227 | # if defined(__BEOS__) && defined(_X86_)
|
|---|
| 228 | # define I386
|
|---|
| 229 | # define BEOS
|
|---|
| 230 | # define mach_type_known
|
|---|
| 231 | # endif
|
|---|
| 232 | # if defined(LINUX) && (defined(i386) || defined(__i386__))
|
|---|
| 233 | # define I386
|
|---|
| 234 | # define mach_type_known
|
|---|
| 235 | # endif
|
|---|
| 236 | # if defined(LINUX) && defined(__x86_64__)
|
|---|
| 237 | # define X86_64
|
|---|
| 238 | # define mach_type_known
|
|---|
| 239 | # endif
|
|---|
| 240 | # if defined(LINUX) && (defined(__ia64__) || defined(__ia64))
|
|---|
| 241 | # define IA64
|
|---|
| 242 | # define mach_type_known
|
|---|
| 243 | # endif
|
|---|
| 244 | # if defined(LINUX) && defined(__arm__)
|
|---|
| 245 | # define ARM32
|
|---|
| 246 | # define mach_type_known
|
|---|
| 247 | # endif
|
|---|
| 248 | # if defined(LINUX) && defined(__cris__)
|
|---|
| 249 | # ifndef CRIS
|
|---|
| 250 | # define CRIS
|
|---|
| 251 | # endif
|
|---|
| 252 | # define mach_type_known
|
|---|
| 253 | # endif
|
|---|
| 254 | # if defined(LINUX) && (defined(powerpc) || defined(__powerpc__) || \
|
|---|
| 255 | defined(powerpc64) || defined(__powerpc64__))
|
|---|
| 256 | # define POWERPC
|
|---|
| 257 | # define mach_type_known
|
|---|
| 258 | # endif
|
|---|
| 259 | # if defined(FREEBSD) && (defined(powerpc) || defined(__powerpc__))
|
|---|
| 260 | # define POWERPC
|
|---|
| 261 | # define mach_type_known
|
|---|
| 262 | # endif
|
|---|
| 263 | # if defined(LINUX) && defined(__mc68000__)
|
|---|
| 264 | # define M68K
|
|---|
| 265 | # define mach_type_known
|
|---|
| 266 | # endif
|
|---|
| 267 | # if defined(LINUX) && (defined(sparc) || defined(__sparc__))
|
|---|
| 268 | # define SPARC
|
|---|
| 269 | # define mach_type_known
|
|---|
| 270 | # endif
|
|---|
| 271 | # if defined(LINUX) && defined(__arm__)
|
|---|
| 272 | # define ARM32
|
|---|
| 273 | # define mach_type_known
|
|---|
| 274 | # endif
|
|---|
| 275 | # if defined(LINUX) && defined(__sh__)
|
|---|
| 276 | # define SH
|
|---|
| 277 | # define mach_type_known
|
|---|
| 278 | # endif
|
|---|
| 279 | # if defined(LINUX) && defined(__m32r__)
|
|---|
| 280 | # define M32R
|
|---|
| 281 | # define mach_type_known
|
|---|
| 282 | # endif
|
|---|
| 283 | # if defined(__alpha) || defined(__alpha__)
|
|---|
| 284 | # define ALPHA
|
|---|
| 285 | # if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) && !defined(FREEBSD)
|
|---|
| 286 | # define OSF1 /* a.k.a Digital Unix */
|
|---|
| 287 | # endif
|
|---|
| 288 | # define mach_type_known
|
|---|
| 289 | # endif
|
|---|
| 290 | # if defined(_AMIGA) && !defined(AMIGA)
|
|---|
| 291 | # define AMIGA
|
|---|
| 292 | # endif
|
|---|
| 293 | # ifdef AMIGA
|
|---|
| 294 | # define M68K
|
|---|
| 295 | # define mach_type_known
|
|---|
| 296 | # endif
|
|---|
| 297 | # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
|
|---|
| 298 | # define M68K
|
|---|
| 299 | # define MACOS
|
|---|
| 300 | # define mach_type_known
|
|---|
| 301 | # endif
|
|---|
| 302 | # if defined(__MWERKS__) && defined(__powerc) && !defined(__MACH__)
|
|---|
| 303 | # define POWERPC
|
|---|
| 304 | # define MACOS
|
|---|
| 305 | # define mach_type_known
|
|---|
| 306 | # endif
|
|---|
| 307 | # if defined(macosx) || (defined(__APPLE__) && defined(__MACH__))
|
|---|
| 308 | # define DARWIN
|
|---|
| 309 | # if defined(__ppc__) || defined(__ppc64__)
|
|---|
| 310 | # define POWERPC
|
|---|
| 311 | # define mach_type_known
|
|---|
| 312 | # endif
|
|---|
| 313 | # if defined(__i386__)
|
|---|
| 314 | # define I386
|
|---|
| 315 | # define mach_type_known
|
|---|
| 316 | # endif
|
|---|
| 317 | # endif
|
|---|
| 318 | # if defined(NeXT) && defined(mc68000)
|
|---|
| 319 | # define M68K
|
|---|
| 320 | # define NEXT
|
|---|
| 321 | # define mach_type_known
|
|---|
| 322 | # endif
|
|---|
| 323 | # if defined(NeXT) && (defined(i386) || defined(__i386__))
|
|---|
| 324 | # define I386
|
|---|
| 325 | # define NEXT
|
|---|
| 326 | # define mach_type_known
|
|---|
| 327 | # endif
|
|---|
| 328 | # if defined(__OpenBSD__) && (defined(i386) || defined(__i386__))
|
|---|
| 329 | # define I386
|
|---|
| 330 | # define OPENBSD
|
|---|
| 331 | # define mach_type_known
|
|---|
| 332 | # endif
|
|---|
| 333 | # if defined(FREEBSD) && (defined(i386) || defined(__i386__))
|
|---|
| 334 | # define I386
|
|---|
| 335 | # define mach_type_known
|
|---|
| 336 | # endif
|
|---|
| 337 | # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
|
|---|
| 338 | # define I386
|
|---|
| 339 | # define mach_type_known
|
|---|
| 340 | # endif
|
|---|
| 341 | # if defined(__NetBSD__) && defined(__x86_64__)
|
|---|
| 342 | # define X86_64
|
|---|
| 343 | # define mach_type_known
|
|---|
| 344 | # endif
|
|---|
| 345 | # if defined(FREEBSD) && defined(__sparc__)
|
|---|
| 346 | # define SPARC
|
|---|
| 347 | # define mach_type_known
|
|---|
| 348 | #endif
|
|---|
| 349 | # if defined(bsdi) && (defined(i386) || defined(__i386__))
|
|---|
| 350 | # define I386
|
|---|
| 351 | # define BSDI
|
|---|
| 352 | # define mach_type_known
|
|---|
| 353 | # endif
|
|---|
| 354 | # if !defined(mach_type_known) && defined(__386BSD__)
|
|---|
| 355 | # define I386
|
|---|
| 356 | # define THREE86BSD
|
|---|
| 357 | # define mach_type_known
|
|---|
| 358 | # endif
|
|---|
| 359 | # if defined(_CX_UX) && defined(_M88K)
|
|---|
| 360 | # define M88K
|
|---|
| 361 | # define CX_UX
|
|---|
| 362 | # define mach_type_known
|
|---|
| 363 | # endif
|
|---|
| 364 | # if defined(DGUX) && defined(m88k)
|
|---|
| 365 | # define M88K
|
|---|
| 366 | /* DGUX defined */
|
|---|
| 367 | # define mach_type_known
|
|---|
| 368 | # endif
|
|---|
| 369 | # if defined(_WIN32_WCE)
|
|---|
| 370 | /* SH3, SH4, MIPS already defined for corresponding architectures */
|
|---|
| 371 | # if defined(SH3) || defined(SH4)
|
|---|
| 372 | # define SH
|
|---|
| 373 | # endif
|
|---|
| 374 | # if defined(x86)
|
|---|
| 375 | # define I386
|
|---|
| 376 | # endif
|
|---|
| 377 | # if defined(ARM)
|
|---|
| 378 | # define ARM32
|
|---|
| 379 | # endif
|
|---|
| 380 | # define MSWINCE
|
|---|
| 381 | # define mach_type_known
|
|---|
| 382 | # else
|
|---|
| 383 | # if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
|
|---|
| 384 | || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
|
|---|
| 385 | # define I386
|
|---|
| 386 | # define MSWIN32 /* or Win32s */
|
|---|
| 387 | # define mach_type_known
|
|---|
| 388 | # endif
|
|---|
| 389 | # if defined(_MSC_VER) && defined(_M_IA64)
|
|---|
| 390 | # define IA64
|
|---|
| 391 | # define MSWIN32 /* Really win64, but we don't treat 64-bit */
|
|---|
| 392 | /* variants as a differnt platform. */
|
|---|
| 393 | # endif
|
|---|
| 394 | # endif
|
|---|
| 395 | # if defined(__DJGPP__)
|
|---|
| 396 | # define I386
|
|---|
| 397 | # ifndef DJGPP
|
|---|
| 398 | # define DJGPP /* MSDOS running the DJGPP port of GCC */
|
|---|
| 399 | # endif
|
|---|
| 400 | # define mach_type_known
|
|---|
| 401 | # endif
|
|---|
| 402 | # if defined(__CYGWIN32__) || defined(__CYGWIN__)
|
|---|
| 403 | # define I386
|
|---|
| 404 | # define CYGWIN32
|
|---|
| 405 | # define mach_type_known
|
|---|
| 406 | # endif
|
|---|
| 407 | # if defined(__MINGW32__)
|
|---|
| 408 | # define I386
|
|---|
| 409 | # define MSWIN32
|
|---|
| 410 | # define mach_type_known
|
|---|
| 411 | # endif
|
|---|
| 412 | # if defined(__BORLANDC__)
|
|---|
| 413 | # define I386
|
|---|
| 414 | # define MSWIN32
|
|---|
| 415 | # define mach_type_known
|
|---|
| 416 | # endif
|
|---|
| 417 | # if defined(_UTS) && !defined(mach_type_known)
|
|---|
| 418 | # define S370
|
|---|
| 419 | # define UTS4
|
|---|
| 420 | # define mach_type_known
|
|---|
| 421 | # endif
|
|---|
| 422 | # if defined(__pj__)
|
|---|
| 423 | # define PJ
|
|---|
| 424 | # define mach_type_known
|
|---|
| 425 | # endif
|
|---|
| 426 | # if defined(__embedded__) && defined(PPC)
|
|---|
| 427 | # define POWERPC
|
|---|
| 428 | # define NOSYS
|
|---|
| 429 | # define mach_type_known
|
|---|
| 430 | # endif
|
|---|
| 431 | /* Ivan Demakov */
|
|---|
| 432 | # if defined(__WATCOMC__) && defined(__386__)
|
|---|
| 433 | # define I386
|
|---|
| 434 | # if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
|
|---|
| 435 | # if defined(__OS2__)
|
|---|
| 436 | # define OS2
|
|---|
| 437 | # else
|
|---|
| 438 | # if defined(__WINDOWS_386__) || defined(__NT__)
|
|---|
| 439 | # define MSWIN32
|
|---|
| 440 | # else
|
|---|
| 441 | # define DOS4GW
|
|---|
| 442 | # endif
|
|---|
| 443 | # endif
|
|---|
| 444 | # endif
|
|---|
| 445 | # define mach_type_known
|
|---|
| 446 | # endif
|
|---|
| 447 | # if defined(__s390__) && defined(LINUX)
|
|---|
| 448 | # define S390
|
|---|
| 449 | # define mach_type_known
|
|---|
| 450 | # endif
|
|---|
| 451 | # if defined(__GNU__)
|
|---|
| 452 | # if defined(__i386__)
|
|---|
| 453 | /* The Debian Hurd running on generic PC */
|
|---|
| 454 | # define HURD
|
|---|
| 455 | # define I386
|
|---|
| 456 | # define mach_type_known
|
|---|
| 457 | # endif
|
|---|
| 458 | # endif
|
|---|
| 459 | # if defined(__TANDEM)
|
|---|
| 460 | /* Nonstop S-series */
|
|---|
| 461 | /* FIXME: Should recognize Integrity series? */
|
|---|
| 462 | # define MIPS
|
|---|
| 463 | # define NONSTOP
|
|---|
| 464 | # define mach_type_known
|
|---|
| 465 | # endif
|
|---|
| 466 |
|
|---|
| 467 | /* Feel free to add more clauses here */
|
|---|
| 468 |
|
|---|
| 469 | /* Or manually define the machine type here. A machine type is */
|
|---|
| 470 | /* characterized by the architecture. Some */
|
|---|
| 471 | /* machine types are further subdivided by OS. */
|
|---|
| 472 | /* the macros ULTRIX, RISCOS, and BSD to distinguish. */
|
|---|
| 473 | /* Note that SGI IRIX is treated identically to RISCOS. */
|
|---|
| 474 | /* SYSV on an M68K actually means A/UX. */
|
|---|
| 475 | /* The distinction in these cases is usually the stack starting address */
|
|---|
| 476 | # ifndef mach_type_known
|
|---|
| 477 | --> unknown machine type
|
|---|
| 478 | # endif
|
|---|
| 479 | /* Mapping is: M68K ==> Motorola 680X0 */
|
|---|
| 480 | /* (SUNOS4,HP,NEXT, and SYSV (A/UX), */
|
|---|
| 481 | /* MACOS and AMIGA variants) */
|
|---|
| 482 | /* I386 ==> Intel 386 */
|
|---|
| 483 | /* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
|
|---|
| 484 | /* FREEBSD, THREE86BSD, MSWIN32, */
|
|---|
| 485 | /* BSDI,SUNOS5, NEXT, other variants) */
|
|---|
| 486 | /* NS32K ==> Encore Multimax */
|
|---|
| 487 | /* MIPS ==> R2000 through R14K */
|
|---|
| 488 | /* (many variants) */
|
|---|
| 489 | /* VAX ==> DEC VAX */
|
|---|
| 490 | /* (BSD, ULTRIX variants) */
|
|---|
| 491 | /* RS6000 ==> IBM RS/6000 AIX3.X */
|
|---|
| 492 | /* RT ==> IBM PC/RT */
|
|---|
| 493 | /* HP_PA ==> HP9000/700 & /800 */
|
|---|
| 494 | /* HP/UX, LINUX */
|
|---|
| 495 | /* SPARC ==> SPARC v7/v8/v9 */
|
|---|
| 496 | /* (SUNOS4, SUNOS5, LINUX, */
|
|---|
| 497 | /* DRSNX variants) */
|
|---|
| 498 | /* ALPHA ==> DEC Alpha */
|
|---|
| 499 | /* (OSF1 and LINUX variants) */
|
|---|
| 500 | /* M88K ==> Motorola 88XX0 */
|
|---|
| 501 | /* (CX_UX and DGUX) */
|
|---|
| 502 | /* S370 ==> 370-like machine */
|
|---|
| 503 | /* running Amdahl UTS4 */
|
|---|
| 504 | /* S390 ==> 390-like machine */
|
|---|
| 505 | /* running LINUX */
|
|---|
| 506 | /* ARM32 ==> Intel StrongARM */
|
|---|
| 507 | /* IA64 ==> Intel IPF */
|
|---|
| 508 | /* (e.g. Itanium) */
|
|---|
| 509 | /* (LINUX and HPUX) */
|
|---|
| 510 | /* SH ==> Hitachi SuperH */
|
|---|
| 511 | /* (LINUX & MSWINCE) */
|
|---|
| 512 | /* X86_64 ==> AMD x86-64 */
|
|---|
| 513 | /* POWERPC ==> IBM/Apple PowerPC */
|
|---|
| 514 | /* (MACOS(<=9),DARWIN(incl.MACOSX),*/
|
|---|
| 515 | /* LINUX, NETBSD, NOSYS variants) */
|
|---|
| 516 | /* Handles 32 and 64-bit variants. */
|
|---|
| 517 | /* AIX should be handled here, but */
|
|---|
| 518 | /* that's called an RS6000. */
|
|---|
| 519 | /* CRIS ==> Axis Etrax */
|
|---|
| 520 | /* M32R ==> Renesas M32R */
|
|---|
| 521 |
|
|---|
| 522 |
|
|---|
| 523 | /*
|
|---|
| 524 | * For each architecture and OS, the following need to be defined:
|
|---|
| 525 | *
|
|---|
| 526 | * CPP_WORDSZ is a simple integer constant representing the word size.
|
|---|
| 527 | * in bits. We assume byte addressibility, where a byte has 8 bits.
|
|---|
| 528 | * We also assume CPP_WORDSZ is either 32 or 64.
|
|---|
| 529 | * (We care about the length of pointers, not hardware
|
|---|
| 530 | * bus widths. Thus a 64 bit processor with a C compiler that uses
|
|---|
| 531 | * 32 bit pointers should use CPP_WORDSZ of 32, not 64. Default is 32.)
|
|---|
| 532 | *
|
|---|
| 533 | * MACH_TYPE is a string representation of the machine type.
|
|---|
| 534 | * OS_TYPE is analogous for the OS.
|
|---|
| 535 | *
|
|---|
| 536 | * ALIGNMENT is the largest N, such that
|
|---|
| 537 | * all pointer are guaranteed to be aligned on N byte boundaries.
|
|---|
| 538 | * defining it to be 1 will always work, but perform poorly.
|
|---|
| 539 | *
|
|---|
| 540 | * DATASTART is the beginning of the data segment.
|
|---|
| 541 | * On some platforms SEARCH_FOR_DATA_START is defined.
|
|---|
| 542 | * SEARCH_FOR_DATASTART will cause GC_data_start to
|
|---|
| 543 | * be set to an address determined by accessing data backwards from _end
|
|---|
| 544 | * until an unmapped page is found. DATASTART will be defined to be
|
|---|
| 545 | * GC_data_start.
|
|---|
| 546 | * On UNIX-like systems, the collector will scan the area between DATASTART
|
|---|
| 547 | * and DATAEND for root pointers.
|
|---|
| 548 | *
|
|---|
| 549 | * DATAEND, if not `end' where `end' is defined as ``extern int end[];''.
|
|---|
| 550 | * RTH suggests gaining access to linker script synth'd values with
|
|---|
| 551 | * this idiom instead of `&end' where `end' is defined as ``extern int end;'' .
|
|---|
| 552 | * Otherwise, ``GCC will assume these are in .sdata/.sbss'' and it will, e.g.,
|
|---|
| 553 | * cause failures on alpha*-*-* with ``-msmall-data or -fpic'' or mips-*-*
|
|---|
| 554 | * without any special options.
|
|---|
| 555 | *
|
|---|
| 556 | * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
|
|---|
| 557 | * the pointer size.
|
|---|
| 558 | *
|
|---|
| 559 | * STACKBOTTOM is the cool end of the stack, which is usually the
|
|---|
| 560 | * highest address in the stack.
|
|---|
| 561 | * Under PCR or OS/2, we have other ways of finding thread stacks.
|
|---|
| 562 | * For each machine, the following should:
|
|---|
| 563 | * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
|
|---|
| 564 | * 2) define exactly one of
|
|---|
| 565 | * STACKBOTTOM (should be defined to be an expression)
|
|---|
| 566 | * LINUX_STACKBOTTOM
|
|---|
| 567 | * HEURISTIC1
|
|---|
| 568 | * HEURISTIC2
|
|---|
| 569 | * If STACKBOTTOM is defined, then it's value will be used directly as the
|
|---|
| 570 | * stack base. If LINUX_STACKBOTTOM is defined, then it will be determined
|
|---|
| 571 | * with a method appropriate for most Linux systems. Currently we look
|
|---|
| 572 | * first for __libc_stack_end, and if that fails read it from /proc.
|
|---|
| 573 | * If either of the last two macros are defined, then STACKBOTTOM is computed
|
|---|
| 574 | * during collector startup using one of the following two heuristics:
|
|---|
| 575 | * HEURISTIC1: Take an address inside GC_init's frame, and round it up to
|
|---|
| 576 | * the next multiple of STACK_GRAN.
|
|---|
| 577 | * HEURISTIC2: Take an address inside GC_init's frame, increment it repeatedly
|
|---|
| 578 | * in small steps (decrement if STACK_GROWS_UP), and read the value
|
|---|
| 579 | * at each location. Remember the value when the first
|
|---|
| 580 | * Segmentation violation or Bus error is signalled. Round that
|
|---|
| 581 | * to the nearest plausible page boundary, and use that instead
|
|---|
| 582 | * of STACKBOTTOM.
|
|---|
| 583 | *
|
|---|
| 584 | * Gustavo Rodriguez-Rivera points out that on most (all?) Unix machines,
|
|---|
| 585 | * the value of environ is a pointer that can serve as STACKBOTTOM.
|
|---|
| 586 | * I expect that HEURISTIC2 can be replaced by this approach, which
|
|---|
| 587 | * interferes far less with debugging. However it has the disadvantage
|
|---|
| 588 | * that it's confused by a putenv call before the collector is initialized.
|
|---|
| 589 | * This could be dealt with by intercepting putenv ...
|
|---|
| 590 | *
|
|---|
| 591 | * If no expression for STACKBOTTOM can be found, and neither of the above
|
|---|
| 592 | * heuristics are usable, the collector can still be used with all of the above
|
|---|
| 593 | * undefined, provided one of the following is done:
|
|---|
| 594 | * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
|
|---|
| 595 | * without reference to STACKBOTTOM. This is appropriate for use in
|
|---|
| 596 | * conjunction with thread packages, since there will be multiple stacks.
|
|---|
| 597 | * (Allocating thread stacks in the heap, and treating them as ordinary
|
|---|
| 598 | * heap data objects is also possible as a last resort. However, this is
|
|---|
| 599 | * likely to introduce significant amounts of excess storage retention
|
|---|
| 600 | * unless the dead parts of the thread stacks are periodically cleared.)
|
|---|
| 601 | * 2) Client code may set GC_stackbottom before calling any GC_ routines.
|
|---|
| 602 | * If the author of the client code controls the main program, this is
|
|---|
| 603 | * easily accomplished by introducing a new main program, setting
|
|---|
| 604 | * GC_stackbottom to the address of a local variable, and then calling
|
|---|
| 605 | * the original main program. The new main program would read something
|
|---|
| 606 | * like:
|
|---|
| 607 | *
|
|---|
| 608 | * # include "gc_private.h"
|
|---|
| 609 | *
|
|---|
| 610 | * main(argc, argv, envp)
|
|---|
| 611 | * int argc;
|
|---|
| 612 | * char **argv, **envp;
|
|---|
| 613 | * {
|
|---|
| 614 | * int dummy;
|
|---|
| 615 | *
|
|---|
| 616 | * GC_stackbottom = (ptr_t)(&dummy);
|
|---|
| 617 | * return(real_main(argc, argv, envp));
|
|---|
| 618 | * }
|
|---|
| 619 | *
|
|---|
| 620 | *
|
|---|
| 621 | * Each architecture may also define the style of virtual dirty bit
|
|---|
| 622 | * implementation to be used:
|
|---|
| 623 | * MPROTECT_VDB: Write protect the heap and catch faults.
|
|---|
| 624 | * PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
|
|---|
| 625 | *
|
|---|
| 626 | * An architecture may define DYNAMIC_LOADING if dynamic_load.c
|
|---|
| 627 | * defined GC_register_dynamic_libraries() for the architecture.
|
|---|
| 628 | *
|
|---|
| 629 | * An architecture may define PREFETCH(x) to preload the cache with *x.
|
|---|
| 630 | * This defaults to a no-op.
|
|---|
| 631 | *
|
|---|
| 632 | * PREFETCH_FOR_WRITE(x) is used if *x is about to be written.
|
|---|
| 633 | *
|
|---|
| 634 | * An architecture may also define CLEAR_DOUBLE(x) to be a fast way to
|
|---|
| 635 | * clear the two words at GC_malloc-aligned address x. By default,
|
|---|
| 636 | * word stores of 0 are used instead.
|
|---|
| 637 | *
|
|---|
| 638 | * HEAP_START may be defined as the initial address hint for mmap-based
|
|---|
| 639 | * allocation.
|
|---|
| 640 | */
|
|---|
| 641 |
|
|---|
| 642 | /* If we are using a recent version of gcc, we can use __builtin_unwind_init()
|
|---|
| 643 | * to push the relevant registers onto the stack. This generally makes
|
|---|
| 644 | * USE_GENERIC_PUSH_REGS the preferred approach for marking from registers.
|
|---|
| 645 | */
|
|---|
| 646 | # if defined(__GNUC__) && ((__GNUC__ >= 3) || \
|
|---|
| 647 | (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) \
|
|---|
| 648 | && !defined(__INTEL_COMPILER) \
|
|---|
| 649 | && !defined(__PATHCC__)
|
|---|
| 650 | # define HAVE_BUILTIN_UNWIND_INIT
|
|---|
| 651 | # endif
|
|---|
| 652 |
|
|---|
| 653 | # define STACK_GRAN 0x1000000
|
|---|
| 654 | # ifdef M68K
|
|---|
| 655 | # define MACH_TYPE "M68K"
|
|---|
| 656 | # define ALIGNMENT 2
|
|---|
| 657 | # ifdef OPENBSD
|
|---|
| 658 | # define OS_TYPE "OPENBSD"
|
|---|
| 659 | # define HEURISTIC2
|
|---|
| 660 | # ifdef __ELF__
|
|---|
| 661 | # define DATASTART GC_data_start
|
|---|
| 662 | # define DYNAMIC_LOADING
|
|---|
| 663 | # else
|
|---|
| 664 | extern char etext[];
|
|---|
| 665 | # define DATASTART ((ptr_t)(etext))
|
|---|
| 666 | # endif
|
|---|
| 667 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 668 | # endif
|
|---|
| 669 | # ifdef NETBSD
|
|---|
| 670 | # define OS_TYPE "NETBSD"
|
|---|
| 671 | # define HEURISTIC2
|
|---|
| 672 | # ifdef __ELF__
|
|---|
| 673 | # define DATASTART GC_data_start
|
|---|
| 674 | # define DYNAMIC_LOADING
|
|---|
| 675 | # else
|
|---|
| 676 | extern char etext[];
|
|---|
| 677 | # define DATASTART ((ptr_t)(etext))
|
|---|
| 678 | # endif
|
|---|
| 679 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 680 | # endif
|
|---|
| 681 | # ifdef LINUX
|
|---|
| 682 | # define OS_TYPE "LINUX"
|
|---|
| 683 | # define STACKBOTTOM ((ptr_t)0xf0000000)
|
|---|
| 684 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 685 | /* We never got around to the assembly version. */
|
|---|
| 686 | /* # define MPROTECT_VDB - Reported to not work 9/17/01 */
|
|---|
| 687 | # ifdef __ELF__
|
|---|
| 688 | # define DYNAMIC_LOADING
|
|---|
| 689 | # include <features.h>
|
|---|
| 690 | # if defined(__GLIBC__)&& __GLIBC__>=2
|
|---|
| 691 | # define SEARCH_FOR_DATA_START
|
|---|
| 692 | # else /* !GLIBC2 */
|
|---|
| 693 | extern char **__environ;
|
|---|
| 694 | # define DATASTART ((ptr_t)(&__environ))
|
|---|
| 695 | /* hideous kludge: __environ is the first */
|
|---|
| 696 | /* word in crt0.o, and delimits the start */
|
|---|
| 697 | /* of the data segment, no matter which */
|
|---|
| 698 | /* ld options were passed through. */
|
|---|
| 699 | /* We could use _etext instead, but that */
|
|---|
| 700 | /* would include .rodata, which may */
|
|---|
| 701 | /* contain large read-only data tables */
|
|---|
| 702 | /* that we'd rather not scan. */
|
|---|
| 703 | # endif /* !GLIBC2 */
|
|---|
| 704 | extern int _end[];
|
|---|
| 705 | # define DATAEND (_end)
|
|---|
| 706 | # else
|
|---|
| 707 | extern int etext[];
|
|---|
| 708 | # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
|
|---|
| 709 | # endif
|
|---|
| 710 | # endif
|
|---|
| 711 | # ifdef SUNOS4
|
|---|
| 712 | # define OS_TYPE "SUNOS4"
|
|---|
| 713 | extern char etext[];
|
|---|
| 714 | # define DATASTART ((ptr_t)((((word) (etext)) + 0x1ffff) & ~0x1ffff))
|
|---|
| 715 | # define HEURISTIC1 /* differs */
|
|---|
| 716 | # define DYNAMIC_LOADING
|
|---|
| 717 | # endif
|
|---|
| 718 | # ifdef HP
|
|---|
| 719 | # define OS_TYPE "HP"
|
|---|
| 720 | extern char etext[];
|
|---|
| 721 | # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
|
|---|
| 722 | # define STACKBOTTOM ((ptr_t) 0xffeffffc)
|
|---|
| 723 | /* empirically determined. seems to work. */
|
|---|
| 724 | # include <unistd.h>
|
|---|
| 725 | # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
|
|---|
| 726 | # endif
|
|---|
| 727 | # ifdef SYSV
|
|---|
| 728 | # define OS_TYPE "SYSV"
|
|---|
| 729 | extern etext[];
|
|---|
| 730 | # define DATASTART ((ptr_t)((((word) (etext)) + 0x3fffff) \
|
|---|
| 731 | & ~0x3fffff) \
|
|---|
| 732 | +((word)etext & 0x1fff))
|
|---|
| 733 | /* This only works for shared-text binaries with magic number 0413.
|
|---|
| 734 | The other sorts of SysV binaries put the data at the end of the text,
|
|---|
| 735 | in which case the default of etext would work. Unfortunately,
|
|---|
| 736 | handling both would require having the magic-number available.
|
|---|
| 737 | -- Parag
|
|---|
| 738 | */
|
|---|
| 739 | # define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
|
|---|
| 740 | /* The stack starts at the top of memory, but */
|
|---|
| 741 | /* 0x0 cannot be used as setjump_test complains */
|
|---|
| 742 | /* that the stack direction is incorrect. Two */
|
|---|
| 743 | /* bytes down from 0x0 should be safe enough. */
|
|---|
| 744 | /* --Parag */
|
|---|
| 745 | # include <sys/mmu.h>
|
|---|
| 746 | # define GETPAGESIZE() PAGESIZE /* Is this still right? */
|
|---|
| 747 | # endif
|
|---|
| 748 | # ifdef AMIGA
|
|---|
| 749 | # define OS_TYPE "AMIGA"
|
|---|
| 750 | /* STACKBOTTOM and DATASTART handled specially */
|
|---|
| 751 | /* in os_dep.c */
|
|---|
| 752 | # define DATAEND /* not needed */
|
|---|
| 753 | # define GETPAGESIZE() 4096
|
|---|
| 754 | # endif
|
|---|
| 755 | # ifdef MACOS
|
|---|
| 756 | # ifndef __LOWMEM__
|
|---|
| 757 | # include <LowMem.h>
|
|---|
| 758 | # endif
|
|---|
| 759 | # define OS_TYPE "MACOS"
|
|---|
| 760 | /* see os_dep.c for details of global data segments. */
|
|---|
| 761 | # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
|
|---|
| 762 | # define DATAEND /* not needed */
|
|---|
| 763 | # define GETPAGESIZE() 4096
|
|---|
| 764 | # endif
|
|---|
| 765 | # ifdef NEXT
|
|---|
| 766 | # define OS_TYPE "NEXT"
|
|---|
| 767 | # define DATASTART ((ptr_t) get_etext())
|
|---|
| 768 | # define STACKBOTTOM ((ptr_t) 0x4000000)
|
|---|
| 769 | # define DATAEND /* not needed */
|
|---|
| 770 | # endif
|
|---|
| 771 | # endif
|
|---|
| 772 |
|
|---|
| 773 | # if defined(POWERPC)
|
|---|
| 774 | # define MACH_TYPE "POWERPC"
|
|---|
| 775 | # ifdef MACOS
|
|---|
| 776 | # define ALIGNMENT 2 /* Still necessary? Could it be 4? */
|
|---|
| 777 | # ifndef __LOWMEM__
|
|---|
| 778 | # include <LowMem.h>
|
|---|
| 779 | # endif
|
|---|
| 780 | # define OS_TYPE "MACOS"
|
|---|
| 781 | /* see os_dep.c for details of global data segments. */
|
|---|
| 782 | # define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
|
|---|
| 783 | # define DATAEND /* not needed */
|
|---|
| 784 | # endif
|
|---|
| 785 | # ifdef LINUX
|
|---|
| 786 | # if defined(__powerpc64__)
|
|---|
| 787 | # define ALIGNMENT 8
|
|---|
| 788 | # define CPP_WORDSZ 64
|
|---|
| 789 | # ifndef HBLKSIZE
|
|---|
| 790 | # define HBLKSIZE 4096
|
|---|
| 791 | # endif
|
|---|
| 792 | # else
|
|---|
| 793 | # define ALIGNMENT 4
|
|---|
| 794 | # endif
|
|---|
| 795 | # define OS_TYPE "LINUX"
|
|---|
| 796 | /* HEURISTIC1 has been reliably reported to fail for a 32-bit */
|
|---|
| 797 | /* executable on a 64 bit kernel. */
|
|---|
| 798 | # define LINUX_STACKBOTTOM
|
|---|
| 799 | # define DYNAMIC_LOADING
|
|---|
| 800 | # define SEARCH_FOR_DATA_START
|
|---|
| 801 | extern int _end[];
|
|---|
| 802 | # define DATAEND (_end)
|
|---|
| 803 | # endif
|
|---|
| 804 | # ifdef DARWIN
|
|---|
| 805 | # ifdef __ppc64__
|
|---|
| 806 | # define ALIGNMENT 8
|
|---|
| 807 | # define CPP_WORDSZ 64
|
|---|
| 808 | # else
|
|---|
| 809 | # define ALIGNMENT 4
|
|---|
| 810 | # endif
|
|---|
| 811 | # define OS_TYPE "DARWIN"
|
|---|
| 812 | # define DYNAMIC_LOADING
|
|---|
| 813 | /* XXX: see get_end(3), get_etext() and get_end() should not be used.
|
|---|
| 814 | These aren't used when dyld support is enabled (it is by default) */
|
|---|
| 815 | # define DATASTART ((ptr_t) get_etext())
|
|---|
| 816 | # define DATAEND ((ptr_t) get_end())
|
|---|
| 817 | # define STACKBOTTOM ((ptr_t) 0xc0000000)
|
|---|
| 818 | # define USE_MMAP
|
|---|
| 819 | # define USE_MMAP_ANON
|
|---|
| 820 | # define USE_ASM_PUSH_REGS
|
|---|
| 821 | /* This is potentially buggy. It needs more testing. See the comments in
|
|---|
| 822 | os_dep.c. It relies on threads to track writes. */
|
|---|
| 823 | # ifdef GC_DARWIN_THREADS
|
|---|
| 824 | /* # define MPROTECT_VDB -- diabled for now. May work for some apps. */
|
|---|
| 825 | # endif
|
|---|
| 826 | # include <unistd.h>
|
|---|
| 827 | # define GETPAGESIZE() getpagesize()
|
|---|
| 828 | # if defined(USE_PPC_PREFETCH) && defined(__GNUC__)
|
|---|
| 829 | /* The performance impact of prefetches is untested */
|
|---|
| 830 | # define PREFETCH(x) \
|
|---|
| 831 | __asm__ __volatile__ ("dcbt 0,%0" : : "r" ((const void *) (x)))
|
|---|
| 832 | # define PREFETCH_FOR_WRITE(x) \
|
|---|
| 833 | __asm__ __volatile__ ("dcbtst 0,%0" : : "r" ((const void *) (x)))
|
|---|
| 834 | # endif
|
|---|
| 835 | /* There seems to be some issues with trylock hanging on darwin. This
|
|---|
| 836 | should be looked into some more */
|
|---|
| 837 | # define NO_PTHREAD_TRYLOCK
|
|---|
| 838 | # endif
|
|---|
| 839 | # ifdef FREEBSD
|
|---|
| 840 | # define ALIGNMENT 4
|
|---|
| 841 | # define OS_TYPE "FREEBSD"
|
|---|
| 842 | # ifndef GC_FREEBSD_THREADS
|
|---|
| 843 | # define MPROTECT_VDB
|
|---|
| 844 | # endif
|
|---|
| 845 | # define SIG_SUSPEND SIGUSR1
|
|---|
| 846 | # define SIG_THR_RESTART SIGUSR2
|
|---|
| 847 | # define FREEBSD_STACKBOTTOM
|
|---|
| 848 | # ifdef __ELF__
|
|---|
| 849 | # define DYNAMIC_LOADING
|
|---|
| 850 | # endif
|
|---|
| 851 | extern char etext[];
|
|---|
| 852 | extern char * GC_FreeBSDGetDataStart();
|
|---|
| 853 | # define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
|
|---|
| 854 | # endif
|
|---|
| 855 | # ifdef NETBSD
|
|---|
| 856 | # define ALIGNMENT 4
|
|---|
| 857 | # define OS_TYPE "NETBSD"
|
|---|
| 858 | # define HEURISTIC2
|
|---|
| 859 | extern char etext[];
|
|---|
| 860 | # define DATASTART GC_data_start
|
|---|
| 861 | # define DYNAMIC_LOADING
|
|---|
| 862 | # endif
|
|---|
| 863 | # ifdef NOSYS
|
|---|
| 864 | # define ALIGNMENT 4
|
|---|
| 865 | # define OS_TYPE "NOSYS"
|
|---|
| 866 | extern void __end[], __dso_handle[];
|
|---|
| 867 | # define DATASTART (__dso_handle) /* OK, that's ugly. */
|
|---|
| 868 | # define DATAEND (__end)
|
|---|
| 869 | /* Stack starts at 0xE0000000 for the simulator. */
|
|---|
| 870 | # undef STACK_GRAN
|
|---|
| 871 | # define STACK_GRAN 0x10000000
|
|---|
| 872 | # define HEURISTIC1
|
|---|
| 873 | # endif
|
|---|
| 874 | # endif
|
|---|
| 875 |
|
|---|
| 876 | # ifdef VAX
|
|---|
| 877 | # define MACH_TYPE "VAX"
|
|---|
| 878 | # define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */
|
|---|
| 879 | extern char etext[];
|
|---|
| 880 | # define DATASTART ((ptr_t)(etext))
|
|---|
| 881 | # ifdef BSD
|
|---|
| 882 | # define OS_TYPE "BSD"
|
|---|
| 883 | # define HEURISTIC1
|
|---|
| 884 | /* HEURISTIC2 may be OK, but it's hard to test. */
|
|---|
| 885 | # endif
|
|---|
| 886 | # ifdef ULTRIX
|
|---|
| 887 | # define OS_TYPE "ULTRIX"
|
|---|
| 888 | # define STACKBOTTOM ((ptr_t) 0x7fffc800)
|
|---|
| 889 | # endif
|
|---|
| 890 | # endif
|
|---|
| 891 |
|
|---|
| 892 | # ifdef RT
|
|---|
| 893 | # define MACH_TYPE "RT"
|
|---|
| 894 | # define ALIGNMENT 4
|
|---|
| 895 | # define DATASTART ((ptr_t) 0x10000000)
|
|---|
| 896 | # define STACKBOTTOM ((ptr_t) 0x1fffd800)
|
|---|
| 897 | # endif
|
|---|
| 898 |
|
|---|
| 899 | # ifdef SPARC
|
|---|
| 900 | # define MACH_TYPE "SPARC"
|
|---|
| 901 | # if defined(__arch64__) || defined(__sparcv9)
|
|---|
| 902 | # define ALIGNMENT 8
|
|---|
| 903 | # define CPP_WORDSZ 64
|
|---|
| 904 | # define ELF_CLASS ELFCLASS64
|
|---|
| 905 | # else
|
|---|
| 906 | # define ALIGNMENT 4 /* Required by hardware */
|
|---|
| 907 | # define CPP_WORDSZ 32
|
|---|
| 908 | # endif
|
|---|
| 909 | # define ALIGN_DOUBLE
|
|---|
| 910 | # ifdef SUNOS5
|
|---|
| 911 | # define OS_TYPE "SUNOS5"
|
|---|
| 912 | extern int _etext[];
|
|---|
| 913 | extern int _end[];
|
|---|
| 914 | extern ptr_t GC_SysVGetDataStart();
|
|---|
| 915 | # define DATASTART GC_SysVGetDataStart(0x10000, _etext)
|
|---|
| 916 | # define DATAEND (_end)
|
|---|
| 917 | # if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
|
|---|
| 918 | # define USE_MMAP
|
|---|
| 919 | /* Otherwise we now use calloc. Mmap may result in the */
|
|---|
| 920 | /* heap interleaved with thread stacks, which can result in */
|
|---|
| 921 | /* excessive blacklisting. Sbrk is unusable since it */
|
|---|
| 922 | /* doesn't interact correctly with the system malloc. */
|
|---|
| 923 | # endif
|
|---|
| 924 | # ifdef USE_MMAP
|
|---|
| 925 | # define HEAP_START (ptr_t)0x40000000
|
|---|
| 926 | # else
|
|---|
| 927 | # define HEAP_START DATAEND
|
|---|
| 928 | # endif
|
|---|
| 929 | # define PROC_VDB
|
|---|
| 930 | /* HEURISTIC1 reportedly no longer works under 2.7. */
|
|---|
| 931 | /* HEURISTIC2 probably works, but this appears to be preferable. */
|
|---|
| 932 | /* Apparently USRSTACK is defined to be USERLIMIT, but in some */
|
|---|
| 933 | /* installations that's undefined. We work around this with a */
|
|---|
| 934 | /* gross hack: */
|
|---|
| 935 | # include <sys/vmparam.h>
|
|---|
| 936 | # ifdef USERLIMIT
|
|---|
| 937 | /* This should work everywhere, but doesn't. */
|
|---|
| 938 | # define STACKBOTTOM USRSTACK
|
|---|
| 939 | # else
|
|---|
| 940 | # define HEURISTIC2
|
|---|
| 941 | # endif
|
|---|
| 942 | # include <unistd.h>
|
|---|
| 943 | # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
|
|---|
| 944 | /* getpagesize() appeared to be missing from at least one */
|
|---|
| 945 | /* Solaris 5.4 installation. Weird. */
|
|---|
| 946 | # define DYNAMIC_LOADING
|
|---|
| 947 | # endif
|
|---|
| 948 | # ifdef SUNOS4
|
|---|
| 949 | # define OS_TYPE "SUNOS4"
|
|---|
| 950 | /* [If you have a weak stomach, don't read this.] */
|
|---|
| 951 | /* We would like to use: */
|
|---|
| 952 | /* # define DATASTART ((ptr_t)((((word) (etext)) + 0x1fff) & ~0x1fff)) */
|
|---|
| 953 | /* This fails occasionally, due to an ancient, but very */
|
|---|
| 954 | /* persistent ld bug. etext is set 32 bytes too high. */
|
|---|
| 955 | /* We instead read the text segment size from the a.out */
|
|---|
| 956 | /* header, which happens to be mapped into our address space */
|
|---|
| 957 | /* at the start of the text segment. The detective work here */
|
|---|
| 958 | /* was done by Robert Ehrlich, Manuel Serrano, and Bernard */
|
|---|
| 959 | /* Serpette of INRIA. */
|
|---|
| 960 | /* This assumes ZMAGIC, i.e. demand-loadable executables. */
|
|---|
| 961 | # define TEXTSTART 0x2000
|
|---|
| 962 | # define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
|
|---|
| 963 | # define MPROTECT_VDB
|
|---|
| 964 | # define HEURISTIC1
|
|---|
| 965 | # define DYNAMIC_LOADING
|
|---|
| 966 | # endif
|
|---|
| 967 | # ifdef DRSNX
|
|---|
| 968 | # define OS_TYPE "DRSNX"
|
|---|
| 969 | extern ptr_t GC_SysVGetDataStart();
|
|---|
| 970 | extern int etext[];
|
|---|
| 971 | # define DATASTART GC_SysVGetDataStart(0x10000, etext)
|
|---|
| 972 | # define MPROTECT_VDB
|
|---|
| 973 | # define STACKBOTTOM ((ptr_t) 0xdfff0000)
|
|---|
| 974 | # define DYNAMIC_LOADING
|
|---|
| 975 | # endif
|
|---|
| 976 | # ifdef LINUX
|
|---|
| 977 | # define OS_TYPE "LINUX"
|
|---|
| 978 | # ifdef __ELF__
|
|---|
| 979 | # define DYNAMIC_LOADING
|
|---|
| 980 | # else
|
|---|
| 981 | Linux Sparc/a.out not supported
|
|---|
| 982 | # endif
|
|---|
| 983 | extern int _end[];
|
|---|
| 984 | extern int _etext[];
|
|---|
| 985 | # define DATAEND (_end)
|
|---|
| 986 | # define SVR4
|
|---|
| 987 | extern ptr_t GC_SysVGetDataStart();
|
|---|
| 988 | # ifdef __arch64__
|
|---|
| 989 | # define DATASTART GC_SysVGetDataStart(0x100000, _etext)
|
|---|
| 990 | # else
|
|---|
| 991 | # define DATASTART GC_SysVGetDataStart(0x10000, _etext)
|
|---|
| 992 | # endif
|
|---|
| 993 | # define LINUX_STACKBOTTOM
|
|---|
| 994 | # endif
|
|---|
| 995 | # ifdef OPENBSD
|
|---|
| 996 | # define OS_TYPE "OPENBSD"
|
|---|
| 997 | # define STACKBOTTOM ((ptr_t) 0xf8000000)
|
|---|
| 998 | extern int etext[];
|
|---|
| 999 | # define DATASTART ((ptr_t)(etext))
|
|---|
| 1000 | # endif
|
|---|
| 1001 | # ifdef NETBSD
|
|---|
| 1002 | # define OS_TYPE "NETBSD"
|
|---|
| 1003 | # define HEURISTIC2
|
|---|
| 1004 | # ifdef __ELF__
|
|---|
| 1005 | # define DATASTART GC_data_start
|
|---|
| 1006 | # define DYNAMIC_LOADING
|
|---|
| 1007 | # else
|
|---|
| 1008 | extern char etext[];
|
|---|
| 1009 | # define DATASTART ((ptr_t)(etext))
|
|---|
| 1010 | # endif
|
|---|
| 1011 | # endif
|
|---|
| 1012 | # ifdef FREEBSD
|
|---|
| 1013 | # define OS_TYPE "FREEBSD"
|
|---|
| 1014 | # define SIG_SUSPEND SIGUSR1
|
|---|
| 1015 | # define SIG_THR_RESTART SIGUSR2
|
|---|
| 1016 | # define FREEBSD_STACKBOTTOM
|
|---|
| 1017 | # ifdef __ELF__
|
|---|
| 1018 | # define DYNAMIC_LOADING
|
|---|
| 1019 | # endif
|
|---|
| 1020 | extern char etext[];
|
|---|
| 1021 | extern char edata[];
|
|---|
| 1022 | extern char end[];
|
|---|
| 1023 | # define NEED_FIND_LIMIT
|
|---|
| 1024 | # define DATASTART ((ptr_t)(&etext))
|
|---|
| 1025 | # define DATAEND (GC_find_limit (DATASTART, TRUE))
|
|---|
| 1026 | # define DATASTART2 ((ptr_t)(&edata))
|
|---|
| 1027 | # define DATAEND2 ((ptr_t)(&end))
|
|---|
| 1028 | # endif
|
|---|
| 1029 | # endif
|
|---|
| 1030 |
|
|---|
| 1031 | # ifdef I386
|
|---|
| 1032 | # define MACH_TYPE "I386"
|
|---|
| 1033 | # if defined(__LP64__) || defined(_WIN64)
|
|---|
| 1034 | # define CPP_WORDSZ 64
|
|---|
| 1035 | # define ALIGNMENT 8
|
|---|
| 1036 | # else
|
|---|
| 1037 | # define CPP_WORDSZ 32
|
|---|
| 1038 | # define ALIGNMENT 4
|
|---|
| 1039 | /* Appears to hold for all "32 bit" compilers */
|
|---|
| 1040 | /* except Borland. The -a4 option fixes */
|
|---|
| 1041 | /* Borland. */
|
|---|
| 1042 | /* Ivan Demakov: For Watcom the option is -zp4. */
|
|---|
| 1043 | # endif
|
|---|
| 1044 | # ifndef SMALL_CONFIG
|
|---|
| 1045 | # define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */
|
|---|
| 1046 | /* improvement on Pentiums. */
|
|---|
| 1047 | # endif
|
|---|
| 1048 | # ifdef HAVE_BUILTIN_UNWIND_INIT
|
|---|
| 1049 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1050 | # endif
|
|---|
| 1051 | # ifdef SEQUENT
|
|---|
| 1052 | # define OS_TYPE "SEQUENT"
|
|---|
| 1053 | extern int etext[];
|
|---|
| 1054 | # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
|
|---|
| 1055 | # define STACKBOTTOM ((ptr_t) 0x3ffff000)
|
|---|
| 1056 | # endif
|
|---|
| 1057 | # ifdef BEOS
|
|---|
| 1058 | # define OS_TYPE "BEOS"
|
|---|
| 1059 | # include <OS.h>
|
|---|
| 1060 | # define GETPAGESIZE() B_PAGE_SIZE
|
|---|
| 1061 | extern int etext[];
|
|---|
| 1062 | # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
|
|---|
| 1063 | # endif
|
|---|
| 1064 | # ifdef SUNOS5
|
|---|
| 1065 | # define OS_TYPE "SUNOS5"
|
|---|
| 1066 | extern int _etext[], _end[];
|
|---|
| 1067 | extern ptr_t GC_SysVGetDataStart();
|
|---|
| 1068 | # define DATASTART GC_SysVGetDataStart(0x1000, _etext)
|
|---|
| 1069 | # define DATAEND (_end)
|
|---|
| 1070 | /* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */
|
|---|
| 1071 | /* but reportedly breaks under 2.8. It appears that the stack */
|
|---|
| 1072 | /* base is a property of the executable, so this should not break */
|
|---|
| 1073 | /* old executables. */
|
|---|
| 1074 | /* HEURISTIC2 probably works, but this appears to be preferable. */
|
|---|
| 1075 | # include <sys/vm.h>
|
|---|
| 1076 | # define STACKBOTTOM USRSTACK
|
|---|
| 1077 | /* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
|
|---|
| 1078 | /* It appears to be fixed in 2.8 and 2.9. */
|
|---|
| 1079 | # ifdef SOLARIS25_PROC_VDB_BUG_FIXED
|
|---|
| 1080 | # define PROC_VDB
|
|---|
| 1081 | # endif
|
|---|
| 1082 | # define DYNAMIC_LOADING
|
|---|
| 1083 | # if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
|
|---|
| 1084 | # define USE_MMAP
|
|---|
| 1085 | /* Otherwise we now use calloc. Mmap may result in the */
|
|---|
| 1086 | /* heap interleaved with thread stacks, which can result in */
|
|---|
| 1087 | /* excessive blacklisting. Sbrk is unusable since it */
|
|---|
| 1088 | /* doesn't interact correctly with the system malloc. */
|
|---|
| 1089 | # endif
|
|---|
| 1090 | # ifdef USE_MMAP
|
|---|
| 1091 | # define HEAP_START (ptr_t)0x40000000
|
|---|
| 1092 | # else
|
|---|
| 1093 | # define HEAP_START DATAEND
|
|---|
| 1094 | # endif
|
|---|
| 1095 | # endif
|
|---|
| 1096 | # ifdef SCO
|
|---|
| 1097 | # define OS_TYPE "SCO"
|
|---|
| 1098 | extern int etext[];
|
|---|
| 1099 | # define DATASTART ((ptr_t)((((word) (etext)) + 0x3fffff) \
|
|---|
| 1100 | & ~0x3fffff) \
|
|---|
| 1101 | +((word)etext & 0xfff))
|
|---|
| 1102 | # define STACKBOTTOM ((ptr_t) 0x7ffffffc)
|
|---|
| 1103 | # endif
|
|---|
| 1104 | # ifdef SCO_ELF
|
|---|
| 1105 | # define OS_TYPE "SCO_ELF"
|
|---|
| 1106 | extern int etext[];
|
|---|
| 1107 | # define DATASTART ((ptr_t)(etext))
|
|---|
| 1108 | # define STACKBOTTOM ((ptr_t) 0x08048000)
|
|---|
| 1109 | # define DYNAMIC_LOADING
|
|---|
| 1110 | # define ELF_CLASS ELFCLASS32
|
|---|
| 1111 | # endif
|
|---|
| 1112 | # ifdef DGUX
|
|---|
| 1113 | # define OS_TYPE "DGUX"
|
|---|
| 1114 | extern int _etext, _end;
|
|---|
| 1115 | extern ptr_t GC_SysVGetDataStart();
|
|---|
| 1116 | # define DATASTART GC_SysVGetDataStart(0x1000, &_etext)
|
|---|
| 1117 | # define DATAEND (&_end)
|
|---|
| 1118 | # define STACK_GROWS_DOWN
|
|---|
| 1119 | # define HEURISTIC2
|
|---|
| 1120 | # include <unistd.h>
|
|---|
| 1121 | # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
|
|---|
| 1122 | # define DYNAMIC_LOADING
|
|---|
| 1123 | # ifndef USE_MMAP
|
|---|
| 1124 | # define USE_MMAP
|
|---|
| 1125 | # endif /* USE_MMAP */
|
|---|
| 1126 | # define MAP_FAILED (void *) -1
|
|---|
| 1127 | # ifdef USE_MMAP
|
|---|
| 1128 | # define HEAP_START (ptr_t)0x40000000
|
|---|
| 1129 | # else /* USE_MMAP */
|
|---|
| 1130 | # define HEAP_START DATAEND
|
|---|
| 1131 | # endif /* USE_MMAP */
|
|---|
| 1132 | # endif /* DGUX */
|
|---|
| 1133 |
|
|---|
| 1134 | # ifdef LINUX
|
|---|
| 1135 | # ifndef __GNUC__
|
|---|
| 1136 | /* The Intel compiler doesn't like inline assembly */
|
|---|
| 1137 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1138 | # endif
|
|---|
| 1139 | # define OS_TYPE "LINUX"
|
|---|
| 1140 | # define LINUX_STACKBOTTOM
|
|---|
| 1141 | # if 0
|
|---|
| 1142 | # define HEURISTIC1
|
|---|
| 1143 | # undef STACK_GRAN
|
|---|
| 1144 | # define STACK_GRAN 0x10000000
|
|---|
| 1145 | /* STACKBOTTOM is usually 0xc0000000, but this changes with */
|
|---|
| 1146 | /* different kernel configurations. In particular, systems */
|
|---|
| 1147 | /* with 2GB physical memory will usually move the user */
|
|---|
| 1148 | /* address space limit, and hence initial SP to 0x80000000. */
|
|---|
| 1149 | # endif
|
|---|
| 1150 | # if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)
|
|---|
| 1151 | # define MPROTECT_VDB
|
|---|
| 1152 | # else
|
|---|
| 1153 | /* We seem to get random errors in incremental mode, */
|
|---|
| 1154 | /* possibly because Linux threads is itself a malloc client */
|
|---|
| 1155 | /* and can't deal with the signals. */
|
|---|
| 1156 | # endif
|
|---|
| 1157 | # define HEAP_START (ptr_t)0x1000
|
|---|
| 1158 | /* This encourages mmap to give us low addresses, */
|
|---|
| 1159 | /* thus allowing the heap to grow to ~3GB */
|
|---|
| 1160 | # ifdef __ELF__
|
|---|
| 1161 | # define DYNAMIC_LOADING
|
|---|
| 1162 | # ifdef UNDEFINED /* includes ro data */
|
|---|
| 1163 | extern int _etext[];
|
|---|
| 1164 | # define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
|
|---|
| 1165 | # endif
|
|---|
| 1166 | # include <features.h>
|
|---|
| 1167 | # if defined(__GLIBC__) && __GLIBC__ >= 2
|
|---|
| 1168 | # define SEARCH_FOR_DATA_START
|
|---|
| 1169 | # else
|
|---|
| 1170 | extern char **__environ;
|
|---|
| 1171 | # define DATASTART ((ptr_t)(&__environ))
|
|---|
| 1172 | /* hideous kludge: __environ is the first */
|
|---|
| 1173 | /* word in crt0.o, and delimits the start */
|
|---|
| 1174 | /* of the data segment, no matter which */
|
|---|
| 1175 | /* ld options were passed through. */
|
|---|
| 1176 | /* We could use _etext instead, but that */
|
|---|
| 1177 | /* would include .rodata, which may */
|
|---|
| 1178 | /* contain large read-only data tables */
|
|---|
| 1179 | /* that we'd rather not scan. */
|
|---|
| 1180 | # endif
|
|---|
| 1181 | extern int _end[];
|
|---|
| 1182 | # define DATAEND (_end)
|
|---|
| 1183 | # else
|
|---|
| 1184 | extern int etext[];
|
|---|
| 1185 | # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
|
|---|
| 1186 | # endif
|
|---|
| 1187 | # ifdef USE_I686_PREFETCH
|
|---|
| 1188 | /* FIXME: Thus should use __builtin_prefetch, but we'll leave that */
|
|---|
| 1189 | /* for the next rtelease. */
|
|---|
| 1190 | # define PREFETCH(x) \
|
|---|
| 1191 | __asm__ __volatile__ (" prefetchnta %0": : "m"(*(char *)(x)))
|
|---|
| 1192 | /* Empirically prefetcht0 is much more effective at reducing */
|
|---|
| 1193 | /* cache miss stalls for the targetted load instructions. But it */
|
|---|
| 1194 | /* seems to interfere enough with other cache traffic that the net */
|
|---|
| 1195 | /* result is worse than prefetchnta. */
|
|---|
| 1196 | # if 0
|
|---|
| 1197 | /* Using prefetches for write seems to have a slight negative */
|
|---|
| 1198 | /* impact on performance, at least for a PIII/500. */
|
|---|
| 1199 | # define PREFETCH_FOR_WRITE(x) \
|
|---|
| 1200 | __asm__ __volatile__ (" prefetcht0 %0": : "m"(*(char *)(x)))
|
|---|
| 1201 | # endif
|
|---|
| 1202 | # endif
|
|---|
| 1203 | # ifdef USE_3DNOW_PREFETCH
|
|---|
| 1204 | # define PREFETCH(x) \
|
|---|
| 1205 | __asm__ __volatile__ (" prefetch %0": : "m"(*(char *)(x)))
|
|---|
| 1206 | # define PREFETCH_FOR_WRITE(x) \
|
|---|
| 1207 | __asm__ __volatile__ (" prefetchw %0": : "m"(*(char *)(x)))
|
|---|
| 1208 | # endif
|
|---|
| 1209 | # endif
|
|---|
| 1210 | # ifdef CYGWIN32
|
|---|
| 1211 | # define OS_TYPE "CYGWIN32"
|
|---|
| 1212 | # define DATASTART ((ptr_t)GC_DATASTART) /* From gc.h */
|
|---|
| 1213 | # define DATAEND ((ptr_t)GC_DATAEND)
|
|---|
| 1214 | # undef STACK_GRAN
|
|---|
| 1215 | # define STACK_GRAN 0x10000
|
|---|
| 1216 | # define HEURISTIC1
|
|---|
| 1217 | # endif
|
|---|
| 1218 | # ifdef OS2
|
|---|
| 1219 | # define OS_TYPE "OS2"
|
|---|
| 1220 | /* STACKBOTTOM and DATASTART are handled specially in */
|
|---|
| 1221 | /* os_dep.c. OS2 actually has the right */
|
|---|
| 1222 | /* system call! */
|
|---|
| 1223 | # define DATAEND /* not needed */
|
|---|
| 1224 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1225 | # endif
|
|---|
| 1226 | # ifdef MSWIN32
|
|---|
| 1227 | # define OS_TYPE "MSWIN32"
|
|---|
| 1228 | /* STACKBOTTOM and DATASTART are handled specially in */
|
|---|
| 1229 | /* os_dep.c. */
|
|---|
| 1230 | # ifndef __WATCOMC__
|
|---|
| 1231 | # define MPROTECT_VDB
|
|---|
| 1232 | # endif
|
|---|
| 1233 | # define DATAEND /* not needed */
|
|---|
| 1234 | # endif
|
|---|
| 1235 | # ifdef MSWINCE
|
|---|
| 1236 | # define OS_TYPE "MSWINCE"
|
|---|
| 1237 | # define DATAEND /* not needed */
|
|---|
| 1238 | # endif
|
|---|
| 1239 | # ifdef DJGPP
|
|---|
| 1240 | # define OS_TYPE "DJGPP"
|
|---|
| 1241 | # include "stubinfo.h"
|
|---|
| 1242 | extern int etext[];
|
|---|
| 1243 | extern int _stklen;
|
|---|
| 1244 | extern int __djgpp_stack_limit;
|
|---|
| 1245 | # define DATASTART ((ptr_t)((((word) (etext)) + 0x1ff) & ~0x1ff))
|
|---|
| 1246 | /* # define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
|
|---|
| 1247 | + _stklen)) */
|
|---|
| 1248 | # define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
|
|---|
| 1249 | /* This may not be right. */
|
|---|
| 1250 | # endif
|
|---|
| 1251 | # ifdef OPENBSD
|
|---|
| 1252 | # define OS_TYPE "OPENBSD"
|
|---|
| 1253 | # endif
|
|---|
| 1254 | # ifdef FREEBSD
|
|---|
| 1255 | # define OS_TYPE "FREEBSD"
|
|---|
| 1256 | # ifndef GC_FREEBSD_THREADS
|
|---|
| 1257 | # define MPROTECT_VDB
|
|---|
| 1258 | # endif
|
|---|
| 1259 | # ifdef __GLIBC__
|
|---|
| 1260 | # define SIG_SUSPEND (32+6)
|
|---|
| 1261 | # define SIG_THR_RESTART (32+5)
|
|---|
| 1262 | extern int _end[];
|
|---|
| 1263 | # define DATAEND (_end)
|
|---|
| 1264 | # else
|
|---|
| 1265 | # define SIG_SUSPEND SIGUSR1
|
|---|
| 1266 | # define SIG_THR_RESTART SIGUSR2
|
|---|
| 1267 | # endif
|
|---|
| 1268 | # define FREEBSD_STACKBOTTOM
|
|---|
| 1269 | # ifdef __ELF__
|
|---|
| 1270 | # define DYNAMIC_LOADING
|
|---|
| 1271 | # endif
|
|---|
| 1272 | extern char etext[];
|
|---|
| 1273 | extern char * GC_FreeBSDGetDataStart();
|
|---|
| 1274 | # define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
|
|---|
| 1275 | # endif
|
|---|
| 1276 | # ifdef NETBSD
|
|---|
| 1277 | # define OS_TYPE "NETBSD"
|
|---|
| 1278 | # ifdef __ELF__
|
|---|
| 1279 | # define DYNAMIC_LOADING
|
|---|
| 1280 | # endif
|
|---|
| 1281 | # endif
|
|---|
| 1282 | # ifdef THREE86BSD
|
|---|
| 1283 | # define OS_TYPE "THREE86BSD"
|
|---|
| 1284 | # endif
|
|---|
| 1285 | # ifdef BSDI
|
|---|
| 1286 | # define OS_TYPE "BSDI"
|
|---|
| 1287 | # endif
|
|---|
| 1288 | # if defined(OPENBSD) || defined(NETBSD) \
|
|---|
| 1289 | || defined(THREE86BSD) || defined(BSDI)
|
|---|
| 1290 | # define HEURISTIC2
|
|---|
| 1291 | extern char etext[];
|
|---|
| 1292 | # define DATASTART ((ptr_t)(etext))
|
|---|
| 1293 | # endif
|
|---|
| 1294 | # ifdef NEXT
|
|---|
| 1295 | # define OS_TYPE "NEXT"
|
|---|
| 1296 | # define DATASTART ((ptr_t) get_etext())
|
|---|
| 1297 | # define STACKBOTTOM ((ptr_t)0xc0000000)
|
|---|
| 1298 | # define DATAEND /* not needed */
|
|---|
| 1299 | # endif
|
|---|
| 1300 | # ifdef DOS4GW
|
|---|
| 1301 | # define OS_TYPE "DOS4GW"
|
|---|
| 1302 | extern long __nullarea;
|
|---|
| 1303 | extern char _end;
|
|---|
| 1304 | extern char *_STACKTOP;
|
|---|
| 1305 | /* Depending on calling conventions Watcom C either precedes
|
|---|
| 1306 | or does not precedes with undescore names of C-variables.
|
|---|
| 1307 | Make sure startup code variables always have the same names. */
|
|---|
| 1308 | #pragma aux __nullarea "*";
|
|---|
| 1309 | #pragma aux _end "*";
|
|---|
| 1310 | # define STACKBOTTOM ((ptr_t) _STACKTOP)
|
|---|
| 1311 | /* confused? me too. */
|
|---|
| 1312 | # define DATASTART ((ptr_t) &__nullarea)
|
|---|
| 1313 | # define DATAEND ((ptr_t) &_end)
|
|---|
| 1314 | # endif
|
|---|
| 1315 | # ifdef HURD
|
|---|
| 1316 | # define OS_TYPE "HURD"
|
|---|
| 1317 | # define STACK_GROWS_DOWN
|
|---|
| 1318 | # define HEURISTIC2
|
|---|
| 1319 | extern int __data_start[];
|
|---|
| 1320 | # define DATASTART ( (ptr_t) (__data_start))
|
|---|
| 1321 | extern int _end[];
|
|---|
| 1322 | # define DATAEND ( (ptr_t) (_end))
|
|---|
| 1323 | /* # define MPROTECT_VDB Not quite working yet? */
|
|---|
| 1324 | # define DYNAMIC_LOADING
|
|---|
| 1325 | # endif
|
|---|
| 1326 | # ifdef DARWIN
|
|---|
| 1327 | # define OS_TYPE "DARWIN"
|
|---|
| 1328 | # define DARWIN_DONT_PARSE_STACK
|
|---|
| 1329 | # define DYNAMIC_LOADING
|
|---|
| 1330 | /* XXX: see get_end(3), get_etext() and get_end() should not be used.
|
|---|
| 1331 | These aren't used when dyld support is enabled (it is by default) */
|
|---|
| 1332 | # define DATASTART ((ptr_t) get_etext())
|
|---|
| 1333 | # define DATAEND ((ptr_t) get_end())
|
|---|
| 1334 | # define STACKBOTTOM ((ptr_t) 0xc0000000)
|
|---|
| 1335 | # define USE_MMAP
|
|---|
| 1336 | # define USE_MMAP_ANON
|
|---|
| 1337 | # define USE_ASM_PUSH_REGS
|
|---|
| 1338 | /* This is potentially buggy. It needs more testing. See the comments in
|
|---|
| 1339 | os_dep.c. It relies on threads to track writes. */
|
|---|
| 1340 | # ifdef GC_DARWIN_THREADS
|
|---|
| 1341 | /* # define MPROTECT_VDB -- disabled for now. May work for some apps. */
|
|---|
| 1342 | # endif
|
|---|
| 1343 | # include <unistd.h>
|
|---|
| 1344 | # define GETPAGESIZE() getpagesize()
|
|---|
| 1345 | /* There seems to be some issues with trylock hanging on darwin. This
|
|---|
| 1346 | should be looked into some more */
|
|---|
| 1347 | # define NO_PTHREAD_TRYLOCK
|
|---|
| 1348 | # endif /* DARWIN */
|
|---|
| 1349 | # endif
|
|---|
| 1350 |
|
|---|
| 1351 | # ifdef NS32K
|
|---|
| 1352 | # define MACH_TYPE "NS32K"
|
|---|
| 1353 | # define ALIGNMENT 4
|
|---|
| 1354 | extern char **environ;
|
|---|
| 1355 | # define DATASTART ((ptr_t)(&environ))
|
|---|
| 1356 | /* hideous kludge: environ is the first */
|
|---|
| 1357 | /* word in crt0.o, and delimits the start */
|
|---|
| 1358 | /* of the data segment, no matter which */
|
|---|
| 1359 | /* ld options were passed through. */
|
|---|
| 1360 | # define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
|
|---|
| 1361 | # endif
|
|---|
| 1362 |
|
|---|
| 1363 | # ifdef MIPS
|
|---|
| 1364 | # define MACH_TYPE "MIPS"
|
|---|
| 1365 | # ifdef LINUX
|
|---|
| 1366 | /* This was developed for a linuxce style platform. Probably */
|
|---|
| 1367 | /* needs to be tweaked for workstation class machines. */
|
|---|
| 1368 | # define OS_TYPE "LINUX"
|
|---|
| 1369 | # define DYNAMIC_LOADING
|
|---|
| 1370 | extern int _end[];
|
|---|
| 1371 | # define DATAEND (_end)
|
|---|
| 1372 | extern int __data_start[];
|
|---|
| 1373 | # define DATASTART ((ptr_t)(__data_start))
|
|---|
| 1374 | # define ALIGNMENT 4
|
|---|
| 1375 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1376 | # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2 || __GLIBC__ > 2
|
|---|
| 1377 | # define LINUX_STACKBOTTOM
|
|---|
| 1378 | # else
|
|---|
| 1379 | # define STACKBOTTOM 0x80000000
|
|---|
| 1380 | # endif
|
|---|
| 1381 | # endif /* Linux */
|
|---|
| 1382 | # ifdef EWS4800
|
|---|
| 1383 | # define HEURISTIC2
|
|---|
| 1384 | # if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64)
|
|---|
| 1385 | extern int _fdata[], _end[];
|
|---|
| 1386 | # define DATASTART ((ptr_t)_fdata)
|
|---|
| 1387 | # define DATAEND ((ptr_t)_end)
|
|---|
| 1388 | # define CPP_WORDSZ _MIPS_SZPTR
|
|---|
| 1389 | # define ALIGNMENT (_MIPS_SZPTR/8)
|
|---|
| 1390 | # else
|
|---|
| 1391 | extern int etext[], edata[], end[];
|
|---|
| 1392 | extern int _DYNAMIC_LINKING[], _gp[];
|
|---|
| 1393 | # define DATASTART ((ptr_t)((((word)etext + 0x3ffff) & ~0x3ffff) \
|
|---|
| 1394 | + ((word)etext & 0xffff)))
|
|---|
| 1395 | # define DATAEND (edata)
|
|---|
| 1396 | # define DATASTART2 (_DYNAMIC_LINKING \
|
|---|
| 1397 | ? (ptr_t)(((word)_gp + 0x8000 + 0x3ffff) & ~0x3ffff) \
|
|---|
| 1398 | : (ptr_t)edata)
|
|---|
| 1399 | # define DATAEND2 (end)
|
|---|
| 1400 | # define ALIGNMENT 4
|
|---|
| 1401 | # endif
|
|---|
| 1402 | # define OS_TYPE "EWS4800"
|
|---|
| 1403 | # define USE_GENERIC_PUSH_REGS 1
|
|---|
| 1404 | # endif
|
|---|
| 1405 | # ifdef ULTRIX
|
|---|
| 1406 | # define HEURISTIC2
|
|---|
| 1407 | # define DATASTART (ptr_t)0x10000000
|
|---|
| 1408 | /* Could probably be slightly higher since */
|
|---|
| 1409 | /* startup code allocates lots of stuff. */
|
|---|
| 1410 | # define OS_TYPE "ULTRIX"
|
|---|
| 1411 | # define ALIGNMENT 4
|
|---|
| 1412 | # endif
|
|---|
| 1413 | # ifdef RISCOS
|
|---|
| 1414 | # define HEURISTIC2
|
|---|
| 1415 | # define DATASTART (ptr_t)0x10000000
|
|---|
| 1416 | # define OS_TYPE "RISCOS"
|
|---|
| 1417 | # define ALIGNMENT 4 /* Required by hardware */
|
|---|
| 1418 | # endif
|
|---|
| 1419 | # ifdef IRIX5
|
|---|
| 1420 | # define HEURISTIC2
|
|---|
| 1421 | extern int _fdata[];
|
|---|
| 1422 | # define DATASTART ((ptr_t)(_fdata))
|
|---|
| 1423 | # ifdef USE_MMAP
|
|---|
| 1424 | # define HEAP_START (ptr_t)0x30000000
|
|---|
| 1425 | # else
|
|---|
| 1426 | # define HEAP_START DATASTART
|
|---|
| 1427 | # endif
|
|---|
| 1428 | /* Lowest plausible heap address. */
|
|---|
| 1429 | /* In the MMAP case, we map there. */
|
|---|
| 1430 | /* In either case it is used to identify */
|
|---|
| 1431 | /* heap sections so they're not */
|
|---|
| 1432 | /* considered as roots. */
|
|---|
| 1433 | # define OS_TYPE "IRIX5"
|
|---|
| 1434 | /*# define MPROTECT_VDB DOB: this should work, but there is evidence */
|
|---|
| 1435 | /* of recent breakage. */
|
|---|
| 1436 | # ifdef _MIPS_SZPTR
|
|---|
| 1437 | # define CPP_WORDSZ _MIPS_SZPTR
|
|---|
| 1438 | # define ALIGNMENT (_MIPS_SZPTR/8)
|
|---|
| 1439 | # if CPP_WORDSZ != 64
|
|---|
| 1440 | # define ALIGN_DOUBLE
|
|---|
| 1441 | # endif
|
|---|
| 1442 | # else
|
|---|
| 1443 | # define ALIGNMENT 4
|
|---|
| 1444 | # define ALIGN_DOUBLE
|
|---|
| 1445 | # endif
|
|---|
| 1446 | # define DYNAMIC_LOADING
|
|---|
| 1447 | # endif
|
|---|
| 1448 | # ifdef MSWINCE
|
|---|
| 1449 | # define OS_TYPE "MSWINCE"
|
|---|
| 1450 | # define ALIGNMENT 4
|
|---|
| 1451 | # define DATAEND /* not needed */
|
|---|
| 1452 | # endif
|
|---|
| 1453 | # if defined(NETBSD)
|
|---|
| 1454 | # define OS_TYPE "NETBSD"
|
|---|
| 1455 | # define ALIGNMENT 4
|
|---|
| 1456 | # define HEURISTIC2
|
|---|
| 1457 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1458 | # ifdef __ELF__
|
|---|
| 1459 | extern int etext[];
|
|---|
| 1460 | # define DATASTART GC_data_start
|
|---|
| 1461 | # define NEED_FIND_LIMIT
|
|---|
| 1462 | # define DYNAMIC_LOADING
|
|---|
| 1463 | # else
|
|---|
| 1464 | # define DATASTART ((ptr_t) 0x10000000)
|
|---|
| 1465 | # define STACKBOTTOM ((ptr_t) 0x7ffff000)
|
|---|
| 1466 | # endif /* _ELF_ */
|
|---|
| 1467 | # endif
|
|---|
| 1468 | # if defined(NONSTOP)
|
|---|
| 1469 | # define CPP_WORDSZ 32
|
|---|
| 1470 | # define OS_TYPE "NONSTOP"
|
|---|
| 1471 | # define ALIGNMENT 4
|
|---|
| 1472 | # define DATASTART ((ptr_t) 0x08000000)
|
|---|
| 1473 | extern int _end[];
|
|---|
| 1474 | # define DATAEND (_end)
|
|---|
| 1475 | # define STACKBOTTOM ((ptr_t) 0x4fffffff)
|
|---|
| 1476 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1477 | # endif
|
|---|
| 1478 | # endif
|
|---|
| 1479 |
|
|---|
| 1480 | # ifdef RS6000
|
|---|
| 1481 | # define MACH_TYPE "RS6000"
|
|---|
| 1482 | # ifdef ALIGNMENT
|
|---|
| 1483 | # undef ALIGNMENT
|
|---|
| 1484 | # endif
|
|---|
| 1485 | # ifdef IA64
|
|---|
| 1486 | # undef IA64 /* DOB: some AIX installs stupidly define IA64 in /usr/include/sys/systemcfg.h */
|
|---|
| 1487 | # endif
|
|---|
| 1488 | # ifdef __64BIT__
|
|---|
| 1489 | # define ALIGNMENT 8
|
|---|
| 1490 | # define CPP_WORDSZ 64
|
|---|
| 1491 | # define STACKBOTTOM ((ptr_t)0x1000000000000000)
|
|---|
| 1492 | # else
|
|---|
| 1493 | # define ALIGNMENT 4
|
|---|
| 1494 | # define CPP_WORDSZ 32
|
|---|
| 1495 | # define STACKBOTTOM ((ptr_t)((ulong)&errno))
|
|---|
| 1496 | # endif
|
|---|
| 1497 | # define USE_MMAP
|
|---|
| 1498 | # define USE_MMAP_ANON
|
|---|
| 1499 | /* From AIX linker man page:
|
|---|
| 1500 | _text Specifies the first location of the program.
|
|---|
| 1501 | _etext Specifies the first location after the program.
|
|---|
| 1502 | _data Specifies the first location of the data.
|
|---|
| 1503 | _edata Specifies the first location after the initialized data
|
|---|
| 1504 | _end or end Specifies the first location after all data.
|
|---|
| 1505 | */
|
|---|
| 1506 | extern int _data[], _end[];
|
|---|
| 1507 | # define DATASTART ((ptr_t)((ulong)_data))
|
|---|
| 1508 | # define DATAEND ((ptr_t)((ulong)_end))
|
|---|
| 1509 | extern int errno;
|
|---|
| 1510 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1511 | # define DYNAMIC_LOADING
|
|---|
| 1512 | /* For really old versions of AIX, this may have to be removed. */
|
|---|
| 1513 | # endif
|
|---|
| 1514 |
|
|---|
| 1515 | # ifdef HP_PA
|
|---|
| 1516 | # define MACH_TYPE "HP_PA"
|
|---|
| 1517 | # ifdef __LP64__
|
|---|
| 1518 | # define CPP_WORDSZ 64
|
|---|
| 1519 | # define ALIGNMENT 8
|
|---|
| 1520 | # else
|
|---|
| 1521 | # define CPP_WORDSZ 32
|
|---|
| 1522 | # define ALIGNMENT 4
|
|---|
| 1523 | # define ALIGN_DOUBLE
|
|---|
| 1524 | # endif
|
|---|
| 1525 | # if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS)
|
|---|
| 1526 | # ifndef LINUX /* For now. */
|
|---|
| 1527 | # define MPROTECT_VDB
|
|---|
| 1528 | # endif
|
|---|
| 1529 | # else
|
|---|
| 1530 | # define GENERIC_COMPARE_AND_SWAP
|
|---|
| 1531 | /* No compare-and-swap instruction. Use pthread mutexes */
|
|---|
| 1532 | /* when we absolutely have to. */
|
|---|
| 1533 | # ifdef PARALLEL_MARK
|
|---|
| 1534 | # define USE_MARK_BYTES
|
|---|
| 1535 | /* Minimize compare-and-swap usage. */
|
|---|
| 1536 | # endif
|
|---|
| 1537 | # endif
|
|---|
| 1538 | # define STACK_GROWS_UP
|
|---|
| 1539 | # ifdef HPUX
|
|---|
| 1540 | # define OS_TYPE "HPUX"
|
|---|
| 1541 | extern int __data_start[];
|
|---|
| 1542 | # define DATASTART ((ptr_t)(__data_start))
|
|---|
| 1543 | # if 0
|
|---|
| 1544 | /* The following appears to work for 7xx systems running HP/UX */
|
|---|
| 1545 | /* 9.xx Furthermore, it might result in much faster */
|
|---|
| 1546 | /* collections than HEURISTIC2, which may involve scanning */
|
|---|
| 1547 | /* segments that directly precede the stack. It is not the */
|
|---|
| 1548 | /* default, since it may not work on older machine/OS */
|
|---|
| 1549 | /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
|
|---|
| 1550 | /* this.) */
|
|---|
| 1551 | # define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
|
|---|
| 1552 | # else
|
|---|
| 1553 | /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */
|
|---|
| 1554 | /* to this. Note that the GC must be initialized before the */
|
|---|
| 1555 | /* first putenv call. */
|
|---|
| 1556 | extern char ** environ;
|
|---|
| 1557 | # define STACKBOTTOM ((ptr_t)environ)
|
|---|
| 1558 | # endif
|
|---|
| 1559 | # define DYNAMIC_LOADING
|
|---|
| 1560 | # include <unistd.h>
|
|---|
| 1561 | # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
|
|---|
| 1562 | # ifndef __GNUC__
|
|---|
| 1563 | # define PREFETCH(x) { \
|
|---|
| 1564 | register long addr = (long)(x); \
|
|---|
| 1565 | (void) _asm ("LDW", 0, 0, addr, 0); \
|
|---|
| 1566 | }
|
|---|
| 1567 | # endif
|
|---|
| 1568 | # endif /* HPUX */
|
|---|
| 1569 | # ifdef LINUX
|
|---|
| 1570 | # define OS_TYPE "LINUX"
|
|---|
| 1571 | # define LINUX_STACKBOTTOM
|
|---|
| 1572 | # define DYNAMIC_LOADING
|
|---|
| 1573 | # define SEARCH_FOR_DATA_START
|
|---|
| 1574 | extern int _end[];
|
|---|
| 1575 | # define DATAEND (&_end)
|
|---|
| 1576 | # endif /* LINUX */
|
|---|
| 1577 | # endif /* HP_PA */
|
|---|
| 1578 |
|
|---|
| 1579 | # ifdef ALPHA
|
|---|
| 1580 | # define MACH_TYPE "ALPHA"
|
|---|
| 1581 | # define ALIGNMENT 8
|
|---|
| 1582 | # define CPP_WORDSZ 64
|
|---|
| 1583 | # ifndef LINUX
|
|---|
| 1584 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1585 | /* Gcc and probably the DEC/Compaq compiler spill pointers to preserved */
|
|---|
| 1586 | /* fp registers in some cases when the target is a 21264. The assembly */
|
|---|
| 1587 | /* code doesn't handle that yet, and version dependencies make that a */
|
|---|
| 1588 | /* bit tricky. Do the easy thing for now. */
|
|---|
| 1589 | # endif
|
|---|
| 1590 | # ifdef NETBSD
|
|---|
| 1591 | # define OS_TYPE "NETBSD"
|
|---|
| 1592 | # define HEURISTIC2
|
|---|
| 1593 | # define DATASTART GC_data_start
|
|---|
| 1594 | # define ELFCLASS32 32
|
|---|
| 1595 | # define ELFCLASS64 64
|
|---|
| 1596 | # define ELF_CLASS ELFCLASS64
|
|---|
| 1597 | # define DYNAMIC_LOADING
|
|---|
| 1598 | # endif
|
|---|
| 1599 | # ifdef OPENBSD
|
|---|
| 1600 | # define OS_TYPE "OPENBSD"
|
|---|
| 1601 | # define HEURISTIC2
|
|---|
| 1602 | # ifdef __ELF__ /* since OpenBSD/Alpha 2.9 */
|
|---|
| 1603 | # define DATASTART GC_data_start
|
|---|
| 1604 | # define ELFCLASS32 32
|
|---|
| 1605 | # define ELFCLASS64 64
|
|---|
| 1606 | # define ELF_CLASS ELFCLASS64
|
|---|
| 1607 | # else /* ECOFF, until OpenBSD/Alpha 2.7 */
|
|---|
| 1608 | # define DATASTART ((ptr_t) 0x140000000)
|
|---|
| 1609 | # endif
|
|---|
| 1610 | # endif
|
|---|
| 1611 | # ifdef FREEBSD
|
|---|
| 1612 | # define OS_TYPE "FREEBSD"
|
|---|
| 1613 | /* MPROTECT_VDB is not yet supported at all on FreeBSD/alpha. */
|
|---|
| 1614 | # define SIG_SUSPEND SIGUSR1
|
|---|
| 1615 | # define SIG_THR_RESTART SIGUSR2
|
|---|
| 1616 | # define FREEBSD_STACKBOTTOM
|
|---|
| 1617 | # ifdef __ELF__
|
|---|
| 1618 | # define DYNAMIC_LOADING
|
|---|
| 1619 | # endif
|
|---|
| 1620 | /* Handle unmapped hole alpha*-*-freebsd[45]* puts between etext and edata. */
|
|---|
| 1621 | extern char etext[];
|
|---|
| 1622 | extern char edata[];
|
|---|
| 1623 | extern char end[];
|
|---|
| 1624 | # define NEED_FIND_LIMIT
|
|---|
| 1625 | # define DATASTART ((ptr_t)(&etext))
|
|---|
| 1626 | # define DATAEND (GC_find_limit (DATASTART, TRUE))
|
|---|
| 1627 | # define DATASTART2 ((ptr_t)(&edata))
|
|---|
| 1628 | # define DATAEND2 ((ptr_t)(&end))
|
|---|
| 1629 | # endif
|
|---|
| 1630 | # ifdef OSF1
|
|---|
| 1631 | # define OS_TYPE "OSF1"
|
|---|
| 1632 | # define DATASTART ((ptr_t) 0x140000000)
|
|---|
| 1633 | extern int _end[];
|
|---|
| 1634 | # define DATAEND ((ptr_t) &_end)
|
|---|
| 1635 | extern char ** environ;
|
|---|
| 1636 | /* round up from the value of environ to the nearest page boundary */
|
|---|
| 1637 | /* Probably breaks if putenv is called before collector */
|
|---|
| 1638 | /* initialization. */
|
|---|
| 1639 | # define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1))
|
|---|
| 1640 | /* # define HEURISTIC2 */
|
|---|
| 1641 | /* Normally HEURISTIC2 is too conervative, since */
|
|---|
| 1642 | /* the text segment immediately follows the stack. */
|
|---|
| 1643 | /* Hence we give an upper pound. */
|
|---|
| 1644 | /* This is currently unused, since we disabled HEURISTIC2 */
|
|---|
| 1645 | extern int __start[];
|
|---|
| 1646 | # define HEURISTIC2_LIMIT ((ptr_t)((word)(__start) & ~(getpagesize()-1)))
|
|---|
| 1647 | # ifndef GC_OSF1_THREADS
|
|---|
| 1648 | /* Unresolved signal issues with threads. */
|
|---|
| 1649 | # define MPROTECT_VDB
|
|---|
| 1650 | # endif
|
|---|
| 1651 | # define DYNAMIC_LOADING
|
|---|
| 1652 | # endif
|
|---|
| 1653 | # ifdef LINUX
|
|---|
| 1654 | # define OS_TYPE "LINUX"
|
|---|
| 1655 | # define LINUX_STACKBOTTOM
|
|---|
| 1656 | # ifdef __ELF__
|
|---|
| 1657 | # define SEARCH_FOR_DATA_START
|
|---|
| 1658 | # define DYNAMIC_LOADING
|
|---|
| 1659 | # else
|
|---|
| 1660 | # define DATASTART ((ptr_t) 0x140000000)
|
|---|
| 1661 | # endif
|
|---|
| 1662 | extern int _end[];
|
|---|
| 1663 | # define DATAEND (_end)
|
|---|
| 1664 | # define MPROTECT_VDB
|
|---|
| 1665 | /* Has only been superficially tested. May not */
|
|---|
| 1666 | /* work on all versions. */
|
|---|
| 1667 | # endif
|
|---|
| 1668 | # endif
|
|---|
| 1669 |
|
|---|
| 1670 | # ifdef IA64
|
|---|
| 1671 | # define MACH_TYPE "IA64"
|
|---|
| 1672 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1673 | /* We need to get preserved registers in addition to register */
|
|---|
| 1674 | /* windows. That's easiest to do with setjmp. */
|
|---|
| 1675 | # ifdef PARALLEL_MARK
|
|---|
| 1676 | # define USE_MARK_BYTES
|
|---|
| 1677 | /* Compare-and-exchange is too expensive to use for */
|
|---|
| 1678 | /* setting mark bits. */
|
|---|
| 1679 | # endif
|
|---|
| 1680 | # ifdef HPUX
|
|---|
| 1681 | # ifdef _ILP32
|
|---|
| 1682 | # define CPP_WORDSZ 32
|
|---|
| 1683 | # define ALIGN_DOUBLE
|
|---|
| 1684 | /* Requires 8 byte alignment for malloc */
|
|---|
| 1685 | # define ALIGNMENT 4
|
|---|
| 1686 | # else
|
|---|
| 1687 | # ifndef _LP64
|
|---|
| 1688 | ---> unknown ABI
|
|---|
| 1689 | # endif
|
|---|
| 1690 | # define CPP_WORDSZ 64
|
|---|
| 1691 | # define ALIGN_DOUBLE
|
|---|
| 1692 | /* Requires 16 byte alignment for malloc */
|
|---|
| 1693 | # define ALIGNMENT 8
|
|---|
| 1694 | # endif
|
|---|
| 1695 | # define OS_TYPE "HPUX"
|
|---|
| 1696 | extern int __data_start[];
|
|---|
| 1697 | # define DATASTART ((ptr_t)(__data_start))
|
|---|
| 1698 | /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2 */
|
|---|
| 1699 | /* to this. Note that the GC must be initialized before the */
|
|---|
| 1700 | /* first putenv call. */
|
|---|
| 1701 | extern char ** environ;
|
|---|
| 1702 | # define STACKBOTTOM ((ptr_t)environ)
|
|---|
| 1703 | # define HPUX_STACKBOTTOM
|
|---|
| 1704 | # define DYNAMIC_LOADING
|
|---|
| 1705 | # include <unistd.h>
|
|---|
| 1706 | # define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
|
|---|
| 1707 | /* The following was empirically determined, and is probably */
|
|---|
| 1708 | /* not very robust. */
|
|---|
| 1709 | /* Note that the backing store base seems to be at a nice */
|
|---|
| 1710 | /* address minus one page. */
|
|---|
| 1711 | # define BACKING_STORE_DISPLACEMENT 0x1000000
|
|---|
| 1712 | # define BACKING_STORE_ALIGNMENT 0x1000
|
|---|
| 1713 | extern ptr_t GC_register_stackbottom;
|
|---|
| 1714 | # define BACKING_STORE_BASE GC_register_stackbottom
|
|---|
| 1715 | /* Known to be wrong for recent HP/UX versions!!! */
|
|---|
| 1716 | # endif
|
|---|
| 1717 | # ifdef LINUX
|
|---|
| 1718 | # define CPP_WORDSZ 64
|
|---|
| 1719 | # define ALIGN_DOUBLE
|
|---|
| 1720 | /* Requires 16 byte alignment for malloc */
|
|---|
| 1721 | # define ALIGNMENT 8
|
|---|
| 1722 | # define OS_TYPE "LINUX"
|
|---|
| 1723 | /* The following works on NUE and older kernels: */
|
|---|
| 1724 | /* # define STACKBOTTOM ((ptr_t) 0xa000000000000000l) */
|
|---|
| 1725 | /* This does not work on NUE: */
|
|---|
| 1726 | # define LINUX_STACKBOTTOM
|
|---|
| 1727 | /* We also need the base address of the register stack */
|
|---|
| 1728 | /* backing store. This is computed in */
|
|---|
| 1729 | /* GC_linux_register_stack_base based on the following */
|
|---|
| 1730 | /* constants: */
|
|---|
| 1731 | # define BACKING_STORE_ALIGNMENT 0x100000
|
|---|
| 1732 | # define BACKING_STORE_DISPLACEMENT 0x80000000
|
|---|
| 1733 | extern ptr_t GC_register_stackbottom;
|
|---|
| 1734 | # define BACKING_STORE_BASE GC_register_stackbottom
|
|---|
| 1735 | # define SEARCH_FOR_DATA_START
|
|---|
| 1736 | # ifdef __GNUC__
|
|---|
| 1737 | # define DYNAMIC_LOADING
|
|---|
| 1738 | # else
|
|---|
| 1739 | /* In the Intel compiler environment, we seem to end up with */
|
|---|
| 1740 | /* statically linked executables and an undefined reference */
|
|---|
| 1741 | /* to _DYNAMIC */
|
|---|
| 1742 | # endif
|
|---|
| 1743 | # define MPROTECT_VDB
|
|---|
| 1744 | /* Requires Linux 2.3.47 or later. */
|
|---|
| 1745 | extern int _end[];
|
|---|
| 1746 | # define DATAEND (_end)
|
|---|
| 1747 | # ifdef __GNUC__
|
|---|
| 1748 | # ifndef __INTEL_COMPILER
|
|---|
| 1749 | # define PREFETCH(x) \
|
|---|
| 1750 | __asm__ (" lfetch [%0]": : "r"(x))
|
|---|
| 1751 | # define PREFETCH_FOR_WRITE(x) \
|
|---|
| 1752 | __asm__ (" lfetch.excl [%0]": : "r"(x))
|
|---|
| 1753 | # define CLEAR_DOUBLE(x) \
|
|---|
| 1754 | __asm__ (" stf.spill [%0]=f0": : "r"((void *)(x)))
|
|---|
| 1755 | # else
|
|---|
| 1756 | # include <ia64intrin.h>
|
|---|
| 1757 | # define PREFETCH(x) \
|
|---|
| 1758 | __lfetch(__lfhint_none, (x))
|
|---|
| 1759 | # define PREFETCH_FOR_WRITE(x) \
|
|---|
| 1760 | __lfetch(__lfhint_nta, (x))
|
|---|
| 1761 | # define CLEAR_DOUBLE(x) \
|
|---|
| 1762 | __stf_spill((void *)(x), 0)
|
|---|
| 1763 | # endif // __INTEL_COMPILER
|
|---|
| 1764 | # endif
|
|---|
| 1765 | # endif
|
|---|
| 1766 | # ifdef MSWIN32
|
|---|
| 1767 | /* FIXME: This is a very partial guess. There is no port, yet. */
|
|---|
| 1768 | # define OS_TYPE "MSWIN32"
|
|---|
| 1769 | /* STACKBOTTOM and DATASTART are handled specially in */
|
|---|
| 1770 | /* os_dep.c. */
|
|---|
| 1771 | # define DATAEND /* not needed */
|
|---|
| 1772 | # if defined(_WIN64)
|
|---|
| 1773 | # define CPP_WORDSZ 64
|
|---|
| 1774 | # else
|
|---|
| 1775 | # define CPP_WORDSZ 32 /* Is this possible? */
|
|---|
| 1776 | # endif
|
|---|
| 1777 | # define ALIGNMENT 8
|
|---|
| 1778 | # endif
|
|---|
| 1779 | # endif
|
|---|
| 1780 |
|
|---|
| 1781 | # ifdef M88K
|
|---|
| 1782 | # define MACH_TYPE "M88K"
|
|---|
| 1783 | # define ALIGNMENT 4
|
|---|
| 1784 | # define ALIGN_DOUBLE
|
|---|
| 1785 | extern int etext[];
|
|---|
| 1786 | # ifdef CX_UX
|
|---|
| 1787 | # define OS_TYPE "CX_UX"
|
|---|
| 1788 | # define DATASTART ((((word)etext + 0x3fffff) & ~0x3fffff) + 0x10000)
|
|---|
| 1789 | # endif
|
|---|
| 1790 | # ifdef DGUX
|
|---|
| 1791 | # define OS_TYPE "DGUX"
|
|---|
| 1792 | extern ptr_t GC_SysVGetDataStart();
|
|---|
| 1793 | # define DATASTART GC_SysVGetDataStart(0x10000, etext)
|
|---|
| 1794 | # endif
|
|---|
| 1795 | # define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
|
|---|
| 1796 | # endif
|
|---|
| 1797 |
|
|---|
| 1798 | # ifdef S370
|
|---|
| 1799 | /* If this still works, and if anyone cares, this should probably */
|
|---|
| 1800 | /* be moved to the S390 category. */
|
|---|
| 1801 | # define MACH_TYPE "S370"
|
|---|
| 1802 | # define ALIGNMENT 4 /* Required by hardware */
|
|---|
| 1803 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1804 | # ifdef UTS4
|
|---|
| 1805 | # define OS_TYPE "UTS4"
|
|---|
| 1806 | extern int etext[];
|
|---|
| 1807 | extern int _etext[];
|
|---|
| 1808 | extern int _end[];
|
|---|
| 1809 | extern ptr_t GC_SysVGetDataStart();
|
|---|
| 1810 | # define DATASTART GC_SysVGetDataStart(0x10000, _etext)
|
|---|
| 1811 | # define DATAEND (_end)
|
|---|
| 1812 | # define HEURISTIC2
|
|---|
| 1813 | # endif
|
|---|
| 1814 | # endif
|
|---|
| 1815 |
|
|---|
| 1816 | # ifdef S390
|
|---|
| 1817 | # define MACH_TYPE "S390"
|
|---|
| 1818 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1819 | # ifndef __s390x__
|
|---|
| 1820 | # define ALIGNMENT 4
|
|---|
| 1821 | # define CPP_WORDSZ 32
|
|---|
| 1822 | # else
|
|---|
| 1823 | # define ALIGNMENT 8
|
|---|
| 1824 | # define CPP_WORDSZ 64
|
|---|
| 1825 | # endif
|
|---|
| 1826 | # ifndef HBLKSIZE
|
|---|
| 1827 | # define HBLKSIZE 4096
|
|---|
| 1828 | # endif
|
|---|
| 1829 | # ifdef LINUX
|
|---|
| 1830 | # define OS_TYPE "LINUX"
|
|---|
| 1831 | # define LINUX_STACKBOTTOM
|
|---|
| 1832 | # define DYNAMIC_LOADING
|
|---|
| 1833 | extern int __data_start[];
|
|---|
| 1834 | # define DATASTART ((ptr_t)(__data_start))
|
|---|
| 1835 | extern int _end[];
|
|---|
| 1836 | # define DATAEND (_end)
|
|---|
| 1837 | # define CACHE_LINE_SIZE 256
|
|---|
| 1838 | # define GETPAGESIZE() 4096
|
|---|
| 1839 | # endif
|
|---|
| 1840 | # endif
|
|---|
| 1841 |
|
|---|
| 1842 | # if defined(PJ)
|
|---|
| 1843 | # define ALIGNMENT 4
|
|---|
| 1844 | extern int _etext[];
|
|---|
| 1845 | # define DATASTART ((ptr_t)(_etext))
|
|---|
| 1846 | # define HEURISTIC1
|
|---|
| 1847 | # endif
|
|---|
| 1848 |
|
|---|
| 1849 | # ifdef ARM32
|
|---|
| 1850 | # define CPP_WORDSZ 32
|
|---|
| 1851 | # define MACH_TYPE "ARM32"
|
|---|
| 1852 | # define ALIGNMENT 4
|
|---|
| 1853 | # ifdef NETBSD
|
|---|
| 1854 | # define OS_TYPE "NETBSD"
|
|---|
| 1855 | # define HEURISTIC2
|
|---|
| 1856 | # ifdef __ELF__
|
|---|
| 1857 | # define DATASTART GC_data_start
|
|---|
| 1858 | # define DYNAMIC_LOADING
|
|---|
| 1859 | # else
|
|---|
| 1860 | extern char etext[];
|
|---|
| 1861 | # define DATASTART ((ptr_t)(etext))
|
|---|
| 1862 | # endif
|
|---|
| 1863 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1864 | # endif
|
|---|
| 1865 | # ifdef LINUX
|
|---|
| 1866 | # define OS_TYPE "LINUX"
|
|---|
| 1867 | # define LINUX_STACKBOTTOM
|
|---|
| 1868 | # undef STACK_GRAN
|
|---|
| 1869 | # define STACK_GRAN 0x10000000
|
|---|
| 1870 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1871 | # ifdef __ELF__
|
|---|
| 1872 | # define DYNAMIC_LOADING
|
|---|
| 1873 | # include <features.h>
|
|---|
| 1874 | # if defined(__GLIBC__) && __GLIBC__ >= 2
|
|---|
| 1875 | # define SEARCH_FOR_DATA_START
|
|---|
| 1876 | # else
|
|---|
| 1877 | extern char **__environ;
|
|---|
| 1878 | # define DATASTART ((ptr_t)(&__environ))
|
|---|
| 1879 | /* hideous kludge: __environ is the first */
|
|---|
| 1880 | /* word in crt0.o, and delimits the start */
|
|---|
| 1881 | /* of the data segment, no matter which */
|
|---|
| 1882 | /* ld options were passed through. */
|
|---|
| 1883 | /* We could use _etext instead, but that */
|
|---|
| 1884 | /* would include .rodata, which may */
|
|---|
| 1885 | /* contain large read-only data tables */
|
|---|
| 1886 | /* that we'd rather not scan. */
|
|---|
| 1887 | # endif
|
|---|
| 1888 | extern int _end[];
|
|---|
| 1889 | # define DATAEND (_end)
|
|---|
| 1890 | # else
|
|---|
| 1891 | extern int etext[];
|
|---|
| 1892 | # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
|
|---|
| 1893 | # endif
|
|---|
| 1894 | # endif
|
|---|
| 1895 | # ifdef MSWINCE
|
|---|
| 1896 | # define OS_TYPE "MSWINCE"
|
|---|
| 1897 | # define DATAEND /* not needed */
|
|---|
| 1898 | # endif
|
|---|
| 1899 | # ifdef NOSYS
|
|---|
| 1900 | /* __data_start is usually defined in the target linker script. */
|
|---|
| 1901 | extern int __data_start[];
|
|---|
| 1902 | # define DATASTART (ptr_t)(__data_start)
|
|---|
| 1903 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1904 | /* __stack_base__ is set in newlib/libc/sys/arm/crt0.S */
|
|---|
| 1905 | extern void *__stack_base__;
|
|---|
| 1906 | # define STACKBOTTOM ((ptr_t) (__stack_base__))
|
|---|
| 1907 | # endif
|
|---|
| 1908 | #endif
|
|---|
| 1909 |
|
|---|
| 1910 | # ifdef CRIS
|
|---|
| 1911 | # define MACH_TYPE "CRIS"
|
|---|
| 1912 | # define CPP_WORDSZ 32
|
|---|
| 1913 | # define ALIGNMENT 1
|
|---|
| 1914 | # define OS_TYPE "LINUX"
|
|---|
| 1915 | # define DYNAMIC_LOADING
|
|---|
| 1916 | # define LINUX_STACKBOTTOM
|
|---|
| 1917 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1918 | # define SEARCH_FOR_DATA_START
|
|---|
| 1919 | extern int _end[];
|
|---|
| 1920 | # define DATAEND (_end)
|
|---|
| 1921 | # endif
|
|---|
| 1922 |
|
|---|
| 1923 | # ifdef SH
|
|---|
| 1924 | # define MACH_TYPE "SH"
|
|---|
| 1925 | # define ALIGNMENT 4
|
|---|
| 1926 | # ifdef MSWINCE
|
|---|
| 1927 | # define OS_TYPE "MSWINCE"
|
|---|
| 1928 | # define DATAEND /* not needed */
|
|---|
| 1929 | # endif
|
|---|
| 1930 | # ifdef LINUX
|
|---|
| 1931 | # define OS_TYPE "LINUX"
|
|---|
| 1932 | # define LINUX_STACKBOTTOM
|
|---|
| 1933 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1934 | # define DYNAMIC_LOADING
|
|---|
| 1935 | # define SEARCH_FOR_DATA_START
|
|---|
| 1936 | extern int _end[];
|
|---|
| 1937 | # define DATAEND (_end)
|
|---|
| 1938 | # endif
|
|---|
| 1939 | # ifdef NETBSD
|
|---|
| 1940 | # define OS_TYPE "NETBSD"
|
|---|
| 1941 | # define HEURISTIC2
|
|---|
| 1942 | # define DATASTART GC_data_start
|
|---|
| 1943 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1944 | # define DYNAMIC_LOADING
|
|---|
| 1945 | # endif
|
|---|
| 1946 | # endif
|
|---|
| 1947 |
|
|---|
| 1948 | # ifdef SH4
|
|---|
| 1949 | # define MACH_TYPE "SH4"
|
|---|
| 1950 | # define OS_TYPE "MSWINCE"
|
|---|
| 1951 | # define ALIGNMENT 4
|
|---|
| 1952 | # define DATAEND /* not needed */
|
|---|
| 1953 | # endif
|
|---|
| 1954 |
|
|---|
| 1955 | # ifdef M32R
|
|---|
| 1956 | # define CPP_WORDSZ 32
|
|---|
| 1957 | # define MACH_TYPE "M32R"
|
|---|
| 1958 | # define ALIGNMENT 4
|
|---|
| 1959 | # ifdef LINUX
|
|---|
| 1960 | # define OS_TYPE "LINUX"
|
|---|
| 1961 | # define LINUX_STACKBOTTOM
|
|---|
| 1962 | # undef STACK_GRAN
|
|---|
| 1963 | # define STACK_GRAN 0x10000000
|
|---|
| 1964 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1965 | # define DYNAMIC_LOADING
|
|---|
| 1966 | # define SEARCH_FOR_DATA_START
|
|---|
| 1967 | extern int _end[];
|
|---|
| 1968 | # define DATAEND (_end)
|
|---|
| 1969 | # endif
|
|---|
| 1970 | # endif
|
|---|
| 1971 |
|
|---|
| 1972 | # ifdef X86_64
|
|---|
| 1973 | # define MACH_TYPE "X86_64"
|
|---|
| 1974 | # define ALIGNMENT 8
|
|---|
| 1975 | # define CPP_WORDSZ 64
|
|---|
| 1976 | # ifndef HBLKSIZE
|
|---|
| 1977 | # define HBLKSIZE 4096
|
|---|
| 1978 | # endif
|
|---|
| 1979 | # define CACHE_LINE_SIZE 64
|
|---|
| 1980 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 1981 | # ifdef LINUX
|
|---|
| 1982 | # define OS_TYPE "LINUX"
|
|---|
| 1983 | # define LINUX_STACKBOTTOM
|
|---|
| 1984 | # if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)
|
|---|
| 1985 | # define MPROTECT_VDB
|
|---|
| 1986 | # else
|
|---|
| 1987 | /* We seem to get random errors in incremental mode, */
|
|---|
| 1988 | /* possibly because Linux threads is itself a malloc client */
|
|---|
| 1989 | /* and can't deal with the signals. */
|
|---|
| 1990 | # endif
|
|---|
| 1991 | # ifdef __ELF__
|
|---|
| 1992 | # define DYNAMIC_LOADING
|
|---|
| 1993 | # ifdef UNDEFINED /* includes ro data */
|
|---|
| 1994 | extern int _etext[];
|
|---|
| 1995 | # define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
|
|---|
| 1996 | # endif
|
|---|
| 1997 | # include <features.h>
|
|---|
| 1998 | # define SEARCH_FOR_DATA_START
|
|---|
| 1999 | extern int _end[];
|
|---|
| 2000 | # define DATAEND (_end)
|
|---|
| 2001 | # else
|
|---|
| 2002 | extern int etext[];
|
|---|
| 2003 | # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
|
|---|
| 2004 | # endif
|
|---|
| 2005 | # if defined(__GNUC__) && __GNUC >= 3
|
|---|
| 2006 | # define PREFETCH(x) __builtin_prefetch((x), 0, 0)
|
|---|
| 2007 | # define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
|
|---|
| 2008 | # endif
|
|---|
| 2009 | # endif
|
|---|
| 2010 | # ifdef FREEBSD
|
|---|
| 2011 | # define OS_TYPE "FREEBSD"
|
|---|
| 2012 | # ifndef GC_FREEBSD_THREADS
|
|---|
| 2013 | # define MPROTECT_VDB
|
|---|
| 2014 | # endif
|
|---|
| 2015 | # ifdef __GLIBC__
|
|---|
| 2016 | # define SIG_SUSPEND (32+6)
|
|---|
| 2017 | # define SIG_THR_RESTART (32+5)
|
|---|
| 2018 | extern int _end[];
|
|---|
| 2019 | # define DATAEND (_end)
|
|---|
| 2020 | # else
|
|---|
| 2021 | # define SIG_SUSPEND SIGUSR1
|
|---|
| 2022 | # define SIG_THR_RESTART SIGUSR2
|
|---|
| 2023 | # endif
|
|---|
| 2024 | # define FREEBSD_STACKBOTTOM
|
|---|
| 2025 | # ifdef __ELF__
|
|---|
| 2026 | # define DYNAMIC_LOADING
|
|---|
| 2027 | # endif
|
|---|
| 2028 | extern char etext[];
|
|---|
| 2029 | extern char * GC_FreeBSDGetDataStart();
|
|---|
| 2030 | # define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
|
|---|
| 2031 | # endif
|
|---|
| 2032 | # ifdef NETBSD
|
|---|
| 2033 | # define OS_TYPE "NETBSD"
|
|---|
| 2034 | # ifdef __ELF__
|
|---|
| 2035 | # define DYNAMIC_LOADING
|
|---|
| 2036 | # endif
|
|---|
| 2037 | # define HEURISTIC2
|
|---|
| 2038 | extern char etext[];
|
|---|
| 2039 | # define SEARCH_FOR_DATA_START
|
|---|
| 2040 | # endif
|
|---|
| 2041 | # ifdef SOLARIS
|
|---|
| 2042 | # define OS_TYPE "SOLARIS"
|
|---|
| 2043 | # define ELF_CLASS ELFCLASS64
|
|---|
| 2044 | extern int _etext[], _end[];
|
|---|
| 2045 | extern ptr_t GC_SysVGetDataStart(size_t, ptr_t);
|
|---|
| 2046 | # define DATASTART GC_SysVGetDataStart(0x1000, (ptr_t)_etext)
|
|---|
| 2047 | # define DATAEND (_end)
|
|---|
| 2048 | /* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */
|
|---|
| 2049 | /* but reportedly breaks under 2.8. It appears that the stack */
|
|---|
| 2050 | /* base is a property of the executable, so this should not break */
|
|---|
| 2051 | /* old executables. */
|
|---|
| 2052 | /* HEURISTIC2 probably works, but this appears to be preferable. */
|
|---|
| 2053 | /* Apparently USRSTACK is defined to be USERLIMIT, but in some */
|
|---|
| 2054 | /* installations that's undefined. We work around this with a */
|
|---|
| 2055 | /* gross hack: */
|
|---|
| 2056 | # include <sys/vmparam.h>
|
|---|
| 2057 | # ifdef USERLIMIT
|
|---|
| 2058 | /* This should work everywhere, but doesn't. */
|
|---|
| 2059 | # define STACKBOTTOM USRSTACK
|
|---|
| 2060 | # else
|
|---|
| 2061 | # define HEURISTIC2
|
|---|
| 2062 | # endif
|
|---|
| 2063 | /* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
|
|---|
| 2064 | /* It appears to be fixed in 2.8 and 2.9. */
|
|---|
| 2065 | # ifdef SOLARIS25_PROC_VDB_BUG_FIXED
|
|---|
| 2066 | # define PROC_VDB
|
|---|
| 2067 | # endif
|
|---|
| 2068 | # define DYNAMIC_LOADING
|
|---|
| 2069 | # if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
|
|---|
| 2070 | # define USE_MMAP
|
|---|
| 2071 | /* Otherwise we now use calloc. Mmap may result in the */
|
|---|
| 2072 | /* heap interleaved with thread stacks, which can result in */
|
|---|
| 2073 | /* excessive blacklisting. Sbrk is unusable since it */
|
|---|
| 2074 | /* doesn't interact correctly with the system malloc. */
|
|---|
| 2075 | # endif
|
|---|
| 2076 | # ifdef USE_MMAP
|
|---|
| 2077 | # define HEAP_START (ptr_t)0x40000000
|
|---|
| 2078 | # else
|
|---|
| 2079 | # define HEAP_START DATAEND
|
|---|
| 2080 | # endif
|
|---|
| 2081 | # endif
|
|---|
| 2082 | # endif
|
|---|
| 2083 |
|
|---|
| 2084 | #if defined(LINUX) && defined(USE_MMAP)
|
|---|
| 2085 | /* The kernel may do a somewhat better job merging mappings etc. */
|
|---|
| 2086 | /* with anonymous mappings. */
|
|---|
| 2087 | # define USE_MMAP_ANON
|
|---|
| 2088 | #endif
|
|---|
| 2089 |
|
|---|
| 2090 | #if defined(LINUX) && defined(REDIRECT_MALLOC)
|
|---|
| 2091 | /* Rld appears to allocate some memory with its own allocator, and */
|
|---|
| 2092 | /* some through malloc, which might be redirected. To make this */
|
|---|
| 2093 | /* work with collectable memory, we have to scan memory allocated */
|
|---|
| 2094 | /* by rld's internal malloc. */
|
|---|
| 2095 | # define USE_PROC_FOR_LIBRARIES
|
|---|
| 2096 | #endif
|
|---|
| 2097 |
|
|---|
| 2098 | # ifndef STACK_GROWS_UP
|
|---|
| 2099 | # define STACK_GROWS_DOWN
|
|---|
| 2100 | # endif
|
|---|
| 2101 |
|
|---|
| 2102 | # ifndef CPP_WORDSZ
|
|---|
| 2103 | # define CPP_WORDSZ 32
|
|---|
| 2104 | # endif
|
|---|
| 2105 |
|
|---|
| 2106 | # ifndef OS_TYPE
|
|---|
| 2107 | # define OS_TYPE ""
|
|---|
| 2108 | # endif
|
|---|
| 2109 |
|
|---|
| 2110 | # ifndef DATAEND
|
|---|
| 2111 | extern int end[];
|
|---|
| 2112 | # define DATAEND (end)
|
|---|
| 2113 | # endif
|
|---|
| 2114 |
|
|---|
| 2115 | # if defined(SVR4) && !defined(GETPAGESIZE)
|
|---|
| 2116 | # include <unistd.h>
|
|---|
| 2117 | # define GETPAGESIZE() sysconf(_SC_PAGESIZE)
|
|---|
| 2118 | # endif
|
|---|
| 2119 |
|
|---|
| 2120 | # ifndef GETPAGESIZE
|
|---|
| 2121 | # if defined(SUNOS5) || defined(IRIX5)
|
|---|
| 2122 | # include <unistd.h>
|
|---|
| 2123 | # endif
|
|---|
| 2124 | # define GETPAGESIZE() getpagesize()
|
|---|
| 2125 | # endif
|
|---|
| 2126 |
|
|---|
| 2127 | # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
|
|---|
| 2128 | /* OS has SVR4 generic features. Probably others also qualify. */
|
|---|
| 2129 | # define SVR4
|
|---|
| 2130 | # endif
|
|---|
| 2131 |
|
|---|
| 2132 | # if defined(SUNOS5) || defined(DRSNX)
|
|---|
| 2133 | /* OS has SUNOS5 style semi-undocumented interface to dynamic */
|
|---|
| 2134 | /* loader. */
|
|---|
| 2135 | # define SUNOS5DL
|
|---|
| 2136 | /* OS has SUNOS5 style signal handlers. */
|
|---|
| 2137 | # define SUNOS5SIGS
|
|---|
| 2138 | # endif
|
|---|
| 2139 |
|
|---|
| 2140 | # if defined(HPUX)
|
|---|
| 2141 | # define SUNOS5SIGS
|
|---|
| 2142 | # endif
|
|---|
| 2143 |
|
|---|
| 2144 | # if defined(FREEBSD) && \
|
|---|
| 2145 | (defined(__DragonFly__) || __FreeBSD__ >= 4 || (__FreeBSD_kernel__ >= 4))
|
|---|
| 2146 | # define SUNOS5SIGS
|
|---|
| 2147 | # endif
|
|---|
| 2148 |
|
|---|
| 2149 | # ifdef GC_NETBSD_THREADS
|
|---|
| 2150 | # define SIGRTMIN 33
|
|---|
| 2151 | # define SIGRTMAX 63
|
|---|
| 2152 | # endif
|
|---|
| 2153 |
|
|---|
| 2154 | # if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \
|
|---|
| 2155 | || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
|
|---|
| 2156 | || defined(DGUX) || defined(BSD) || defined(SUNOS4) \
|
|---|
| 2157 | || defined(_AIX) || defined(DARWIN) || defined(OSF1)
|
|---|
| 2158 | # define UNIX_LIKE /* Basic Unix-like system calls work. */
|
|---|
| 2159 | # endif
|
|---|
| 2160 |
|
|---|
| 2161 | # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
|
|---|
| 2162 | -> bad word size
|
|---|
| 2163 | # endif
|
|---|
| 2164 |
|
|---|
| 2165 | # ifdef PCR
|
|---|
| 2166 | # undef DYNAMIC_LOADING
|
|---|
| 2167 | # undef STACKBOTTOM
|
|---|
| 2168 | # undef HEURISTIC1
|
|---|
| 2169 | # undef HEURISTIC2
|
|---|
| 2170 | # undef PROC_VDB
|
|---|
| 2171 | # undef MPROTECT_VDB
|
|---|
| 2172 | # define PCR_VDB
|
|---|
| 2173 | # endif
|
|---|
| 2174 |
|
|---|
| 2175 | # ifdef SRC_M3
|
|---|
| 2176 | /* Postponed for now. */
|
|---|
| 2177 | # undef PROC_VDB
|
|---|
| 2178 | # undef MPROTECT_VDB
|
|---|
| 2179 | # endif
|
|---|
| 2180 |
|
|---|
| 2181 | # ifdef SMALL_CONFIG
|
|---|
| 2182 | /* Presumably not worth the space it takes. */
|
|---|
| 2183 | # undef PROC_VDB
|
|---|
| 2184 | # undef MPROTECT_VDB
|
|---|
| 2185 | # endif
|
|---|
| 2186 |
|
|---|
| 2187 | # ifdef USE_MUNMAP
|
|---|
| 2188 | # undef MPROTECT_VDB /* Can't deal with address space holes. */
|
|---|
| 2189 | # endif
|
|---|
| 2190 |
|
|---|
| 2191 | # ifdef PARALLEL_MARK
|
|---|
| 2192 | # undef MPROTECT_VDB /* For now. */
|
|---|
| 2193 | # endif
|
|---|
| 2194 |
|
|---|
| 2195 | # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
|
|---|
| 2196 | # define DEFAULT_VDB
|
|---|
| 2197 | # endif
|
|---|
| 2198 |
|
|---|
| 2199 | # ifndef PREFETCH
|
|---|
| 2200 | # define PREFETCH(x)
|
|---|
| 2201 | # define NO_PREFETCH
|
|---|
| 2202 | # endif
|
|---|
| 2203 |
|
|---|
| 2204 | # ifndef PREFETCH_FOR_WRITE
|
|---|
| 2205 | # define PREFETCH_FOR_WRITE(x)
|
|---|
| 2206 | # define NO_PREFETCH_FOR_WRITE
|
|---|
| 2207 | # endif
|
|---|
| 2208 |
|
|---|
| 2209 | # ifndef CACHE_LINE_SIZE
|
|---|
| 2210 | # define CACHE_LINE_SIZE 32 /* Wild guess */
|
|---|
| 2211 | # endif
|
|---|
| 2212 |
|
|---|
| 2213 | # if defined(LINUX) || defined(__GLIBC__)
|
|---|
| 2214 | # define REGISTER_LIBRARIES_EARLY
|
|---|
| 2215 | /* We sometimes use dl_iterate_phdr, which may acquire an internal */
|
|---|
| 2216 | /* lock. This isn't safe after the world has stopped. So we must */
|
|---|
| 2217 | /* call GC_register_dynamic_libraries before stopping the world. */
|
|---|
| 2218 | /* For performance reasons, this may be beneficial on other */
|
|---|
| 2219 | /* platforms as well, though it should be avoided in win32. */
|
|---|
| 2220 | # endif /* LINUX */
|
|---|
| 2221 |
|
|---|
| 2222 | # if defined(SEARCH_FOR_DATA_START)
|
|---|
| 2223 | extern ptr_t GC_data_start;
|
|---|
| 2224 | # define DATASTART GC_data_start
|
|---|
| 2225 | # endif
|
|---|
| 2226 |
|
|---|
| 2227 | # ifndef CLEAR_DOUBLE
|
|---|
| 2228 | # define CLEAR_DOUBLE(x) \
|
|---|
| 2229 | ((word*)x)[0] = 0; \
|
|---|
| 2230 | ((word*)x)[1] = 0;
|
|---|
| 2231 | # endif /* CLEAR_DOUBLE */
|
|---|
| 2232 |
|
|---|
| 2233 | /* Internally we use GC_SOLARIS_THREADS to test for either old or pthreads. */
|
|---|
| 2234 | # if defined(GC_SOLARIS_PTHREADS) && !defined(GC_SOLARIS_THREADS)
|
|---|
| 2235 | # define GC_SOLARIS_THREADS
|
|---|
| 2236 | # endif
|
|---|
| 2237 |
|
|---|
| 2238 | # if defined(GC_IRIX_THREADS) && !defined(IRIX5)
|
|---|
| 2239 | --> inconsistent configuration
|
|---|
| 2240 | # endif
|
|---|
| 2241 | # if defined(GC_LINUX_THREADS) && !defined(LINUX)
|
|---|
| 2242 | --> inconsistent configuration
|
|---|
| 2243 | # endif
|
|---|
| 2244 | # if defined(GC_NETBSD_THREADS) && !defined(NETBSD)
|
|---|
| 2245 | --> inconsistent configuration
|
|---|
| 2246 | # endif
|
|---|
| 2247 | # if defined(GC_SOLARIS_THREADS) && !defined(SUNOS5)
|
|---|
| 2248 | --> inconsistent configuration
|
|---|
| 2249 | # endif
|
|---|
| 2250 | # if defined(GC_HPUX_THREADS) && !defined(HPUX)
|
|---|
| 2251 | --> inconsistent configuration
|
|---|
| 2252 | # endif
|
|---|
| 2253 | # if defined(GC_AIX_THREADS) && !defined(_AIX)
|
|---|
| 2254 | --> inconsistent configuration
|
|---|
| 2255 | # endif
|
|---|
| 2256 | # if defined(GC_WIN32_THREADS) && !defined(MSWIN32) && !defined(CYGWIN32)
|
|---|
| 2257 | --> inconsistent configuration
|
|---|
| 2258 | # endif
|
|---|
| 2259 |
|
|---|
| 2260 | # if defined(PCR) || defined(SRC_M3) || \
|
|---|
| 2261 | defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) || \
|
|---|
| 2262 | defined(GC_PTHREADS)
|
|---|
| 2263 | # define THREADS
|
|---|
| 2264 | # endif
|
|---|
| 2265 |
|
|---|
| 2266 | # if defined(HP_PA) || defined(M88K) \
|
|---|
| 2267 | || defined(POWERPC) && !defined(DARWIN) \
|
|---|
| 2268 | || defined(LINT) || defined(MSWINCE) || defined(ARM32) || defined(CRIS) \
|
|---|
| 2269 | || (defined(I386) && defined(__LCC__))
|
|---|
| 2270 | /* Use setjmp based hack to mark from callee-save registers. */
|
|---|
| 2271 | /* The define should move to the individual platform */
|
|---|
| 2272 | /* descriptions. */
|
|---|
| 2273 | # define USE_GENERIC_PUSH_REGS
|
|---|
| 2274 | # endif
|
|---|
| 2275 |
|
|---|
| 2276 | # if defined(MSWINCE)
|
|---|
| 2277 | # define NO_GETENV
|
|---|
| 2278 | # endif
|
|---|
| 2279 |
|
|---|
| 2280 | # if defined(SPARC)
|
|---|
| 2281 | # define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
|
|---|
| 2282 | /* include assembly code to do it well. */
|
|---|
| 2283 | # endif
|
|---|
| 2284 |
|
|---|
| 2285 | /* Can we save call chain in objects for debugging? */
|
|---|
| 2286 | /* SET NFRAMES (# of saved frames) and NARGS (#of args for each */
|
|---|
| 2287 | /* frame) to reasonable values for the platform. */
|
|---|
| 2288 | /* Set SAVE_CALL_CHAIN if we can. SAVE_CALL_COUNT can be specified */
|
|---|
| 2289 | /* at build time, though we feel free to adjust it slightly. */
|
|---|
| 2290 | /* Define NEED_CALLINFO if we either save the call stack or */
|
|---|
| 2291 | /* GC_ADD_CALLER is defined. */
|
|---|
| 2292 | /* GC_CAN_SAVE_CALL_STACKS is set in gc.h. */
|
|---|
| 2293 |
|
|---|
| 2294 | #if defined(SPARC)
|
|---|
| 2295 | # define CAN_SAVE_CALL_ARGS
|
|---|
| 2296 | #endif
|
|---|
| 2297 | #if (defined(I386) || defined(X86_64)) && (defined(LINUX) || defined(__GLIBC__))
|
|---|
| 2298 | /* SAVE_CALL_CHAIN is supported if the code is compiled to save */
|
|---|
| 2299 | /* frame pointers by default, i.e. no -fomit-frame-pointer flag. */
|
|---|
| 2300 | # define CAN_SAVE_CALL_ARGS
|
|---|
| 2301 | #endif
|
|---|
| 2302 |
|
|---|
| 2303 | # if defined(SAVE_CALL_COUNT) && !defined(GC_ADD_CALLER) \
|
|---|
| 2304 | && defined(GC_CAN_SAVE_CALL_STACKS)
|
|---|
| 2305 | # define SAVE_CALL_CHAIN
|
|---|
| 2306 | # endif
|
|---|
| 2307 | # ifdef SAVE_CALL_CHAIN
|
|---|
| 2308 | # if defined(SAVE_CALL_NARGS) && defined(CAN_SAVE_CALL_ARGS)
|
|---|
| 2309 | # define NARGS SAVE_CALL_NARGS
|
|---|
| 2310 | # else
|
|---|
| 2311 | # define NARGS 0 /* Number of arguments to save for each call. */
|
|---|
| 2312 | # endif
|
|---|
| 2313 | # endif
|
|---|
| 2314 | # ifdef SAVE_CALL_CHAIN
|
|---|
| 2315 | # ifndef SAVE_CALL_COUNT
|
|---|
| 2316 | # define NFRAMES 6 /* Number of frames to save. Even for */
|
|---|
| 2317 | /* alignment reasons. */
|
|---|
| 2318 | # else
|
|---|
| 2319 | # define NFRAMES ((SAVE_CALL_COUNT + 1) & ~1)
|
|---|
| 2320 | # endif
|
|---|
| 2321 | # define NEED_CALLINFO
|
|---|
| 2322 | # endif /* SAVE_CALL_CHAIN */
|
|---|
| 2323 | # ifdef GC_ADD_CALLER
|
|---|
| 2324 | # define NFRAMES 1
|
|---|
| 2325 | # define NARGS 0
|
|---|
| 2326 | # define NEED_CALLINFO
|
|---|
| 2327 | # endif
|
|---|
| 2328 |
|
|---|
| 2329 | # if defined(MAKE_BACK_GRAPH) && !defined(DBG_HDRS_ALL)
|
|---|
| 2330 | # define DBG_HDRS_ALL
|
|---|
| 2331 | # endif
|
|---|
| 2332 |
|
|---|
| 2333 | # if defined(POINTER_MASK) && !defined(POINTER_SHIFT)
|
|---|
| 2334 | # define POINTER_SHIFT 0
|
|---|
| 2335 | # endif
|
|---|
| 2336 |
|
|---|
| 2337 | # if defined(POINTER_SHIFT) && !defined(POINTER_MASK)
|
|---|
| 2338 | # define POINTER_MASK ((GC_word)(-1))
|
|---|
| 2339 | # endif
|
|---|
| 2340 |
|
|---|
| 2341 | # if !defined(FIXUP_POINTER) && defined(POINTER_MASK)
|
|---|
| 2342 | # define FIXUP_POINTER(p) (p) = ((p) & (POINTER_MASK) << POINTER_SHIFT)
|
|---|
| 2343 | # endif
|
|---|
| 2344 |
|
|---|
| 2345 | # if defined(FIXUP_POINTER)
|
|---|
| 2346 | # define NEED_FIXUP_POINTER 1
|
|---|
| 2347 | # else
|
|---|
| 2348 | # define NEED_FIXUP_POINTER 0
|
|---|
| 2349 | # define FIXUP_POINTER(p)
|
|---|
| 2350 | # endif
|
|---|
| 2351 |
|
|---|
| 2352 | #ifdef GC_PRIVATE_H
|
|---|
| 2353 | /* This relies on some type definitions from gc_priv.h, from */
|
|---|
| 2354 | /* where it's normally included. */
|
|---|
| 2355 | /* */
|
|---|
| 2356 | /* How to get heap memory from the OS: */
|
|---|
| 2357 | /* Note that sbrk()-like allocation is preferred, since it */
|
|---|
| 2358 | /* usually makes it possible to merge consecutively allocated */
|
|---|
| 2359 | /* chunks. It also avoids unintented recursion with */
|
|---|
| 2360 | /* -DREDIRECT_MALLOC. */
|
|---|
| 2361 | /* GET_MEM() returns a HLKSIZE aligned chunk. */
|
|---|
| 2362 | /* 0 is taken to mean failure. */
|
|---|
| 2363 | /* In the case os USE_MMAP, the argument must also be a */
|
|---|
| 2364 | /* physical page size. */
|
|---|
| 2365 | /* GET_MEM is currently not assumed to retrieve 0 filled space, */
|
|---|
| 2366 | /* though we should perhaps take advantage of the case in which */
|
|---|
| 2367 | /* does. */
|
|---|
| 2368 | struct hblk; /* See gc_priv.h. */
|
|---|
| 2369 | # ifdef PCR
|
|---|
| 2370 | char * real_malloc();
|
|---|
| 2371 | # define GET_MEM(bytes) HBLKPTR(real_malloc((size_t)bytes + GC_page_size) \
|
|---|
| 2372 | + GC_page_size-1)
|
|---|
| 2373 | # else
|
|---|
| 2374 | # ifdef OS2
|
|---|
| 2375 | void * os2_alloc(size_t bytes);
|
|---|
| 2376 | # define GET_MEM(bytes) HBLKPTR((ptr_t)os2_alloc((size_t)bytes \
|
|---|
| 2377 | + GC_page_size) \
|
|---|
| 2378 | + GC_page_size-1)
|
|---|
| 2379 | # else
|
|---|
| 2380 | # if defined(NEXT) || defined(DOS4GW) || defined(NONSTOP) || \
|
|---|
| 2381 | (defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC)) || \
|
|---|
| 2382 | (defined(SUNOS5) && !defined(USE_MMAP))
|
|---|
| 2383 | # define GET_MEM(bytes) HBLKPTR((size_t) \
|
|---|
| 2384 | calloc(1, (size_t)bytes + GC_page_size) \
|
|---|
| 2385 | + GC_page_size-1)
|
|---|
| 2386 | # else
|
|---|
| 2387 | # ifdef MSWIN32
|
|---|
| 2388 | extern ptr_t GC_win32_get_mem();
|
|---|
| 2389 | # define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes)
|
|---|
| 2390 | # else
|
|---|
| 2391 | # ifdef MACOS
|
|---|
| 2392 | # if defined(USE_TEMPORARY_MEMORY)
|
|---|
| 2393 | extern Ptr GC_MacTemporaryNewPtr(size_t size,
|
|---|
| 2394 | Boolean clearMemory);
|
|---|
| 2395 | # define GET_MEM(bytes) HBLKPTR( \
|
|---|
| 2396 | GC_MacTemporaryNewPtr(bytes + GC_page_size, true) \
|
|---|
| 2397 | + GC_page_size-1)
|
|---|
| 2398 | # else
|
|---|
| 2399 | # define GET_MEM(bytes) HBLKPTR( \
|
|---|
| 2400 | NewPtrClear(bytes + GC_page_size) + GC_page_size-1)
|
|---|
| 2401 | # endif
|
|---|
| 2402 | # else
|
|---|
| 2403 | # ifdef MSWINCE
|
|---|
| 2404 | extern ptr_t GC_wince_get_mem();
|
|---|
| 2405 | # define GET_MEM(bytes) (struct hblk *)GC_wince_get_mem(bytes)
|
|---|
| 2406 | # else
|
|---|
| 2407 | # if defined(AMIGA) && defined(GC_AMIGA_FASTALLOC)
|
|---|
| 2408 | extern void *GC_amiga_get_mem(size_t size);
|
|---|
| 2409 | # define GET_MEM(bytes) HBLKPTR((size_t) \
|
|---|
| 2410 | GC_amiga_get_mem((size_t)bytes + GC_page_size) \
|
|---|
| 2411 | + GC_page_size-1)
|
|---|
| 2412 | # else
|
|---|
| 2413 | extern ptr_t GC_unix_get_mem();
|
|---|
| 2414 | # define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)
|
|---|
| 2415 | # endif
|
|---|
| 2416 | # endif
|
|---|
| 2417 | # endif
|
|---|
| 2418 | # endif
|
|---|
| 2419 | # endif
|
|---|
| 2420 | # endif
|
|---|
| 2421 | # endif
|
|---|
| 2422 |
|
|---|
| 2423 | #endif /* GC_PRIVATE_H */
|
|---|
| 2424 |
|
|---|
| 2425 | #if defined(_AIX) && !defined(__GNUC__) && !defined(__STDC__)
|
|---|
| 2426 | /* IBMs xlc compiler doesn't appear to follow the convention of */
|
|---|
| 2427 | /* defining __STDC__ to be zero in extended mode. */
|
|---|
| 2428 | # define __STDC__ 0
|
|---|
| 2429 | #endif
|
|---|
| 2430 |
|
|---|
| 2431 | # endif /* GCCONFIG_H */
|
|---|