[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/libgc/include gc.h,1.2,1.3 gc_allocator
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/libgc/include gc.h,1.2,1.3 gc_allocator.h,1.1,1.2 gc_cpp.h,1.2,1.3 gc_mark.h,1.1.1.1,1.2 gc_typed.h,1.1.1.1,1.2 new_gc_alloc.h,1.2,1.3 |
Date: |
Wed, 05 Feb 2003 20:35:48 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/libgc/include
In directory subversions:/tmp/cvs-serv32390/libgc/include
Modified Files:
gc.h gc_allocator.h gc_cpp.h gc_mark.h gc_typed.h
new_gc_alloc.h
Log Message:
Update the libgc library using gc6.2alpha3 from the libgc ftp site.
Index: gc.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/gc.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gc.h 8 Apr 2002 23:36:50 -0000 1.2
--- gc.h 6 Feb 2003 01:35:46 -0000 1.3
***************
*** 85,89 ****
defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) || \
defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) || \
! defined(GC_DGUX386_THREADS)
# define GC_PTHREADS
# endif
--- 85,90 ----
defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) || \
defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) || \
! defined(GC_DGUX386_THREADS) || \
! (defined(GC_WIN32_THREADS) && defined(__CYGWIN32__))
# define GC_PTHREADS
# endif
***************
*** 226,231 ****
/* in response. */
! GC_API int GC_dont_gc; /* Dont collect unless explicitly requested,
e.g. */
! /* because it's not safe. */
GC_API int GC_dont_expand;
--- 227,238 ----
/* in response. */
! GC_API int GC_dont_gc; /* != 0 ==> Dont collect. In versions 7.2a1+,
*/
! /* this overrides explicit GC_gcollect() calls. */
! /* Used as a counter, so that nested enabling */
! /* and disabling work correctly. Should */
! /* normally be updated with GC_enable() and */
! /* GC_disable() calls. */
! /* Direct assignment to GC_dont_gc is */
! /* deprecated. */
GC_API int GC_dont_expand;
***************
*** 475,481 ****
/* Return the total number of bytes allocated in this process.
*/
! /* Never decreases. */
GC_API size_t GC_get_total_bytes GC_PROTO((void));
/* Enable incremental/generational collection. */
/* Not advisable unless dirty bits are */
--- 482,497 ----
/* Return the total number of bytes allocated in this process.
*/
! /* Never decreases, except due to wrapping. */
GC_API size_t GC_get_total_bytes GC_PROTO((void));
+ /* Disable garbage collection. Even GC_gcollect calls will be
*/
+ /* ineffective.
*/
+ GC_API void GC_disable GC_PROTO((void));
+
+ /* Reenable garbage collection. GC_diable() and GC_enable() calls */
+ /* nest. Garbage collection is enabled if the number of calls to both
*/
+ /* both functions is equal. */
+ GC_API void GC_enable GC_PROTO((void));
+
/* Enable incremental/generational collection. */
/* Not advisable unless dirty bits are */
***************
*** 487,490 ****
--- 503,509 ----
/* functional if GC_parallel is TRUE */
/* or if GC_time_limit is GC_TIME_UNLIMITED. */
+ /* Causes GC_local_gcj_malloc() to revert to */
+ /* locked allocation. Must be called */
+ /* before any GC_local_gcj_malloc() calls. */
GC_API void GC_enable_incremental GC_PROTO((void));
***************
*** 530,533 ****
--- 549,588 ----
#endif
+ #ifdef __linux__
+ # include <features.h>
+ # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
+ && !defined(__ia64__)
+ # define GC_HAVE_BUILTIN_BACKTRACE
+ # define GC_CAN_SAVE_CALL_STACKS
+ # endif
+ # if defined(__i386__) || defined(__x86_64__)
+ # define GC_CAN_SAVE_CALL_STACKS
+ # endif
+ #endif
+
+ #if defined(__sparc__)
+ # define GC_CAN_SAVE_CALL_STACKS
+ #endif
+
+ /* If we're on an a platform on which we can't save call stacks, but */
+ /* gcc is normally used, we go ahead and define GC_ADD_CALLER. */
+ /* We make this decision independent of whether gcc is actually being */
+ /* used, in order to keep the interface consistent, and allow mixing */
+ /* of compilers. */
+ /* This may also be desirable if it is possible but expensive to */
+ /* retrieve the call chain. */
+ #if (defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) \
+ || defined(__FreeBSD__)) & !defined(GC_CAN_SAVE_CALL_STACKS)
+ # define GC_ADD_CALLER
+ # if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+ /* gcc knows how to retrieve return address, but we don't know */
+ /* how to generate call stacks. */
+ # define GC_RETURN_ADDR (GC_word)__builtin_return_address(0)
+ # else
+ /* Just pass 0 for gcc compatibility. */
+ # define GC_RETURN_ADDR 0
+ # endif
+ #endif
+
#ifdef GC_ADD_CALLER
# define GC_EXTRAS GC_RETURN_ADDR, __FILE__, __LINE__
***************
*** 552,558 ****
GC_PROTO((GC_PTR old_object, size_t new_size_in_bytes,
GC_EXTRA_PARAMS));
-
GC_API void GC_debug_change_stubborn GC_PROTO((GC_PTR));
GC_API void GC_debug_end_stubborn_change GC_PROTO((GC_PTR));
# ifdef GC_DEBUG
# define GC_MALLOC(sz) GC_debug_malloc(sz, GC_EXTRAS)
--- 607,629 ----
GC_PROTO((GC_PTR old_object, size_t new_size_in_bytes,
GC_EXTRA_PARAMS));
GC_API void GC_debug_change_stubborn GC_PROTO((GC_PTR));
GC_API void GC_debug_end_stubborn_change GC_PROTO((GC_PTR));
+
+ /* Routines that allocate objects with debug information (like the */
+ /* above), but just fill in dummy file and line number information. */
+ /* Thus they can serve as drop-in malloc/realloc replacements. This */
+ /* can be useful for two reasons: */
+ /* 1) It allows the collector to be built with DBG_HDRS_ALL defined */
+ /* even if some allocation calls come from 3rd party libraries */
+ /* that can't be recompiled.
*/
+ /* 2) On some platforms, the file and line information is redundant, */
+ /* since it can be reconstructed from a stack trace. On such */
+ /* platforms it may be more convenient not to recompile, e.g. for */
+ /* leak detection. This can be accomplished by instructing the */
+ /* linker to replace malloc/realloc with these. */
+ GC_API GC_PTR GC_debug_malloc_replacement GC_PROTO((size_t size_in_bytes));
+ GC_API GC_PTR GC_debug_realloc_replacement
+ GC_PROTO((GC_PTR object_addr, size_t size_in_bytes));
+
# ifdef GC_DEBUG
# define GC_MALLOC(sz) GC_debug_malloc(sz, GC_EXTRAS)
***************
*** 656,660 ****
/* but it's unavoidable for C++, since the compiler may */
/* silently introduce these. It's also benign in that specific */
! /* case. */
/* Note that cd will still be viewed as accessible, even if it */
/* refers to the object itself. */
--- 727,732 ----
/* but it's unavoidable for C++, since the compiler may */
/* silently introduce these. It's also benign in that specific */
! /* case. And it helps if finalizable objects are split to */
! /* avoid cycles. */
/* Note that cd will still be viewed as accessible, even if it */
/* refers to the object itself. */
***************
*** 750,753 ****
--- 822,829 ----
GC_API GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn_proc p));
/* Returns old warning procedure. */
+
+ GC_API GC_word GC_set_free_space_divisor GC_PROTO((GC_word value));
+ /* Set free_space_divisor. See above for definition. */
+ /* Returns old value. */
/* The following is intended to be used by a higher level */
***************
*** 887,890 ****
--- 963,967 ----
#if defined(GC_WIN32_THREADS)
# include <windows.h>
+ # include <winbase.h>
/*
Index: gc_allocator.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/gc_allocator.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** gc_allocator.h 8 Apr 2002 23:36:50 -0000 1.1
--- gc_allocator.h 6 Feb 2003 01:35:46 -0000 1.2
***************
*** 36,39 ****
--- 36,41 ----
*/
+ #include "gc.h" // For size_t
+
/* First some helpers to allow us to dispatch on whether or not a type
* is known to be pointerfree.
Index: gc_cpp.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/gc_cpp.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** gc_cpp.h 8 Apr 2002 23:36:50 -0000 1.2
--- gc_cpp.h 6 Feb 2003 01:35:46 -0000 1.3
***************
*** 135,139 ****
#ifndef THINK_CPLUS
! #define _cdecl
#endif
--- 135,141 ----
#ifndef THINK_CPLUS
! # define GC_cdecl
! #else
! # define GC_cdecl _cdecl
#endif
***************
*** 160,169 ****
--- 162,177 ----
inline void* operator new( size_t size );
inline void* operator new( size_t size, GCPlacement gcp );
+ inline void* operator new( size_t size, void *p );
+ /* Must be redefined here, since the other overloadings */
+ /* hide the global definition. */
inline void operator delete( void* obj );
+ inline void operator delete( void*, void* );
#ifdef GC_OPERATOR_NEW_ARRAY
inline void* operator new[]( size_t size );
inline void* operator new[]( size_t size, GCPlacement gcp );
+ inline void* operator new[]( size_t size, void *p );
inline void operator delete[]( void* obj );
+ inline void gc::operator delete[]( void*, void* );
#endif /* GC_OPERATOR_NEW_ARRAY */
};
***************
*** 177,181 ****
inline virtual ~gc_cleanup();
private:
! inline static void _cdecl cleanup( void* obj, void* clientData );};
/*
Instances of classes derived from "gc_cleanup" will be allocated
--- 185,189 ----
inline virtual ~gc_cleanup();
private:
! inline static void GC_cdecl cleanup( void* obj, void* clientData );};
/*
Instances of classes derived from "gc_cleanup" will be allocated
***************
*** 213,216 ****
--- 221,225 ----
+ #ifdef _MSC_VER
/** This ensures that the system default operator new[] doesn't get
* undefined, which is what seems to happen on VC++ 6 for some reason
***************
*** 227,231 ****
void operator delete(void* obj);
- #ifdef _MSC_VER
// This new operator is used by VC++ in case of Debug builds !
void* operator new( size_t size,
--- 236,239 ----
***************
*** 265,271 ****
--- 273,283 ----
return GC_MALLOC_UNCOLLECTABLE( size );}
+ inline void* gc::operator new( size_t size, void *p ) {
+ return p;}
+
inline void gc::operator delete( void* obj ) {
GC_FREE( obj );}
+ inline void gc::operator delete( void*, void* ) {}
#ifdef GC_OPERATOR_NEW_ARRAY
***************
*** 277,282 ****
--- 289,299 ----
return gc::operator new( size, gcp );}
+ inline void* gc::operator new[]( size_t size, void *p ) {
+ return p;}
+
inline void gc::operator delete[]( void* obj ) {
gc::operator delete( obj );}
+
+ inline void gc::operator delete[]( void*, void* ) {}
#endif /* GC_OPERATOR_NEW_ARRAY */
Index: gc_mark.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/gc_mark.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** gc_mark.h 9 Nov 2001 02:21:30 -0000 1.1.1.1
--- gc_mark.h 6 Feb 2003 01:35:46 -0000 1.2
***************
*** 130,134 ****
/* performance of this call is not extremely performance critical. */
/* (Otherwise we would need to inline GC_mark_and_push completely, */
! /* which would tie the client code to a fixed colllector version.) */
struct GC_ms_entry *GC_mark_and_push
GC_PROTO((GC_PTR obj,
--- 130,136 ----
/* performance of this call is not extremely performance critical. */
/* (Otherwise we would need to inline GC_mark_and_push completely, */
! /* which would tie the client code to a fixed collector version.) */
! /* Note that mark procedures should explicitly call FIXUP_POINTER() */
! /* if required.
*/
struct GC_ms_entry *GC_mark_and_push
GC_PROTO((GC_PTR obj,
Index: gc_typed.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/gc_typed.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** gc_typed.h 9 Nov 2001 02:21:28 -0000 1.1.1.1
--- gc_typed.h 6 Feb 2003 01:35:46 -0000 1.2
***************
*** 30,41 ****
# endif
typedef GC_word * GC_bitmap;
/* The least significant bit of the first word is one if */
/* the first word in the object may be a pointer. */
# define GC_get_bit(bm, index) \
! (((bm)[divWORDSZ(index)] >> modWORDSZ(index)) & 1)
# define GC_set_bit(bm, index) \
! (bm)[divWORDSZ(index)] |= (word)1 << modWORDSZ(index)
typedef GC_word GC_descr;
--- 30,48 ----
# endif
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
typedef GC_word * GC_bitmap;
/* The least significant bit of the first word is one if */
/* the first word in the object may be a pointer. */
+ # define GC_WORDSZ (8*sizeof(GC_word))
# define GC_get_bit(bm, index) \
! (((bm)[index/GC_WORDSZ] >> (index%GC_WORDSZ)) & 1)
# define GC_set_bit(bm, index) \
! (bm)[index/GC_WORDSZ] |= ((GC_word)1 << (index%GC_WORDSZ))
! # define GC_WORD_OFFSET(t, f) (offsetof(t,f)/sizeof(GC_word))
! # define GC_WORD_LEN(t) (sizeof(t)/ sizeof(GC_word))
! # define GC_BITMAP_SIZE(t) ((GC_WORD_LEN(t) + GC_WORDSZ-1)/GC_WORDSZ)
typedef GC_word GC_descr;
***************
*** 58,61 ****
--- 65,78 ----
/* per allocation. */
+ /* It is possible to generate a descriptor for a C type T with */
+ /* word aligned pointer fields f1, f2, ... as follows:
*/
+ /* */
+ /* GC_descr T_descr;
+ /* GC_word T_bitmap[GC_BITMAP_SIZE(T)] = {0}; */
+ /* GC_set_bit(T_bitmap, GC_WORD_OFFSET(T,f1));
*/
+ /* GC_set_bit(T_bitmap, GC_WORD_OFFSET(T,f2));
*/
+ /* ...
*/
+ /* T_descr = GC_make_descriptor(T_bitmap, GC_WORD_LEN(T)); */
+
GC_API GC_PTR GC_malloc_explicitly_typed
GC_PROTO((size_t size_in_bytes, GC_descr d));
***************
*** 80,92 ****
#ifdef GC_DEBUG
! # define GC_MALLOC_EXPLICTLY_TYPED(bytes, d) GC_MALLOC(bytes)
! # define GC_CALLOC_EXPLICTLY_TYPED(n, bytes, d) GC_MALLOC(n*bytes)
#else
! # define GC_MALLOC_EXPLICTLY_TYPED(bytes, d) \
GC_malloc_explicitly_typed(bytes, d)
! # define GC_CALLOC_EXPLICTLY_TYPED(n, bytes, d) \
GC_calloc_explicitly_typed(n, bytes, d)
#endif /* !GC_DEBUG */
#endif /* _GC_TYPED_H */
--- 97,112 ----
#ifdef GC_DEBUG
! # define GC_MALLOC_EXPLICITLY_TYPED(bytes, d) GC_MALLOC(bytes)
! # define GC_CALLOC_EXPLICITLY_TYPED(n, bytes, d) GC_MALLOC(n*bytes)
#else
! # define GC_MALLOC_EXPLICITLY_TYPED(bytes, d) \
GC_malloc_explicitly_typed(bytes, d)
! # define GC_CALLOC_EXPLICITLY_TYPED(n, bytes, d) \
GC_calloc_explicitly_typed(n, bytes, d)
#endif /* !GC_DEBUG */
+ #ifdef __cplusplus
+ } /* matches extern "C" */
+ #endif
#endif /* _GC_TYPED_H */
Index: new_gc_alloc.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/libgc/include/new_gc_alloc.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** new_gc_alloc.h 8 Apr 2002 23:36:50 -0000 1.2
--- new_gc_alloc.h 6 Feb 2003 01:35:46 -0000 1.3
***************
*** 65,68 ****
--- 65,76 ----
#endif
+ /* A hack to deal with gcc 3.1. If you are using gcc3.1 and later, */
+ /* you should probably really use gc_allocator.h instead. */
+ #if defined (__GNUC__) && \
+ (__GNUC > 3 || (__GNUC__ == 3 && (__GNUC_MINOR__ >= 1)))
+ # define simple_alloc __simple_alloc
+ #endif
+
+
#define GC_ALLOC_H
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/libgc/include gc.h,1.2,1.3 gc_allocator.h,1.1,1.2 gc_cpp.h,1.2,1.3 gc_mark.h,1.1.1.1,1.2 gc_typed.h,1.1.1.1,1.2 new_gc_alloc.h,1.2,1.3,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnet/libgc/tests test.c,1.2,1.3 test_cpp.cc,1.2,1.3
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.2103,1.2104
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnet/libgc/tests test.c,1.2,1.3 test_cpp.cc,1.2,1.3
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnet ChangeLog,1.2103,1.2104
- Index(es):