fix codetest failure - ASSERT_ARGS does not have a ; after and
[parrot.git] / src / gc / gc_private.h
blob44de15e385e23c35fccaee8cb86cf35de78aa596
1 /*
2 Copyright (C) 2001-2010, Parrot Foundation.
3 $Id$
5 =head1 NAME
7 src/gc/gc_private.h - private header file for the GC subsystem
9 =head1 DESCRIPTION
11 This is a private header file for the GC subsystem. It contains definitions
12 that are only for use in the GC and don't need to be included in the rest of
13 Parrot.
16 #ifndef PARROT_GC_PRIVATE_H_GUARD
17 #define PARROT_GC_PRIVATE_H_GUARD
19 #include "parrot/settings.h"
21 #if ! DISABLE_GC_DEBUG
22 /* Set when walking the system stack. Defined in src/gc/system.c */
23 extern int CONSERVATIVE_POINTER_CHASING;
24 #endif
26 #ifdef __ia64__
28 # include <ucontext.h>
29 extern void *flush_reg_store(void);
30 # define BACKING_STORE_BASE 0x80000fff80000000
32 # ifdef __hpux
33 # include <sys/pstat.h>
34 # include <ia64/sys/inline.h>
35 # endif /* __hpux */
37 #endif /* __ia64__ */
39 /* the percent of used Arena items at which to trace next time through */
40 #define GC_DEBUG_REPLENISH_LEVEL_FACTOR 0.0
41 #define GC_DEBUG_UNITS_PER_ALLOC_GROWTH_FACTOR 1
42 #define REPLENISH_LEVEL_FACTOR 0.5
44 /* this factor is totally arbitrary, but gives good timings for stress.pasm */
45 #define UNITS_PER_ALLOC_GROWTH_FACTOR 1.75
47 #define POOL_MAX_BYTES 65536 * 128
48 #define GC_SIZE_THRESHOLD 1024 * 1024
50 #define PMC_HEADERS_PER_ALLOC 4096 * 10 / sizeof (PMC)
51 #define BUFFER_HEADERS_PER_ALLOC 4096 / sizeof (Buffer)
52 #define STRING_HEADERS_PER_ALLOC 4096 * 20 / sizeof (STRING)
54 #define CONSTANT_PMC_HEADERS_PER_ALLOC 4096 / sizeof (PMC)
55 #define GET_SIZED_POOL_IDX(x) ((x) / sizeof (void *))
56 #define GC_NUM_INITIAL_FIXED_SIZE_POOLS 128
59 /* these values are used for the attribute allocator */
60 #define GC_ATTRIB_POOLS_HEADROOM 8
61 #define GC_FIXED_SIZE_POOL_SIZE 4096
63 /* Set to 1 if we want to use the fixed-size allocator. Set to 0 if we want
64 to allocate these things using mem_sys_allocate instead */
65 #define GC_USE_FIXED_SIZE_ALLOCATOR 1
67 /* We're using this here to add an additional pointer to a PObj without
68 having to actually add an entire pointer to every PObj-alike structure
69 in Parrot. Astute observers may notice that if the PObj is comprised of
70 only an INTVAL, then there are some systems where sizeof(PObj*) can be
71 larger then sizeof(PObj), thus creating overflow. However PObjs are never
72 used by themselves, things like PMCs and STRINGs are cast to PObj in the
73 GC, so we should have plenty of space. */
75 typedef struct GC_MS_PObj_Wrapper {
76 size_t flags;
77 struct GC_MS_PObj_Wrapper * next_ptr;
78 } GC_MS_PObj_Wrapper;
81 typedef enum _gc_sys_type_enum {
82 MS, /*mark and sweep*/
83 INF /*infinite memory core*/
84 } gc_sys_type_enum;
86 /* how often to skip a full GC when this pool has nothing free */
87 typedef enum _gc_skip_type_enum {
88 GC_NO_SKIP = 0,
89 GC_ONE_SKIP, /* unused */
90 GC_ALWAYS_SKIP,
91 GC_NEVER_SKIP /* unused */
92 } gc_skip_type_enum;
94 typedef struct GC_Subsystem {
95 /* Which GC subsystem are we using? See PARROT_GC_DEFAULT_TYPE in
96 * include/parrot/settings.h for possible values */
97 gc_sys_type_enum sys_type;
99 /** Function hooks that each subsystem MUST provide */
100 void (*finalize_gc_system) (PARROT_INTERP);
101 void (*destroy_child_interp)(Interp *dest_interp, Interp *child_interp);
103 void (*do_gc_mark)(PARROT_INTERP, UINTVAL flags);
104 void (*compact_string_pool)(PARROT_INTERP);
106 void (*mark_special)(PARROT_INTERP, PMC *);
107 void (*pmc_needs_early_collection)(PARROT_INTERP, PMC *);
109 void (*init_pool)(PARROT_INTERP, struct Fixed_Size_Pool *);
111 PMC* (*allocate_pmc_header)(PARROT_INTERP, UINTVAL flags);
112 void (*free_pmc_header)(PARROT_INTERP, PMC *);
114 STRING* (*allocate_string_header)(PARROT_INTERP, UINTVAL flags);
115 void (*free_string_header)(PARROT_INTERP, STRING*);
117 Buffer* (*allocate_bufferlike_header)(PARROT_INTERP, size_t size);
118 void (*free_bufferlike_header)(PARROT_INTERP, Buffer*, size_t size);
120 void* (*allocate_pmc_attributes)(PARROT_INTERP, PMC *);
121 void (*free_pmc_attributes)(PARROT_INTERP, PMC *);
123 void (*allocate_string_storage)(PARROT_INTERP, STRING *str, size_t size);
124 void (*reallocate_string_storage)(PARROT_INTERP, STRING *str, size_t size);
126 void (*allocate_buffer_storage)(PARROT_INTERP, ARGMOD(Buffer *buffer), size_t nsize);
127 void (*reallocate_buffer_storage)(PARROT_INTERP, ARGMOD(Buffer *buffer), size_t newsize);
129 void* (*allocate_fixed_size_storage)(PARROT_INTERP, size_t size);
130 void (*free_fixed_size_storage)(PARROT_INTERP, size_t size, void *);
132 void* (*allocate_memory_chunk)(PARROT_INTERP, size_t size);
133 void* (*reallocate_memory_chunk)(PARROT_INTERP, void *data, size_t newsize);
134 void* (*allocate_memory_chunk_with_interior_pointers)(PARROT_INTERP, size_t size);
135 void* (*reallocate_memory_chunk_with_interior_pointers)(PARROT_INTERP, void *data,
136 size_t oldsize, size_t newsize);
137 void (*free_memory_chunk)(PARROT_INTERP, void *data);
139 void (*block_mark)(PARROT_INTERP);
140 void (*unblock_mark)(PARROT_INTERP);
141 unsigned int (*is_blocked_mark)(PARROT_INTERP);
143 void (*block_sweep)(PARROT_INTERP);
144 void (*unblock_sweep)(PARROT_INTERP);
145 unsigned int (*is_blocked_sweep)(PARROT_INTERP);
147 /* Introspection. Each GC must provide this function. Even with fake data */
148 /* Return by value to simplify memory management */
149 size_t (*get_gc_info)(PARROT_INTERP, Interpinfo_enum);
151 /*Function hooks that GC systems can CHOOSE to provide if they need them
152 *These will be called via the GC API functions Parrot_gc_func_name
153 *e.g. read barrier && write barrier hooks can go here later ...*/
155 /* Holds system-specific data structures
156 * unused right now, but this is where it should go if we need them ...
157 union {
158 } gc_private;
160 } GC_Subsystem;
162 /* This header structure describes a block of memory that is part of a
163 variable-size pool. The allocatable memory follows the header. */
165 typedef struct Memory_Block {
166 size_t free; /* Remaining free space. */
167 size_t size; /* Size of memory. */
168 struct Memory_Block *prev; /* Pointer to previous block. */
169 struct Memory_Block *next; /* Pointer to next block. */
170 char *start; /* Pointer to start of memory. */
171 char *top; /* Pointer to free space in memory. */
172 size_t freed; /* Amount of freed memory.
173 Used in compact_pool */
174 } Memory_Block;
176 /* This structure describes a variable-size memory pool. Various such pools
177 hang off the Memory_Pools root structure. */
179 typedef struct Variable_Size_Pool {
180 Memory_Block *top_block; /* Pointer to most recent memory block. */
181 /* Pool compactor, or NULL. */
182 void (*compact)(PARROT_INTERP, struct Memory_Pools *,
183 struct Variable_Size_Pool *);
184 size_t minimum_block_size; /* Minimum allocation size, to
185 prevent fragmentation. */
186 size_t total_allocated; /* Total bytes allocated to this pool. */
187 size_t guaranteed_reclaimable; /* Bytes that can definitely be reclaimed. */
188 size_t possibly_reclaimable; /* Bytes that can possibly be reclaimed
189 (above plus COW-freed bytes). */
190 FLOATVAL reclaim_factor; /* Minimum percentage we will reclaim. */
191 } Variable_Size_Pool;
193 /* This header structure describes an arena: a block of memory that is part of a
194 fixed-sized pool. The arena has enough memory for 'total_objects' objects
195 of a particular size specified in the pool. */
197 typedef struct Fixed_Size_Arena {
198 size_t used; /* Number of objects slots used. */
199 size_t total_objects; /* Total number of object slots. */
200 struct Fixed_Size_Arena *prev; /* Pointer to previous arena. */
201 struct Fixed_Size_Arena *next; /* Pointer to next arena. */
202 void *start_objects; /* Pointer to arena memory. */
203 } Fixed_Size_Arena;
205 /* This simple header structure describes a free PMC attribute object.
206 A list of them hang off the PMC attribute pool. */
208 typedef struct PMC_Attribute_Free_List {
209 struct PMC_Attribute_Free_List * next; /* Pointer to next free object. */
210 } PMC_Attribute_Free_List;
212 /* This header structure describes a PMC attribute arena: A block of memory
213 that is part of a PMC attribute pool. The allocatable memory follows
214 this header. */
216 typedef struct PMC_Attribute_Arena {
217 struct PMC_Attribute_Arena * next; /* Pointer to next arena. */
218 struct PMC_Attribute_Arena * prev; /* Pointer to previous arena. */
219 } PMC_Attribute_Arena;
221 /* This structure describes a PMC attribute pool. A vector of them hang
222 off the Memory_Pools root structure. */
224 typedef struct PMC_Attribute_Pool {
225 size_t attr_size; /* Size of attribute object. */
226 size_t total_objects; /* Total objects in the pool. */
227 size_t objects_per_alloc; /* Number of object slots to allocate. */
228 size_t num_free_objects; /* Number of objects on the free list. */
229 PMC_Attribute_Free_List * free_list; /* List of free object slots, or NULL. */
230 PMC_Attribute_Arena * top_arena; /* Pointer to most recent arena. */
231 PMC_Attribute_Free_List * newfree; /* Pointer to next object slot in
232 latest arena, or NULL (slots weren't
233 put on free list). */
234 PMC_Attribute_Free_List * newlast; /* High water mark in arena. */
236 } PMC_Attribute_Pool;
238 /* This structure describes a fixed-size memory pool. Various such pools
239 hang off the Memory_Pools root structure. */
241 typedef struct Fixed_Size_Pool {
243 struct Variable_Size_Pool *mem_pool; /* Pointer to associated variable-size
244 pool, or NULL. */
245 size_t object_size; /* Size in bytes of an individual pool
246 object. This size may include
247 a GC system-specific GC header. */
249 size_t start_arena_memory; /* Address of the lowest arena. */
250 size_t end_arena_memory; /* And the highest one. */
252 Fixed_Size_Arena *last_Arena; /* Pointer to most recent arena. */
253 GC_MS_PObj_Wrapper * free_list; /* List of free object slots, or NULL. */
254 size_t num_free_objects; /* Number of objects on the free list. */
255 size_t total_objects; /* Total objects in the pool. */
257 PARROT_OBSERVER const char *name; /* Name of pool. */
259 size_t objects_per_alloc; /* Number of object slots to allocate. */
261 int skip; /* How often to skip full GC
262 (see gc_skip_type_enum). */
263 size_t replenish_level; /* Replenish pool when free object slots
264 goes below this level. */
266 add_free_object_fn_type add_free_object; /* Adds a free object to
267 the pool's free list */
268 get_free_object_fn_type get_free_object; /* Gets and removes a free object
269 from the pool's free list. */
270 alloc_objects_fn_type alloc_objects; /* Allocates an arena for objects. */
271 alloc_objects_fn_type more_objects; /* Obtain more free objects. */
272 gc_object_fn_type gc_object; /* GCs object during sweep. */
274 /* Contains GC system-specific data structures ... unused at the moment,
275 * but this is where it should go when we need it ...
276 union {
277 } gc_private;
280 void *newfree; /* Pointer to next object slot in
281 latest arena, or NULL (slots weren't
282 put on free list). */
283 void *newlast; /* High water mark in arena. */
285 } Fixed_Size_Pool;
287 /* This structure acts as the root for all the various memory pools:
288 variable-sized, fixed-size, and PMC attributes. It also contains
289 various GC-related items. It hangs off the Interp structure. */
291 typedef struct Memory_Pools {
292 /* Pointers to pools */
293 Variable_Size_Pool *memory_pool; /* General memory pool. */
294 Variable_Size_Pool *constant_string_pool; /* Constant string pool (not
295 compacted). */
296 Fixed_Size_Pool *string_header_pool; /* String header pool. */
297 Fixed_Size_Pool *pmc_pool; /* PMC object pool. */
298 Fixed_Size_Pool *constant_pmc_pool; /* And one for constant PMCs. */
299 Fixed_Size_Pool *constant_string_header_pool; /* And a constant string
300 header pool. */
302 Fixed_Size_Pool **sized_header_pools; /* Vector of pools for other
303 fixed-size headers. */
304 size_t num_sized; /* Length of that vector. */
306 PMC_Attribute_Pool **attrib_pools; /* Vector of pools for PMC
307 attributes. */
308 size_t num_attribs; /* Length of that vector. */
310 /* statistics for GC */
311 size_t gc_mark_runs; /* Number of times we've done a mark run */
312 size_t gc_lazy_mark_runs; /* Number of successful lazy mark runs */
313 size_t gc_collect_runs; /* Number of times we've done a memory
314 compaction */
315 size_t mem_allocs_since_last_collect; /* The number of memory
316 * allocations from the
317 * system since the last
318 * compaction run */
319 size_t header_allocs_since_last_collect; /* The size of header
320 * blocks allocated from
321 * the system since the last
322 * GC run */
323 size_t memory_allocated; /* The total amount of memory allocated
324 * in fixed and variable size pools.
325 * Doesn't count memory for internal
326 * structures */
327 size_t memory_used; /* The total amount of memory used
328 * in fixed and variable size
329 * pools. Also includes memory in
330 * variable size pools that has been
331 * freed but can only be reclaimed
332 * by a GC run */
333 size_t mem_used_last_collect; /* The total amount of
334 * memory used after
335 * the last GC run */
336 UINTVAL memory_collected; /* Total amount of memory copied
337 during collection */
338 UINTVAL num_early_gc_PMCs; /* how many PMCs want immediate destruction */
339 UINTVAL num_early_PMCs_seen; /* how many such PMCs has GC seen */
340 PMC *gc_mark_start; /* first PMC marked during a GC run */
341 PMC *gc_mark_ptr; /* last PMC marked during a GC run */
342 PMC *gc_trace_ptr; /* last PMC trace_children was called on */
343 int lazy_gc; /* flag that indicates whether we should stop
344 when we've seen all impatient PMCs */
346 /* GC blocking */
347 UINTVAL gc_mark_block_level; /* How many outstanding GC block
348 requests are there? */
349 UINTVAL gc_sweep_block_level; /* How many outstanding GC block
350 requests are there? */
352 /* private data for the GC subsystem */
353 void *gc_private; /* GC subsystem data */
354 } Memory_Pools;
356 /* HEADERIZER BEGIN: src/gc/system.c */
357 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
359 void trace_system_areas(PARROT_INTERP, ARGIN(const Memory_Pools *mem_pools))
360 __attribute__nonnull__(1)
361 __attribute__nonnull__(2);
363 #define ASSERT_ARGS_trace_system_areas __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
364 PARROT_ASSERT_ARG(interp) \
365 , PARROT_ASSERT_ARG(mem_pools))
366 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
367 /* HEADERIZER END: src/gc/system.c */
369 /* HEADERIZER BEGIN: src/gc/mark_sweep.c */
370 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
372 PARROT_WARN_UNUSED_RESULT
373 INTVAL contained_in_pool(
374 ARGIN(const Fixed_Size_Pool *pool),
375 ARGIN(const void *ptr))
376 __attribute__nonnull__(1)
377 __attribute__nonnull__(2);
379 PARROT_WARN_UNUSED_RESULT
380 PARROT_CANNOT_RETURN_NULL
381 Fixed_Size_Pool * get_bufferlike_pool(PARROT_INTERP,
382 ARGMOD(Memory_Pools *mem_pools),
383 size_t buffer_size)
384 __attribute__nonnull__(1)
385 __attribute__nonnull__(2)
386 FUNC_MODIFIES(*mem_pools);
388 PARROT_IGNORABLE_RESULT
389 int /*@alt void@*/
390 header_pools_iterate_callback(PARROT_INTERP,
391 ARGMOD(Memory_Pools *mem_pools),
392 int flag,
393 ARGIN_NULLOK(void *arg),
394 NOTNULL(const pool_iter_fn func))
395 __attribute__nonnull__(1)
396 __attribute__nonnull__(2)
397 __attribute__nonnull__(5)
398 FUNC_MODIFIES(*mem_pools);
400 void initialize_fixed_size_pools(PARROT_INTERP,
401 ARGMOD(Memory_Pools *mem_pools))
402 __attribute__nonnull__(1)
403 __attribute__nonnull__(2)
404 FUNC_MODIFIES(*mem_pools);
406 void mark_special(PARROT_INTERP,
407 ARGMOD(Memory_Pools *mem_pools),
408 ARGIN(PMC *obj))
409 __attribute__nonnull__(1)
410 __attribute__nonnull__(2)
411 __attribute__nonnull__(3)
412 FUNC_MODIFIES(*mem_pools);
414 void Parrot_add_to_free_list(SHIM_INTERP,
415 ARGMOD(Fixed_Size_Pool *pool),
416 ARGMOD(Fixed_Size_Arena *arena))
417 __attribute__nonnull__(2)
418 __attribute__nonnull__(3)
419 FUNC_MODIFIES(*pool)
420 FUNC_MODIFIES(*arena);
422 void Parrot_append_arena_in_pool(SHIM_INTERP,
423 ARGMOD(Memory_Pools *mem_pools),
424 ARGMOD(Fixed_Size_Pool *pool),
425 ARGMOD(Fixed_Size_Arena *new_arena),
426 size_t size)
427 __attribute__nonnull__(2)
428 __attribute__nonnull__(3)
429 __attribute__nonnull__(4)
430 FUNC_MODIFIES(*mem_pools)
431 FUNC_MODIFIES(*pool)
432 FUNC_MODIFIES(*new_arena);
434 void Parrot_gc_clear_live_bits(SHIM_INTERP,
435 ARGIN(const Fixed_Size_Pool *pool))
436 __attribute__nonnull__(2);
438 void Parrot_gc_run_init(SHIM_INTERP, ARGMOD(Memory_Pools *mem_pools))
439 __attribute__nonnull__(2)
440 FUNC_MODIFIES(*mem_pools);
442 void Parrot_gc_sweep_pool(PARROT_INTERP,
443 ARGMOD(Memory_Pools *mem_pools),
444 ARGMOD(Fixed_Size_Pool *pool))
445 __attribute__nonnull__(1)
446 __attribute__nonnull__(2)
447 __attribute__nonnull__(3)
448 FUNC_MODIFIES(*mem_pools)
449 FUNC_MODIFIES(*pool);
451 int Parrot_gc_trace_root(PARROT_INTERP,
452 ARGMOD(Memory_Pools *mem_pools),
453 Parrot_gc_trace_type trace)
454 __attribute__nonnull__(1)
455 __attribute__nonnull__(2)
456 FUNC_MODIFIES(*mem_pools);
458 #define ASSERT_ARGS_contained_in_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
459 PARROT_ASSERT_ARG(pool) \
460 , PARROT_ASSERT_ARG(ptr))
461 #define ASSERT_ARGS_get_bufferlike_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
462 PARROT_ASSERT_ARG(interp) \
463 , PARROT_ASSERT_ARG(mem_pools))
464 #define ASSERT_ARGS_header_pools_iterate_callback __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
465 PARROT_ASSERT_ARG(interp) \
466 , PARROT_ASSERT_ARG(mem_pools) \
467 , PARROT_ASSERT_ARG(func))
468 #define ASSERT_ARGS_initialize_fixed_size_pools __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
469 PARROT_ASSERT_ARG(interp) \
470 , PARROT_ASSERT_ARG(mem_pools))
471 #define ASSERT_ARGS_mark_special __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
472 PARROT_ASSERT_ARG(interp) \
473 , PARROT_ASSERT_ARG(mem_pools) \
474 , PARROT_ASSERT_ARG(obj))
475 #define ASSERT_ARGS_Parrot_add_to_free_list __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
476 PARROT_ASSERT_ARG(pool) \
477 , PARROT_ASSERT_ARG(arena))
478 #define ASSERT_ARGS_Parrot_append_arena_in_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
479 PARROT_ASSERT_ARG(mem_pools) \
480 , PARROT_ASSERT_ARG(pool) \
481 , PARROT_ASSERT_ARG(new_arena))
482 #define ASSERT_ARGS_Parrot_gc_clear_live_bits __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
483 PARROT_ASSERT_ARG(pool))
484 #define ASSERT_ARGS_Parrot_gc_run_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
485 PARROT_ASSERT_ARG(mem_pools))
486 #define ASSERT_ARGS_Parrot_gc_sweep_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
487 PARROT_ASSERT_ARG(interp) \
488 , PARROT_ASSERT_ARG(mem_pools) \
489 , PARROT_ASSERT_ARG(pool))
490 #define ASSERT_ARGS_Parrot_gc_trace_root __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
491 PARROT_ASSERT_ARG(interp) \
492 , PARROT_ASSERT_ARG(mem_pools))
493 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
494 /* HEADERIZER END: src/gc/mark_sweep.c */
497 /* HEADERIZER BEGIN: src/gc/alloc_resources.c */
498 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
500 PARROT_CANNOT_RETURN_NULL
501 PARROT_WARN_UNUSED_RESULT
502 char * aligned_mem(SHIM(const Buffer *buffer), ARGIN(char *mem))
503 __attribute__nonnull__(2);
505 void check_buffer_ptr(
506 ARGMOD(Buffer * pobj),
507 ARGMOD(Variable_Size_Pool * pool))
508 __attribute__nonnull__(1)
509 __attribute__nonnull__(2)
510 FUNC_MODIFIES(* pobj)
511 FUNC_MODIFIES(* pool);
513 void compact_pool(PARROT_INTERP,
514 ARGMOD(Memory_Pools *mem_pools),
515 ARGMOD(Variable_Size_Pool *pool))
516 __attribute__nonnull__(1)
517 __attribute__nonnull__(2)
518 __attribute__nonnull__(3)
519 FUNC_MODIFIES(*mem_pools)
520 FUNC_MODIFIES(*pool);
522 void initialize_var_size_pools(SHIM_INTERP, ARGMOD(Memory_Pools *mem_pools))
523 __attribute__nonnull__(2)
524 FUNC_MODIFIES(*mem_pools);
526 PARROT_MALLOC
527 PARROT_CANNOT_RETURN_NULL
528 void * mem_allocate(PARROT_INTERP,
529 ARGMOD(Memory_Pools *mem_pools),
530 size_t size,
531 ARGMOD(Variable_Size_Pool *pool))
532 __attribute__nonnull__(1)
533 __attribute__nonnull__(2)
534 __attribute__nonnull__(4)
535 FUNC_MODIFIES(*mem_pools)
536 FUNC_MODIFIES(*pool);
538 void merge_pools(
539 ARGMOD(Variable_Size_Pool *dest),
540 ARGMOD(Variable_Size_Pool *source))
541 __attribute__nonnull__(1)
542 __attribute__nonnull__(2)
543 FUNC_MODIFIES(*dest)
544 FUNC_MODIFIES(*source);
546 void Parrot_gc_destroy_header_pools(PARROT_INTERP,
547 ARGMOD(Memory_Pools *mem_pools))
548 __attribute__nonnull__(1)
549 __attribute__nonnull__(2)
550 FUNC_MODIFIES(*mem_pools);
552 void Parrot_gc_destroy_memory_pools(SHIM_INTERP,
553 ARGMOD(Memory_Pools *mem_pools))
554 __attribute__nonnull__(2)
555 FUNC_MODIFIES(*mem_pools);
557 void Parrot_gc_merge_memory_pools(
558 ARGMOD(Interp *dest_interp),
559 ARGMOD(Memory_Pools *dest_arena),
560 ARGIN(const Memory_Pools *source_arena))
561 __attribute__nonnull__(1)
562 __attribute__nonnull__(2)
563 __attribute__nonnull__(3)
564 FUNC_MODIFIES(*dest_interp)
565 FUNC_MODIFIES(*dest_arena);
567 #define ASSERT_ARGS_aligned_mem __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
568 PARROT_ASSERT_ARG(mem))
569 #define ASSERT_ARGS_check_buffer_ptr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
570 PARROT_ASSERT_ARG(pobj) \
571 , PARROT_ASSERT_ARG(pool))
572 #define ASSERT_ARGS_compact_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
573 PARROT_ASSERT_ARG(interp) \
574 , PARROT_ASSERT_ARG(mem_pools) \
575 , PARROT_ASSERT_ARG(pool))
576 #define ASSERT_ARGS_initialize_var_size_pools __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
577 PARROT_ASSERT_ARG(mem_pools))
578 #define ASSERT_ARGS_mem_allocate __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
579 PARROT_ASSERT_ARG(interp) \
580 , PARROT_ASSERT_ARG(mem_pools) \
581 , PARROT_ASSERT_ARG(pool))
582 #define ASSERT_ARGS_merge_pools __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
583 PARROT_ASSERT_ARG(dest) \
584 , PARROT_ASSERT_ARG(source))
585 #define ASSERT_ARGS_Parrot_gc_destroy_header_pools \
586 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
587 PARROT_ASSERT_ARG(interp) \
588 , PARROT_ASSERT_ARG(mem_pools))
589 #define ASSERT_ARGS_Parrot_gc_destroy_memory_pools \
590 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
591 PARROT_ASSERT_ARG(mem_pools))
592 #define ASSERT_ARGS_Parrot_gc_merge_memory_pools __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
593 PARROT_ASSERT_ARG(dest_interp) \
594 , PARROT_ASSERT_ARG(dest_arena) \
595 , PARROT_ASSERT_ARG(source_arena))
596 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
597 /* HEADERIZER END: src/gc/alloc_resources.c */
599 /* GC subsystem init functions */
600 /* HEADERIZER BEGIN: src/gc/gc_ms.c */
601 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
603 PARROT_CANNOT_RETURN_NULL
604 void * gc_ms_allocate_fixed_size_storage(PARROT_INTERP, size_t size)
605 __attribute__nonnull__(1);
607 void gc_ms_allocate_string_storage(PARROT_INTERP,
608 ARGOUT(STRING *str),
609 size_t size)
610 __attribute__nonnull__(1)
611 __attribute__nonnull__(2)
612 FUNC_MODIFIES(*str);
614 void gc_ms_compact_memory_pool(PARROT_INTERP)
615 __attribute__nonnull__(1);
617 void gc_ms_free_fixed_size_storage(PARROT_INTERP,
618 size_t size,
619 ARGMOD(void *data))
620 __attribute__nonnull__(1)
621 __attribute__nonnull__(3)
622 FUNC_MODIFIES(*data);
624 void gc_ms_free_pmc_attributes(PARROT_INTERP, ARGMOD(PMC *pmc))
625 __attribute__nonnull__(1)
626 __attribute__nonnull__(2)
627 FUNC_MODIFIES(*pmc);
629 void gc_ms_pmc_needs_early_collection(PARROT_INTERP, ARGMOD(PMC *pmc))
630 __attribute__nonnull__(1)
631 __attribute__nonnull__(2)
632 FUNC_MODIFIES(*pmc);
634 void Parrot_gc_ms_init(PARROT_INTERP)
635 __attribute__nonnull__(1);
637 #define ASSERT_ARGS_gc_ms_allocate_fixed_size_storage \
638 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
639 PARROT_ASSERT_ARG(interp))
640 #define ASSERT_ARGS_gc_ms_allocate_string_storage __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
641 PARROT_ASSERT_ARG(interp) \
642 , PARROT_ASSERT_ARG(str))
643 #define ASSERT_ARGS_gc_ms_compact_memory_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
644 PARROT_ASSERT_ARG(interp))
645 #define ASSERT_ARGS_gc_ms_free_fixed_size_storage __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
646 PARROT_ASSERT_ARG(interp) \
647 , PARROT_ASSERT_ARG(data))
648 #define ASSERT_ARGS_gc_ms_free_pmc_attributes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
649 PARROT_ASSERT_ARG(interp) \
650 , PARROT_ASSERT_ARG(pmc))
651 #define ASSERT_ARGS_gc_ms_pmc_needs_early_collection \
652 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
653 PARROT_ASSERT_ARG(interp) \
654 , PARROT_ASSERT_ARG(pmc))
655 #define ASSERT_ARGS_Parrot_gc_ms_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
656 PARROT_ASSERT_ARG(interp))
657 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
658 /* HEADERIZER END: src/gc/gc_ms.c */
660 /* HEADERIZER BEGIN: src/gc/gc_inf.c */
661 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
663 void Parrot_gc_inf_init(PARROT_INTERP)
664 __attribute__nonnull__(1);
666 #define ASSERT_ARGS_Parrot_gc_inf_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
667 PARROT_ASSERT_ARG(interp))
668 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
669 /* HEADERIZER END: src/gc/gc_inf.c */
671 #endif /* PARROT_GC_PRIVATE_H_GUARD */
674 * Local variables:
675 * c-file-style: "parrot"
676 * End:
677 * vim: expandtab shiftwidth=4: