Commit daf25006 authored by Erick's avatar Erick

Upgraded the Boehm GC library to version 7.6.4

parent 85009535
......@@ -22,7 +22,7 @@ for MPI
GC: The Boehm's conservative garbage collector for C and C++
============================================================
- Version: 7.2alpha2
- Version: 7.6.4
- License: Free (BSD-like)
- Home Page: http://www.hpl.hp.com/personal/Hans_Boehm/gc
......
This diff is collapsed.
......@@ -14,7 +14,7 @@ rc= $(bcbin)\brc32
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
-w-pro -w-aus -w-par -w-ccc -w-rch -a4
defines= -DALL_INTERIOR_POINTERS -DUSE_GENERIC -DNO_GETENV -DJAVA_FINALIZATION -DGC_OPERATOR_NEW_ARRAY
.c.obj:
......@@ -34,7 +34,8 @@ XXXOBJS= XXXalloc.obj XXXreclaim.obj XXXallchblk.obj XXXmisc.obj \
XXXmach_dep.obj XXXos_dep.obj XXXmark_rts.obj XXXheaders.obj XXXmark.obj \
XXXobj_map.obj XXXblacklst.obj XXXfinalize.obj XXXnew_hblk.obj \
XXXdbg_mlc.obj XXXmalloc.obj XXXstubborn.obj XXXdyn_load.obj \
XXXtypd_mlc.obj XXXptr_chck.obj XXXgc_cpp.obj XXXmallocx.obj
XXXtypd_mlc.obj XXXptr_chck.obj XXXgc_cpp.obj XXXmallocx.obj \
XXXfnlz_mlc.obj
OBJS= $(XXXOBJS:XXX=)
......@@ -53,16 +54,16 @@ gctest.exe: tests\test.obj gc.lib
$(cflags) -W -e$* tests\test.obj gc.lib
|
cord\de.obj cord\de_win.obj: include\cord.h include\private\cord_pos.h cord\de_win.h \
cord\de_cmds.h
cord\tests\de.obj cord\tests\de_win.obj: include\cord.h \
include\cord_pos.h cord\tests\de_win.h cord\tests\de_cmds.h
cord\de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj \
cord\de_win.res gc.lib
cord\de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\tests\de.obj \
cord\tests\de_win.obj cord\tests\de_win.res gc.lib
$(cc) @&&|
$(cflags) -W -e$* cord\cordbscs.obj cord\cordxtra.obj \
cord\de.obj cord\de_win.obj gc.lib
cord\tests\de.obj cord\tests\de_win.obj gc.lib
|
$(rc) cord\de_win.res cord\de.exe
$(rc) cord\tests\de_win.res cord\de.exe
gc_cpp.obj: include\gc_cpp.h include\gc.h
......@@ -84,4 +85,3 @@ clean:
del gc.lib
del *.obj
del tests\test.obj
#
# Copyright (c) 1994 by Xerox Corporation. All rights reserved.
# Copyright (c) 1996 by Silicon Graphics. All rights reserved.
# Copyright (c) 1998 by Fergus Henderson. All rights reserved.
# Copyright (c) 2000-2010 by Hewlett-Packard Company. All rights reserved.
##
# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
# OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
##
# Permission is hereby granted to use or copy this program
# for any purpose, provided the above notices are retained on all copies.
# Permission to modify the code and to distribute modified code is granted,
# provided the above notices are retained, and a notice that the code was
# modified is included with the above copyright notice.
##
#
# get cmake and run:
# cmake -G "Visual Studio 8 2005"
# in the same dir as this file
# this will generate gc.sln
#
SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
PROJECT(gc)
INCLUDE(CTest)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
ADD_DEFINITIONS("-D_CRT_SECURE_NO_DEPRECATE
-DALL_INTERIOR_POINTERS")
IF(APPLE)
IF("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;x86_64" CACHE STRING "Build architectures for Mac OS X" FORCE)
ENDIF()
ENDIF(APPLE)
#LIBATOMIC #TODO
#ADD_LIBRARY(atomic_ops STATIC )
#SET_TARGET_PROPERTIES(atomic_ops PROPERTIES COMPILE_FLAGS -DNO_DEBUGGING)
#LIBGC
INCLUDE_DIRECTORIES(include)
INCLUDE_DIRECTORIES(libatomic_ops/src)
SET(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c
mark_rts.c headers.c mark.c obj_map.c blacklst.c finalize.c
new_hblk.c dbg_mlc.c malloc.c stubborn.c dyn_load.c
typd_mlc.c ptr_chck.c mallocx.c gc_cpp.cc)
SET(LIBS)
OPTION(enable_threads "TODO" NO)
IF(enable_threads)
FIND_PACKAGE(Threads REQUIRED)
MESSAGE("Thread Model: ${CMAKE_THREAD_LIBS_INIT}" )
INCLUDE_DIRECTORIES(${Threads_INCLUDE_DIR})
SET(LIBS ${LIBS} ${Threads_LIBRARIES})
ENDIF(enable_threads)
OPTION(enable_parallel_mark "Parallelize marking and free list construction" NO)
#IF(Threads_FOUND)
# ADD_DEFINITIONS("")
#ELSE
# MESSAGE("Parallel mark requires enable_threads ON" )
#ENDIF(Threads_FOUND)
IF(enable_parallel_mark)
ADD_DEFINITIONS("-DPARALLEL_MARK")
ENDIF(enable_parallel_mark)
OPTION(enable_cplusplus "install C++ support" NO)
SET(_HOST ${CMAKE_HOST_SYSTEM_PROCESSOR}--${CMAKE_SYSTEM}) #FIXME missing the vendor field.Use lowercase
STRING(TOLOWER ${_HOST} HOST)
MESSAGE("HOST = ${HOST}")
#Thread Detection. Relying on cmake for lib an includes.
#TODO check cmake detection
IF(CMAKE_USE_PTHREADS_INIT)
SET(SRC ${SRC} pthread_start.c pthread_support.c pthread_stop_world.c)
IF( HOST MATCHES x86-.*-linux.*|ia64-.*-linux.*|i586-.*-linux.*|i686-.*-linux.*|x86_64-.*-linux.*|alpha-.*-linux.*|sparc.*-.*-linux.*)
ADD_DEFINITIONS("-DGC_LINUX_THREADS")
ADD_DEFINITIONS("-D_REENTRANT")
ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
SET(SRC ${SRC} thread_local_alloc.c)
MESSAGE("Explicit GC_INIT() calls may be required.")
ENDIF()
IF ( HOST MATCHES .*-.*-linux.*)
ADD_DEFINITIONS("-DGC_LINUX_THREADS")
ADD_DEFINITIONS("-D_REENTRANT")
ENDIF()
IF ( HOST MATCHES .*-.*-aix.*)
ADD_DEFINITIONS("-DGC_AIX_THREADS")
ADD_DEFINITIONS("-D_REENTRANT")
ENDIF()
IF ( HOST MATCHES .*-.*-hpux11.*)
MESSAGE("Only HP/UX 11 POSIX threads are supported.")
ADD_DEFINITIONS("-DGC_HPUX_THREADS")
ADD_DEFINITIONS("-D_POSIX_C_SOURCE=199506L") #TODO test -DVAR=value. Alternative is COMPILE_DEFINITIONS property
MESSAGE("Explicit GC_INIT() calls may be required.")
ADD_DEFINITIONS("-D_REENTRANT") #TODO
ENDIF()
IF ( HOST MATCHES .*-.*-hpux10.*)
MESSAGE("Only HP/UX 11 POSIX threads are supported.")
ENDIF()
IF ( HOST MATCHES .*-.*-openbsd.*)
ADD_DEFINITIONS("-DGC_OPENBSD_THREADS")
ENDIF()
IF ( HOST MATCHES .*-.*-freebsd.*)
MESSAGE("FreeBSD does not yet fully support threads with Boehm GC.")
ADD_DEFINITIONS("-DGC_FREEBSD_THREADS")
ENDIF()
IF ( HOST MATCHES .*-.*-kfreebsd.*-gnu)
ADD_DEFINITIONS("-DGC_FREEBSD_THREADS")
ADD_DEFINITIONS("-D_REENTRANT")
ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
ADD_DEFINITIONS("-DUSE_COMPILER_TLS")
SET(SRC ${SRC} thread_local_alloc.c)
ENDIF()
IF ( HOST MATCHES .*-.*-gnu.*)
ADD_DEFINITIONS("-DGC_GNU_THREADS")
ADD_DEFINITIONS("-D_REENTRANT")
ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
SET(SRC ${SRC} thread_local_alloc.c)
ENDIF()
IF ( HOST MATCHES .*-.*-netbsd.*)
MESSAGE("Only on NetBSD 2.0 or later.")
ADD_DEFINITIONS("-DGC_NETBSD_THREADS")
ADD_DEFINITIONS("-D_REENTRANT")
ADD_DEFINITIONS("-D_PTHREADS")
ENDIF()
IF ( HOST MATCHES .*-.*-solaris.*)
ADD_DEFINITIONS("-DGC_SOLARIS_THREADS")
ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
SET(SRC ${SRC} thread_local_alloc.c)
#TODO
# if test "$GCC" != yes; then
# CFLAGS="$CFLAGS -O"
# need_atomic_ops_asm=true
# fi
ENDIF()
IF ( HOST MATCHES .*-.*-irix.*)
ADD_DEFINITIONS("-DGC_IRIX_THREADS")
ENDIF()
IF ( HOST MATCHES .*-.*-cygwin.*)
ADD_DEFINITIONS("-DGC_THREADS")
ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
SET(SRC ${SRC} thread_local_alloc.c win32_threads.c)
ENDIF()
IF ( HOST MATCHES .*-.*-darwin.*)
ADD_DEFINITIONS("-DGC_DARWIN_THREADS")
ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
MESSAGE("Explicit GC_INIT() calls may be required.")
SET(SRC ${SRC} darwin_stop_world.c thread_local_alloc.c)
#TODO
#darwin_threads=true
ENDIF()
IF ( HOST MATCHES .*-.*-osf.*)
ADD_DEFINITIONS("-DGC_OSF1_THREADS")
IF(enable_parallel_mark)
ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
SET(SRC ${SRC} thread_local_alloc.c)
MESSAGE("Explicit GC_INIT() calls may be required.")
# May want to enable it in other cases, too.
# Measurements haven't yet been done.
ENDIF()
ENDIF()
IF ( HOST MATCHES .*-.*-linux.*)
ADD_DEFINITIONS("-DGC_LINUX_THREADS")
ADD_DEFINITIONS("-D_REENTRANT")
ENDIF()
ENDIF(CMAKE_USE_PTHREADS_INIT)
IF(CMAKE_USE_WIN32_THREADS_INIT)
ADD_DEFINITIONS("-DGC_THREADS")
IF(enable_parallel_mark)
ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC")
SET(SRC ${SRC} thread_local_alloc.c)
ENDIF()
ADD_DEFINITIONS("-DEMPTY_GETENV_RESULTS") #TODO test
SET(SRC ${SRC} win32_threads.c)
ENDIF(CMAKE_USE_WIN32_THREADS_INIT)
OPTION(enable_gcj_support "Support for gcj" NO)
IF(enable_gcj_support)
ADD_DEFINITIONS("-DGC_GCJ_SUPPORT")
IF(enable_threads)
ADD_DEFINITIONS("-DGC_ENABLE_SUSPEND_THREAD")
ENDIF(enable_threads)
SET(SRC ${SRC} gcj_mlc.c)
ENDIF(enable_gcj_support)
ADD_LIBRARY( gc-lib STATIC ${SRC})
SET_TARGET_PROPERTIES(gc-lib PROPERTIES
COMPILE_DEFINITIONS GC_NOT_DLL)
#TODO TARGET_LINK_LIBRARIES(... ... ${LIBS})
ADD_LIBRARY( gcmt-lib STATIC ${SRC})
SET_TARGET_PROPERTIES(gcmt-lib PROPERTIES
COMPILE_DEFINITIONS GC_NOT_DLL)
ADD_LIBRARY( gcmt-dll SHARED ${SRC})
IF(WIN32)
ADD_EXECUTABLE(cord cord/cordbscs.c cord/cordxtra.c
cord/tests/de.c cord/tests/de_win.c)
SET_TARGET_PROPERTIES(cord PROPERTIES WIN32_EXECUTABLE TRUE)
SET_TARGET_PROPERTIES(cord PROPERTIES
COMPILE_DEFINITIONS GC_NOT_DLL)
TARGET_LINK_LIBRARIES(cord gc-lib)
TARGET_LINK_LIBRARIES(cord gdi32)
ENDIF(WIN32)
ADD_SUBDIRECTORY(tests)
This diff is collapsed.
......@@ -4,8 +4,6 @@
# You need GNU Make 3.71, gcc 2.5.7, emx 0.8h and GNU fileutils 3.9
# or similar tools. C++ interface and de.exe weren't tested.
#
# Rename this file "Makefile".
#
# Primary targets:
# gc.a - builds basic library
......@@ -18,28 +16,11 @@ CC= gcc
CXX=g++
# Needed only for "make c++", which adds the c++ interface
CFLAGS= -O -DALL_INTERIOR_POINTERS
CFLAGS= -O -DALL_INTERIOR_POINTERS -I$(srcdir)/include
# Setjmp_test may yield overly optimistic results when compiled
# without optimization.
# -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
# objects should have been explicitly deallocated, and reports exceptions
# -DSOLARIS_THREADS enables support for Solaris (thr_) threads.
# (Clients should also define SOLARIS_THREADS and then include
# gc.h before performing thr_ or GC_ operations.)
# -DALL_INTERIOR_POINTERS allows all pointers to the interior
# of objects to be recognized. (See gc_private.h for consequences.)
# -DSMALL_CONFIG tries to tune the collector for small heap sizes,
# usually causing it to use less space in such situations.
# Incremental collection no longer works in this case.
# -DDONT_ADD_BYTE_AT_END is meaningful only with
# -DALL_INTERIOR_POINTERS. Normally -DALL_INTERIOR_POINTERS
# causes all objects to be padded so that pointers just past the end of
# 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.
CXXFLAGS= $(CFLAGS)
AR= ar
RANLIB= ar s
......@@ -48,30 +29,26 @@ RANLIB= ar s
srcdir = .
VPATH = $(srcdir)
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 dyn_load.o dbg_mlc.o malloc.o stubborn.o checksums.o typd_mlc.o ptr_chck.o mallocx.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 dyn_load.o dbg_mlc.o fnlz_mlc.o malloc.o stubborn.o checksums.o typd_mlc.o ptr_chck.o mallocx.o
CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
CORD_INCLUDE_FILES= $(srcdir)/gc.h $(srcdir)/cord/cord.h $(srcdir)/cord/ec.h \
$(srcdir)/cord/cord_pos.h
CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \
$(srcdir)/include/ec.h $(srcdir)/include/cord_pos.h
# Libraries needed for curses applications. Only needed for de.
CURSES= -lcurses -ltermlib
# The following is irrelevant on most systems. But a few
# versions of make otherwise fork the shell specified in
# the SHELL environment variable.
SHELL= bash
SPECIALCFLAGS =
SPECIALCFLAGS = -I$(srcdir)/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.
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
$(OBJS) test.o: $(srcdir)/include/private/gc_priv.h \
$(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/gc.h \
$(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h
# The dependency on Makefile is needed. Changing
# options affects the size of GC_arrays,
# invalidating all .o files that rely on gc_priv.h
......@@ -85,17 +62,13 @@ gc.a: $(OBJS)
cords: $(CORD_OBJS) cord/cordtest.exe
$(AR) ru gc.a $(CORD_OBJS)
$(RANLIB) gc.a
cp $(srcdir)/cord/cord.h include/cord.h
cp $(srcdir)/cord/ec.h include/ec.h
cp $(srcdir)/cord/cord_pos.h include/cord_pos.h
gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/gc_cpp.h
$(CXX) -c -O $(srcdir)/gc_cpp.cc
gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/include/gc_cpp.h
$(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc
c++: gc_cpp.o $(srcdir)/gc_cpp.h
c++: gc_cpp.o $(srcdir)/include/gc_cpp.h
$(AR) ru gc.a gc_cpp.o
$(RANLIB) gc.a
cp $(srcdir)/gc_cpp.h include/gc_cpp.h
mach_dep.o: $(srcdir)/mach_dep.c
$(CC) -o mach_dep.o -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
......@@ -112,11 +85,11 @@ cord/cordxtra.o: $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
cord/cordprnt.o: $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
$(CC) $(CFLAGS) -c $(srcdir)/cord/cordprnt.c -o cord/cordprnt.o
cord/cordtest.exe: $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a
$(CC) $(CFLAGS) -o cord/cordtest.exe $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a
cord/cordtest.exe: $(srcdir)/cord/tests/cordtest.c $(CORD_OBJS) gc.a
$(CC) $(CFLAGS) -o cord/cordtest.exe $(srcdir)/cord/tests/cordtest.c $(CORD_OBJS) gc.a
cord/de.exe: $(srcdir)/cord/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a
$(CC) $(CFLAGS) -o cord/de.exe $(srcdir)/cord/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a $(CURSES)
cord/de.exe: $(srcdir)/cord/tests/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a
$(CC) $(CFLAGS) -o cord/de.exe $(srcdir)/cord/tests/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a $(CURSES)
clean:
rm -f gc.a tests/test.o gctest.exe output-local output-diff $(OBJS) \
......@@ -130,8 +103,8 @@ gctest.exe: tests/test.o gc.a
# If an optimized setjmp_test generates a segmentation fault,
# odds are your compiler is broken. Gctest may still work.
# Try compiling setjmp_t.c unoptimized.
setjmp_test.exe: $(srcdir)/setjmp_t.c $(srcdir)/gc.h
$(CC) $(CFLAGS) -o setjmp_test.exe $(srcdir)/setjmp_t.c
setjmp_test.exe: $(srcdir)/tools/setjmp_t.c $(srcdir)/include/gc.h
$(CC) $(CFLAGS) -o setjmp_test.exe $(srcdir)/tools/setjmp_t.c
test: setjmp_test.exe gctest.exe
./setjmp_test
......
/*
MacOS.c
Some routines for the Macintosh OS port of the Hans-J. Boehm, Alan J. Demers
garbage collector.
<Revision History>
11/22/94 pcb StripAddress the temporary memory handle for 24-bit mode.
11/30/94 pcb Tracking all memory usage so we can deallocate it all at once.
02/10/96 pcb Added routine to perform a final collection when
unloading shared library.
by Patrick C. Beard.
*/
/* Boehm, February 15, 1996 2:55 pm PST */
#include <Resources.h>
#include <Memory.h>
#include <LowMem.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "gc.h"
#include "gc_priv.h"
// use 'CODE' resource 0 to get exact location of the beginning of global space.
typedef struct {
unsigned long aboveA5;
unsigned long belowA5;
unsigned long JTSize;
unsigned long JTOffset;
} *CodeZeroPtr, **CodeZeroHandle;
void* GC_MacGetDataStart()
{
CodeZeroHandle code0 = (CodeZeroHandle)GetResource('CODE', 0);
if (code0) {
long belowA5Size = (**code0).belowA5;
ReleaseResource((Handle)code0);
return (LMGetCurrentA5() - belowA5Size);
}
fprintf(stderr, "Couldn't load the jump table.");
exit(-1);
return 0;
}
/* track the use of temporary memory so it can be freed all at once. */
typedef struct TemporaryMemoryBlock TemporaryMemoryBlock, **TemporaryMemoryHandle;
struct TemporaryMemoryBlock {
TemporaryMemoryHandle nextBlock;
char data[];
};
static TemporaryMemoryHandle theTemporaryMemory = NULL;
static Boolean firstTime = true;
void GC_MacFreeTemporaryMemory(void);
Ptr GC_MacTemporaryNewPtr(size_t size, Boolean clearMemory)
{
static Boolean firstTime = true;
OSErr result;
TemporaryMemoryHandle tempMemBlock;
Ptr tempPtr = nil;
tempMemBlock = (TemporaryMemoryHandle)TempNewHandle(size + sizeof(TemporaryMemoryBlock), &result);
if (tempMemBlock && result == noErr) {
HLockHi((Handle)tempMemBlock);
tempPtr = (**tempMemBlock).data;
if (clearMemory) memset(tempPtr, 0, size);
tempPtr = StripAddress(tempPtr);
// keep track of the allocated blocks.
(**tempMemBlock).nextBlock = theTemporaryMemory;
theTemporaryMemory = tempMemBlock;
}
# if !defined(SHARED_LIBRARY_BUILD)
// install an exit routine to clean up the memory used at the end.
if (firstTime) {
atexit(&GC_MacFreeTemporaryMemory);
firstTime = false;
}
# endif
return tempPtr;
}
extern word GC_fo_entries;
static void perform_final_collection()
{
unsigned i;
word last_fo_entries = 0;
/* adjust the stack bottom, because CFM calls us from another stack
location. */
GC_stackbottom = (ptr_t)&i;
/* try to collect and finalize everything in sight */
for (i = 0; i < 2 || GC_fo_entries < last_fo_entries; i++) {
last_fo_entries = GC_fo_entries;
GC_gcollect();
}
}
void GC_MacFreeTemporaryMemory()
{
# if defined(SHARED_LIBRARY_BUILD)
/* if possible, collect all memory, and invoke all finalizers. */
perform_final_collection();
# endif
if (theTemporaryMemory != NULL) {
long totalMemoryUsed = 0;
TemporaryMemoryHandle tempMemBlock = theTemporaryMemory;
while (tempMemBlock != NULL) {
TemporaryMemoryHandle nextBlock = (**tempMemBlock).nextBlock;
totalMemoryUsed += GetHandleSize((Handle)tempMemBlock);
DisposeHandle((Handle)tempMemBlock);
tempMemBlock = nextBlock;
}
theTemporaryMemory = NULL;
# 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);
}
# endif
}
}
#if __option(far_data)
void* GC_MacGetDataEnd()
{
CodeZeroHandle code0 = (CodeZeroHandle)GetResource('CODE', 0);
if (code0) {
long aboveA5Size = (**code0).aboveA5;
ReleaseResource((Handle)code0);
return (LMGetCurrentA5() + aboveA5Size);
}
fprintf(stderr, "Couldn't load the jump table.");
exit(-1);
return 0;
}
#endif /* __option(far_data) */
This diff is collapsed.
/*
MacOS_Test_config.h
Configuration flags for Macintosh development systems.
Test version.
<Revision History>
11/16/95 pcb Updated compilation flags to reflect latest 4.6 Makefile.
by Patrick C. Beard.
*/
/* Boehm, November 17, 1995 12:05 pm PST */
#ifdef __MWERKS__
// for CodeWarrior Pro with Metrowerks Standard Library (MSL).
// #define MSL_USE_PRECOMPILED_HEADERS 0
#include <ansi_prefix.mac.h>
#ifndef __STDC__
#define __STDC__ 0
#endif
#endif
// these are defined again in gc_priv.h.
#undef TRUE
#undef FALSE
#define ALL_INTERIOR_POINTERS // follows interior pointers.
//#define SILENT // want collection messages.
//#define DONT_ADD_BYTE_AT_END // no padding.
//#define SMALL_CONFIG // whether to a smaller heap.
#define NO_SIGNALS // signals aren't real on the Macintosh.
#define USE_TEMPORARY_MEMORY // use Macintosh temporary memory.
// CFLAGS= -O -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DSILENT
//
//LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \
// -DREDIRECT_MALLOC=GC_malloc_uncollectable \
// -DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS
// Flags for building libgc.a -- the last two are required.