[BACK]Return to gcconfig.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / gc / include / private

Annotation of OpenXM_contrib2/asir2000/gc/include/private/gcconfig.h, Revision 1.6

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>