Back to index

plt-scheme  4.2.1
gcconfig.h
Go to the documentation of this file.
00001 /* 
00002  * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
00003  * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
00004  * Copyright (c) 1996 by Silicon Graphics.  All rights reserved.
00005  * Copyright (c) 2000-2004 Hewlett-Packard Development Company, L.P.
00006  *
00007  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
00008  * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
00009  *
00010  * Permission is hereby granted to use or copy this program
00011  * for any purpose,  provided the above notices are retained on all copies.
00012  * Permission to modify the code and to distribute modified code is granted,
00013  * provided the above notices are retained, and a notice that the code was
00014  * modified is included with the above copyright notice.
00015  */
00016 
00017 /*
00018  * This header is private to the gc.  It is almost always included from
00019  * gc_priv.h.  However it is possible to include it by itself if just the
00020  * configuration macros are needed.  In that
00021  * case, a few declarations relying on types declared in gc_priv.h will be
00022  * omitted.
00023  */
00024  
00025 #ifndef GCCONFIG_H
00026 
00027 # define GCCONFIG_H
00028 
00029 # ifndef GC_PRIVATE_H
00030     /* Fake ptr_t declaration, just to avoid compilation errors.      */
00031     /* This avoids many instances if "ifndef GC_PRIVATE_H" below.     */
00032     typedef struct GC_undefined_struct * ptr_t;
00033 # endif
00034 
00035 /* Machine dependent parameters.  Some tuning parameters can be found */
00036 /* near the top of gc_private.h.                               */
00037 
00038 /* Machine specific parts contributed by various people.  See README file. */
00039 
00040 /* First a unified test for Linux: */
00041 # if defined(linux) || defined(__linux__)
00042 #  ifndef LINUX
00043 #    define LINUX
00044 #  endif
00045 # endif
00046 
00047 /* And one for NetBSD: */
00048 # if defined(__NetBSD__)
00049 #    define NETBSD
00050 # endif
00051 
00052 /* And one for OpenBSD: */
00053 # if defined(__OpenBSD__)
00054 #    define OPENBSD
00055 # endif
00056 
00057 /* And one for FreeBSD: */
00058 # if defined(__FreeBSD__) && !defined(FREEBSD)
00059 #    define FREEBSD
00060 # endif
00061 
00062 /* Determine the machine type: */
00063 # if defined(__arm__) || defined(__thumb__)
00064 #    define ARM32
00065 #    if !defined(LINUX) && !defined(NETBSD)
00066 #      define NOSYS
00067 #      define mach_type_known
00068 #    endif
00069 # endif
00070 # if defined(sun) && defined(mc68000)
00071 #    define M68K
00072 #    define SUNOS4
00073 #    define mach_type_known
00074 # endif
00075 # if defined(hp9000s300)
00076 #    define M68K
00077 #    define HP
00078 #    define mach_type_known
00079 # endif
00080 # if defined(OPENBSD) && defined(m68k)
00081 #    define M68K
00082 #    define mach_type_known
00083 # endif
00084 # if defined(OPENBSD) && defined(__sparc__)
00085 #    define SPARC
00086 #    define mach_type_known
00087 # endif
00088 # if defined(NETBSD) && (defined(m68k) || defined(__m68k__))
00089 #    define M68K
00090 #    define mach_type_known
00091 # endif
00092 # if defined(NETBSD) && defined(__powerpc__)
00093 #    define POWERPC
00094 #    define mach_type_known
00095 # endif
00096 # if defined(NETBSD) && (defined(__arm32__) || defined(__arm__))
00097 #    define ARM32
00098 #    define mach_type_known
00099 # endif
00100 # if defined(NETBSD) && defined(__sh__)
00101 #    define SH
00102 #    define mach_type_known
00103 # endif
00104 # if defined(vax)
00105 #    define VAX
00106 #    ifdef ultrix
00107 #      define ULTRIX
00108 #    else
00109 #      define BSD
00110 #    endif
00111 #    define mach_type_known
00112 # endif
00113 # if defined(__NetBSD__) && defined(__vax__)
00114 #    define VAX
00115 #    define mach_type_known
00116 # endif
00117 # if defined(mips) || defined(__mips) || defined(_mips)
00118 #    define MIPS
00119 #    if defined(nec_ews) || defined(_nec_ews)
00120 #      define EWS4800
00121 #    endif
00122 #    if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD)
00123 #      if defined(ultrix) || defined(__ultrix)
00124 #       define ULTRIX
00125 #      else
00126 #       if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) \
00127            || defined(__SYSTYPE_SVR4__)
00128 #         define IRIX5   /* or IRIX 6.X */
00129 #       else
00130 #         define RISCOS  /* or IRIX 4.X */
00131 #       endif
00132 #      endif
00133 #    endif /* !LINUX */
00134 #    if defined(__NetBSD__) && defined(__MIPSEL__)
00135 #      undef ULTRIX
00136 #    endif
00137 #    define mach_type_known
00138 # endif
00139 # if defined(DGUX) && (defined(i386) || defined(__i386__))
00140 #    define I386
00141 #    ifndef _USING_DGUX
00142 #    define _USING_DGUX
00143 #    endif
00144 #    define mach_type_known
00145 # endif
00146 # if defined(sequent) && (defined(i386) || defined(__i386__))
00147 #    define I386
00148 #    define SEQUENT
00149 #    define mach_type_known
00150 # endif
00151 # if defined(sun) && (defined(i386) || defined(__i386__))
00152 #    define I386
00153 #    define SUNOS5
00154 #    define mach_type_known
00155 # endif
00156 # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
00157 #    define I386
00158 #    define OS2
00159 #    define mach_type_known
00160 # endif
00161 # if defined(ibm032)
00162 #   define RT
00163 #   define mach_type_known
00164 # endif
00165 # if defined(sun) && (defined(sparc) || defined(__sparc))
00166 #   define SPARC
00167     /* Test for SunOS 5.x */
00168 #     include <errno.h>
00169 #     ifdef ECHRNG
00170 #       define SUNOS5
00171 #     else
00172 #      define SUNOS4
00173 #     endif
00174 #   define mach_type_known
00175 # endif
00176 # if defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
00177      && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__)
00178 #   define SPARC
00179 #   define DRSNX
00180 #   define mach_type_known
00181 # endif
00182 # if defined(_IBMR2)
00183 #   define RS6000
00184 #   define mach_type_known
00185 # endif
00186 # if defined(__NetBSD__) && defined(__sparc__)
00187 #   define SPARC
00188 #   define mach_type_known
00189 # endif
00190 # if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
00191        /* The above test may need refinement     */
00192 #   define I386
00193 #   if defined(_SCO_ELF)
00194 #     define SCO_ELF
00195 #   else
00196 #     define SCO
00197 #   endif
00198 #   define mach_type_known
00199 # endif
00200 # if defined(_AUX_SOURCE)
00201 #   define M68K
00202 #   define SYSV
00203 #   define mach_type_known
00204 # endif
00205 # if defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
00206      || defined(hppa) || defined(__hppa__)
00207 #   define HP_PA
00208 #   if !defined(LINUX) && !defined(HPUX)
00209 #     define HPUX
00210 #   endif
00211 #   define mach_type_known
00212 # endif
00213 # if defined(__ia64) && defined(_HPUX_SOURCE)
00214 #   define IA64
00215 #   ifndef HPUX
00216 #     define HPUX
00217 #   endif
00218 #   define mach_type_known
00219 # endif
00220 # if defined(__BEOS__) && defined(_X86_)
00221 #    define I386
00222 #    define BEOS
00223 #    define mach_type_known
00224 # endif
00225 # if defined(LINUX) && (defined(i386) || defined(__i386__))
00226 #    define I386
00227 #    define mach_type_known
00228 # endif
00229 # if defined(LINUX) && defined(__x86_64__)
00230 #    define X86_64
00231 #    define mach_type_known
00232 # endif
00233 # if defined(LINUX) && (defined(__ia64__) || defined(__ia64))
00234 #    define IA64
00235 #    define mach_type_known
00236 # endif
00237 # if defined(LINUX) && defined(__arm__)
00238 #    define ARM32
00239 #    define mach_type_known
00240 # endif
00241 # if defined(LINUX) && defined(__cris__)
00242 #    ifndef CRIS
00243 #      define CRIS
00244 #    endif
00245 #    define mach_type_known
00246 # endif
00247 # if defined(LINUX) && (defined(powerpc) || defined(__powerpc__) || \
00248                       defined(powerpc64) || defined(__powerpc64__))
00249 #    define POWERPC
00250 #    define mach_type_known
00251 # endif
00252 # if defined(FREEBSD) && (defined(powerpc) || defined(__powerpc__))
00253 #    define POWERPC
00254 #    define mach_type_known
00255 # endif
00256 # if defined(LINUX) && defined(__mc68000__)
00257 #    define M68K
00258 #    define mach_type_known
00259 # endif
00260 # if defined(LINUX) && (defined(sparc) || defined(__sparc__))
00261 #    define SPARC
00262 #    define mach_type_known
00263 # endif
00264 # if defined(LINUX) && defined(__arm__)
00265 #    define ARM32
00266 #    define mach_type_known
00267 # endif
00268 # if defined(LINUX) && defined(__sh__)
00269 #    define SH
00270 #    define mach_type_known
00271 # endif
00272 # if defined(LINUX) && defined(__m32r__)
00273 #    define M32R
00274 #    define mach_type_known
00275 # endif
00276 # if defined(__alpha) || defined(__alpha__)
00277 #   define ALPHA
00278 #   if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) && !defined(FREEBSD)
00279 #     define OSF1    /* a.k.a Digital Unix */
00280 #   endif
00281 #   define mach_type_known
00282 # endif
00283 # if defined(_AMIGA) && !defined(AMIGA)
00284 #   define AMIGA
00285 # endif
00286 # ifdef AMIGA 
00287 #   define M68K
00288 #   define mach_type_known
00289 # endif
00290 # if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
00291 #   define M68K
00292 #   define MACOS
00293 #   define mach_type_known
00294 # endif
00295 # if defined(__MWERKS__) && defined(__powerc) && !defined(__MACH__)
00296 #   define POWERPC
00297 #   define MACOS
00298 #   define mach_type_known
00299 # endif
00300 # if defined(macosx) || (defined(__APPLE__) && defined(__MACH__))
00301 #   define DARWIN
00302 #   if defined(__ppc__)  || defined(__ppc64__)
00303 #    define POWERPC
00304 #    define mach_type_known
00305 #   endif
00306 #   if defined(__i386__)
00307 #    define I386
00308 #    define mach_type_known
00309 #   endif
00310 # endif
00311 # if defined(NeXT) && defined(mc68000)
00312 #   define M68K
00313 #   define NEXT
00314 #   define mach_type_known
00315 # endif
00316 # if defined(NeXT) && (defined(i386) || defined(__i386__))
00317 #   define I386
00318 #   define NEXT
00319 #   define mach_type_known
00320 # endif
00321 # if defined(__OpenBSD__) && (defined(i386) || defined(__i386__))
00322 #   define I386
00323 #   define OPENBSD
00324 #   define mach_type_known
00325 # endif
00326 # if defined(FREEBSD) && (defined(i386) || defined(__i386__))
00327 #   define I386
00328 #   define mach_type_known
00329 # endif
00330 # if defined(__NetBSD__) && (defined(i386) || defined(__i386__))
00331 #   define I386
00332 #   define mach_type_known
00333 # endif
00334 /* PLTSCHEME: added OpenBSD: */
00335 # if (defined(__NetBSD__) || defined(__OpenBSD__)) && defined(__x86_64__)
00336 #    define X86_64
00337 #    define mach_type_known
00338 # endif
00339 /* PLTSCHEME: added FREEBSD + __amd64__ */
00340 # if defined(FREEBSD) && defined(__amd64__)
00341 #    define X86_64
00342 #    define mach_type_known
00343 # endif
00344 # if defined(FREEBSD) && defined(__sparc__)
00345 #    define SPARC
00346 #    define mach_type_known
00347 # endif
00348 # if defined(bsdi) && (defined(i386) || defined(__i386__))
00349 #    define I386
00350 #    define BSDI
00351 #    define mach_type_known
00352 # endif
00353 # if !defined(mach_type_known) && defined(__386BSD__)
00354 #   define I386
00355 #   define THREE86BSD
00356 #   define mach_type_known
00357 # endif
00358 # if defined(_CX_UX) && defined(_M88K)
00359 #   define M88K
00360 #   define CX_UX
00361 #   define mach_type_known
00362 # endif
00363 # if defined(DGUX) && defined(m88k)
00364 #   define M88K
00365     /* DGUX defined */
00366 #   define mach_type_known
00367 # endif
00368 # if defined(_WIN32_WCE)
00369     /* SH3, SH4, MIPS already defined for corresponding architectures */
00370 #   if defined(SH3) || defined(SH4)
00371 #     define SH
00372 #   endif
00373 #   if defined(x86)
00374 #     define I386
00375 #   endif
00376 #   if defined(ARM)
00377 #     define ARM32
00378 #   endif
00379 #   define MSWINCE
00380 #   define mach_type_known
00381 # else
00382 #   if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
00383         || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
00384 #     define I386
00385 #     define MSWIN32 /* or Win32s */
00386 #     define mach_type_known
00387 #   endif
00388 #   if defined(_MSC_VER) && defined(_M_IA64)
00389 #     define IA64
00390 #     define MSWIN32 /* Really win64, but we don't treat 64-bit       */
00391                      /* variants as a differnt platform.              */
00392 #   endif
00393 # endif
00394 # if defined(__DJGPP__)
00395 #   define I386
00396 #   ifndef DJGPP
00397 #     define DJGPP  /* MSDOS running the DJGPP port of GCC */
00398 #   endif
00399 #   define mach_type_known
00400 # endif
00401 # if defined(__CYGWIN32__) || defined(__CYGWIN__)
00402 #   define I386
00403 #   define CYGWIN32
00404 #   define mach_type_known
00405 # endif
00406 # if defined(__MINGW32__)
00407 #   define I386
00408 #   define MSWIN32
00409 #   define mach_type_known
00410 # endif
00411 # if defined(__BORLANDC__)
00412 #   define I386
00413 #   define MSWIN32
00414 #   define mach_type_known
00415 # endif
00416 # if defined(_UTS) && !defined(mach_type_known)
00417 #   define S370
00418 #   define UTS4
00419 #   define mach_type_known
00420 # endif
00421 # if defined(__pj__)
00422 #   define PJ
00423 #   define mach_type_known
00424 # endif
00425 # if defined(__embedded__) && defined(PPC)
00426 #   define POWERPC
00427 #   define NOSYS
00428 #   define mach_type_known
00429 # endif
00430 /* Ivan Demakov */
00431 # if defined(__WATCOMC__) && defined(__386__)
00432 #   define I386
00433 #   if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
00434 #     if defined(__OS2__)
00435 #       define OS2
00436 #     else
00437 #       if defined(__WINDOWS_386__) || defined(__NT__)
00438 #         define MSWIN32
00439 #       else
00440 #         define DOS4GW
00441 #       endif
00442 #     endif
00443 #   endif
00444 #   define mach_type_known
00445 # endif
00446 # if defined(__s390__) && defined(LINUX)
00447 #    define S390
00448 #    define mach_type_known
00449 # endif
00450 # if defined(__GNU__)
00451 #   if defined(__i386__)
00452 /* The Debian Hurd running on generic PC */  
00453 #     define  HURD
00454 #     define  I386
00455 #     define  mach_type_known
00456 #    endif 
00457 # endif
00458 # if defined(__TANDEM)
00459     /* Nonstop S-series */
00460     /* FIXME: Should recognize Integrity series? */
00461 #   define MIPS
00462 #   define NONSTOP
00463 #   define mach_type_known
00464 # endif
00465 
00466 /* Feel free to add more clauses here */
00467 
00468 /* Or manually define the machine type here.  A machine type is       */
00469 /* characterized by the architecture.  Some                           */
00470 /* machine types are further subdivided by OS.                        */
00471 /* the macros ULTRIX, RISCOS, and BSD to distinguish.                 */
00472 /* Note that SGI IRIX is treated identically to RISCOS.               */
00473 /* SYSV on an M68K actually means A/UX.                               */
00474 /* The distinction in these cases is usually the stack starting address */
00475 # ifndef mach_type_known
00476        --> unknown machine type
00477 # endif
00478                   /* Mapping is: M68K       ==> Motorola 680X0 */
00479                   /*           (SUNOS4,HP,NEXT, and SYSV (A/UX),      */
00480                   /*           MACOS and AMIGA variants)              */
00481                   /*             I386       ==> Intel 386             */
00482                   /*            (SEQUENT, OS2, SCO, LINUX, NETBSD,    */
00483                   /*             FREEBSD, THREE86BSD, MSWIN32, */
00484                   /*                    BSDI,SUNOS5, NEXT, other variants)   */
00485                     /*             NS32K      ==> Encore Multimax     */
00486                    /*             MIPS       ==> R2000 through R14K   */
00487                     /*                    (many variants)                    */
00488                     /*                VAX       ==> DEC VAX           */
00489                     /*                    (BSD, ULTRIX variants)             */
00490                     /*                RS6000     ==> IBM RS/6000 AIX3.X      */
00491                     /*                RT        ==> IBM PC/RT         */
00492                     /*                HP_PA      ==> HP9000/700 & /800       */
00493                     /*                             HP/UX, LINUX              */
00494                   /*           SPARC      ==> SPARC     v7/v8/v9      */
00495                   /*               (SUNOS4, SUNOS5, LINUX,            */
00496                   /*                DRSNX variants)            */
00497                   /*                  ALPHA      ==> DEC Alpha               */
00498                   /*               (OSF1 and LINUX variants)   */
00499                   /*                  M88K       ==> Motorola 88XX0        */
00500                   /*                       (CX_UX and DGUX)           */
00501                   /*                  S370             ==> 370-like machine  */
00502                   /*                      running Amdahl UTS4         */
00503                     /*             S390       ==> 390-like machine      */
00504                   /*                  running LINUX                   */
00505                   /*                  ARM32      ==> Intel StrongARM  */
00506                   /*                  IA64             ==> Intel IPF         */
00507                   /*                        (e.g. Itanium)     */
00508                   /*               (LINUX and HPUX)             */
00509                   /*           SH        ==> Hitachi SuperH    */
00510                   /*                      (LINUX & MSWINCE)           */
00511                   /*                  X86_64     ==> AMD x86-64              */
00512                   /*           POWERPC    ==> IBM/Apple PowerPC       */
00513                   /*               (MACOS(<=9),DARWIN(incl.MACOSX),*/
00514                   /*                LINUX, NETBSD, NOSYS variants)    */
00515                   /*               Handles 32 and 64-bit variants.    */
00516                   /*                      AIX should be handled here, but    */
00517                   /*               that's called an RS6000.    */
00518                   /*           CRIS       ==> Axis Etrax              */
00519                   /*           M32R             ==> Renesas M32R             */
00520 
00521 
00522 /*
00523  * For each architecture and OS, the following need to be defined:
00524  *
00525  * CPP_WORDSZ is a simple integer constant representing the word size.
00526  * in bits.  We assume byte addressibility, where a byte has 8 bits.
00527  * We also assume CPP_WORDSZ is either 32 or 64.
00528  * (We care about the length of pointers, not hardware
00529  * bus widths.  Thus a 64 bit processor with a C compiler that uses
00530  * 32 bit pointers should use CPP_WORDSZ of 32, not 64. Default is 32.)
00531  *
00532  * MACH_TYPE is a string representation of the machine type.
00533  * OS_TYPE is analogous for the OS.
00534  *
00535  * ALIGNMENT is the largest N, such that
00536  * all pointer are guaranteed to be aligned on N byte boundaries.
00537  * defining it to be 1 will always work, but perform poorly.
00538  *
00539  * DATASTART is the beginning of the data segment.
00540  * On some platforms SEARCH_FOR_DATA_START is defined.
00541  * SEARCH_FOR_DATASTART will cause GC_data_start to
00542  * be set to an address determined by accessing data backwards from _end
00543  * until an unmapped page is found.  DATASTART will be defined to be
00544  * GC_data_start.
00545  * On UNIX-like systems, the collector will scan the area between DATASTART
00546  * and DATAEND for root pointers.
00547  *
00548  * DATAEND, if not `end' where `end' is defined as ``extern int end[];''.
00549  * RTH suggests gaining access to linker script synth'd values with
00550  * this idiom instead of `&end' where `end' is defined as ``extern int end;'' .
00551  * Otherwise, ``GCC will assume these are in .sdata/.sbss'' and it will, e.g.,
00552  * cause failures on alpha*-*-* with ``-msmall-data or -fpic'' or mips-*-*
00553  * without any special options.
00554  *
00555  * ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
00556  * the pointer size.
00557  *
00558  * STACKBOTTOM is the cool end of the stack, which is usually the
00559  * highest address in the stack.
00560  * Under PCR or OS/2, we have other ways of finding thread stacks.
00561  * For each machine, the following should:
00562  * 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
00563  * 2) define exactly one of
00564  *     STACKBOTTOM (should be defined to be an expression)
00565  *     LINUX_STACKBOTTOM
00566  *     HEURISTIC1
00567  *     HEURISTIC2
00568  * If STACKBOTTOM is defined, then it's value will be used directly as the
00569  * stack base.  If LINUX_STACKBOTTOM is defined, then it will be determined
00570  * with a method appropriate for most Linux systems.  Currently we look
00571  * first for __libc_stack_end, and if that fails read it from /proc.
00572  * If either of the last two macros are defined, then STACKBOTTOM is computed
00573  * during collector startup using one of the following two heuristics:
00574  * HEURISTIC1:  Take an address inside GC_init's frame, and round it up to
00575  *            the next multiple of STACK_GRAN.
00576  * HEURISTIC2:  Take an address inside GC_init's frame, increment it repeatedly
00577  *            in small steps (decrement if STACK_GROWS_UP), and read the value
00578  *            at each location.  Remember the value when the first
00579  *            Segmentation violation or Bus error is signalled.  Round that
00580  *            to the nearest plausible page boundary, and use that instead
00581  *            of STACKBOTTOM.
00582  *
00583  * Gustavo Rodriguez-Rivera points out that on most (all?) Unix machines,
00584  * the value of environ is a pointer that can serve as STACKBOTTOM.
00585  * I expect that HEURISTIC2 can be replaced by this approach, which
00586  * interferes far less with debugging.  However it has the disadvantage
00587  * that it's confused by a putenv call before the collector is initialized.
00588  * This could be dealt with by intercepting putenv ...
00589  *
00590  * If no expression for STACKBOTTOM can be found, and neither of the above
00591  * heuristics are usable, the collector can still be used with all of the above
00592  * undefined, provided one of the following is done:
00593  * 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
00594  *    without reference to STACKBOTTOM.  This is appropriate for use in
00595  *    conjunction with thread packages, since there will be multiple stacks.
00596  *    (Allocating thread stacks in the heap, and treating them as ordinary
00597  *    heap data objects is also possible as a last resort.  However, this is
00598  *    likely to introduce significant amounts of excess storage retention
00599  *    unless the dead parts of the thread stacks are periodically cleared.)
00600  * 2) Client code may set GC_stackbottom before calling any GC_ routines.
00601  *    If the author of the client code controls the main program, this is
00602  *    easily accomplished by introducing a new main program, setting
00603  *    GC_stackbottom to the address of a local variable, and then calling
00604  *    the original main program.  The new main program would read something
00605  *    like:
00606  *
00607  *            # include "gc_private.h"
00608  *
00609  *            main(argc, argv, envp)
00610  *            int argc;
00611  *            char **argv, **envp;
00612  *            {
00613  *                int dummy;
00614  *
00615  *                GC_stackbottom = (ptr_t)(&dummy);
00616  *                return(real_main(argc, argv, envp));
00617  *            }
00618  *
00619  *
00620  * Each architecture may also define the style of virtual dirty bit
00621  * implementation to be used:
00622  *   MPROTECT_VDB: Write protect the heap and catch faults.
00623  *   PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
00624  *
00625  * An architecture may define DYNAMIC_LOADING if dynamic_load.c
00626  * defined GC_register_dynamic_libraries() for the architecture.
00627  *
00628  * An architecture may define PREFETCH(x) to preload the cache with *x.
00629  * This defaults to a no-op.
00630  *
00631  * PREFETCH_FOR_WRITE(x) is used if *x is about to be written.
00632  *
00633  * An architecture may also define CLEAR_DOUBLE(x) to be a fast way to
00634  * clear the two words at GC_malloc-aligned address x.  By default,
00635  * word stores of 0 are used instead.
00636  *
00637  * HEAP_START may be defined as the initial address hint for mmap-based
00638  * allocation.
00639  */
00640 
00641 /* If we are using a recent version of gcc, we can use __builtin_unwind_init()
00642  * to push the relevant registers onto the stack.  This generally makes
00643  * USE_GENERIC_PUSH_REGS the preferred approach for marking from registers.
00644  */
00645 # if defined(__GNUC__) && ((__GNUC__ >= 3) || \
00646                         (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)) \
00647                      && !defined(__INTEL_COMPILER) \
00648                      && !defined(__PATHCC__)
00649 #   define HAVE_BUILTIN_UNWIND_INIT
00650 # endif
00651 
00652 # define STACK_GRAN 0x1000000
00653 # ifdef M68K
00654 #   define MACH_TYPE "M68K"
00655 #   define ALIGNMENT 2
00656 #   ifdef OPENBSD
00657 #      define OS_TYPE "OPENBSD"
00658 #      define HEURISTIC2
00659 #      ifdef __ELF__
00660 #        define DATASTART GC_data_start
00661 #        define DYNAMIC_LOADING
00662 #      else
00663          extern char etext[];
00664 #        define DATASTART ((ptr_t)(etext))
00665 #       endif
00666 #       define USE_GENERIC_PUSH_REGS
00667 #   endif
00668 #   ifdef NETBSD
00669 #      define OS_TYPE "NETBSD"
00670 #      define HEURISTIC2
00671 #      ifdef __ELF__
00672 #        define DATASTART GC_data_start
00673 #        define DYNAMIC_LOADING
00674 #      else
00675          extern char etext[];
00676 #        define DATASTART ((ptr_t)(etext))
00677 #       endif
00678 #      define USE_GENERIC_PUSH_REGS
00679 #   endif
00680 #   ifdef LINUX
00681 #       define OS_TYPE "LINUX"
00682 #       define STACKBOTTOM ((ptr_t)0xf0000000)
00683 #       define USE_GENERIC_PUSH_REGS
00684               /* We never got around to the assembly version. */
00685 /* #       define MPROTECT_VDB - Reported to not work  9/17/01 */
00686 #       ifdef __ELF__
00687 #            define DYNAMIC_LOADING
00688 #           include <features.h>
00689 #           if defined(__GLIBC__)&& __GLIBC__>=2
00690 #              define SEARCH_FOR_DATA_START
00691 #           else /* !GLIBC2 */
00692                extern char **__environ;
00693 #              define DATASTART ((ptr_t)(&__environ))
00694                              /* hideous kludge: __environ is the first */
00695                              /* word in crt0.o, and delimits the start */
00696                              /* of the data segment, no matter which   */
00697                              /* ld options were passed through.        */
00698                              /* We could use _etext instead, but that  */
00699                              /* would include .rodata, which may       */
00700                              /* contain large read-only data tables    */
00701                              /* that we'd rather not scan.             */
00702 #           endif /* !GLIBC2 */
00703              extern int _end[];
00704 #            define DATAEND (_end)
00705 #       else
00706              extern int etext[];
00707 #            define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
00708 #       endif
00709 #   endif
00710 #   ifdef SUNOS4
00711 #      define OS_TYPE "SUNOS4"
00712        extern char etext[];
00713 #      define DATASTART ((ptr_t)((((word) (etext)) + 0x1ffff) & ~0x1ffff))
00714 #      define HEURISTIC1    /* differs    */
00715 #      define DYNAMIC_LOADING
00716 #   endif
00717 #   ifdef HP
00718 #      define OS_TYPE "HP"
00719        extern char etext[];
00720 #       define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
00721 #       define STACKBOTTOM ((ptr_t) 0xffeffffc)
00722                            /* empirically determined.  seems to work. */
00723 #      include <unistd.h>
00724 #      define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
00725 #   endif
00726 #   ifdef SYSV
00727 #      define OS_TYPE "SYSV"
00728        extern etext[];
00729 #      define DATASTART ((ptr_t)((((word) (etext)) + 0x3fffff) \
00730                                & ~0x3fffff) \
00731                               +((word)etext & 0x1fff))
00732        /* This only works for shared-text binaries with magic number 0413.
00733           The other sorts of SysV binaries put the data at the end of the text,
00734           in which case the default of etext would work.  Unfortunately,
00735           handling both would require having the magic-number available.
00736                             -- Parag
00737           */
00738 #      define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
00739                      /* The stack starts at the top of memory, but   */
00740                      /* 0x0 cannot be used as setjump_test complains */
00741                      /* that the stack direction is incorrect.  Two  */
00742                      /* bytes down from 0x0 should be safe enough.   */
00743                      /*            --Parag                            */
00744 #      include <sys/mmu.h>
00745 #      define GETPAGESIZE() PAGESIZE      /* Is this still right? */
00746 #   endif
00747 #   ifdef AMIGA
00748 #      define OS_TYPE "AMIGA"
00749               /* STACKBOTTOM and DATASTART handled specially   */
00750               /* in os_dep.c                                   */
00751 #      define DATAEND       /* not needed */
00752 #      define GETPAGESIZE() 4096
00753 #   endif
00754 #   ifdef MACOS
00755 #     ifndef __LOWMEM__
00756 #     include <LowMem.h>
00757 #     endif
00758 #     define OS_TYPE "MACOS"
00759                      /* see os_dep.c for details of global data segments. */
00760 #     define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
00761 #     define DATAEND /* not needed */
00762 #     define GETPAGESIZE() 4096
00763 #   endif
00764 #   ifdef NEXT
00765 #      define OS_TYPE "NEXT"
00766 #      define DATASTART ((ptr_t) get_etext())
00767 #      define STACKBOTTOM ((ptr_t) 0x4000000)
00768 #      define DATAEND       /* not needed */
00769 #   endif
00770 # endif
00771 
00772 # if defined(POWERPC)
00773 #   define MACH_TYPE "POWERPC"
00774 #   ifdef MACOS
00775 #     define ALIGNMENT 2  /* Still necessary?  Could it be 4?  */
00776 #     ifndef __LOWMEM__
00777 #     include <LowMem.h>
00778 #     endif
00779 #     define OS_TYPE "MACOS"
00780                      /* see os_dep.c for details of global data segments. */
00781 #     define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
00782 #     define DATAEND  /* not needed */
00783 #   endif
00784 #   ifdef LINUX
00785 #     if defined(__powerpc64__)
00786 #       define ALIGNMENT 8
00787 #       define CPP_WORDSZ 64
00788 #       ifndef HBLKSIZE
00789 #         define HBLKSIZE 4096
00790 #       endif
00791 #     else
00792 #       define ALIGNMENT 4
00793 #     endif
00794 #     define OS_TYPE "LINUX"
00795       /* HEURISTIC1 has been reliably reported to fail for a 32-bit   */
00796       /* executable on a 64 bit kernel.                               */
00797 #     define LINUX_STACKBOTTOM
00798 #     define DYNAMIC_LOADING
00799 #     define SEARCH_FOR_DATA_START
00800       extern int _end[];
00801 #     define DATAEND (_end)
00802 #   endif
00803 #   ifdef DARWIN
00804 #     ifdef __ppc64__
00805 #       define ALIGNMENT 8
00806 #       define CPP_WORDSZ 64
00807 #     else
00808 #       define ALIGNMENT 4
00809 #     endif
00810 #     define OS_TYPE "DARWIN"
00811 #     define DYNAMIC_LOADING
00812       /* XXX: see get_end(3), get_etext() and get_end() should not be used.
00813          These aren't used when dyld support is enabled (it is by default) */
00814 #     define DATASTART ((ptr_t) get_etext())
00815 #     define DATAEND ((ptr_t) get_end())
00816 #     define STACKBOTTOM ((ptr_t) 0xc0000000)
00817 #     define USE_MMAP
00818 #     define USE_MMAP_ANON
00819 #     define USE_ASM_PUSH_REGS
00820       /* This is potentially buggy. It needs more testing. See the comments in
00821          os_dep.c.  It relies on threads to track writes. */
00822 #     ifdef GC_DARWIN_THREADS
00823 /* #       define MPROTECT_VDB -- diabled for now.  May work for some apps. */
00824 #     endif
00825 #     include <unistd.h>
00826 #     define GETPAGESIZE() getpagesize()
00827 #     if defined(USE_PPC_PREFETCH) && defined(__GNUC__)
00828        /* The performance impact of prefetches is untested */
00829 #      define PREFETCH(x) \
00830          __asm__ __volatile__ ("dcbt 0,%0" : : "r" ((const void *) (x)))
00831 #      define PREFETCH_FOR_WRITE(x) \
00832          __asm__ __volatile__ ("dcbtst 0,%0" : : "r" ((const void *) (x)))
00833 #     endif
00834       /* There seems to be some issues with trylock hanging on darwin. This
00835          should be looked into some more */
00836 #     define NO_PTHREAD_TRYLOCK
00837 #   endif
00838 #   ifdef FREEBSD
00839 #       define ALIGNMENT 4
00840 #       define OS_TYPE "FREEBSD"
00841 #       ifndef GC_FREEBSD_THREADS
00842 #           define MPROTECT_VDB
00843 #       endif
00844 #       define SIG_SUSPEND SIGUSR1
00845 #       define SIG_THR_RESTART SIGUSR2
00846 #       define FREEBSD_STACKBOTTOM
00847 #       ifdef __ELF__
00848 #           define DYNAMIC_LOADING
00849 #       endif
00850         extern char etext[];
00851         extern char * GC_FreeBSDGetDataStart();
00852 #       define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
00853 #   endif
00854 #   ifdef NETBSD
00855 #     define ALIGNMENT 4
00856 #     define OS_TYPE "NETBSD"
00857 #     define HEURISTIC2
00858       extern char etext[];
00859 #     define DATASTART GC_data_start
00860 #     define DYNAMIC_LOADING
00861 #   endif
00862 #   ifdef NOSYS
00863 #     define ALIGNMENT 4
00864 #     define OS_TYPE "NOSYS"
00865       extern void __end[], __dso_handle[];
00866 #     define DATASTART (__dso_handle)  /* OK, that's ugly.  */
00867 #     define DATAEND (__end)
00868        /* Stack starts at 0xE0000000 for the simulator.  */
00869 #     undef STACK_GRAN
00870 #     define STACK_GRAN 0x10000000
00871 #     define HEURISTIC1
00872 #   endif
00873 # endif
00874 
00875 # ifdef VAX
00876 #   define MACH_TYPE "VAX"
00877 #   define ALIGNMENT 4      /* Pointers are longword aligned by 4.2 C compiler */
00878     extern char etext[];
00879 #   define DATASTART ((ptr_t)(etext))
00880 #   ifdef BSD
00881 #      define OS_TYPE "BSD"
00882 #      define HEURISTIC1
00883                      /* HEURISTIC2 may be OK, but it's hard to test. */
00884 #   endif
00885 #   ifdef ULTRIX
00886 #      define OS_TYPE "ULTRIX"
00887 #      define STACKBOTTOM ((ptr_t) 0x7fffc800)
00888 #   endif
00889 # endif
00890 
00891 # ifdef RT
00892 #   define MACH_TYPE "RT"
00893 #   define ALIGNMENT 4
00894 #   define DATASTART ((ptr_t) 0x10000000)
00895 #   define STACKBOTTOM ((ptr_t) 0x1fffd800)
00896 # endif
00897 
00898 # ifdef SPARC
00899 #   define MACH_TYPE "SPARC"
00900 #   if defined(__arch64__) || defined(__sparcv9)
00901 #     define ALIGNMENT 8
00902 #     define CPP_WORDSZ 64
00903 #     define ELF_CLASS ELFCLASS64
00904 #   else
00905 #     define ALIGNMENT 4    /* Required by hardware     */
00906 #     define CPP_WORDSZ 32
00907 #   endif
00908 #   define ALIGN_DOUBLE
00909 #   ifdef SUNOS5
00910 #      define OS_TYPE "SUNOS5"
00911        extern int _etext[];
00912        extern int _end[];
00913        extern ptr_t GC_SysVGetDataStart();
00914 #       define DATASTART GC_SysVGetDataStart(0x10000, _etext)
00915 #      define DATAEND (_end)
00916 #      if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
00917 #          define USE_MMAP
00918            /* Otherwise we now use calloc.  Mmap may result in the    */
00919            /* heap interleaved with thread stacks, which can result in       */
00920            /* excessive blacklisting.  Sbrk is unusable since it      */
00921            /* doesn't interact correctly with the system malloc.      */
00922 #      endif
00923 #       ifdef USE_MMAP
00924 #         define HEAP_START (ptr_t)0x40000000
00925 #       else
00926 #        define HEAP_START DATAEND
00927 #       endif
00928 #      define PROC_VDB
00929 /*     HEURISTIC1 reportedly no longer works under 2.7.               */
00930 /*     HEURISTIC2 probably works, but this appears to be preferable.  */
00931 /*     Apparently USRSTACK is defined to be USERLIMIT, but in some    */
00932 /*     installations that's undefined.  We work around this with a    */
00933 /*     gross hack:                                             */
00934 #       include <sys/vmparam.h>
00935 #      ifdef USERLIMIT
00936          /* This should work everywhere, but doesn't.   */
00937 #        define STACKBOTTOM USRSTACK
00938 #       else
00939 #        define HEURISTIC2
00940 #       endif
00941 #      include <unistd.h>
00942 #       define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
00943               /* getpagesize() appeared to be missing from at least one */
00944               /* Solaris 5.4 installation.  Weird.                      */
00945 #      define DYNAMIC_LOADING
00946 #   endif
00947 #   ifdef SUNOS4
00948 #      define OS_TYPE "SUNOS4"
00949        /* [If you have a weak stomach, don't read this.]              */
00950        /* We would like to use:                                */
00951 /* #       define DATASTART ((ptr_t)((((word) (etext)) + 0x1fff) & ~0x1fff)) */
00952        /* This fails occasionally, due to an ancient, but very        */
00953        /* persistent ld bug.  etext is set 32 bytes too high.         */
00954        /* We instead read the text segment size from the a.out        */
00955        /* header, which happens to be mapped into our address space   */
00956        /* at the start of the text segment.  The detective work here  */
00957        /* was done by Robert Ehrlich, Manuel Serrano, and Bernard     */
00958        /* Serpette of INRIA.                                          */
00959        /* This assumes ZMAGIC, i.e. demand-loadable executables.      */
00960 #      define TEXTSTART 0x2000
00961 #       define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
00962 #      define MPROTECT_VDB
00963 #      define HEURISTIC1
00964 #      define DYNAMIC_LOADING
00965 #   endif
00966 #   ifdef DRSNX
00967 #      define OS_TYPE "DRSNX"
00968        extern ptr_t GC_SysVGetDataStart();
00969        extern int etext[];
00970 #       define DATASTART GC_SysVGetDataStart(0x10000, etext)
00971 #      define MPROTECT_VDB
00972 #       define STACKBOTTOM ((ptr_t) 0xdfff0000)
00973 #      define DYNAMIC_LOADING
00974 #   endif
00975 #   ifdef LINUX
00976 #     define OS_TYPE "LINUX"
00977 #     ifdef __ELF__
00978 #       define DYNAMIC_LOADING
00979 #     else
00980           Linux Sparc/a.out not supported
00981 #     endif
00982       extern int _end[];
00983       extern int _etext[];
00984 #     define DATAEND (_end)
00985 #     define SVR4
00986       extern ptr_t GC_SysVGetDataStart();
00987 #     ifdef __arch64__
00988 #      define DATASTART GC_SysVGetDataStart(0x100000, _etext)
00989 #     else
00990 #       define DATASTART GC_SysVGetDataStart(0x10000, _etext)
00991 #     endif
00992 #     define LINUX_STACKBOTTOM
00993 #   endif
00994 #   ifdef OPENBSD
00995 #     define OS_TYPE "OPENBSD"
00996 #     define STACKBOTTOM ((ptr_t) 0xf8000000)
00997       extern int etext[];
00998 #     define DATASTART ((ptr_t)(etext))
00999 #   endif
01000 #   ifdef NETBSD
01001 #     define OS_TYPE "NETBSD"
01002 #     define HEURISTIC2
01003 #     ifdef __ELF__
01004 #      define DATASTART GC_data_start
01005 #      define DYNAMIC_LOADING
01006 #     else
01007        extern char etext[];
01008 #      define DATASTART ((ptr_t)(etext))
01009 #     endif
01010 #   endif
01011 #   ifdef FREEBSD
01012 #      define OS_TYPE "FREEBSD"
01013 #      define SIG_SUSPEND SIGUSR1
01014 #      define SIG_THR_RESTART SIGUSR2
01015 #      define FREEBSD_STACKBOTTOM
01016 #      ifdef __ELF__
01017 #          define DYNAMIC_LOADING
01018 #      endif
01019        extern char etext[];
01020        extern char edata[];
01021        extern char end[];
01022 #      define NEED_FIND_LIMIT
01023 #      define DATASTART ((ptr_t)(&etext))
01024 #      define DATAEND (GC_find_limit (DATASTART, TRUE))
01025 #      define DATASTART2 ((ptr_t)(&edata))
01026 #      define DATAEND2 ((ptr_t)(&end))
01027 #   endif
01028 # endif
01029 
01030 # ifdef I386
01031 #   define MACH_TYPE "I386"
01032 #   if defined(__LP64__) || defined(_WIN64)
01033 #     define CPP_WORDSZ 64
01034 #     define ALIGNMENT 8
01035 #   else
01036 #     define CPP_WORDSZ 32
01037 #     define ALIGNMENT 4
01038                      /* Appears to hold for all "32 bit" compilers    */
01039                      /* except Borland.  The -a4 option fixes  */
01040                      /* Borland.                               */
01041                         /* Ivan Demakov: For Watcom the option is -zp4. */
01042 #   endif
01043 #   ifndef SMALL_CONFIG
01044 #     define ALIGN_DOUBLE /* Not strictly necessary, but may give speed   */
01045                        /* improvement on Pentiums.                      */
01046 #   endif
01047 #   ifdef HAVE_BUILTIN_UNWIND_INIT
01048 #      define USE_GENERIC_PUSH_REGS
01049 #   endif
01050 #   ifdef SEQUENT
01051 #      define OS_TYPE "SEQUENT"
01052        extern int etext[];
01053 #       define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
01054 #       define STACKBOTTOM ((ptr_t) 0x3ffff000) 
01055 #   endif
01056 #   ifdef BEOS
01057 #     define OS_TYPE "BEOS"
01058 #     include <OS.h>
01059 #     define GETPAGESIZE() B_PAGE_SIZE
01060       extern int etext[];
01061 #     define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
01062 #   endif
01063 #   ifdef SUNOS5
01064 #      define OS_TYPE "SUNOS5"
01065         extern int _etext[], _end[];
01066        extern ptr_t GC_SysVGetDataStart();
01067 #       define DATASTART GC_SysVGetDataStart(0x1000, _etext)
01068 #      define DATAEND (_end)
01069 /*     # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7,     */
01070 /*      but reportedly breaks under 2.8.  It appears that the stack   */
01071 /*     base is a property of the executable, so this should not break */
01072 /*     old executables.                                        */
01073 /*     HEURISTIC2 probably works, but this appears to be preferable.  */
01074 #       include <sys/vm.h>
01075 #      define STACKBOTTOM USRSTACK
01076 /* At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
01077 /* It appears to be fixed in 2.8 and 2.9.                      */
01078 #      ifdef SOLARIS25_PROC_VDB_BUG_FIXED
01079 #        define PROC_VDB
01080 #      endif
01081 #      define DYNAMIC_LOADING
01082 #      if !defined(USE_MMAP) && defined(REDIRECT_MALLOC)
01083 #          define USE_MMAP
01084            /* Otherwise we now use calloc.  Mmap may result in the    */
01085            /* heap interleaved with thread stacks, which can result in       */
01086            /* excessive blacklisting.  Sbrk is unusable since it      */
01087            /* doesn't interact correctly with the system malloc.      */
01088 #      endif
01089 #       ifdef USE_MMAP
01090 #         define HEAP_START (ptr_t)0x40000000
01091 #       else
01092 #        define HEAP_START DATAEND
01093 #       endif
01094 #   endif
01095 #   ifdef SCO
01096 #      define OS_TYPE "SCO"
01097        extern int etext[];
01098 #      define DATASTART ((ptr_t)((((word) (etext)) + 0x3fffff) \
01099                               & ~0x3fffff) \
01100                              +((word)etext & 0xfff))
01101 #      define STACKBOTTOM ((ptr_t) 0x7ffffffc)
01102 #   endif
01103 #   ifdef SCO_ELF
01104 #       define OS_TYPE "SCO_ELF"
01105         extern int etext[];
01106 #       define DATASTART ((ptr_t)(etext))
01107 #       define STACKBOTTOM ((ptr_t) 0x08048000)
01108 #       define DYNAMIC_LOADING
01109 #      define ELF_CLASS ELFCLASS32
01110 #   endif
01111 #   ifdef DGUX
01112 #      define OS_TYPE "DGUX"
01113        extern int _etext, _end;
01114        extern ptr_t GC_SysVGetDataStart();
01115 #      define DATASTART GC_SysVGetDataStart(0x1000, &_etext)
01116 #      define DATAEND (&_end)
01117 #      define STACK_GROWS_DOWN
01118 #      define HEURISTIC2
01119 #      include <unistd.h>
01120 #      define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
01121 #      define DYNAMIC_LOADING
01122 #      ifndef USE_MMAP
01123 #        define USE_MMAP
01124 #      endif /* USE_MMAP */
01125 #      define MAP_FAILED (void *) -1
01126 #      ifdef USE_MMAP
01127 #        define HEAP_START (ptr_t)0x40000000
01128 #      else /* USE_MMAP */
01129 #        define HEAP_START DATAEND
01130 #      endif /* USE_MMAP */
01131 #   endif /* DGUX */
01132 
01133 #   ifdef LINUX
01134 #      ifndef __GNUC__
01135          /* The Intel compiler doesn't like inline assembly */
01136 #        define USE_GENERIC_PUSH_REGS
01137 #      endif
01138 #      define OS_TYPE "LINUX"
01139 #       define LINUX_STACKBOTTOM
01140 #      if 0
01141 #        define HEURISTIC1
01142 #         undef STACK_GRAN
01143 #         define STACK_GRAN 0x10000000
01144          /* STACKBOTTOM is usually 0xc0000000, but this changes with  */
01145          /* different kernel configurations.  In particular, systems  */
01146          /* with 2GB physical memory will usually move the user       */
01147          /* address space limit, and hence initial SP to 0x80000000.  */
01148 #       endif
01149 #       if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)
01150 #          define MPROTECT_VDB
01151 #      else
01152            /* We seem to get random errors in incremental mode,       */
01153            /* possibly because Linux threads is itself a malloc client */
01154            /* and can't deal with the signals.                        */
01155 #      endif
01156 #      define HEAP_START (ptr_t)0x1000
01157               /* This encourages mmap to give us low addresses,       */
01158               /* thus allowing the heap to grow to ~3GB        */
01159 #       ifdef __ELF__
01160 #            define DYNAMIC_LOADING
01161 #           ifdef UNDEFINED /* includes ro data */
01162               extern int _etext[];
01163 #              define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
01164 #           endif
01165 #           include <features.h>
01166 #           if defined(__GLIBC__) && __GLIBC__ >= 2
01167 #              define SEARCH_FOR_DATA_START
01168 #           else
01169                 extern char **__environ;
01170 #                define DATASTART ((ptr_t)(&__environ))
01171                            /* hideous kludge: __environ is the first */
01172                            /* word in crt0.o, and delimits the start */
01173                            /* of the data segment, no matter which   */
01174                            /* ld options were passed through.        */
01175                            /* We could use _etext instead, but that  */
01176                            /* would include .rodata, which may       */
01177                            /* contain large read-only data tables    */
01178                            /* that we'd rather not scan.              */
01179 #           endif
01180             extern int _end[];
01181 #           define DATAEND (_end)
01182 #      else
01183             extern int etext[];
01184 #            define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
01185 #       endif
01186 #      ifdef USE_I686_PREFETCH
01187          /* FIXME: Thus should use __builtin_prefetch, but we'll leave that  */
01188          /* for the next rtelease.                                    */
01189 #        define PREFETCH(x) \
01190            __asm__ __volatile__ (" prefetchnta   %0": : "m"(*(char *)(x)))
01191            /* Empirically prefetcht0 is much more effective at reducing      */
01192            /* cache miss stalls for the targetted load instructions.  But it */
01193            /* seems to interfere enough with other cache traffic that the net       */
01194            /* result is worse than prefetchnta.                       */
01195 #         if 0 
01196            /* Using prefetches for write seems to have a slight negative     */
01197            /* impact on performance, at least for a PIII/500.                */
01198 #          define PREFETCH_FOR_WRITE(x) \
01199              __asm__ __volatile__ ("      prefetcht0    %0": : "m"(*(char *)(x)))
01200 #        endif
01201 #      endif
01202 #      ifdef USE_3DNOW_PREFETCH
01203 #        define PREFETCH(x) \
01204            __asm__ __volatile__ (" prefetch      %0": : "m"(*(char *)(x)))
01205 #        define PREFETCH_FOR_WRITE(x) \
01206            __asm__ __volatile__ (" prefetchw     %0": : "m"(*(char *)(x)))
01207 #      endif
01208 #   endif
01209 #   ifdef CYGWIN32
01210 #       define OS_TYPE "CYGWIN32"
01211 #       define DATASTART ((ptr_t)GC_DATASTART)  /* From gc.h */
01212 #       define DATAEND       ((ptr_t)GC_DATAEND)
01213 #      undef STACK_GRAN
01214 #       define STACK_GRAN 0x10000
01215 #       define HEURISTIC1
01216 #   endif
01217 #   ifdef OS2
01218 #      define OS_TYPE "OS2"
01219               /* STACKBOTTOM and DATASTART are handled specially in   */
01220               /* os_dep.c. OS2 actually has the right                 */
01221               /* system call!                                         */
01222 #      define DATAEND       /* not needed */
01223 #      define USE_GENERIC_PUSH_REGS
01224 #   endif
01225 #   ifdef MSWIN32
01226 #      define OS_TYPE "MSWIN32"
01227               /* STACKBOTTOM and DATASTART are handled specially in   */
01228               /* os_dep.c.                                     */
01229 #       ifndef __WATCOMC__
01230 #        define MPROTECT_VDB
01231 #      endif
01232 #       define DATAEND  /* not needed */
01233 #   endif
01234 #   ifdef MSWINCE
01235 #      define OS_TYPE "MSWINCE"
01236 #       define DATAEND  /* not needed */
01237 #   endif
01238 #   ifdef DJGPP
01239 #       define OS_TYPE "DJGPP"
01240 #       include "stubinfo.h"
01241         extern int etext[];
01242         extern int _stklen;
01243         extern int __djgpp_stack_limit;
01244 #       define DATASTART ((ptr_t)((((word) (etext)) + 0x1ff) & ~0x1ff))
01245 /* #       define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
01246                                                      + _stklen)) */
01247 #       define STACKBOTTOM ((ptr_t)((word) __djgpp_stack_limit + _stklen))
01248               /* This may not be right.  */
01249 #   endif
01250 #   ifdef OPENBSD
01251 #      define OS_TYPE "OPENBSD"
01252 #   endif
01253 #   ifdef FREEBSD
01254 #      define OS_TYPE "FREEBSD"
01255 #      ifndef GC_FREEBSD_THREADS
01256 #          define MPROTECT_VDB
01257 #      endif
01258 #      define SIG_SUSPEND SIGUSR1
01259 #      define SIG_THR_RESTART SIGUSR2
01260 #      define FREEBSD_STACKBOTTOM
01261 #      ifdef __ELF__
01262 #          define DYNAMIC_LOADING
01263 #      endif
01264        extern char etext[];
01265        extern char * GC_FreeBSDGetDataStart();
01266 #      define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
01267 #   endif
01268 #   ifdef NETBSD
01269 #      define OS_TYPE "NETBSD"
01270 #      ifdef __ELF__
01271 #          define DYNAMIC_LOADING
01272 #      endif
01273 #   endif
01274 #   ifdef THREE86BSD
01275 #      define OS_TYPE "THREE86BSD"
01276 #   endif
01277 #   ifdef BSDI
01278 #      define OS_TYPE "BSDI"
01279 #   endif
01280 #   if defined(OPENBSD) || defined(NETBSD) \
01281         || defined(THREE86BSD) || defined(BSDI)
01282 #      define HEURISTIC2
01283        extern char etext[];
01284 #      define DATASTART ((ptr_t)(etext))
01285 #   endif
01286 #   ifdef NEXT
01287 #      define OS_TYPE "NEXT"
01288 #      define DATASTART ((ptr_t) get_etext())
01289 #      define STACKBOTTOM ((ptr_t)0xc0000000)
01290 #      define DATAEND       /* not needed */
01291 #   endif
01292 #   ifdef DOS4GW
01293 #     define OS_TYPE "DOS4GW"
01294       extern long __nullarea;
01295       extern char _end;
01296       extern char *_STACKTOP;
01297       /* Depending on calling conventions Watcom C either precedes
01298          or does not precedes with undescore names of C-variables.
01299          Make sure startup code variables always have the same names.  */
01300       #pragma aux __nullarea "*";
01301       #pragma aux _end "*";
01302 #     define STACKBOTTOM ((ptr_t) _STACKTOP)
01303                          /* confused? me too. */
01304 #     define DATASTART ((ptr_t) &__nullarea)
01305 #     define DATAEND ((ptr_t) &_end)
01306 #   endif
01307 #   ifdef HURD
01308 #     define OS_TYPE "HURD"
01309 #     define STACK_GROWS_DOWN
01310 #     define HEURISTIC2
01311       extern int  __data_start[];
01312 #     define DATASTART ( (ptr_t) (__data_start))
01313       extern int   _end[];
01314 #     define DATAEND ( (ptr_t) (_end))
01315 /* #     define MPROTECT_VDB  Not quite working yet? */
01316 #     define DYNAMIC_LOADING
01317 #   endif
01318 #   ifdef DARWIN
01319 #     define OS_TYPE "DARWIN"
01320 #     define DARWIN_DONT_PARSE_STACK
01321 #     define DYNAMIC_LOADING
01322       /* XXX: see get_end(3), get_etext() and get_end() should not be used.
01323         These aren't used when dyld support is enabled (it is by default) */
01324 #     define DATASTART ((ptr_t) get_etext())
01325 #     define DATAEND ((ptr_t) get_end())
01326 #     define STACKBOTTOM ((ptr_t) 0xc0000000)
01327 #     define USE_MMAP
01328 #     define USE_MMAP_ANON
01329 #     define USE_ASM_PUSH_REGS
01330       /* This is potentially buggy. It needs more testing. See the comments in
01331         os_dep.c.  It relies on threads to track writes. */
01332 #     ifdef GC_DARWIN_THREADS
01333 /* #       define MPROTECT_VDB -- disabled for now.  May work for some apps. */
01334 #     endif
01335 #     include <unistd.h>
01336 #     define GETPAGESIZE() getpagesize()
01337       /* There seems to be some issues with trylock hanging on darwin. This
01338          should be looked into some more */
01339 #      define NO_PTHREAD_TRYLOCK
01340 #   endif /* DARWIN */
01341 # endif
01342 
01343 # ifdef NS32K
01344 #   define MACH_TYPE "NS32K"
01345 #   define ALIGNMENT 4
01346     extern char **environ;
01347 #   define DATASTART ((ptr_t)(&environ))
01348                            /* hideous kludge: environ is the first   */
01349                            /* word in crt0.o, and delimits the start */
01350                            /* of the data segment, no matter which   */
01351                            /* ld options were passed through.        */
01352 #   define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
01353 # endif
01354 
01355 # ifdef MIPS
01356 #   define MACH_TYPE "MIPS"
01357 #   ifdef LINUX
01358       /* This was developed for a linuxce style platform.  Probably   */
01359       /* needs to be tweaked for workstation class machines.          */
01360 #     define OS_TYPE "LINUX"
01361 #     define DYNAMIC_LOADING
01362       extern int _end[];
01363 #     define DATAEND (_end)
01364       extern int __data_start[];
01365 #     define DATASTART ((ptr_t)(__data_start))
01366 #     define ALIGNMENT 4
01367 #     define USE_GENERIC_PUSH_REGS
01368 #     if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2 || __GLIBC__ > 2
01369 #        define LINUX_STACKBOTTOM
01370 #     else
01371 #        define STACKBOTTOM 0x80000000
01372 #     endif
01373 #   endif /* Linux */
01374 #   ifdef EWS4800
01375 #      define HEURISTIC2
01376 #      if defined(_MIPS_SZPTR) && (_MIPS_SZPTR == 64)
01377          extern int _fdata[], _end[];
01378 #        define DATASTART ((ptr_t)_fdata)
01379 #        define DATAEND ((ptr_t)_end)
01380 #        define CPP_WORDSZ _MIPS_SZPTR
01381 #        define ALIGNMENT (_MIPS_SZPTR/8)
01382 #      else
01383          extern int etext[], edata[], end[];
01384          extern int _DYNAMIC_LINKING[], _gp[];
01385 #        define DATASTART ((ptr_t)((((word)etext + 0x3ffff) & ~0x3ffff) \
01386                + ((word)etext & 0xffff)))
01387 #        define DATAEND (edata)
01388 #        define DATASTART2 (_DYNAMIC_LINKING \
01389                ? (ptr_t)(((word)_gp + 0x8000 + 0x3ffff) & ~0x3ffff) \
01390                : (ptr_t)edata)
01391 #        define DATAEND2 (end)
01392 #        define ALIGNMENT 4
01393 #      endif
01394 #      define OS_TYPE "EWS4800"
01395 #      define USE_GENERIC_PUSH_REGS 1
01396 #   endif
01397 #   ifdef ULTRIX
01398 #      define HEURISTIC2
01399 #       define DATASTART (ptr_t)0x10000000
01400                            /* Could probably be slightly higher since */
01401                            /* startup code allocates lots of stuff.   */
01402 #      define OS_TYPE "ULTRIX"
01403 #       define ALIGNMENT 4
01404 #   endif
01405 #   ifdef RISCOS
01406 #      define HEURISTIC2
01407 #       define DATASTART (ptr_t)0x10000000
01408 #      define OS_TYPE "RISCOS"
01409 #      define ALIGNMENT 4  /* Required by hardware */
01410 #   endif
01411 #   ifdef IRIX5
01412 #      define HEURISTIC2
01413         extern int _fdata[];
01414 #       define DATASTART ((ptr_t)(_fdata))
01415 #       ifdef USE_MMAP
01416 #         define HEAP_START (ptr_t)0x30000000
01417 #       else
01418 #        define HEAP_START DATASTART
01419 #       endif
01420                            /* Lowest plausible heap address.          */
01421                            /* In the MMAP case, we map there.  */
01422                            /* In either case it is used to identify   */
01423                            /* heap sections so they're not            */
01424                            /* considered as roots.                    */
01425 #      define OS_TYPE "IRIX5"
01426 /*#       define MPROTECT_VDB DOB: this should work, but there is evidence */
01427 /*            of recent breakage.                                 */
01428 #       ifdef _MIPS_SZPTR
01429 #        define CPP_WORDSZ _MIPS_SZPTR
01430 #        define ALIGNMENT (_MIPS_SZPTR/8)
01431 #        if CPP_WORDSZ != 64
01432 #          define ALIGN_DOUBLE
01433 #        endif
01434 #      else
01435 #         define ALIGNMENT 4
01436 #        define ALIGN_DOUBLE
01437 #      endif
01438 #      define DYNAMIC_LOADING
01439 #   endif
01440 #   ifdef MSWINCE
01441 #       define OS_TYPE "MSWINCE"
01442 #       define ALIGNMENT 4
01443 #       define DATAEND /* not needed */
01444 #   endif
01445 #   if defined(NETBSD)
01446 #     define OS_TYPE "NETBSD"
01447 #     define ALIGNMENT 4
01448 #     define HEURISTIC2
01449 #     define USE_GENERIC_PUSH_REGS
01450 #     ifdef __ELF__
01451         extern int etext[];
01452 #       define DATASTART GC_data_start
01453 #       define NEED_FIND_LIMIT
01454 #       define DYNAMIC_LOADING
01455 #     else
01456 #       define DATASTART ((ptr_t) 0x10000000)
01457 #       define STACKBOTTOM ((ptr_t) 0x7ffff000)
01458 #     endif /* _ELF_ */
01459 #  endif
01460 #  if defined(NONSTOP)
01461 #    define CPP_WORDSZ 32
01462 #    define OS_TYPE "NONSTOP"
01463 #    define ALIGNMENT 4
01464 #    define DATASTART ((ptr_t) 0x08000000)
01465      extern int _end[];
01466 #    define DATAEND (_end)
01467 #    define STACKBOTTOM ((ptr_t) 0x4fffffff)
01468 #    define USE_GENERIC_PUSH_REGS
01469 #   endif
01470 # endif
01471 
01472 # ifdef RS6000
01473 #   define MACH_TYPE "RS6000"
01474 #   ifdef ALIGNMENT
01475 #     undef ALIGNMENT
01476 #   endif
01477 #   ifdef IA64
01478 #     undef IA64 /* DOB: some AIX installs stupidly define IA64 in /usr/include/sys/systemcfg.h */
01479 #   endif
01480 #   ifdef __64BIT__
01481 #     define ALIGNMENT 8
01482 #     define CPP_WORDSZ 64
01483 #     define STACKBOTTOM ((ptr_t)0x1000000000000000)
01484 #   else
01485 #     define ALIGNMENT 4
01486 #     define CPP_WORDSZ 32
01487 #     define STACKBOTTOM ((ptr_t)((ulong)&errno))
01488 #   endif
01489 #   define USE_MMAP
01490 #   define USE_MMAP_ANON
01491  /* From AIX linker man page:
01492  _text Specifies the first location of the program.
01493  _etext Specifies the first location after the program.
01494  _data Specifies the first location of the data.
01495  _edata Specifies the first location after the initialized data
01496  _end or end Specifies the first location after all data.
01497  */
01498     extern int _data[], _end[];
01499 #   define DATASTART ((ptr_t)((ulong)_data))
01500 #   define DATAEND ((ptr_t)((ulong)_end))
01501     extern int errno;
01502 #   define USE_GENERIC_PUSH_REGS
01503 #   define DYNAMIC_LOADING
01504        /* For really old versions of AIX, this may have to be removed. */
01505 # endif
01506 
01507 # ifdef HP_PA
01508 #   define MACH_TYPE "HP_PA"
01509 #   ifdef __LP64__
01510 #     define CPP_WORDSZ 64
01511 #     define ALIGNMENT 8
01512 #   else
01513 #     define CPP_WORDSZ 32
01514 #     define ALIGNMENT 4
01515 #     define ALIGN_DOUBLE
01516 #   endif
01517 #   if !defined(GC_HPUX_THREADS) && !defined(GC_LINUX_THREADS)
01518 #     ifndef LINUX /* For now. */
01519 #       define MPROTECT_VDB
01520 #     endif
01521 #   else
01522 #     define GENERIC_COMPARE_AND_SWAP
01523        /* No compare-and-swap instruction.  Use pthread mutexes       */
01524        /* when we absolutely have to.                                 */
01525 #     ifdef PARALLEL_MARK
01526 #      define USE_MARK_BYTES
01527               /* Minimize compare-and-swap usage.              */
01528 #     endif
01529 #   endif
01530 #   define STACK_GROWS_UP
01531 #   ifdef HPUX
01532 #     define OS_TYPE "HPUX"
01533       extern int __data_start[];
01534 #     define DATASTART ((ptr_t)(__data_start))
01535 #     if 0
01536        /* The following appears to work for 7xx systems running HP/UX */
01537        /* 9.xx Furthermore, it might result in much faster            */
01538        /* collections than HEURISTIC2, which may involve scanning     */
01539        /* segments that directly precede the stack.  It is not the    */
01540        /* default, since it may not work on older machine/OS          */
01541        /* combinations. (Thanks to Raymond X.T. Nijssen for uncovering       */
01542        /* this.)                                               */
01543 #       define STACKBOTTOM ((ptr_t) 0x7b033000)  /* from /etc/conf/h/param.h */
01544 #     else
01545        /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2      */
01546        /* to this.  Note that the GC must be initialized before the   */
01547        /* first putenv call.                                          */
01548        extern char ** environ;
01549 #       define STACKBOTTOM ((ptr_t)environ)
01550 #     endif
01551 #     define DYNAMIC_LOADING
01552 #     include <unistd.h>
01553 #     define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
01554 #     ifndef __GNUC__
01555 #       define PREFETCH(x)  { \
01556                               register long addr = (long)(x); \
01557                               (void) _asm ("LDW", 0, 0, addr, 0); \
01558                             }
01559 #     endif
01560 #   endif /* HPUX */
01561 #   ifdef LINUX
01562 #     define OS_TYPE "LINUX"
01563 #     define LINUX_STACKBOTTOM
01564 #     define DYNAMIC_LOADING
01565 #     define SEARCH_FOR_DATA_START
01566       extern int _end[];
01567 #     define DATAEND (&_end)
01568 #   endif /* LINUX */
01569 # endif /* HP_PA */
01570 
01571 # ifdef ALPHA
01572 #   define MACH_TYPE "ALPHA"
01573 #   define ALIGNMENT 8
01574 #   define CPP_WORDSZ 64
01575 #   ifndef LINUX
01576 #     define USE_GENERIC_PUSH_REGS
01577       /* Gcc and probably the DEC/Compaq compiler spill pointers to preserved */
01578       /* fp registers in some cases when the target is a 21264.  The assembly */
01579       /* code doesn't handle that yet, and version dependencies make that a   */
01580       /* bit tricky.  Do the easy thing for now.                          */
01581 #   endif
01582 #   ifdef NETBSD
01583 #      define OS_TYPE "NETBSD"
01584 #      define HEURISTIC2
01585 #      define DATASTART GC_data_start
01586 #      define ELFCLASS32 32
01587 #      define ELFCLASS64 64
01588 #      define ELF_CLASS ELFCLASS64
01589 #       define DYNAMIC_LOADING
01590 #   endif
01591 #   ifdef OPENBSD
01592 #      define OS_TYPE "OPENBSD"
01593 #      define HEURISTIC2
01594 #      ifdef __ELF__ /* since OpenBSD/Alpha 2.9 */
01595 #         define DATASTART GC_data_start
01596 #         define ELFCLASS32 32
01597 #         define ELFCLASS64 64
01598 #         define ELF_CLASS ELFCLASS64
01599 #       else         /* ECOFF, until OpenBSD/Alpha 2.7 */
01600 #         define DATASTART ((ptr_t) 0x140000000)
01601 #      endif
01602 #   endif
01603 #   ifdef FREEBSD
01604 #      define OS_TYPE "FREEBSD"
01605 /* MPROTECT_VDB is not yet supported at all on FreeBSD/alpha. */
01606 #      define SIG_SUSPEND SIGUSR1
01607 #      define SIG_THR_RESTART SIGUSR2
01608 #      define FREEBSD_STACKBOTTOM
01609 #      ifdef __ELF__
01610 #          define DYNAMIC_LOADING
01611 #      endif
01612 /* Handle unmapped hole alpha*-*-freebsd[45]* puts between etext and edata. */
01613        extern char etext[];
01614        extern char edata[];
01615        extern char end[];
01616 #      define NEED_FIND_LIMIT
01617 #      define DATASTART ((ptr_t)(&etext))
01618 #      define DATAEND (GC_find_limit (DATASTART, TRUE))
01619 #      define DATASTART2 ((ptr_t)(&edata))
01620 #      define DATAEND2 ((ptr_t)(&end))
01621 #   endif
01622 #   ifdef OSF1
01623 #      define OS_TYPE "OSF1"
01624 #      define DATASTART ((ptr_t) 0x140000000)
01625        extern int _end[];
01626 #      define DATAEND ((ptr_t) &_end)
01627        extern char ** environ;
01628        /* round up from the value of environ to the nearest page boundary */
01629        /* Probably breaks if putenv is called before collector           */
01630        /* initialization.                                         */
01631 #      define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1))
01632 /* #          define HEURISTIC2 */
01633        /* Normally HEURISTIC2 is too conervative, since        */
01634        /* the text segment immediately follows the stack.             */
01635        /* Hence we give an upper pound.                        */
01636        /* This is currently unused, since we disabled HEURISTIC2      */
01637        extern int __start[];
01638 #      define HEURISTIC2_LIMIT ((ptr_t)((word)(__start) & ~(getpagesize()-1)))
01639 #      ifndef GC_OSF1_THREADS
01640          /* Unresolved signal issues with threads.      */
01641 #        define MPROTECT_VDB
01642 #       endif
01643 #      define DYNAMIC_LOADING
01644 #   endif
01645 #   ifdef LINUX
01646 #       define OS_TYPE "LINUX"
01647 #       define LINUX_STACKBOTTOM
01648 #       ifdef __ELF__
01649 #        define SEARCH_FOR_DATA_START
01650 #         define DYNAMIC_LOADING
01651 #       else
01652 #           define DATASTART ((ptr_t) 0x140000000)
01653 #       endif
01654        extern int _end[];
01655 #      define DATAEND (_end)
01656 #      define MPROTECT_VDB
01657               /* Has only been superficially tested.  May not  */
01658               /* work on all versions.                  */
01659 #   endif
01660 # endif
01661 
01662 # ifdef IA64
01663 #   define MACH_TYPE "IA64"
01664 #   define USE_GENERIC_PUSH_REGS
01665        /* We need to get preserved registers in addition to register   */
01666        /* windows.   That's easiest to do with setjmp.                */
01667 #   ifdef PARALLEL_MARK
01668 #      define USE_MARK_BYTES
01669            /* Compare-and-exchange is too expensive to use for        */
01670            /* setting mark bits.                               */
01671 #   endif
01672 #   ifdef HPUX
01673 #      ifdef _ILP32
01674 #        define CPP_WORDSZ 32
01675 #         define ALIGN_DOUBLE
01676            /* Requires 8 byte alignment for malloc */
01677 #        define ALIGNMENT 4
01678 #       else
01679 #        ifndef _LP64
01680               ---> unknown ABI
01681 #         endif
01682 #        define CPP_WORDSZ 64
01683 #        define ALIGN_DOUBLE
01684            /* Requires 16 byte alignment for malloc */
01685 #         define ALIGNMENT 8
01686 #       endif
01687 #       define OS_TYPE "HPUX"      
01688         extern int __data_start[];
01689 #       define DATASTART ((ptr_t)(__data_start))
01690         /* Gustavo Rodriguez-Rivera suggested changing HEURISTIC2     */
01691         /* to this.  Note that the GC must be initialized before the  */
01692        /* first putenv call.                                          */
01693        extern char ** environ;
01694 #       define STACKBOTTOM ((ptr_t)environ)
01695 #       define HPUX_STACKBOTTOM
01696 #       define DYNAMIC_LOADING
01697 #       include <unistd.h>
01698 #       define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
01699        /* The following was empirically determined, and is probably   */
01700        /* not very robust.                                     */
01701        /* Note that the backing store base seems to be at a nice      */
01702        /* address minus one page.                              */
01703 #      define BACKING_STORE_DISPLACEMENT 0x1000000
01704 #      define BACKING_STORE_ALIGNMENT 0x1000
01705        extern ptr_t GC_register_stackbottom;
01706 #      define BACKING_STORE_BASE GC_register_stackbottom
01707        /* Known to be wrong for recent HP/UX versions!!!       */
01708 #   endif
01709 #   ifdef LINUX
01710 #      define CPP_WORDSZ 64
01711 #      define ALIGN_DOUBLE
01712          /* Requires 16 byte alignment for malloc */
01713 #      define ALIGNMENT 8
01714 #       define OS_TYPE "LINUX"
01715        /* The following works on NUE and older kernels: */
01716 /* #       define STACKBOTTOM ((ptr_t) 0xa000000000000000l)    */
01717        /* This does not work on NUE:                           */
01718 #       define LINUX_STACKBOTTOM
01719        /* We also need the base address of the register stack  */
01720        /* backing store.  This is computed in                  */
01721        /* GC_linux_register_stack_base based on the following  */
01722        /* constants:                                    */
01723 #       define BACKING_STORE_ALIGNMENT 0x100000
01724 #       define BACKING_STORE_DISPLACEMENT 0x80000000
01725        extern ptr_t GC_register_stackbottom;
01726 #      define BACKING_STORE_BASE GC_register_stackbottom
01727 #      define SEARCH_FOR_DATA_START
01728 #      ifdef __GNUC__
01729 #         define DYNAMIC_LOADING
01730 #      else
01731          /* In the Intel compiler environment, we seem to end up with  */
01732          /* statically linked executables and an undefined reference  */
01733          /* to _DYNAMIC                                        */
01734 #      endif
01735 #      define MPROTECT_VDB
01736               /* Requires Linux 2.3.47 or later. */
01737        extern int _end[];
01738 #      define DATAEND (_end)
01739 #       ifdef __GNUC__
01740 #        ifndef __INTEL_COMPILER
01741 #          define PREFETCH(x) \
01742              __asm__ ("     lfetch [%0]": : "r"(x))
01743 #          define PREFETCH_FOR_WRITE(x) \
01744              __asm__ ("     lfetch.excl   [%0]": : "r"(x))
01745 #          define CLEAR_DOUBLE(x) \
01746              __asm__ ("     stf.spill     [%0]=f0": : "r"((void *)(x)))
01747 #        else
01748 #           include <ia64intrin.h>
01749 #          define PREFETCH(x) \
01750              __lfetch(__lfhint_none, (x))
01751 #          define PREFETCH_FOR_WRITE(x) \
01752              __lfetch(__lfhint_nta,  (x))
01753 #          define CLEAR_DOUBLE(x) \
01754              __stf_spill((void *)(x), 0)
01755 #        endif // __INTEL_COMPILER
01756 #       endif
01757 #   endif
01758 #   ifdef MSWIN32
01759       /* FIXME: This is a very partial guess.  There is no port, yet. */
01760 #     define OS_TYPE "MSWIN32"
01761               /* STACKBOTTOM and DATASTART are handled specially in   */
01762               /* os_dep.c.                                     */
01763 #     define DATAEND  /* not needed */
01764 #     if defined(_WIN64)
01765 #       define CPP_WORDSZ 64
01766 #     else
01767 #       define CPP_WORDSZ 32   /* Is this possible?     */
01768 #     endif
01769 #     define ALIGNMENT 8
01770 #   endif
01771 # endif
01772 
01773 # ifdef M88K
01774 #   define MACH_TYPE "M88K"
01775 #   define ALIGNMENT 4
01776 #   define ALIGN_DOUBLE
01777     extern int etext[];
01778 #   ifdef CX_UX
01779 #      define OS_TYPE "CX_UX"
01780 #       define DATASTART ((((word)etext + 0x3fffff) & ~0x3fffff) + 0x10000)
01781 #   endif
01782 #   ifdef  DGUX
01783 #      define OS_TYPE "DGUX"
01784        extern ptr_t GC_SysVGetDataStart();
01785 #       define DATASTART GC_SysVGetDataStart(0x10000, etext)
01786 #   endif
01787 #   define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
01788 # endif
01789 
01790 # ifdef S370
01791     /* If this still works, and if anyone cares, this should probably */
01792     /* be moved to the S390 category.                                 */
01793 #   define MACH_TYPE "S370"
01794 #   define ALIGNMENT 4      /* Required by hardware     */
01795 #   define USE_GENERIC_PUSH_REGS
01796 #   ifdef UTS4
01797 #       define OS_TYPE "UTS4"
01798        extern int etext[];
01799        extern int _etext[];
01800        extern int _end[];
01801        extern ptr_t GC_SysVGetDataStart();
01802 #       define DATASTART GC_SysVGetDataStart(0x10000, _etext)
01803 #      define DATAEND (_end)
01804 #      define HEURISTIC2
01805 #   endif
01806 # endif
01807 
01808 # ifdef S390
01809 #   define MACH_TYPE "S390"
01810 #   define USE_GENERIC_PUSH_REGS
01811 #   ifndef __s390x__
01812 #     define ALIGNMENT 4
01813 #     define CPP_WORDSZ 32
01814 #   else
01815 #     define ALIGNMENT 8
01816 #     define CPP_WORDSZ 64
01817 #   endif
01818 #   ifndef HBLKSIZE
01819 #     define HBLKSIZE 4096
01820 #   endif
01821 #   ifdef LINUX
01822 #       define OS_TYPE "LINUX"
01823 #       define LINUX_STACKBOTTOM
01824 #       define DYNAMIC_LOADING
01825        extern int __data_start[];
01826 #       define DATASTART ((ptr_t)(__data_start))
01827     extern int _end[];
01828 #   define DATAEND (_end)
01829 #   define CACHE_LINE_SIZE 256
01830 #   define GETPAGESIZE() 4096
01831 #   endif
01832 # endif
01833 
01834 # if defined(PJ)
01835 #   define ALIGNMENT 4
01836     extern int _etext[];
01837 #   define DATASTART ((ptr_t)(_etext))
01838 #   define HEURISTIC1
01839 # endif
01840 
01841 # ifdef ARM32
01842 #   define CPP_WORDSZ 32
01843 #   define MACH_TYPE "ARM32"
01844 #   define ALIGNMENT 4
01845 #   ifdef NETBSD
01846 #       define OS_TYPE "NETBSD"
01847 #       define HEURISTIC2
01848 #      ifdef __ELF__
01849 #          define DATASTART GC_data_start
01850 #         define DYNAMIC_LOADING
01851 #      else
01852            extern char etext[];
01853 #          define DATASTART ((ptr_t)(etext))
01854 #      endif
01855 #       define USE_GENERIC_PUSH_REGS
01856 #   endif
01857 #   ifdef LINUX
01858 #       define OS_TYPE "LINUX"
01859 #       define LINUX_STACKBOTTOM
01860 #       undef STACK_GRAN
01861 #       define STACK_GRAN 0x10000000
01862 #       define USE_GENERIC_PUSH_REGS
01863 #       ifdef __ELF__
01864 #            define DYNAMIC_LOADING
01865 #           include <features.h>
01866 #           if defined(__GLIBC__) && __GLIBC__ >= 2
01867 #              define SEARCH_FOR_DATA_START
01868 #           else
01869                 extern char **__environ;
01870 #                define DATASTART ((ptr_t)(&__environ))
01871                            /* hideous kludge: __environ is the first */
01872                            /* word in crt0.o, and delimits the start */
01873                            /* of the data segment, no matter which   */
01874                            /* ld options were passed through.        */
01875                            /* We could use _etext instead, but that  */
01876                            /* would include .rodata, which may       */
01877                            /* contain large read-only data tables    */
01878                            /* that we'd rather not scan.              */
01879 #           endif
01880             extern int _end[];
01881 #           define DATAEND (_end)
01882 #      else
01883             extern int etext[];
01884 #            define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
01885 #       endif
01886 #   endif
01887 #   ifdef MSWINCE
01888 #     define OS_TYPE "MSWINCE"
01889 #     define DATAEND /* not needed */
01890 #   endif
01891 #   ifdef NOSYS
01892       /* __data_start is usually defined in the target linker script.  */
01893       extern int __data_start[];
01894 #     define DATASTART (ptr_t)(__data_start)
01895 #     define USE_GENERIC_PUSH_REGS
01896       /* __stack_base__ is set in newlib/libc/sys/arm/crt0.S  */
01897       extern void *__stack_base__;
01898 #     define STACKBOTTOM ((ptr_t) (__stack_base__))
01899 #   endif
01900 #endif
01901 
01902 # ifdef CRIS
01903 #   define MACH_TYPE "CRIS"
01904 #   define CPP_WORDSZ 32
01905 #   define ALIGNMENT 1
01906 #   define OS_TYPE "LINUX"
01907 #   define DYNAMIC_LOADING
01908 #   define LINUX_STACKBOTTOM
01909 #   define USE_GENERIC_PUSH_REGS
01910 #   define SEARCH_FOR_DATA_START
01911       extern int _end[];
01912 #   define DATAEND (_end)
01913 # endif
01914 
01915 # ifdef SH
01916 #   define MACH_TYPE "SH"
01917 #   define ALIGNMENT 4
01918 #   ifdef MSWINCE
01919 #     define OS_TYPE "MSWINCE"
01920 #     define DATAEND /* not needed */
01921 #   endif
01922 #   ifdef LINUX
01923 #     define OS_TYPE "LINUX"
01924 #     define LINUX_STACKBOTTOM
01925 #     define USE_GENERIC_PUSH_REGS
01926 #     define DYNAMIC_LOADING
01927 #     define SEARCH_FOR_DATA_START
01928       extern int _end[];
01929 #     define DATAEND (_end)
01930 #   endif
01931 #   ifdef NETBSD
01932 #      define OS_TYPE "NETBSD"
01933 #      define HEURISTIC2
01934 #      define DATASTART GC_data_start
01935 #      define USE_GENERIC_PUSH_REGS
01936 #      define DYNAMIC_LOADING
01937 #   endif
01938 # endif
01939  
01940 # ifdef SH4
01941 #   define MACH_TYPE "SH4"
01942 #   define OS_TYPE "MSWINCE"
01943 #   define ALIGNMENT 4
01944 #   define DATAEND /* not needed */
01945 # endif
01946 
01947 # ifdef M32R
01948 #   define CPP_WORDSZ 32
01949 #   define MACH_TYPE "M32R"
01950 #   define ALIGNMENT 4
01951 #   ifdef LINUX
01952 #     define OS_TYPE "LINUX"
01953 #     define LINUX_STACKBOTTOM
01954 #     undef STACK_GRAN
01955 #     define STACK_GRAN 0x10000000
01956 #     define USE_GENERIC_PUSH_REGS
01957 #     define DYNAMIC_LOADING
01958 #     define SEARCH_FOR_DATA_START
01959       extern int _end[];
01960 #     define DATAEND (_end)
01961 #   endif
01962 # endif
01963 
01964 # ifdef X86_64
01965 #   define MACH_TYPE "X86_64"
01966 #   define ALIGNMENT 8
01967 #   define CPP_WORDSZ 64
01968 #   ifndef HBLKSIZE
01969 #     define HBLKSIZE 4096
01970 #   endif
01971 #   define CACHE_LINE_SIZE 64
01972 #   define USE_GENERIC_PUSH_REGS
01973 #   ifdef LINUX
01974 #      define OS_TYPE "LINUX"
01975 #       define LINUX_STACKBOTTOM
01976 #       if !defined(GC_LINUX_THREADS) || !defined(REDIRECT_MALLOC)
01977 #          define MPROTECT_VDB
01978 #      else
01979            /* We seem to get random errors in incremental mode,       */
01980            /* possibly because Linux threads is itself a malloc client */
01981            /* and can't deal with the signals.                        */
01982 #      endif
01983 #       ifdef __ELF__
01984 #            define DYNAMIC_LOADING
01985 #           ifdef UNDEFINED /* includes ro data */
01986               extern int _etext[];
01987 #              define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
01988 #           endif
01989 #           include <features.h>
01990 #           define SEARCH_FOR_DATA_START
01991             extern int _end[];
01992 #           define DATAEND (_end)
01993 #      else
01994             extern int etext[];
01995 #            define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
01996 #       endif
01997 #       if defined(__GNUC__) && __GNUC >= 3
01998 #          define PREFETCH(x) __builtin_prefetch((x), 0, 0)
01999 #          define PREFETCH_FOR_WRITE(x) __builtin_prefetch((x), 1)
02000 #      endif
02001 #   endif
02002 /* PLTSCHEME: added FREEBSD: */
02003 #   ifdef FREEBSD
02004 #       define OS_TYPE "FREEBSD"
02005 #       define SIG_SUSPEND SIGUSR1
02006 #       define SIG_THR_RESTART SIGUSR2
02007 #       ifdef __ELF__
02008 #           define DYNAMIC_LOADING
02009 #       endif
02010 #       define HEURISTIC2
02011         extern char etext[];
02012 #       define SEARCH_FOR_DATA_START
02013 #   endif
02014 /* PLTSCHEME: added OPENBSD: */
02015 #   if defined(NETBSD) || defined(OPENBSD)
02016 #       ifdef NETBSD
02017 #          define OS_TYPE "NETBSD"
02018 #       endif
02019 #       ifdef OPENBSD
02020 #          define OS_TYPE "OPENBSD"
02021 #       endif
02022 #      ifdef __ELF__
02023 #          define DYNAMIC_LOADING
02024 #      endif
02025 #      define HEURISTIC2
02026        extern char etext[];
02027 #      define SEARCH_FOR_DATA_START
02028 #   endif
02029 # endif
02030 
02031 #if defined(LINUX) && defined(USE_MMAP)
02032     /* The kernel may do a somewhat better job merging mappings etc.  */
02033     /* with anonymous mappings.                                       */
02034 #   define USE_MMAP_ANON
02035 #endif
02036 
02037 #if defined(LINUX) && defined(REDIRECT_MALLOC)
02038     /* Rld appears to allocate some memory with its own allocator, and       */
02039     /* some through malloc, which might be redirected.  To make this  */
02040     /* work with collectable memory, we have to scan memory allocated */
02041     /* by rld's internal malloc.                               */
02042 #   define USE_PROC_FOR_LIBRARIES
02043 #endif
02044     
02045 # ifndef STACK_GROWS_UP
02046 #   define STACK_GROWS_DOWN
02047 # endif
02048 
02049 # ifndef CPP_WORDSZ
02050 #   define CPP_WORDSZ 32
02051 # endif
02052 
02053 # ifndef OS_TYPE
02054 #   define OS_TYPE ""
02055 # endif
02056 
02057 # ifndef DATAEND
02058     extern int end[];
02059 #   define DATAEND (end)
02060 # endif
02061 
02062 # if defined(SVR4) && !defined(GETPAGESIZE)
02063 #    include <unistd.h>
02064 #    define GETPAGESIZE()  sysconf(_SC_PAGESIZE)
02065 # endif
02066 
02067 # ifndef GETPAGESIZE
02068 #   if defined(SUNOS5) || defined(IRIX5)
02069 #      include <unistd.h>
02070 #   endif
02071 #   define GETPAGESIZE() getpagesize()
02072 # endif
02073 
02074 # if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
02075            /* OS has SVR4 generic features.  Probably others also qualify.   */
02076 #   define SVR4
02077 # endif
02078 
02079 # if defined(SUNOS5) || defined(DRSNX)
02080            /* OS has SUNOS5 style semi-undocumented interface to dynamic     */
02081            /* loader.                                                        */
02082 #   define SUNOS5DL
02083            /* OS has SUNOS5 style signal handlers.                           */
02084 #   define SUNOS5SIGS
02085 # endif
02086 
02087 # if defined(HPUX)
02088 #   define SUNOS5SIGS
02089 # endif
02090 
02091 # if defined(FREEBSD) && (__FreeBSD__ >= 4)
02092 #   define SUNOS5SIGS
02093 # endif
02094 
02095 # ifdef GC_NETBSD_THREADS
02096 #   define SIGRTMIN 33
02097 #   define SIGRTMAX 63
02098 # endif
02099 
02100 # if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \
02101            || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
02102            || defined(DGUX) || defined(BSD) || defined(SUNOS4) \
02103            || defined(_AIX) || defined(DARWIN) || defined(OSF1)
02104 #   define UNIX_LIKE   /* Basic Unix-like system calls work.   */
02105 # endif
02106 
02107 # if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
02108           -> bad word size
02109 # endif
02110 
02111 # ifdef PCR
02112 #   undef DYNAMIC_LOADING
02113 #   undef STACKBOTTOM
02114 #   undef HEURISTIC1
02115 #   undef HEURISTIC2
02116 #   undef PROC_VDB
02117 #   undef MPROTECT_VDB
02118 #   define PCR_VDB
02119 # endif
02120 
02121 # ifdef SRC_M3
02122        /* Postponed for now. */
02123 #   undef PROC_VDB
02124 #   undef MPROTECT_VDB
02125 # endif
02126 
02127 # ifdef SMALL_CONFIG
02128        /* Presumably not worth the space it takes. */
02129 #   undef PROC_VDB
02130 #   undef MPROTECT_VDB
02131 # endif
02132 
02133 # ifdef USE_MUNMAP
02134 #   undef MPROTECT_VDB  /* Can't deal with address space holes. */
02135 # endif
02136 
02137 # ifdef PARALLEL_MARK
02138 #   undef MPROTECT_VDB  /* For now.       */
02139 # endif
02140 
02141 # if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
02142 #   define DEFAULT_VDB
02143 # endif
02144 
02145 # ifndef PREFETCH
02146 #   define PREFETCH(x)
02147 #   define NO_PREFETCH
02148 # endif
02149 
02150 # ifndef PREFETCH_FOR_WRITE
02151 #   define PREFETCH_FOR_WRITE(x)
02152 #   define NO_PREFETCH_FOR_WRITE
02153 # endif
02154 
02155 # ifndef CACHE_LINE_SIZE
02156 #   define CACHE_LINE_SIZE 32      /* Wild guess */
02157 # endif
02158 
02159 # ifdef LINUX
02160 #   define REGISTER_LIBRARIES_EARLY
02161     /* We sometimes use dl_iterate_phdr, which may acquire an internal       */
02162     /* lock.  This isn't safe after the world has stopped.  So we must       */
02163     /* call GC_register_dynamic_libraries before stopping the world.  */
02164     /* For performance reasons, this may be beneficial on other              */
02165     /* platforms as well, though it should be avoided in win32.              */
02166 # endif /* LINUX */
02167 
02168 # if defined(SEARCH_FOR_DATA_START)
02169     extern ptr_t GC_data_start;
02170 #   define DATASTART GC_data_start
02171 # endif
02172 
02173 # ifndef CLEAR_DOUBLE
02174 #   define CLEAR_DOUBLE(x) \
02175               ((word*)x)[0] = 0; \
02176               ((word*)x)[1] = 0;
02177 # endif /* CLEAR_DOUBLE */
02178 
02179        /* Internally we use GC_SOLARIS_THREADS to test for either old or pthreads. */
02180 # if defined(GC_SOLARIS_PTHREADS) && !defined(GC_SOLARIS_THREADS)
02181 #   define GC_SOLARIS_THREADS
02182 # endif
02183 
02184 # if defined(GC_IRIX_THREADS) && !defined(IRIX5)
02185        --> inconsistent configuration
02186 # endif
02187 # if defined(GC_LINUX_THREADS) && !defined(LINUX)
02188        --> inconsistent configuration
02189 # endif
02190 # if defined(GC_NETBSD_THREADS) && !defined(NETBSD)
02191        --> inconsistent configuration
02192 # endif
02193 # if defined(GC_SOLARIS_THREADS) && !defined(SUNOS5)
02194        --> inconsistent configuration
02195 # endif
02196 # if defined(GC_HPUX_THREADS) && !defined(HPUX)
02197        --> inconsistent configuration
02198 # endif
02199 # if defined(GC_AIX_THREADS) && !defined(_AIX)
02200        --> inconsistent configuration
02201 # endif
02202 # if defined(GC_WIN32_THREADS) && !defined(MSWIN32) && !defined(CYGWIN32)
02203        --> inconsistent configuration
02204 # endif
02205 
02206 # if defined(PCR) || defined(SRC_M3) || \
02207               defined(GC_SOLARIS_THREADS) || defined(GC_WIN32_THREADS) || \
02208               defined(GC_PTHREADS)
02209 #   define THREADS
02210 # endif
02211 
02212 # if defined(HP_PA) || defined(M88K) \
02213              || defined(POWERPC) && !defined(DARWIN) \
02214             || defined(LINT) || defined(MSWINCE) || defined(ARM32) || defined(CRIS) \
02215             || (defined(I386) && defined(__LCC__))
02216        /* Use setjmp based hack to mark from callee-save registers.    */
02217        /* The define should move to the individual platform           */
02218        /* descriptions.                                        */
02219 #      define USE_GENERIC_PUSH_REGS
02220 # endif
02221 
02222 # if defined(MSWINCE)
02223 #   define NO_GETENV
02224 # endif
02225 
02226 # if defined(SPARC)
02227 #   define ASM_CLEAR_CODE   /* Stack clearing is crucial, and we      */
02228                             /* include assembly code to do it well.   */
02229 # endif
02230 
02231   /* Can we save call chain in objects for debugging?                  */
02232   /* SET NFRAMES (# of saved frames) and NARGS (#of args for each     */
02233   /* frame) to reasonable values for the platform.                    */
02234   /* Set SAVE_CALL_CHAIN if we can.  SAVE_CALL_COUNT can be specified        */
02235   /* at build time, though we feel free to adjust it slightly.        */
02236   /* Define NEED_CALLINFO if we either save the call stack or         */
02237   /* GC_ADD_CALLER is defined.                                        */
02238   /* GC_CAN_SAVE_CALL_STACKS is set in gc.h.                          */
02239 
02240 #if defined(SPARC)
02241 # define CAN_SAVE_CALL_ARGS
02242 #endif
02243 #if (defined(I386) || defined(X86_64)) && defined(LINUX)
02244            /* SAVE_CALL_CHAIN is supported if the code is compiled to save   */
02245            /* frame pointers by default, i.e. no -fomit-frame-pointer flag.  */
02246 # define CAN_SAVE_CALL_ARGS
02247 #endif
02248 
02249 # if defined(SAVE_CALL_COUNT) && !defined(GC_ADD_CALLER) \
02250             && defined(GC_CAN_SAVE_CALL_STACKS)
02251 #   define SAVE_CALL_CHAIN 
02252 # endif
02253 # ifdef SAVE_CALL_CHAIN
02254 #   if defined(SAVE_CALL_NARGS) && defined(CAN_SAVE_CALL_ARGS)
02255 #     define NARGS SAVE_CALL_NARGS
02256 #   else
02257 #     define NARGS 0 /* Number of arguments to save for each call.    */
02258 #   endif
02259 # endif
02260 # ifdef SAVE_CALL_CHAIN
02261 #   ifndef SAVE_CALL_COUNT
02262 #     define NFRAMES 6      /* Number of frames to save. Even for            */
02263                             /* alignment reasons.                            */
02264 #   else
02265 #     define NFRAMES ((SAVE_CALL_COUNT + 1) & ~1)
02266 #   endif
02267 #   define NEED_CALLINFO
02268 # endif /* SAVE_CALL_CHAIN */
02269 # ifdef GC_ADD_CALLER
02270 #   define NFRAMES 1
02271 #   define NARGS 0
02272 #   define NEED_CALLINFO
02273 # endif
02274 
02275 # if defined(MAKE_BACK_GRAPH) && !defined(DBG_HDRS_ALL)
02276 #   define DBG_HDRS_ALL
02277 # endif
02278 
02279 # if defined(POINTER_MASK) && !defined(POINTER_SHIFT)
02280 #   define POINTER_SHIFT 0
02281 # endif
02282 
02283 # if defined(POINTER_SHIFT) && !defined(POINTER_MASK)
02284 #   define POINTER_MASK ((GC_word)(-1))
02285 # endif
02286 
02287 # if !defined(FIXUP_POINTER) && defined(POINTER_MASK)
02288 #   define FIXUP_POINTER(p) (p) = ((p) & (POINTER_MASK) << POINTER_SHIFT)
02289 # endif
02290 
02291 # if defined(FIXUP_POINTER)
02292 #   define NEED_FIXUP_POINTER 1
02293 # else
02294 #   define NEED_FIXUP_POINTER 0
02295 #   define FIXUP_POINTER(p)
02296 # endif
02297 
02298 #ifdef GC_PRIVATE_H
02299        /* This relies on some type definitions from gc_priv.h, from   */
02300         /* where it's normally included.                       */
02301        /*                                                      */
02302        /* How to get heap memory from the OS:                         */
02303        /* Note that sbrk()-like allocation is preferred, since it     */
02304        /* usually makes it possible to merge consecutively allocated  */
02305        /* chunks.  It also avoids unintented recursion with           */
02306        /* -DREDIRECT_MALLOC.                                          */
02307        /* GET_MEM() returns a HLKSIZE aligned chunk.                  */
02308        /* 0 is taken to mean failure.                                 */
02309        /* In the case os USE_MMAP, the argument must also be a        */
02310        /* physical page size.                                         */
02311        /* GET_MEM is currently not assumed to retrieve 0 filled space, */
02312        /* though we should perhaps take advantage of the case in which */
02313        /* does.                                                */
02314        struct hblk;  /* See gc_priv.h.    */
02315 # ifdef PCR
02316            char * real_malloc();
02317 #   define GET_MEM(bytes) HBLKPTR(real_malloc((size_t)bytes + GC_page_size) \
02318                                      + GC_page_size-1)
02319 # else
02320 #   ifdef OS2
02321              void * os2_alloc(size_t bytes);
02322 #     define GET_MEM(bytes) HBLKPTR((ptr_t)os2_alloc((size_t)bytes \
02323                                        + GC_page_size) \
02324                                        + GC_page_size-1)
02325 #   else
02326 #     if defined(NEXT) || defined(DOS4GW) || defined(NONSTOP) || \
02327                (defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC)) || \
02328                (defined(SUNOS5) && !defined(USE_MMAP))
02329 #       define GET_MEM(bytes) HBLKPTR((size_t) \
02330                                          calloc(1, (size_t)bytes + GC_page_size) \
02331                                          + GC_page_size-1)
02332 #     else
02333 #      ifdef MSWIN32
02334          extern ptr_t GC_win32_get_mem();
02335 #         define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes)
02336 #      else
02337 #        ifdef MACOS
02338 #          if defined(USE_TEMPORARY_MEMORY)
02339                      extern Ptr GC_MacTemporaryNewPtr(size_t size,
02340                                                   Boolean clearMemory);
02341 #               define GET_MEM(bytes) HBLKPTR( \
02342                          GC_MacTemporaryNewPtr(bytes + GC_page_size, true) \
02343                          + GC_page_size-1)
02344 #          else
02345 #                 define GET_MEM(bytes) HBLKPTR( \
02346                             NewPtrClear(bytes + GC_page_size) + GC_page_size-1)
02347 #          endif
02348 #        else
02349 #          ifdef MSWINCE
02350              extern ptr_t GC_wince_get_mem();
02351 #            define GET_MEM(bytes) (struct hblk *)GC_wince_get_mem(bytes)
02352 #          else
02353 #            if defined(AMIGA) && defined(GC_AMIGA_FASTALLOC)
02354                      extern void *GC_amiga_get_mem(size_t size);
02355 #             define GET_MEM(bytes) HBLKPTR((size_t) \
02356                        GC_amiga_get_mem((size_t)bytes + GC_page_size) \
02357                        + GC_page_size-1)
02358 #            else
02359               extern ptr_t GC_unix_get_mem();
02360 #               define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)
02361 #            endif
02362 #          endif
02363 #        endif
02364 #      endif
02365 #     endif
02366 #   endif
02367 # endif
02368 
02369 #endif /* GC_PRIVATE_H */
02370 
02371 #if defined(_AIX) && !defined(__GNUC__) && !defined(__STDC__)
02372   /* IBMs xlc compiler doesn't appear to follow the convention of     */
02373   /* defining  __STDC__ to be zero in extended mode.                  */
02374 #   define __STDC__ 0
02375 #endif
02376 
02377 # endif /* GCCONFIG_H */