root/gc/include/private/gcconfig.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


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

/* [<][>][^][v][top][bottom][index][help] */