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