OSDN Git Service

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