gc7.0alpha1 tarball import

This commit is contained in:
Ivan Maidanski
2011-07-26 20:09:54 +04:00
parent ffa0c9ea38
commit e35a4171fe
86 changed files with 4226 additions and 8740 deletions
+1 -2
View File
@@ -15,8 +15,7 @@ lib= $(bcbin)\tlib
link= $(bcbin)\ilink32
cflags= -O2 -R -v- -vi -H -H=gc.csm -I$(bcinclude);$(gcinclude1);$(gcinclude2) -L$(bclib) \
-w-pro -w-aus -w-par -w-ccc -w-rch -a4 -D__STDC__=0
#defines= -DSILENT
defines= -DSILENT -DALL_INTERIOR_POINTERS -DUSE_GENERIC -DNO_GETENV -DJAVA_FINALIZATION -DGC_OPERATOR_NEW_ARRAY
defines= -DALL_INTERIOR_POINTERS -DUSE_GENERIC -DNO_GETENV -DJAVA_FINALIZATION -DGC_OPERATOR_NEW_ARRAY
.c.obj:
$(cc) @&&|
+2 -3
View File
@@ -18,10 +18,9 @@ CC= gcc
CXX=g++
# Needed only for "make c++", which adds the c++ interface
CFLAGS= -O -DALL_INTERIOR_POINTERS -DSILENT
CFLAGS= -O -DALL_INTERIOR_POINTERS
# Setjmp_test may yield overly optimistic results when compiled
# without optimization.
# -DSILENT disables statistics printing, and improves performance.
# -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
# altered stubborn objects, at substantial performance cost.
# -DFIND_LEAK causes the collector to assume that all inaccessible
@@ -74,7 +73,7 @@ all: gc.a gctest.exe
$(OBJS) test.o: $(srcdir)/gc_priv.h $(srcdir)/gc_hdrs.h $(srcdir)/gc.h \
$(srcdir)/gcconfig.h $(srcdir)/gc_typed.h
# The dependency on Makefile is needed. Changing
# options such as -DSILENT affects the size of GC_arrays,
# options affects the size of GC_arrays,
# invalidating all .o files that rely on gc_priv.h
mark.o typd_mlc.o finalize.o: $(srcdir)/include/gc_mark.h $(srcdir)/include/private/gc_pmark.h
+5 -3
View File
@@ -128,10 +128,12 @@ void GC_MacFreeTemporaryMemory()
}
theTemporaryMemory = NULL;
# if !defined(SILENT) && !defined(SHARED_LIBRARY_BUILD)
fprintf(stdout, "[total memory used: %ld bytes.]\n",
# if !defined(SHARED_LIBRARY_BUILD)
if (GC_print_stats) {
fprintf(stdout, "[total memory used: %ld bytes.]\n",
totalMemoryUsed);
fprintf(stdout, "[total collections: %ld.]\n", GC_gc_no);
fprintf(stdout, "[total collections: %ld.]\n", GC_gc_no);
}
# endif
}
}
+32 -21
View File
@@ -30,7 +30,13 @@ AS=as $(AS_ABI_FLAG)
srcdir= .
VPATH= $(srcdir)
CFLAGS= -O -I$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DNO_EXECUTE_PERMISSION -DSILENT -DALL_INTERIOR_POINTERS
# Atomic_ops installation directory. If this doesn't exist, we create
# it from the included atomic_ops distribution.
AO_VERSION=0.6
AO_SRC_DIR=$(srcdir)/atomic_ops-$(AO_VERSION)
AO_INSTALL_DIR=$(AO_SRC_DIR)/installed
CFLAGS= -O -I$(srcdir)/include -I$(AO_INSTALL_DIR)/include -DATOMIC_UNCOLLECTABLE -DNO_EXECUTE_PERMISSION -DALL_INTERIOR_POINTERS
# To build the parallel collector on Linux, add to the above:
# -DGC_LINUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC
@@ -54,7 +60,6 @@ HOSTCFLAGS=$(CFLAGS)
# without optimization.
# These define arguments influence the collector configuration:
# -DSILENT disables statistics printing, and improves performance.
# -DFIND_LEAK causes GC_find_leak to be initially set.
# This causes the collector to assume that all inaccessible
# objects should have been explicitly deallocated, and reports exceptions.
@@ -96,13 +101,6 @@ HOSTCFLAGS=$(CFLAGS)
# an object can be recognized. This can be expensive. (The padding
# is normally more than one byte due to alignment constraints.)
# -DDONT_ADD_BYTE_AT_END disables the padding.
# -DNO_SIGNALS does not disable signals during critical parts of
# the GC process. This is no less correct than many malloc
# implementations, and it sometimes has a significant performance
# impact. However, it is dangerous for many not-quite-ANSI C
# programs that call things like printf in asynchronous signal handlers.
# This is on by default. Turning it off has not been extensively tested with
# compilers that reorder stores. It should have been.
# -DNO_EXECUTE_PERMISSION may cause some or all of the heap to not
# have execute permission, i.e. it may be impossible to execute
# code from the heap. Currently this only affects the incremental
@@ -154,6 +152,14 @@ HOSTCFLAGS=$(CFLAGS)
# -DATOMIC_UNCOLLECTABLE includes code for GC_malloc_atomic_uncollectable.
# This is useful if either the vendor malloc implementation is poor,
# or if REDIRECT_MALLOC is used.
# -DMARK_BIT_PER_GRANULE requests that a mark bit (or often byte)
# be allocated for each allocation granule, as opposed to each object.
# This often improves speed, possibly at some cost in space and/or
# cache footprint. Normally it is best to let this decision be
# made automatically depending on platform.
# -DMARK_BIT_PER_OBJ requests that a mark bit be allocated for each
# object instead of allocation granule. The opposiet of
# MARK_BIT_PER_GRANULE.
# -DHBLKSIZE=ddd, where ddd is a power of 2 between 512 and 16384, explicitly
# sets the heap block size. Each heap block is devoted to a single size and
# kind of object. For the incremental collector it makes sense to match
@@ -276,6 +282,9 @@ HOSTCFLAGS=$(CFLAGS)
# -DPOINTER_SHIFT=n causes the collector to left shift candidate pointers
# by the indicated amount before trying to interpret them. Applied
# after POINTER_MASK. EXPERIMENTAL. See also the preceding macro.
# -DENABLE_TRACE enables the GC_TRACE=addr environment setting to do its
# job. By default this is not supported in order tokeep the marker as fast
# as possible.
#
CXXFLAGS= $(CFLAGS)
@@ -283,25 +292,25 @@ AR= ar
RANLIB= ranlib
OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o aix_irix_threads.o pthread_support.o pthread_stop_world.o darwin_stop_world.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o gc_dlopen.o backgraph.o win32_threads.o
OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o aix_irix_threads.o pthread_support.o pthread_stop_world.o darwin_stop_world.o typd_mlc.o ptr_chck.o mallocx.o gcj_mlc.o specific.o gc_dlopen.o backgraph.o win32_threads.o
CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c aix_irix_threads.c pthread_support.c pthread_stop_world.c darwin_stop_world.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c gc_dlopen.c backgraph.c win32_threads.c
CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c aix_irix_threads.c pthread_support.c pthread_stop_world.c darwin_stop_world.c typd_mlc.c ptr_chck.c mallocx.c gcj_mlc.c specific.c gc_dlopen.c backgraph.c win32_threads.c
CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c include/cord.h include/ec.h include/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC
CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
SRCS= $(CSRCS) mips_sgi_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.S \
sparc_mach_dep.S include/gc.h include/gc_typed.h \
sparc_mach_dep.S include/gc.h include/gc_typed.h include/gc_tiny_fl.h \
include/private/gc_hdrs.h include/private/gc_priv.h \
include/private/gcconfig.h include/private/gc_pmark.h \
include/gc_inl.h include/gc_inline.h include/gc_mark.h \
threadlibs.c if_mach.c if_not_there.c gc_cpp.cc include/gc_cpp.h \
gcname.c include/weakpointer.h include/private/gc_locks.h \
gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h \
mips_ultrix_mach_dep.s \
include/new_gc_alloc.h include/gc_allocator.h \
include/javaxfc.h sparc_sunos4_mach_dep.s sparc_netbsd_mach_dep.s \
include/private/solaris_threads.h include/gc_backptr.h \
include/gc_backptr.h \
hpux_test_and_clear.s include/gc_gcj.h \
include/gc_local_alloc.h include/private/dbg_mlc.h \
include/private/specific.h powerpc_darwin_mach_dep.s \
@@ -344,7 +353,7 @@ OTHER_FILES= Makefile setjmp_t.c callprocs pc_excludes \
Mac_files/datastart.c Mac_files/dataend.c \
Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \
add_gc_prefix.c gc_cpp.cpp \
version.h AmigaOS.c \
version.h AmigaOS.c atomic_ops-0.6.tar.gz \
$(TESTS) $(GNU_BUILD_FILES) $(OTHER_MAKEFILES)
CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \
@@ -360,7 +369,7 @@ CURSES= -lcurses -ltermlib
# the SHELL environment variable.
SHELL= /bin/sh
SPECIALCFLAGS = -I$(srcdir)/include
SPECIALCFLAGS = -I$(srcdir)/include -I$(AO_INSTALL_DIR)/include
# Alternative flags to the C compiler for mach_dep.c.
# Mach_dep.c often doesn't like optimization, and it's
# not time-critical anyway.
@@ -368,6 +377,11 @@ SPECIALCFLAGS = -I$(srcdir)/include
all: gc.a gctest
# if AO_INSTALL_DIR doesn't exist, we assume that it is pointing to
# the default location, and we need to build
$(AO_INSTALL_DIR):
tar xvfz $(AO_SRC_DIR).tar.gz; cd $(AO_SRC_DIR); make CC=$(CC) install
LEAKFLAGS=$(CFLAGS) -DFIND_LEAK
BSD-pkg-all: bsd-libgc.a bsd-libleak.a
@@ -397,17 +411,15 @@ $(OBJS) tests/test.o dyn_load.o dyn_load_sunos53.o: \
$(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/private/gc_locks.h \
$(srcdir)/include/gc.h $(srcdir)/include/gc_pthread_redirects.h \
$(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h \
$(srcdir)/include/gc_config_macros.h Makefile
$(srcdir)/include/gc_config_macros.h Makefile $(AO_INSTALL_DIR)
# The dependency on Makefile is needed. Changing
# options such as -DSILENT affects the size of GC_arrays,
# options affects the size of GC_arrays,
# invalidating all .o files that rely on gc_priv.h
mark.o typd_mlc.o finalize.o ptr_chck.o: $(srcdir)/include/gc_mark.h $(srcdir)/include/private/gc_pmark.h
specific.o pthread_support.o: $(srcdir)/include/private/specific.h
solaris_threads.o solaris_pthreads.o: $(srcdir)/include/private/solaris_threads.h
dbg_mlc.o gcj_mlc.o: $(srcdir)/include/private/dbg_mlc.h
tests/test.o: tests $(srcdir)/tests/test.c
@@ -512,7 +524,6 @@ mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s \
./if_mach POWERPC DARWIN $(AS) -o mach_dep.o $(srcdir)/powerpc_darwin_mach_dep.s
./if_mach ALPHA LINUX $(CC) -c -o mach_dep.o $(srcdir)/alpha_mach_dep.S
./if_mach SPARC SUNOS5 $(CC) -c -o mach_dep.o $(srcdir)/sparc_mach_dep.S
./if_mach SPARC SUNOS4 $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
./if_mach SPARC OPENBSD $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
./if_mach SPARC NETBSD $(AS) -o mach_dep.o $(srcdir)/sparc_netbsd_mach_dep.s
./if_mach IA64 "" as $(AS_ABI_FLAG) -o ia64_save_regs_in_stack.o $(srcdir)/ia64_save_regs_in_stack.s
+8 -6
View File
@@ -34,7 +34,8 @@ lib_LTLIBRARIES = libgc.la $(extra)
include_HEADERS = include/gc.h include/gc_local_alloc.h \
include/gc_pthread_redirects.h include/gc_config_macros.h \
include/leak_detector.h include/gc_typed.h @addincludes@
include/leak_detector.h include/gc_typed.h include/gc_tiny_fl.h \
@addincludes@
EXTRA_HEADERS = include/gc_cpp.h include/gc_allocator.h
@@ -53,9 +54,9 @@ backgraph.c win32_threads.c \
pthread_support.c pthread_stop_world.c darwin_stop_world.c \
$(asm_libgc_sources)
# Include THREADDLLIBS here to ensure that the correct versions of
# Include THREADLIBS here to ensure that the correct versions of
# linuxthread semaphore functions get linked:
libgc_la_LIBADD = @addobjs@ $(THREADDLLIBS) $(UNWINDLIBS)
libgc_la_LIBADD = @addobjs@ $(THREADLIBS) $(UNWINDLIBS)
libgc_la_DEPENDENCIES = @addobjs@
libgc_la_LDFLAGS = -version-info 1:2:0
@@ -65,7 +66,7 @@ EXTRA_libgc_la_SOURCES = alpha_mach_dep.S \
sparc_sunos4_mach_dep.s ia64_save_regs_in_stack.s
libgccpp_la_SOURCES = gc_cpp.cc
libgccpp_la_LIBADD = $(THREADDLLIBS) $(UNWINDLIBS)
libgccpp_la_LIBADD = $(THREADLIBS) $(UNWINDLIBS)
libgccpp_la_LDFLAGS = -version-info 1:2:0
EXTRA_DIST += alpha_mach_dep.S mips_sgi_mach_dep.s sparc_mach_dep.S
@@ -91,9 +92,9 @@ test_cpp.o: $(srcdir)/tests/test_cpp.cc
## are included in the distribution
# gctest_OBJECTS = test.o
gctest_SOURCES = tests/test.c
gctest_LDADD = ./libgc.la $(THREADDLLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
gctest_LDADD = ./libgc.la $(THREADLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
test_cpp_SOURCES = tests/test_cpp.cc
test_cpp_LDADD = ./libgc.la ./libgccpp.la $(THREADDLLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
test_cpp_LDADD = ./libgc.la ./libgccpp.la $(THREADLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
TESTS = gctest $(extra_checks)
@@ -106,6 +107,7 @@ include/gc_mark.h @addincludes@
## FIXME: we shouldn't have to do this, but automake forces us to.
.s.lo:
.S.lo:
## We use -Wp,-P to strip #line directives. Irix `as' chokes on
## these.
$(LTCOMPILE) -Wp,-P -x assembler-with-cpp -c $<
+32 -21
View File
@@ -30,7 +30,13 @@ AS=as $(AS_ABI_FLAG)
srcdir= .
VPATH= $(srcdir)
CFLAGS= -O -I$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DNO_EXECUTE_PERMISSION -DSILENT -DALL_INTERIOR_POINTERS
# Atomic_ops installation directory. If this doesn't exist, we create
# it from the included atomic_ops distribution.
AO_VERSION=0.6
AO_SRC_DIR=$(srcdir)/atomic_ops-$(AO_VERSION)
AO_INSTALL_DIR=$(AO_SRC_DIR)/installed
CFLAGS= -O -I$(srcdir)/include -I$(AO_INSTALL_DIR)/include -DATOMIC_UNCOLLECTABLE -DNO_EXECUTE_PERMISSION -DALL_INTERIOR_POINTERS
# To build the parallel collector on Linux, add to the above:
# -DGC_LINUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC
@@ -54,7 +60,6 @@ HOSTCFLAGS=$(CFLAGS)
# without optimization.
# These define arguments influence the collector configuration:
# -DSILENT disables statistics printing, and improves performance.
# -DFIND_LEAK causes GC_find_leak to be initially set.
# This causes the collector to assume that all inaccessible
# objects should have been explicitly deallocated, and reports exceptions.
@@ -96,13 +101,6 @@ HOSTCFLAGS=$(CFLAGS)
# an object can be recognized. This can be expensive. (The padding
# is normally more than one byte due to alignment constraints.)
# -DDONT_ADD_BYTE_AT_END disables the padding.
# -DNO_SIGNALS does not disable signals during critical parts of
# the GC process. This is no less correct than many malloc
# implementations, and it sometimes has a significant performance
# impact. However, it is dangerous for many not-quite-ANSI C
# programs that call things like printf in asynchronous signal handlers.
# This is on by default. Turning it off has not been extensively tested with
# compilers that reorder stores. It should have been.
# -DNO_EXECUTE_PERMISSION may cause some or all of the heap to not
# have execute permission, i.e. it may be impossible to execute
# code from the heap. Currently this only affects the incremental
@@ -154,6 +152,14 @@ HOSTCFLAGS=$(CFLAGS)
# -DATOMIC_UNCOLLECTABLE includes code for GC_malloc_atomic_uncollectable.
# This is useful if either the vendor malloc implementation is poor,
# or if REDIRECT_MALLOC is used.
# -DMARK_BIT_PER_GRANULE requests that a mark bit (or often byte)
# be allocated for each allocation granule, as opposed to each object.
# This often improves speed, possibly at some cost in space and/or
# cache footprint. Normally it is best to let this decision be
# made automatically depending on platform.
# -DMARK_BIT_PER_OBJ requests that a mark bit be allocated for each
# object instead of allocation granule. The opposiet of
# MARK_BIT_PER_GRANULE.
# -DHBLKSIZE=ddd, where ddd is a power of 2 between 512 and 16384, explicitly
# sets the heap block size. Each heap block is devoted to a single size and
# kind of object. For the incremental collector it makes sense to match
@@ -276,6 +282,9 @@ HOSTCFLAGS=$(CFLAGS)
# -DPOINTER_SHIFT=n causes the collector to left shift candidate pointers
# by the indicated amount before trying to interpret them. Applied
# after POINTER_MASK. EXPERIMENTAL. See also the preceding macro.
# -DENABLE_TRACE enables the GC_TRACE=addr environment setting to do its
# job. By default this is not supported in order tokeep the marker as fast
# as possible.
#
CXXFLAGS= $(CFLAGS)
@@ -283,25 +292,25 @@ AR= ar
RANLIB= ranlib
OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o aix_irix_threads.o pthread_support.o pthread_stop_world.o darwin_stop_world.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o gc_dlopen.o backgraph.o win32_threads.o
OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o aix_irix_threads.o pthread_support.o pthread_stop_world.o darwin_stop_world.o typd_mlc.o ptr_chck.o mallocx.o gcj_mlc.o specific.o gc_dlopen.o backgraph.o win32_threads.o
CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c aix_irix_threads.c pthread_support.c pthread_stop_world.c darwin_stop_world.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c gc_dlopen.c backgraph.c win32_threads.c
CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c aix_irix_threads.c pthread_support.c pthread_stop_world.c darwin_stop_world.c typd_mlc.c ptr_chck.c mallocx.c gcj_mlc.c specific.c gc_dlopen.c backgraph.c win32_threads.c
CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c include/cord.h include/ec.h include/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC
CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
SRCS= $(CSRCS) mips_sgi_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.S \
sparc_mach_dep.S include/gc.h include/gc_typed.h \
sparc_mach_dep.S include/gc.h include/gc_typed.h include/gc_tiny_fl.h \
include/private/gc_hdrs.h include/private/gc_priv.h \
include/private/gcconfig.h include/private/gc_pmark.h \
include/gc_inl.h include/gc_inline.h include/gc_mark.h \
threadlibs.c if_mach.c if_not_there.c gc_cpp.cc include/gc_cpp.h \
gcname.c include/weakpointer.h include/private/gc_locks.h \
gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h \
mips_ultrix_mach_dep.s \
include/new_gc_alloc.h include/gc_allocator.h \
include/javaxfc.h sparc_sunos4_mach_dep.s sparc_netbsd_mach_dep.s \
include/private/solaris_threads.h include/gc_backptr.h \
include/gc_backptr.h \
hpux_test_and_clear.s include/gc_gcj.h \
include/gc_local_alloc.h include/private/dbg_mlc.h \
include/private/specific.h powerpc_darwin_mach_dep.s \
@@ -344,7 +353,7 @@ OTHER_FILES= Makefile setjmp_t.c callprocs pc_excludes \
Mac_files/datastart.c Mac_files/dataend.c \
Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \
add_gc_prefix.c gc_cpp.cpp \
version.h AmigaOS.c \
version.h AmigaOS.c atomic_ops-0.6.tar.gz \
$(TESTS) $(GNU_BUILD_FILES) $(OTHER_MAKEFILES)
CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \
@@ -360,7 +369,7 @@ CURSES= -lcurses -ltermlib
# the SHELL environment variable.
SHELL= /bin/sh
SPECIALCFLAGS = -I$(srcdir)/include
SPECIALCFLAGS = -I$(srcdir)/include -I$(AO_INSTALL_DIR)/include
# Alternative flags to the C compiler for mach_dep.c.
# Mach_dep.c often doesn't like optimization, and it's
# not time-critical anyway.
@@ -368,6 +377,11 @@ SPECIALCFLAGS = -I$(srcdir)/include
all: gc.a gctest
# if AO_INSTALL_DIR doesn't exist, we assume that it is pointing to
# the default location, and we need to build
$(AO_INSTALL_DIR):
tar xvfz $(AO_SRC_DIR).tar.gz; cd $(AO_SRC_DIR); make CC=$(CC) install
LEAKFLAGS=$(CFLAGS) -DFIND_LEAK
BSD-pkg-all: bsd-libgc.a bsd-libleak.a
@@ -397,17 +411,15 @@ $(OBJS) tests/test.o dyn_load.o dyn_load_sunos53.o: \
$(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/private/gc_locks.h \
$(srcdir)/include/gc.h $(srcdir)/include/gc_pthread_redirects.h \
$(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h \
$(srcdir)/include/gc_config_macros.h Makefile
$(srcdir)/include/gc_config_macros.h Makefile $(AO_INSTALL_DIR)
# The dependency on Makefile is needed. Changing
# options such as -DSILENT affects the size of GC_arrays,
# options affects the size of GC_arrays,
# invalidating all .o files that rely on gc_priv.h
mark.o typd_mlc.o finalize.o ptr_chck.o: $(srcdir)/include/gc_mark.h $(srcdir)/include/private/gc_pmark.h
specific.o pthread_support.o: $(srcdir)/include/private/specific.h
solaris_threads.o solaris_pthreads.o: $(srcdir)/include/private/solaris_threads.h
dbg_mlc.o gcj_mlc.o: $(srcdir)/include/private/dbg_mlc.h
tests/test.o: tests $(srcdir)/tests/test.c
@@ -512,7 +524,6 @@ mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s \
./if_mach POWERPC DARWIN $(AS) -o mach_dep.o $(srcdir)/powerpc_darwin_mach_dep.s
./if_mach ALPHA LINUX $(CC) -c -o mach_dep.o $(srcdir)/alpha_mach_dep.S
./if_mach SPARC SUNOS5 $(CC) -c -o mach_dep.o $(srcdir)/sparc_mach_dep.S
./if_mach SPARC SUNOS4 $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
./if_mach SPARC OPENBSD $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
./if_mach SPARC NETBSD $(AS) -o mach_dep.o $(srcdir)/sparc_netbsd_mach_dep.s
./if_mach IA64 "" as $(AS_ABI_FLAG) -o ia64_save_regs_in_stack.o $(srcdir)/ia64_save_regs_in_stack.s
+2 -3
View File
@@ -29,11 +29,10 @@ EXE_SUFFIX=.exe
srcdir= .
VPATH= $(srcdir)
CFLAGS= -gstabs+ -O2 -I$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION -DSILENT
CFLAGS= -gstabs+ -O2 -I$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION
# Setjmp_test may yield overly optimistic results when compiled
# without optimization.
# -DSILENT disables statistics printing, and improves performance.
# -DFIND_LEAK causes GC_find_leak to be initially set.
# This causes the collector to assume that all inaccessible
# objects should have been explicitly deallocated, and reports exceptions.
@@ -221,7 +220,7 @@ $(OBJS) test.o dyn_load.o dyn_load_sunos53.o: \
$(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h \
Makefile
# The dependency on Makefile is needed. Changing
# options such as -DSILENT affects the size of GC_arrays,
# options affects the size of GC_arrays,
# invalidating all .o files that rely on gc_priv.h
mark.o typd_mlc.o finalize.o: $(srcdir)/include/gc_mark.h
+9 -10
View File
@@ -108,7 +108,7 @@ OBJDUMP = @OBJDUMP@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
STRIP = @STRIP@
THREADDLLIBS = @THREADDLLIBS@
THREADLIBS = @THREADLIBS@
UNWINDLIBS = @UNWINDLIBS@
VERSION = @VERSION@
addincludes = @addincludes@
@@ -168,7 +168,8 @@ lib_LTLIBRARIES = libgc.la $(extra)
include_HEADERS = include/gc.h include/gc_local_alloc.h \
include/gc_pthread_redirects.h include/gc_config_macros.h \
include/leak_detector.h include/gc_typed.h @addincludes@
include/leak_detector.h include/gc_typed.h include/gc_tiny_fl.h \
@addincludes@
EXTRA_HEADERS = include/gc_cpp.h include/gc_allocator.h
@@ -186,9 +187,9 @@ pthread_support.c pthread_stop_world.c darwin_stop_world.c \
$(asm_libgc_sources)
# Include THREADDLLIBS here to ensure that the correct versions of
# Include THREADLIBS here to ensure that the correct versions of
# linuxthread semaphore functions get linked:
libgc_la_LIBADD = @addobjs@ $(THREADDLLIBS) $(UNWINDLIBS)
libgc_la_LIBADD = @addobjs@ $(THREADLIBS) $(UNWINDLIBS)
libgc_la_DEPENDENCIES = @addobjs@
libgc_la_LDFLAGS = -version-info 1:2:0
@@ -199,7 +200,7 @@ EXTRA_libgc_la_SOURCES = alpha_mach_dep.S \
libgccpp_la_SOURCES = gc_cpp.cc
libgccpp_la_LIBADD = $(THREADDLLIBS) $(UNWINDLIBS)
libgccpp_la_LIBADD = $(THREADLIBS) $(UNWINDLIBS)
libgccpp_la_LDFLAGS = -version-info 1:2:0
AM_CXXFLAGS = @GC_CFLAGS@
@@ -212,9 +213,9 @@ check_PROGRAMS = gctest $(extra_checks)
# gctest_OBJECTS = test.o
gctest_SOURCES = tests/test.c
gctest_LDADD = ./libgc.la $(THREADDLLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
gctest_LDADD = ./libgc.la $(THREADLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
test_cpp_SOURCES = tests/test_cpp.cc
test_cpp_LDADD = ./libgc.la ./libgccpp.la $(THREADDLLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
test_cpp_LDADD = ./libgc.la ./libgccpp.la $(THREADLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
TESTS = gctest $(extra_checks)
@@ -450,9 +451,6 @@ distclean-depend:
.S.obj:
$(CCASCOMPILE) -c `cygpath -w $<`
.S.lo:
$(LTCCASCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
.c.o:
@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@@ -909,6 +907,7 @@ include/gc_pthread_redirects.h include/gc_config_macros.h \
include/gc_mark.h @addincludes@
.s.lo:
.S.lo:
$(LTCOMPILE) -Wp,-P -x assembler-with-cpp -c $<
#
+2 -2
View File
@@ -11,10 +11,10 @@ OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj mach_dep.obj os_dep.obj mark_r
all: gctest.exe cord\de.exe test_cpp.exe
.c.obj:
$(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DSILENT -DALL_INTERIOR_POINTERS -D__STDC__ -DGC_NOT_DLL -DGC_BUILD $*.c /Fo$*.obj
$(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DALL_INTERIOR_POINTERS -D__STDC__ -DGC_NOT_DLL -DGC_BUILD $*.c /Fo$*.obj
.cpp.obj:
$(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DSILENT -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -DGC_BUILD $*.CPP /Fo$*.obj
$(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -DGC_BUILD $*.CPP /Fo$*.obj
$(OBJS) tests\test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h include\private\gc_locks.h include\private\gc_pmark.h include\gc_mark.h
+3 -3
View File
@@ -1,4 +1,4 @@
# Makefile for Windows NT. Assumes Microsoft compiler.
# Makefile for Windows NT. Assumes Microsoft compiler, and a single thread.
# DLLs are included in the root set under NT, but not under win32S.
# Use "nmake nodebug=1 all" for optimized versions of library, gctest and editor.
@@ -11,10 +11,10 @@ OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj mach_dep.obj os_dep.obj mark_r
all: gctest.exe cord\de.exe test_cpp.exe
.c.obj:
$(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DSILENT -DALL_INTERIOR_POINTERS -D__STDC__ -DGC_NOT_DLL -DGC_WIN32_THREADS $*.c /Fo$*.obj
$(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DALL_INTERIOR_POINTERS -D__STDC__ -DGC_NOT_DLL -DGC_WIN32_THREADS $*.c /Fo$*.obj
.cpp.obj:
$(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DSILENT -DALL_INTERIOR_POINTERS -DGC_NOT_DLL $*.CPP -DGC_WIN32_THREADS /Fo$*.obj
$(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DALL_INTERIOR_POINTERS -DGC_NOT_DLL $*.CPP -DGC_WIN32_THREADS /Fo$*.obj
$(OBJS) tests\test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h include\private\gc_locks.h include\private\gc_pmark.h include\gc_mark.h
+4 -4
View File
@@ -114,8 +114,8 @@ CLEAN :
CPP=cl.exe
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "SILENT" /D "GC_BUILD" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS" /FR /YX /c
CPP_PROJ=/nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "SILENT" /D "GC_BUILD" /D\
# ADD CPP /nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "GC_BUILD" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS" /FR /YX /c
CPP_PROJ=/nologo /MD /W3 /GX /O2 /I include /D "NDEBUG" /D "GC_BUILD" /D\
"WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D\
"GC_WIN32_THREADS" /FR"$(INTDIR)/" /Fp"$(INTDIR)/gc.pch" /YX /Fo"$(INTDIR)/" /c
CPP_OBJS=.\Release/
@@ -296,8 +296,8 @@ CLEAN :
CPP=cl.exe
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "SILENT" /D "GC_BUILD" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS" /FR /YX /c
CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "SILENT" /D "GC_BUILD"\
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "GC_BUILD" /D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D "GC_WIN32_THREADS" /FR /YX /c
CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I include /D "_DEBUG" /D "GC_BUILD"\
/D "WIN32" /D "_WINDOWS" /D "ALL_INTERIOR_POINTERS" /D "__STDC__" /D\
"GC_WIN32_THREADS" /FR"$(INTDIR)/" /Fp"$(INTDIR)/gc.pch" /YX /Fo"$(INTDIR)/"\
/Fd"$(INTDIR)/" /c
+1 -1
View File
@@ -10,7 +10,7 @@ OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj mach_dep.obj os_dep.obj mark_r
CORDOBJS= cord\cordbscs.obj cord\cordxtra.obj cord\cordprnt.obj
CC= icc
CFLAGS= /O /Q /DSILENT /DSMALL_CONFIG /DALL_INTERIOR_POINTERS
CFLAGS= /O /Q /DSMALL_CONFIG /DALL_INTERIOR_POINTERS
# Use /Ti instead of /O for debugging
# Setjmp_test may yield overly optimistic results when compiled
# without optimization.
+1 -1
View File
@@ -13,7 +13,7 @@ include ../config/common.mk
CPPFLAGS = $(INCLUDE) $(CONFIG_CPPFLAGS) \
-DPCR_NO_RENAME -DPCR_NO_HOSTDEP_ERR
#CFLAGS = -DPCR -DSILENT $(CONFIG_CFLAGS)
#CFLAGS = -DPCR $(CONFIG_CFLAGS)
CFLAGS = -DPCR $(CONFIG_CFLAGS)
SPECIALCFLAGS = # For code involving asm's
-1
View File
@@ -26,7 +26,6 @@ OPTIMIZE=optimize optimizetime optglobal optimizerdepth=100 optimizerpeephole op
OPT= $(OPTIMIZE) CPU=$(CPU) math=$(MATH) NOSTACKCHECK VERBOSE \
MAPHUNK NOVERSION NOICONS nodebug \
DEFINE SILENT \
parm=reg \
DEFINE __USE_SYSBASE
+9 -9
View File
@@ -25,7 +25,7 @@ CPU=5
OPTIM=-oneatx -s
#OPTIM=-ohneatx -s
DEFS=-DALL_INTERIOR_POINTERS -DSILENT -DNO_SIGNALS #-DSMALL_CONFIG #-DGC_DEBUG
DEFS=-DALL_INTERIOR_POINTERS #-DSMALL_CONFIG #-DGC_DEBUG
#####
@@ -98,13 +98,13 @@ gc.dll: $(OBJS) .AUTODEPEND
@for %i in ($(OBJS)) do @%append $*.lnk file '%i'
!ifeq CALLING s
@%append $*.lnk export GC_is_marked
@%append $*.lnk export GC_incr_words_allocd
@%append $*.lnk export GC_incr_mem_freed
@%append $*.lnk export GC_incr_bytes_allocd
@%append $*.lnk export GC_incr_bytes_freed
@%append $*.lnk export GC_generic_malloc_words_small
!else
@%append $*.lnk export GC_is_marked_
@%append $*.lnk export GC_incr_words_allocd_
@%append $*.lnk export GC_incr_mem_freed_
@%append $*.lnk export GC_incr_bytes_allocd_
@%append $*.lnk export GC_incr_bytes_freed_
@%append $*.lnk export GC_generic_malloc_words_small_
!endif
*wlink @$*.lnk
@@ -156,12 +156,12 @@ test_cpp.exe: test_cpp.obj gc.lib
@%append $*.lnk library gc.lib
!ifdef MAKE_AS_DLL
!ifeq CALLING s
@%append $*.lnk import GC_incr_words_allocd gc
@%append $*.lnk import GC_incr_mem_freed gc
@%append $*.lnk import GC_incr_bytes_allocd gc
@%append $*.lnk import GC_incr_bytes_freed gc
@%append $*.lnk import GC_generic_malloc_words_small gc
!else
@%append $*.lnk import GC_incr_words_allocd_ gc
@%append $*.lnk import GC_incr_mem_freed_ gc
@%append $*.lnk import GC_incr_bytes_allocd_ gc
@%append $*.lnk import GC_incr_bytes_freed_ gc
@%append $*.lnk import GC_generic_malloc_words_small_ gc
!endif
!endif
+7 -5
View File
@@ -26,10 +26,9 @@
* as a base instead.
*/
# include "private/gc_priv.h"
# if defined(GC_IRIX_THREADS) || defined(GC_AIX_THREADS)
# include "private/gc_priv.h"
# include <pthread.h>
# include <assert.h>
# include <semaphore.h>
@@ -65,6 +64,8 @@ void GC_print_sig_mask()
}
#endif
GC_bool GC_need_to_lock = FALSE;
/* We use the allocation lock to protect thread-related data structures. */
/* The set of all known threads. We intercept thread creation and */
@@ -583,6 +584,7 @@ GC_pthread_create(pthread_t *new_thread,
pthread_attr_getdetachstate(attr, &detachstate);
if (PTHREAD_CREATE_DETACHED == detachstate) my_flags |= DETACHED;
si -> flags = my_flags;
GC_need_to_lock = TRUE;
result = pthread_create(new_thread, attr, GC_start_routine, si);
/* Wait until child has been added to the thread table. */
@@ -617,9 +619,9 @@ VOLATILE GC_bool GC_collecting = 0; /* A hint that we're in the collector and
#define SLEEP_THRESHOLD 3
volatile unsigned int GC_allocate_lock = 0;
#define GC_TRY_LOCK() !GC_test_and_set(&GC_allocate_lock)
#define GC_LOCK_TAKEN GC_allocate_lock
volatile AO_TS_t GC_allocate_lock = 0;
#define GC_TRY_LOCK() !AO_test_and_set_acquire(&GC_allocate_lock)
#define GC_LOCK_TAKEN ((int)(GC_allocate_lock)) /* FIXME */
void GC_lock()
{
+102 -73
View File
@@ -106,40 +106,39 @@ void GC_print_hblkfreelist()
word total_free = 0;
hdr * hhdr;
word sz;
int i;
unsigned i;
for (i = 0; i <= N_HBLK_FLS; ++i) {
h = GC_hblkfreelist[i];
# ifdef USE_MUNMAP
if (0 != h) GC_printf1("Free list %ld:\n",
(unsigned long)i);
if (0 != h) GC_printf("Free list %ld:\n",
(unsigned long)i);
# else
if (0 != h) GC_printf2("Free list %ld (Total size %ld):\n",
(unsigned long)i,
(unsigned long)GC_free_bytes[i]);
if (0 != h) GC_printf("Free list %lu (Total size %lu):\n",
i, (unsigned long)GC_free_bytes[i]);
# endif
while (h != 0) {
hhdr = HDR(h);
sz = hhdr -> hb_sz;
GC_printf2("\t0x%lx size %lu ", (unsigned long)h, (unsigned long)sz);
GC_printf("\t0x%lx size %lu ", (unsigned long)h, (unsigned long)sz);
total_free += sz;
if (GC_is_black_listed(h, HBLKSIZE) != 0) {
GC_printf0("start black listed\n");
GC_printf("start black listed\n");
} else if (GC_is_black_listed(h, hhdr -> hb_sz) != 0) {
GC_printf0("partially black listed\n");
GC_printf("partially black listed\n");
} else {
GC_printf0("not black listed\n");
GC_printf("not black listed\n");
}
h = hhdr -> hb_next;
}
}
# ifndef USE_MUNMAP
if (total_free != GC_large_free_bytes) {
GC_printf1("GC_large_free_bytes = %lu (INCONSISTENT!!)\n",
(unsigned long) GC_large_free_bytes);
GC_printf("GC_large_free_bytes = %lu (INCONSISTENT!!)\n",
(unsigned long) GC_large_free_bytes);
}
# endif
GC_printf1("Total of %lu bytes on free list\n", (unsigned long)total_free);
GC_printf("Total of %lu bytes on free list\n", (unsigned long)total_free);
}
/* Return the free list index on which the block described by the header */
@@ -178,12 +177,12 @@ void GC_dump_regions()
++i;
end = GC_heap_sects[i].hs_start + GC_heap_sects[i].hs_bytes;
}
GC_printf2("***Section from 0x%lx to 0x%lx\n", start, end);
GC_printf("***Section from %p to %p\n", start, end);
for (p = start; p < end;) {
hhdr = HDR(p);
GC_printf1("\t0x%lx ", (unsigned long)p);
GC_printf("\t%p ", p);
if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) {
GC_printf1("Missing header!!(%ld)\n", hhdr);
GC_printf("Missing header!!(%d)\n", hhdr);
p += HBLKSIZE;
continue;
}
@@ -192,25 +191,25 @@ void GC_dump_regions()
divHBLKSZ(hhdr -> hb_sz));
int actual_index;
GC_printf1("\tfree block of size 0x%lx bytes",
(unsigned long)(hhdr -> hb_sz));
GC_printf("\tfree block of size 0x%lx bytes",
(unsigned long)(hhdr -> hb_sz));
if (IS_MAPPED(hhdr)) {
GC_printf0("\n");
GC_printf("\n");
} else {
GC_printf0("(unmapped)\n");
GC_printf("(unmapped)\n");
}
actual_index = free_list_index_of(hhdr);
if (-1 == actual_index) {
GC_printf1("\t\tBlock not on free list %ld!!\n",
correct_index);
GC_printf("\t\tBlock not on free list %d!!\n",
correct_index);
} else if (correct_index != actual_index) {
GC_printf2("\t\tBlock on list %ld, should be on %ld!!\n",
actual_index, correct_index);
GC_printf("\t\tBlock on list %d, should be on %d!!\n",
actual_index, correct_index);
}
p += hhdr -> hb_sz;
} else {
GC_printf1("\tused for blocks of size 0x%lx bytes\n",
(unsigned long)WORDS_TO_BYTES(hhdr -> hb_sz));
GC_printf("\tused for blocks of size 0x%lx bytes\n",
(unsigned long)(hhdr -> hb_sz));
p += HBLKSIZE * OBJ_SZ_TO_BLOCKS(hhdr -> hb_sz);
}
}
@@ -222,25 +221,56 @@ void GC_dump_regions()
/* Initialize hdr for a block containing the indicated size and */
/* kind of objects. */
/* Return FALSE on failure. */
static GC_bool setup_header(hhdr, sz, kind, flags)
register hdr * hhdr;
word sz; /* object size in words */
int kind;
unsigned char flags;
static GC_bool setup_header(hdr * hhdr, struct hblk *block, size_t byte_sz,
int kind, unsigned char flags)
{
register word descr;
word descr;
size_t granules;
/* Add description of valid object pointers */
if (!GC_add_map_entry(sz)) return(FALSE);
hhdr -> hb_map = GC_obj_map[sz > MAXOBJSZ? 0 : sz];
/* Set size, kind and mark proc fields */
hhdr -> hb_sz = sz;
hhdr -> hb_sz = byte_sz;
hhdr -> hb_obj_kind = kind;
hhdr -> hb_flags = flags;
hhdr -> hb_block = block;
descr = GC_obj_kinds[kind].ok_descriptor;
if (GC_obj_kinds[kind].ok_relocate_descr) descr += WORDS_TO_BYTES(sz);
if (GC_obj_kinds[kind].ok_relocate_descr) descr += byte_sz;
hhdr -> hb_descr = descr;
# ifdef MARK_BIT_PER_OBJ
/* Set hb_inv_sz as portably as possible. */
/* We set it to the smallest value such that sz * inv_sz > 2**32 */
/* This may be more precision than necessary. */
if (byte_sz > MAXOBJBYTES) {
hhdr -> hb_inv_sz = LARGE_INV_SZ;
} else {
word inv_sz;
# if CPP_WORDSZ == 64
inv_sz = ((word)1 << 32)/byte_sz;
if (((inv_sz*byte_sz) >> 32) == 0) ++inv_sz;
# else /* 32 bit words */
GC_ASSERT(byte_sz >= 4);
inv_sz = ((unsigned)1 << 31)/byte_sz;
inv_sz *= 2;
while (inv_sz*byte_sz > byte_sz) ++inv_sz;
# endif
hhdr -> hb_inv_sz = inv_sz;
}
# else /* MARK_BIT_PER_GRANULE */
hhdr -> hb_large_block = (byte_sz > MAXOBJBYTES);
granules = BYTES_TO_GRANULES(byte_sz);
if (EXPECT(!GC_add_map_entry(granules), FALSE)) {
/* Make it look like a valid block. */
hhdr -> hb_sz = HBLKSIZE;
hhdr -> hb_descr = 0;
hhdr -> hb_large_block = TRUE;
hhdr -> hb_map = 0;
return FALSE;
} else {
int index = (hhdr -> hb_large_block? 0 : granules);
hhdr -> hb_map = GC_obj_map[index];
}
# endif /* MARK_BIT_PER_GRANULE */
/* Clear mark bits */
GC_clear_hdr_marks(hhdr);
@@ -355,7 +385,7 @@ hdr * hhdr;
GET_HDR(second, second_hdr);
second_hdr -> hb_prev = h;
}
GC_invalidate_map(hhdr);
hhdr -> hb_flags |= FREE_BLK;
}
#ifdef USE_MUNMAP
@@ -471,7 +501,7 @@ int index;
rest = (struct hblk *)((word)h + bytes);
rest_hdr = GC_install_header(rest);
if (0 == rest_hdr) {
/* This may be very bad news ... */
/* FIXME: This is likely to be very bad news ... */
WARN("Header allocation failed: Dropping block.\n", 0);
return(0);
}
@@ -479,7 +509,7 @@ int index;
rest_hdr -> hb_flags = 0;
# ifdef GC_ASSERTIONS
/* Mark h not free, to avoid assertion about adjacent free blocks. */
hhdr -> hb_map = 0;
hhdr -> hb_flags &= ~FREE_BLK;
# endif
GC_add_to_fl(rest, rest_hdr);
return h;
@@ -525,7 +555,8 @@ int index; /* Index of free list */
INCR_FREE_BYTES(index, -(signed_word)h_size);
FREE_ASSERT(GC_free_bytes[index] > 0);
# ifdef GC_ASSERTIONS
nhdr -> hb_map = 0; /* Don't fail test for consecutive */
nhdr -> hb_flags &= ~FREE_BLK;
/* Don't fail test for consecutive */
/* free blocks in GC_add_to_fl. */
# endif
# ifdef USE_MUNMAP
@@ -533,30 +564,31 @@ int index; /* Index of free list */
# endif
hhdr -> hb_sz = h_size;
GC_add_to_fl(h, hhdr);
GC_invalidate_map(nhdr);
nhdr -> hb_flags |= FREE_BLK;
}
struct hblk * GC_allochblk_nth();
struct hblk *
GC_allochblk_nth(word sz/* bytes */, int kind, unsigned char flags, int n);
/*
* Allocate (and return pointer to) a heap block
* for objects of size sz words, searching the nth free list.
* for objects of size sz bytes, searching the nth free list.
*
* NOTE: We set obj_map field in header correctly.
* Caller is responsible for building an object freelist in block.
*
* Unlike older versions of the collectors, the client is responsible
* for clearing the block, if necessary.
* The client is responsible for clearing the block, if necessary.
*/
struct hblk *
GC_allochblk(sz, kind, flags)
word sz;
int kind;
unsigned flags; /* IGNORE_OFF_PAGE or 0 */
GC_allochblk(size_t sz, int kind, unsigned flags/* IGNORE_OFF_PAGE or 0 */)
{
word blocks = OBJ_SZ_TO_BLOCKS(sz);
int start_list = GC_hblk_fl_from_blocks(blocks);
word blocks;
int start_list;
int i;
GC_ASSERT((sz & (GRANULE_BYTES - 1)) == 0);
blocks = OBJ_SZ_TO_BLOCKS(sz);
start_list = GC_hblk_fl_from_blocks(blocks);
for (i = start_list; i <= N_HBLK_FLS; ++i) {
struct hblk * result = GC_allochblk_nth(sz, kind, flags, i);
if (0 != result) {
@@ -567,18 +599,18 @@ unsigned flags; /* IGNORE_OFF_PAGE or 0 */
}
/*
* The same, but with search restricted to nth free list.
* Flags is IGNORE_OFF_PAGE or zero.
* Unlike the above, sz is in bytes.
*/
struct hblk *
GC_allochblk_nth(sz, kind, flags, n)
word sz;
int kind;
unsigned char flags; /* IGNORE_OFF_PAGE or 0 */
int n;
GC_allochblk_nth(word sz, int kind, unsigned char flags, int n)
{
register struct hblk *hbp;
register hdr * hhdr; /* Header corr. to hbp */
register struct hblk *thishbp;
register hdr * thishdr; /* Header corr. to hbp */
struct hblk *hbp;
hdr * hhdr; /* Header corr. to hbp */
/* Initialized after loop if hbp !=0 */
/* Gcc uninitialized use warning is bogus. */
struct hblk *thishbp;
hdr * thishdr; /* Header corr. to hbp */
signed_word size_needed; /* number of bytes in requested objects */
signed_word size_avail; /* bytes available in this block */
@@ -609,8 +641,7 @@ int n;
/* If we are deallocating lots of memory from */
/* finalizers, fail and collect sooner rather */
/* than later. */
if (WORDS_TO_BYTES(GC_finalizer_mem_freed)
> (GC_heapsize >> 4)) {
if (GC_finalizer_bytes_freed > (GC_heapsize >> 4)) {
continue;
}
# endif /* !USE_MUNMAP */
@@ -700,14 +731,14 @@ int n;
struct hblk * h;
struct hblk * prev = hhdr -> hb_prev;
GC_words_wasted += BYTES_TO_WORDS(total_size);
GC_bytes_wasted += total_size;
GC_large_free_bytes -= total_size;
GC_remove_from_fl(hhdr, n);
for (h = hbp; h < limit; h++) {
if (h == hbp || 0 != (hhdr = GC_install_header(h))) {
(void) setup_header(
hhdr,
BYTES_TO_WORDS(HBLKSIZE),
hhdr, h,
HBLKSIZE,
PTRFREE, 0); /* Cant fail */
if (GC_debugging_started) {
BZERO(h, HBLKSIZE);
@@ -745,7 +776,7 @@ int n;
/* This leaks memory under very rare conditions. */
/* Set up header */
if (!setup_header(hhdr, sz, kind, flags)) {
if (!setup_header(hhdr, hbp, sz, kind, flags)) {
GC_remove_counts(hbp, (word)size_needed);
return(0); /* ditto */
}
@@ -779,8 +810,7 @@ struct hblk * GC_freehblk_ptr = 0; /* Search position hint for GC_freehblk */
* All mark words are assumed to be cleared.
*/
void
GC_freehblk(hbp)
struct hblk *hbp;
GC_freehblk(struct hblk *hbp)
{
struct hblk *next, *prev;
hdr *hhdr, *prevhdr, *nexthdr;
@@ -798,13 +828,12 @@ signed_word size;
/* Check for duplicate deallocation in the easy case */
if (HBLK_IS_FREE(hhdr)) {
GC_printf1("Duplicate large block deallocation of 0x%lx\n",
(unsigned long) hbp);
GC_printf("Duplicate large block deallocation of %p\n", hbp);
ABORT("Duplicate large block deallocation");
}
GC_ASSERT(IS_MAPPED(hhdr));
GC_invalidate_map(hhdr);
hhdr -> hb_flags |= FREE_BLK;
next = (struct hblk *)((word)hbp + size);
GET_HDR(next, nexthdr);
prev = GC_free_block_ending_at(hbp);
+214 -282
View File
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -254,12 +254,12 @@ static void add_edge(ptr_t p, ptr_t q)
}
}
typedef void (*per_object_func)(ptr_t p, word n_words, word gc_descr);
typedef void (*per_object_func)(ptr_t p, word n_bytes, word gc_descr);
static void per_object_helper(struct hblk *h, word fn)
{
hdr * hhdr = HDR(h);
word sz = hhdr -> hb_sz;
size_t sz = hhdr -> hb_sz;
word descr = hhdr -> hb_descr;
per_object_func f = (per_object_func)fn;
int i = 0;
@@ -275,7 +275,7 @@ void GC_apply_to_each_object(per_object_func f)
GC_apply_to_all_blocks(per_object_helper, (word)f);
}
static void reset_back_edge(ptr_t p, word n_words, word gc_descr)
static void reset_back_edge(ptr_t p, word n_bytes, word gc_descr)
{
/* Skip any free list links, or dropped blocks */
if (GC_HAS_DEBUG_INFO(p)) {
@@ -311,20 +311,20 @@ static void reset_back_edge(ptr_t p, word n_words, word gc_descr)
}
}
static void add_back_edges(ptr_t p, word n_words, word gc_descr)
static void add_back_edges(ptr_t p, size_t n_bytes, word gc_descr)
{
word *currentp = (word *)(p + sizeof(oh));
/* For now, fix up non-length descriptors conservatively. */
if((gc_descr & GC_DS_TAGS) != GC_DS_LENGTH) {
gc_descr = WORDS_TO_BYTES(n_words);
gc_descr = n_bytes;
}
while (currentp < (word *)(p + gc_descr)) {
word current = *currentp++;
FIXUP_POINTER(current);
if (current >= (word)GC_least_plausible_heap_addr &&
current <= (word)GC_greatest_plausible_heap_addr) {
ptr_t target = GC_base((GC_PTR)current);
ptr_t target = GC_base((void *)current);
if (0 != target) {
add_edge(p, target);
}
@@ -369,7 +369,7 @@ static word backwards_height(ptr_t p)
word this_height;
if (GC_is_marked(q) && !(FLAG_MANY & (word)GET_OH_BG_PTR(p))) {
if (GC_print_stats)
GC_printf2("Found bogus pointer from 0x%lx to 0x%lx\n", q, p);
GC_log_printf("Found bogus pointer from 0x%lx to 0x%lx\n", q, p);
/* Reachable object "points to" unreachable one. */
/* Could be caused by our lax treatment of GC descriptors. */
this_height = 1;
@@ -392,7 +392,7 @@ ptr_t GC_deepest_obj;
/* next GC. */
/* Set GC_max_height to be the maximum height we encounter, and */
/* GC_deepest_obj to be the corresponding object. */
static void update_max_height(ptr_t p, word n_words, word gc_descr)
static void update_max_height(ptr_t p, word n_bytes, word gc_descr)
{
if (GC_is_marked(p) && GC_HAS_DEBUG_INFO(p)) {
int i;
@@ -457,8 +457,8 @@ void GC_print_back_graph_stats(void)
GC_print_heap_obj(GC_deepest_obj);
}
if (GC_print_stats) {
GC_printf1("Needed max total of %ld back-edge structs\n",
GC_n_back_edge_structs);
GC_log_printf("Needed max total of %ld back-edge structs\n",
GC_n_back_edge_structs);
}
GC_apply_to_each_object(reset_back_edge);
GC_deepest_obj = 0;
+33 -48
View File
@@ -50,40 +50,34 @@ word GC_total_stack_black_listed;
word GC_black_list_spacing = MINHINCR*HBLKSIZE; /* Initial rough guess */
void GC_clear_bl();
void GC_clear_bl(word *);
# if defined(__STDC__) || defined(__cplusplus)
void GC_default_print_heap_obj_proc(ptr_t p)
# else
void GC_default_print_heap_obj_proc(p)
ptr_t p;
# endif
void GC_default_print_heap_obj_proc(ptr_t p)
{
ptr_t base = GC_base(p);
GC_err_printf2("start: 0x%lx, appr. length: %ld", base, GC_size(base));
GC_err_printf("start: %p, appr. length: %ld", base,
(unsigned long)GC_size(base));
}
void (*GC_print_heap_obj) GC_PROTO((ptr_t p)) =
GC_default_print_heap_obj_proc;
void (*GC_print_heap_obj) (ptr_t p) = GC_default_print_heap_obj_proc;
void GC_print_source_ptr(p)
ptr_t p;
void GC_print_source_ptr(ptr_t p)
{
ptr_t base = GC_base(p);
if (0 == base) {
if (0 == p) {
GC_err_printf0("in register");
GC_err_printf("in register");
} else {
GC_err_printf0("in root set");
GC_err_printf("in root set");
}
} else {
GC_err_printf0("in object at ");
GC_err_printf("in object at ");
(*GC_print_heap_obj)(base);
}
}
void GC_bl_init()
void GC_bl_init(void)
{
if (!GC_all_interior_pointers) {
GC_old_normal_bl = (word *)
@@ -91,7 +85,7 @@ void GC_bl_init()
GC_incomplete_normal_bl = (word *)GC_scratch_alloc
((word)(sizeof(page_hash_table)));
if (GC_old_normal_bl == 0 || GC_incomplete_normal_bl == 0) {
GC_err_printf0("Insufficient memory for black list\n");
GC_err_printf("Insufficient memory for black list\n");
EXIT();
}
GC_clear_bl(GC_old_normal_bl);
@@ -101,30 +95,28 @@ void GC_bl_init()
GC_incomplete_stack_bl = (word *)GC_scratch_alloc
((word)(sizeof(page_hash_table)));
if (GC_old_stack_bl == 0 || GC_incomplete_stack_bl == 0) {
GC_err_printf0("Insufficient memory for black list\n");
GC_err_printf("Insufficient memory for black list\n");
EXIT();
}
GC_clear_bl(GC_old_stack_bl);
GC_clear_bl(GC_incomplete_stack_bl);
}
void GC_clear_bl(doomed)
word *doomed;
void GC_clear_bl(word *doomed)
{
BZERO(doomed, sizeof(page_hash_table));
}
void GC_copy_bl(old, new)
word *new, *old;
void GC_copy_bl(word *old, word *new)
{
BCOPY(old, new, sizeof(page_hash_table));
}
static word total_stack_black_listed();
static word total_stack_black_listed(void);
/* Signal the completion of a collection. Turn the incomplete black */
/* lists into new black lists, etc. */
void GC_promote_black_lists()
void GC_promote_black_lists(void)
{
word * very_old_normal_bl = GC_old_normal_bl;
word * very_old_stack_bl = GC_old_stack_bl;
@@ -138,10 +130,9 @@ void GC_promote_black_lists()
GC_incomplete_normal_bl = very_old_normal_bl;
GC_incomplete_stack_bl = very_old_stack_bl;
GC_total_stack_black_listed = total_stack_black_listed();
# ifdef PRINTSTATS
GC_printf1("%ld bytes in heap blacklisted for interior pointers\n",
(unsigned long)GC_total_stack_black_listed);
# endif
if (GC_print_stats == VERBOSE)
GC_log_printf("%ld bytes in heap blacklisted for interior pointers\n",
(unsigned long)GC_total_stack_black_listed);
if (GC_total_stack_black_listed != 0) {
GC_black_list_spacing =
HBLKSIZE*(GC_heapsize/GC_total_stack_black_listed);
@@ -158,7 +149,7 @@ void GC_promote_black_lists()
}
}
void GC_unpromote_black_lists()
void GC_unpromote_black_lists(void)
{
if (!GC_all_interior_pointers) {
GC_copy_bl(GC_old_normal_bl, GC_incomplete_normal_bl);
@@ -170,12 +161,10 @@ void GC_unpromote_black_lists()
/* the plausible heap bounds. */
/* Add it to the normal incomplete black list if appropriate. */
#ifdef PRINT_BLACK_LIST
void GC_add_to_black_list_normal(p, source)
ptr_t source;
void GC_add_to_black_list_normal(word p, ptr_t source)
#else
void GC_add_to_black_list_normal(p)
void GC_add_to_black_list_normal(word p)
#endif
word p;
{
if (!(GC_modws_valid_offsets[p & (sizeof(word)-1)])) return;
{
@@ -184,9 +173,9 @@ word p;
if (HDR(p) == 0 || get_pht_entry_from_index(GC_old_normal_bl, index)) {
# ifdef PRINT_BLACK_LIST
if (!get_pht_entry_from_index(GC_incomplete_normal_bl, index)) {
GC_err_printf2(
"Black listing (normal) 0x%lx referenced from 0x%lx ",
(unsigned long) p, (unsigned long) source);
GC_err_printf(
"Black listing (normal) %p referenced from %p ",
(ptr_t) p, source);
GC_print_source_ptr(source);
GC_err_puts("\n");
}
@@ -199,21 +188,20 @@ word p;
/* And the same for false pointers from the stack. */
#ifdef PRINT_BLACK_LIST
void GC_add_to_black_list_stack(p, source)
void GC_add_to_black_list_stack(word p, ptr_t source)
ptr_t source;
#else
void GC_add_to_black_list_stack(p)
void GC_add_to_black_list_stack(word p)
#endif
word p;
{
register int index = PHT_HASH(p);
if (HDR(p) == 0 || get_pht_entry_from_index(GC_old_stack_bl, index)) {
# ifdef PRINT_BLACK_LIST
if (!get_pht_entry_from_index(GC_incomplete_stack_bl, index)) {
GC_err_printf2(
"Black listing (stack) 0x%lx referenced from 0x%lx ",
(unsigned long)p, (unsigned long)source);
GC_err_printf(
"Black listing (stack) %p referenced from %p ",
(ptr_t)p, source);
GC_print_source_ptr(source);
GC_err_puts("\n");
}
@@ -230,9 +218,7 @@ word p;
* If (h,len) is not black listed, return 0.
* Knows about the structure of the black list hash tables.
*/
struct hblk * GC_is_black_listed(h, len)
struct hblk * h;
word len;
struct hblk * GC_is_black_listed(struct hblk *h, word len)
{
register int index = PHT_HASH((word)h);
register word i;
@@ -267,8 +253,7 @@ word len;
/* Return the number of blacklisted blocks in a given range. */
/* Used only for statistical purposes. */
/* Looks only at the GC_incomplete_stack_bl. */
word GC_number_stack_black_listed(start, endp1)
struct hblk *start, *endp1;
word GC_number_stack_black_listed(struct hblk *start, struct hblk *endp1)
{
register struct hblk * h;
word result = 0;
@@ -283,7 +268,7 @@ struct hblk *start, *endp1;
/* Return the total number of (stack) black-listed bytes. */
static word total_stack_black_listed()
static word total_stack_black_listed(void)
{
register unsigned i;
word total = 0;

Some files were not shown because too many files have changed in this diff Show More