Annotation of OpenXM_contrib2/asir2000/gc6.diff, Revision 1.2
1.2 ! ohara 1: # $OpenXM: OpenXM_contrib2/asir2000/gc6.diff,v 1.1 2008/03/19 07:05:55 ohara Exp $
1.1 ohara 2: # Patches not depend on Risa/Asir
3: diff -urN gc6.8.orig/include/private/gcconfig.h gc6.8/include/private/gcconfig.h
4: --- gc6.8.orig/include/private/gcconfig.h 2006-07-08 06:08:05.000000000 +0900
5: +++ gc6.8/include/private/gcconfig.h 2008-03-19 13:31:36.000000000 +0900
6: @@ -63,7 +63,7 @@
7: /* Determine the machine type: */
8: # if defined(__arm__) || defined(__thumb__)
9: # define ARM32
10: -# if !defined(LINUX) && !defined(NETBSD)
11: +# if !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD)
12: # define NOSYS
13: # define mach_type_known
14: # endif
15: @@ -342,10 +342,22 @@
16: # define X86_64
17: # define mach_type_known
18: # endif
19: +# if defined(__FreeBSD__) && defined(__amd64__)
20: +# define X86_64
21: +# define mach_type_known
22: +# endif
23: # if defined(FREEBSD) && defined(__sparc__)
24: # define SPARC
25: # define mach_type_known
26: -#endif
27: +# endif
28: +# if defined(FREEBSD) && defined(__powerpc__)
29: +# define POWERPC
30: +# define mach_type_known
31: +# endif
32: +# if defined(FREEBSD) && defined(__arm__)
33: +# define ARM32
34: +# define mach_type_known
35: +# endif
36: # if defined(bsdi) && (defined(i386) || defined(__i386__))
37: # define I386
38: # define BSDI
39: @@ -860,6 +872,16 @@
40: # define DATASTART GC_data_start
41: # define DYNAMIC_LOADING
42: # endif
43: +# ifdef FREEBSD
44: +# define ALIGNMENT 4
45: +# define OS_TYPE "FREEBSD"
46: +# ifdef __ELF__
47: +# define DYNAMIC_LOADING
48: +# endif
49: +# define HEURISTIC2
50: + extern char etext[];
51: +# define SEARCH_FOR_DATA_START
52: +# endif
53: # ifdef NOSYS
54: # define ALIGNMENT 4
55: # define OS_TYPE "NOSYS"
56: @@ -1862,6 +1884,17 @@
57: # endif
58: # define USE_GENERIC_PUSH_REGS
59: # endif
60: +# ifdef FREEBSD
61: +# define ALIGNMENT 4
62: +# define OS_TYPE "FREEBSD"
63: +# ifdef __ELF__
64: +# define DYNAMIC_LOADING
65: +# endif
66: +# define HEURISTIC2
67: + extern char etext[];
68: +# define SEARCH_FOR_DATA_START
69: +# endif
70: +
71: # ifdef LINUX
72: # define OS_TYPE "LINUX"
73: # define LINUX_STACKBOTTOM
74: @@ -2026,8 +2059,19 @@
75: # define DYNAMIC_LOADING
76: # endif
77: extern char etext[];
78: +/* T.Saito
79: extern char * GC_FreeBSDGetDataStart();
80: # define DATASTART GC_FreeBSDGetDataStart(0x1000, &etext)
81: +*/
82: + extern int _etext[];
83: + extern char edata[];
84: + extern char end[];
85: +# define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
86: +# define NEED_FIND_LIMIT
87: +# define DATAEND (GC_find_limit (DATASTART, TRUE))
88: +# define DATASTART2 ((ptr_t)(&edata))
89: +# define DATAEND2 ((ptr_t)(&end))
90: +/* end T.Saito */
91: # endif
92: # ifdef NETBSD
93: # define OS_TYPE "NETBSD"
94: @@ -2038,6 +2082,17 @@
95: extern char etext[];
96: # define SEARCH_FOR_DATA_START
97: # endif
98: +# ifdef FREEBSD
99: +# define OS_TYPE "FREEBSD"
100: +# define SIG_SUSPEND SIGUSR1
101: +# define SIG_THR_RESTART SIGUSR2
102: +# ifdef __ELF__
103: +# define DYNAMIC_LOADING
104: +# endif
105: +# define HEURISTIC2
106: + extern char etext[];
107: +# define SEARCH_FOR_DATA_START
108: +# endif
109: # ifdef SOLARIS
110: # define OS_TYPE "SOLARIS"
111: # define ELF_CLASS ELFCLASS64
112: diff -urN gc6.8.orig/os_dep.c gc6.8/os_dep.c
113: --- gc6.8.orig/os_dep.c 2006-04-22 08:26:47.000000000 +0900
114: +++ gc6.8/os_dep.c 2008-03-19 13:31:36.000000000 +0900
115: @@ -694,7 +694,7 @@
116: || defined(HURD) || defined(NETBSD)
117: static struct sigaction old_segv_act;
118: # if defined(IRIX5) || defined(HPUX) \
119: - || defined(HURD) || defined(NETBSD)
120: + || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
121: static struct sigaction old_bus_act;
122: # endif
123: # else
124: @@ -709,7 +709,7 @@
125: # endif
126: {
127: # if defined(SUNOS5SIGS) || defined(IRIX5) \
128: - || defined(OSF1) || defined(HURD) || defined(NETBSD)
129: + || defined(OSF1) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
130: struct sigaction act;
131:
132: act.sa_handler = h;
133: @@ -731,7 +731,7 @@
134: # else
135: (void) sigaction(SIGSEGV, &act, &old_segv_act);
136: # if defined(IRIX5) \
137: - || defined(HPUX) || defined(HURD) || defined(NETBSD)
138: + || defined(HPUX) || defined(HURD) || defined(NETBSD) || defined(FREEBSD)
139: /* Under Irix 5.x or HP/UX, we may get SIGBUS. */
140: /* Pthreads doesn't exist under Irix 5.x, so we */
141: /* don't have to worry in the threads case. */
142: diff -urN gc6.8.orig/dyn_load.c gc6.8/dyn_load.c
143: --- gc6.8.orig/dyn_load.c 2006-06-07 14:01:52.000000000 +0900
144: +++ gc6.8/dyn_load.c 2008-03-19 13:31:36.000000000 +0900
145: @@ -102,6 +102,12 @@
146: # else
147: # define ElfW(type) Elf64_##type
148: # endif
149: +# elif defined(__FreeBSD__)
150: +# if __ELF_WORD_SIZE == 32
151: +# define ElfW(type) Elf32_##type
152: +# else
153: +# define ElfW(type) Elf64_##type
154: +# endif
155: # else
156: # ifdef NETBSD
157: # if ELFSIZE == 32
158: diff -urN gc6.8.orig/include/gc.h gc6.8/include/gc.h
159: --- gc6.8.orig/include/gc.h 2006-07-08 09:10:16.000000000 +0900
160: +++ gc6.8/include/gc.h 2007-08-03 15:05:31.000000000 +0900
161: @@ -504,6 +504,7 @@
162: /* gcc knows how to retrieve return address, but we don't know */
163: /* how to generate call stacks. */
164: # define GC_RETURN_ADDR (GC_word)__builtin_return_address(0)
165: +# define GC_RETURN_ADDR_PARENT (GC_word)__builtin_return_address(1)
166: # else
167: /* Just pass 0 for gcc compatibility. */
168: # define GC_RETURN_ADDR 0
169: diff -urN gc6.8.orig/dbg_mlc.c gc6.8/dbg_mlc.c
170: --- gc6.8.orig/dbg_mlc.c 2006-02-18 10:38:53.000000000 +0900
171: +++ gc6.8/dbg_mlc.c 2007-08-03 15:05:31.000000000 +0900
172: @@ -477,6 +477,23 @@
173: GC_register_displacement((word)sizeof(oh) + offset);
174: }
175:
176: +#if defined(__FreeBSD__)
177: +#include <dlfcn.h>
178: +static void GC_caller_func_offset(ad, symp, offp)
179: +const GC_word ad;
180: +const char **symp;
181: +int *offp;
182: +{
183: + Dl_info caller;
184: + if (dladdr((const void *)ad, &caller) && caller.dli_sname != NULL) {
185: + *symp = caller.dli_sname;
186: + *offp = (const char *)ad - (const char *)caller.dli_saddr;
187: + }
188: +}
189: +#else
190: +#define GC_caller_func(ad, symp, offp)
191: +#endif
192: +
193: # ifdef __STDC__
194: GC_PTR GC_debug_malloc(size_t lb, GC_EXTRA_PARAMS)
195: # else
196: @@ -491,6 +508,13 @@
197: {
198: GC_PTR result = GC_malloc(lb + DEBUG_BYTES);
199:
200: +#ifdef GC_ADD_CALLER
201: + if (s == NULL) {
202: + GC_caller_func_offset(ra, &s, &i);
203: + if (s == NULL)
204: + s = "unknown";
205: + }
206: +#endif
207: if (result == 0) {
208: GC_err_printf1("GC_debug_malloc(%ld) returning NIL (",
209: (unsigned long) lb);
210: @@ -880,6 +904,13 @@
211: register size_t old_sz;
212: register hdr * hhdr;
213:
214: +#ifdef GC_ADD_CALLER
215: + if (s == NULL) {
216: + GC_caller_func_offset(ra, &s, &i);
217: + if (s == NULL)
218: + s = "unknown";
219: + }
220: +#endif
221: if (p == 0) return(GC_debug_malloc(lb, OPT_RA s, i));
222: if (base == 0) {
223: GC_err_printf1(
224: @@ -1188,7 +1219,11 @@
225: }
226:
227: #ifdef GC_ADD_CALLER
228: -# define RA GC_RETURN_ADDR,
229: +# ifdef GC_RETURN_ADDR_PARENT
230: +# define RA GC_RETURN_ADDR_PARENT,
231: +# else
232: +# define RA GC_RETURN_ADDR,
233: +# endif
234: #else
235: # define RA
236: #endif
237: @@ -1196,12 +1231,12 @@
238: GC_PTR GC_debug_malloc_replacement(lb)
239: size_t lb;
240: {
241: - return GC_debug_malloc(lb, RA "unknown", 0);
242: + return GC_debug_malloc(lb, RA NULL, 0);
243: }
244:
245: GC_PTR GC_debug_realloc_replacement(p, lb)
246: GC_PTR p;
247: size_t lb;
248: {
249: - return GC_debug_realloc(p, lb, RA "unknown", 0);
250: + return GC_debug_realloc(p, lb, RA NULL, 0);
251: }
252: diff -urN gc6.8.orig/include/private/gc_priv.h gc6.8/include/private/gc_priv.h
253: --- gc6.8.orig/include/private/gc_priv.h 2006-02-11 04:38:40.000000000 +0900
254: +++ gc6.8/include/private/gc_priv.h 2008-03-19 13:31:36.000000000 +0900
255: @@ -19,6 +19,10 @@
256: # ifndef GC_PRIVATE_H
257: # define GC_PRIVATE_H
258:
259: +#if defined(__INTERIX)
260: +#define __CYGWIN__
261: +#endif
262: +
263: #if defined(mips) && defined(SYSTYPE_BSD) && defined(sony_news)
264: /* sony RISC NEWS, NEWSOS 4 */
265: # define BSD_TIME
266: diff -urN gc6.8.orig/misc.c gc6.8/misc.c
267: --- gc6.8.orig/misc.c 2006-02-11 04:38:46.000000000 +0900
268: +++ gc6.8/misc.c 2008-03-19 13:31:36.000000000 +0900
269: @@ -89,7 +89,7 @@
270: # define GC_REGISTER_MAIN_STATIC_DATA() TRUE
271: #endif
272:
273: -GC_FAR struct _GC_arrays GC_arrays /* = { 0 } */;
274: +GC_FAR struct _GC_arrays GC_arrays = { 0 };
275:
276:
277: GC_bool GC_debugging_started = FALSE;
1.2 ! ohara 278: diff -urN gc6.8.orig/configure.in gc6.8/configure.in
! 279: --- gc6.8.orig/configure.in 2006-06-07 14:01:52.000000000 +0900
! 280: +++ gc6.8/configure.in 2009-02-24 01:01:02.000000000 +0900
! 281: @@ -478,6 +478,14 @@
! 282: fi
! 283: fi
! 284:
! 285: +AC_ARG_ENABLE(large-config,
! 286: + [AC_HELP_STRING([--enable-large-config],
! 287: + [Optimize for large (> 100 MB) heap or root set])])
! 288: +
! 289: +if test "${enable_large_config}" = yes; then
! 290: + AC_DEFINE(LARGE_CONFIG, 1, [Define to optimize for large heaps or root sets])
! 291: +fi
! 292: +
! 293: AC_ARG_ENABLE(gc-assertions,
! 294: [ --enable-gc-assertions collector-internal assertion checking])
! 295: if test "${enable_gc_assertions}" = yes; then
! 296: diff -urN gc6.8.orig/configure gc6.8/configure
! 297: --- gc6.8.orig/configure 2006-03-24 09:42:55.000000000 +0900
! 298: +++ gc6.8/configure 2009-02-24 01:04:38.000000000 +0900
! 299: @@ -1043,6 +1043,7 @@
! 300: --disable-libtool-lock avoid locking (might break parallel builds)
! 301: --enable-full-debug include full support for pointer backtracing etc.
! 302: --enable-redirect-malloc redirect malloc and friends to GC routines
! 303: + --enable-large-config Optimize for large (> 100 MB) heap or root set
! 304: --enable-gc-assertions collector-internal assertion checking
! 305:
! 306: Optional Packages:
! 307: @@ -9825,6 +9826,20 @@
! 308: fi
! 309: fi
! 310:
! 311: +# Check whether --enable-large-config or --disable-large-config was given.
! 312: +if test "${enable_large_config+set}" = set; then
! 313: + enableval="$enable_large_config"
! 314: +
! 315: +fi;
! 316: +
! 317: +if test "${enable_large_config}" = yes; then
! 318: +
! 319: +cat >>confdefs.h <<\_ACEOF
! 320: +#define LARGE_CONFIG 1
! 321: +_ACEOF
! 322: +
! 323: +fi
! 324: +
! 325: # Check whether --enable-gc-assertions or --disable-gc-assertions was given.
! 326: if test "${enable_gc_assertions+set}" = set; then
! 327: enableval="$enable_gc_assertions"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>