X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=mono%2Fmetadata%2Fmono-gc.h;h=bd1262a67b8b60fa2dc0e3d329c5ed3170376bb0;hb=HEAD;hp=f2ff92b53b82cd2532217226f4b14f76fa367cb6;hpb=58fdac7b8a191881c721c1e04592fc4a8b4b6ab1;p=mono.git diff --git a/mono/metadata/mono-gc.h b/mono/metadata/mono-gc.h index f2ff92b53b8..bd1262a67b8 100644 --- a/mono/metadata/mono-gc.h +++ b/mono/metadata/mono-gc.h @@ -1,5 +1,6 @@ -/* - * mono-gc.h: GC related public interface +/** + * \file + * GC related public interface * */ #ifndef __METADATA_MONO_GC_H__ @@ -11,15 +12,59 @@ MONO_BEGIN_DECLS typedef int (*MonoGCReferences) (MonoObject *obj, MonoClass *klass, uintptr_t size, uintptr_t num, MonoObject **refs, uintptr_t *offsets, void *data); -void mono_gc_collect (int generation); -int mono_gc_max_generation (void); -int mono_gc_get_generation (MonoObject *object); -int mono_gc_collection_count (int generation); -int64_t mono_gc_get_used_size (void); -int64_t mono_gc_get_heap_size (void); -int mono_gc_invoke_finalizers (void); +typedef enum { + // Roots external to Mono. Embedders may only use this value. + MONO_ROOT_SOURCE_EXTERNAL = 0, + // Thread stack. Must not be used to register roots. + MONO_ROOT_SOURCE_STACK = 1, + // Roots in the finalizer queue. Must not be used to register roots. + MONO_ROOT_SOURCE_FINALIZER_QUEUE = 2, + // Managed static variables. + MONO_ROOT_SOURCE_STATIC = 3, + // Static variables with ThreadStaticAttribute. + MONO_ROOT_SOURCE_THREAD_STATIC = 4, + // Static variables with ContextStaticAttribute. + MONO_ROOT_SOURCE_CONTEXT_STATIC = 5, + // GCHandle structures. + MONO_ROOT_SOURCE_GC_HANDLE = 6, + // Roots in the just-in-time compiler. + MONO_ROOT_SOURCE_JIT = 7, + // Roots in the threading subsystem. + MONO_ROOT_SOURCE_THREADING = 8, + // Roots in application domains. + MONO_ROOT_SOURCE_DOMAIN = 9, + // Roots in reflection code. + MONO_ROOT_SOURCE_REFLECTION = 10, + // Roots from P/Invoke or other marshaling. + MONO_ROOT_SOURCE_MARSHAL = 11, + // Roots in the thread pool data structures. + MONO_ROOT_SOURCE_THREAD_POOL = 12, + // Roots in the debugger agent. + MONO_ROOT_SOURCE_DEBUGGER = 13, + // Handle structures, used for object passed to internal functions + MONO_ROOT_SOURCE_HANDLE = 14, +} MonoGCRootSource; + +typedef enum { + MONO_GC_HANDLE_TYPE_MIN = 0, + MONO_GC_HANDLE_WEAK = MONO_GC_HANDLE_TYPE_MIN, + MONO_GC_HANDLE_WEAK_TRACK_RESURRECTION, + MONO_GC_HANDLE_NORMAL, + MONO_GC_HANDLE_PINNED, + MONO_GC_HANDLE_TYPE_MAX, +} MonoGCHandleType; + +MONO_API void mono_gc_collect (int generation); +MONO_API int mono_gc_max_generation (void); +MONO_API int mono_gc_get_generation (MonoObject *object); +MONO_API int mono_gc_collection_count (int generation); +MONO_API int64_t mono_gc_get_used_size (void); +MONO_API int64_t mono_gc_get_heap_size (void); +MONO_API MonoBoolean mono_gc_pending_finalizers (void); +MONO_API void mono_gc_finalize_notify (void); +MONO_API int mono_gc_invoke_finalizers (void); /* heap walking is only valid in the pre-stop-world event callback */ -int mono_gc_walk_heap (int flags, MonoGCReferences callback, void *data); +MONO_API int mono_gc_walk_heap (int flags, MonoGCReferences callback, void *data); MONO_END_DECLS