[sre] Wrap mono_image_create_token with HANDLE_FUNCTION_{ENTER,RETURN}
[mono-project.git] / mono / metadata / mono-gc.h
blobbd1262a67b8b60fa2dc0e3d329c5ed3170376bb0
1 /**
2 * \file
3 * GC related public interface
5 */
6 #ifndef __METADATA_MONO_GC_H__
7 #define __METADATA_MONO_GC_H__
9 #include <mono/metadata/object.h>
11 MONO_BEGIN_DECLS
13 typedef int (*MonoGCReferences) (MonoObject *obj, MonoClass *klass, uintptr_t size, uintptr_t num, MonoObject **refs, uintptr_t *offsets, void *data);
15 typedef enum {
16 // Roots external to Mono. Embedders may only use this value.
17 MONO_ROOT_SOURCE_EXTERNAL = 0,
18 // Thread stack. Must not be used to register roots.
19 MONO_ROOT_SOURCE_STACK = 1,
20 // Roots in the finalizer queue. Must not be used to register roots.
21 MONO_ROOT_SOURCE_FINALIZER_QUEUE = 2,
22 // Managed static variables.
23 MONO_ROOT_SOURCE_STATIC = 3,
24 // Static variables with ThreadStaticAttribute.
25 MONO_ROOT_SOURCE_THREAD_STATIC = 4,
26 // Static variables with ContextStaticAttribute.
27 MONO_ROOT_SOURCE_CONTEXT_STATIC = 5,
28 // GCHandle structures.
29 MONO_ROOT_SOURCE_GC_HANDLE = 6,
30 // Roots in the just-in-time compiler.
31 MONO_ROOT_SOURCE_JIT = 7,
32 // Roots in the threading subsystem.
33 MONO_ROOT_SOURCE_THREADING = 8,
34 // Roots in application domains.
35 MONO_ROOT_SOURCE_DOMAIN = 9,
36 // Roots in reflection code.
37 MONO_ROOT_SOURCE_REFLECTION = 10,
38 // Roots from P/Invoke or other marshaling.
39 MONO_ROOT_SOURCE_MARSHAL = 11,
40 // Roots in the thread pool data structures.
41 MONO_ROOT_SOURCE_THREAD_POOL = 12,
42 // Roots in the debugger agent.
43 MONO_ROOT_SOURCE_DEBUGGER = 13,
44 // Handle structures, used for object passed to internal functions
45 MONO_ROOT_SOURCE_HANDLE = 14,
46 } MonoGCRootSource;
48 typedef enum {
49 MONO_GC_HANDLE_TYPE_MIN = 0,
50 MONO_GC_HANDLE_WEAK = MONO_GC_HANDLE_TYPE_MIN,
51 MONO_GC_HANDLE_WEAK_TRACK_RESURRECTION,
52 MONO_GC_HANDLE_NORMAL,
53 MONO_GC_HANDLE_PINNED,
54 MONO_GC_HANDLE_TYPE_MAX,
55 } MonoGCHandleType;
57 MONO_API void mono_gc_collect (int generation);
58 MONO_API int mono_gc_max_generation (void);
59 MONO_API int mono_gc_get_generation (MonoObject *object);
60 MONO_API int mono_gc_collection_count (int generation);
61 MONO_API int64_t mono_gc_get_used_size (void);
62 MONO_API int64_t mono_gc_get_heap_size (void);
63 MONO_API MonoBoolean mono_gc_pending_finalizers (void);
64 MONO_API void mono_gc_finalize_notify (void);
65 MONO_API int mono_gc_invoke_finalizers (void);
66 /* heap walking is only valid in the pre-stop-world event callback */
67 MONO_API int mono_gc_walk_heap (int flags, MonoGCReferences callback, void *data);
69 MONO_END_DECLS
71 #endif /* __METADATA_MONO_GC_H__ */