1 /* gc_api.h 2 * Copyright (C) 2001-2010, Parrot Foundation. 3 * Overview: 4 * Handles dead object destruction of the various headers 5 * History: 6 * Initial version by Mike Lambert on 2002.05.27 7 */ 8 9 #ifndef PARROT_GC_API_H_GUARD 10 #define PARROT_GC_API_H_GUARD 11 12 #include "parrot/parrot.h" 13 14 /* 15 * we need an alignment that is the same as malloc(3) have for 16 * allocating Buffer items like FLOATVAL (double) 17 * This should be either a config hint or tested 18 */ 19 #ifdef MALLOC_ALIGNMENT 20 # define BUFFER_ALIGNMENT MALLOC_ALIGNMENT 21 #else 22 /* or (2 * sizeof (size_t)) */ 23 # define BUFFER_ALIGNMENT 8 24 #endif 25 26 #define BUFFER_ALIGN_1 (BUFFER_ALIGNMENT - 1) 27 #define BUFFER_ALIGN_MASK ~BUFFER_ALIGN_1 28 29 #define WORD_ALIGN_1 (sizeof (void *) - 1) 30 #define WORD_ALIGN_MASK ~WORD_ALIGN_1 31 32 #define ALIGNED_STRING_SIZE(len) (((len) + sizeof (void*) + WORD_ALIGN_1) & WORD_ALIGN_MASK) 33 34 #define PARROT_GC_WRITE_BARRIER(i, p) \ 35 do { if (PObj_GC_need_write_barrier_TEST((p))) Parrot_gc_write_barrier((i), (p)); } while (0) 36 37 typedef struct _Parrot_GC_Init_Args { 38 void *stacktop; 39 const char *system; 40 Parrot_Float4 nursery_size; 41 Parrot_Int dynamic_threshold; 42 Parrot_Int min_threshold; 43 Parrot_UInt numthreads; 44 Parrot_UInt debug_flags; 45 } Parrot_GC_Init_Args; 46 47 typedef enum _gc_sys_type_enum { 48 MS, /* mark and sweep */ 49 INF, /* infinite memory core */ 50 MS2, /* non-recursive mark and sweep */ 51 GMS /* generational mark & sweep */ 52 } gc_sys_type_enum; 53 54 /* pool iteration */ 55 typedef enum { 56 POOL_PMC = 0x01, 57 POOL_BUFFER = 0x02, 58 POOL_CONST = 0x04, 59 POOL_ALL = 0x07 60 } pool_iter_enum; 61 62 struct Memory_Block; 63 struct Var_Size_Pool; 64 struct Fixed_Size_Pool; 65 struct Fixed_Size_Arena; 66 struct Memory_Pools; 67 68 typedef enum { 69 GC_TRACE_FULL = 1, 70 GC_TRACE_ROOT_ONLY = 2, 71 GC_TRACE_SYSTEM_ONLY = 3 72 } Parrot_gc_trace_type; 73 74 typedef int (*pool_iter_fn)(PARROT_INTERP, struct Memory_Pools *, 75 struct Fixed_Size_Pool *, int, void*); 76 typedef void (*add_free_object_fn_type)(PARROT_INTERP, struct Memory_Pools *, 77 struct Fixed_Size_Pool *, void *); 78 typedef void * (*get_free_object_fn_type)(PARROT_INTERP, struct Memory_Pools *, 79 struct Fixed_Size_Pool *); 80 typedef void (*alloc_objects_fn_type)(PARROT_INTERP, struct Memory_Pools *, 81 struct Fixed_Size_Pool *); 82 typedef void (*gc_object_fn_type)(PARROT_INTERP, ARGMOD(struct Memory_Pools *), 83 ARGIN(struct Fixed_Size_Pool *), ARGMOD(PObj *)); 84 85 /* &gen_from_enum(interpinfo.pasm) prefix(INTERPINFO_) */ 86 87 typedef enum { 88 TOTAL_MEM_ALLOC = 1, 89 TOTAL_MEM_USED, 90 GC_MARK_RUNS, 91 GC_COLLECT_RUNS, 92 ACTIVE_PMCS, 93 ACTIVE_BUFFERS, 94 TOTAL_PMCS, 95 TOTAL_BUFFERS, 96 HEADER_ALLOCS_SINCE_COLLECT, 97 MEM_ALLOCS_SINCE_COLLECT, 98 TOTAL_COPIED, 99 IMPATIENT_PMCS, 100 GC_LAZY_MARK_RUNS, 101 EXTENDED_PMCS, 102 CURRENT_RUNCORE, 103 PARROT_INTSIZE, 104 PARROT_FLOATSIZE, 105 PARROT_POINTERSIZE, 106 PARROT_INTMAX, 107 PARROT_INTMIN, 108 109 /* interpinfo_p constants */ 110 CURRENT_CTX, 111 CURRENT_SUB, 112 CURRENT_CONT, 113 CURRENT_LEXPAD, 114 CURRENT_TASK, 115 116 /* interpinfo_s constants */ 117 EXECUTABLE_FULLNAME, 118 EXECUTABLE_BASENAME, 119 RUNTIME_PREFIX, 120 GC_SYS_NAME, 121 PARROT_OS, 122 PARROT_OS_VERSION, 123 PARROT_OS_VERSION_NUMBER, 124 CPU_ARCH, 125 CPU_TYPE, 126 127 /* additional gc constants */ 128 MAX_GENERATIONS 129 } Interpinfo_enum; 130 131 /* &end_gen */ 132 133 #define GC_trace_stack_FLAG (UINTVAL)(1 << 1) /* trace system areas and stack */ 134 #define GC_trace_normal_FLAG (UINTVAL)(1 << 1) /* the same */ 135 #define GC_lazy_FLAG (UINTVAL)(1 << 2) /* timely destruction run */ 136 #define GC_finish_FLAG (UINTVAL)(1 << 3) /* on Parrot exit: mark (almost) 137 all PMCs dead and */ 138 #define GC_strings_cb_FLAG (UINTVAL)(1 << 4) /* Invoked from String GC during 139 mem_alloc to sweep dead strings */ 140 /* garbage collect. */ 141 142 /* HEADERIZER BEGIN: src/gc/api.c */ 143 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ 144 145 PARROT_EXPORT 146 void Parrot_block_GC_mark(PARROT_INTERP) 147 __attribute__nonnull__(1); 148 149 PARROT_EXPORT 150 void Parrot_block_GC_mark_locked(PARROT_INTERP) 151 __attribute__nonnull__(1); 152 153 PARROT_EXPORT 154 void Parrot_block_GC_move(PARROT_INTERP) 155 __attribute__nonnull__(1); 156 157 PARROT_EXPORT 158 void Parrot_block_GC_sweep(PARROT_INTERP) 159 __attribute__nonnull__(1); 160 161 PARROT_EXPORT 162 int Parrot_gc_active_pmcs(PARROT_INTERP) 163 __attribute__nonnull__(1); 164 165 PARROT_EXPORT 166 int Parrot_gc_active_sized_buffers(PARROT_INTERP) 167 __attribute__nonnull__(1); 168 169 PARROT_EXPORT 170 void Parrot_gc_allocate_buffer_storage_aligned(PARROT_INTERP, 171 ARGOUT(Parrot_Buffer *buffer), 172 size_t size) 173 __attribute__nonnull__(1) 174 __attribute__nonnull__(2) 175 FUNC_MODIFIES(*buffer); 176 177 PARROT_EXPORT 178 PARROT_CANNOT_RETURN_NULL 179 void * Parrot_gc_allocate_fixed_size_storage(PARROT_INTERP, size_t size) 180 __attribute__nonnull__(1); 181 182 PARROT_EXPORT 183 PARROT_CANNOT_RETURN_NULL 184 void * Parrot_gc_allocate_memory_chunk(PARROT_INTERP, size_t size) 185 __attribute__nonnull__(1); 186 187 PARROT_EXPORT 188 PARROT_CANNOT_RETURN_NULL 189 void * Parrot_gc_allocate_memory_chunk_with_interior_pointers(PARROT_INTERP, 190 size_t size) 191 __attribute__nonnull__(1); 192 193 PARROT_EXPORT 194 PARROT_CANNOT_RETURN_NULL 195 void * Parrot_gc_allocate_pmc_attributes(PARROT_INTERP, ARGMOD(PMC *pmc)) 196 __attribute__nonnull__(1) 197 __attribute__nonnull__(2) 198 FUNC_MODIFIES(*pmc); 199 200 PARROT_EXPORT 201 void Parrot_gc_allocate_string_storage(PARROT_INTERP, 202 ARGOUT(STRING *str), 203 size_t size) 204 __attribute__nonnull__(1) 205 __attribute__nonnull__(2) 206 FUNC_MODIFIES(*str); 207 208 PARROT_EXPORT 209 void Parrot_gc_compact_memory_pool(PARROT_INTERP) 210 __attribute__nonnull__(1); 211 212 PARROT_EXPORT 213 void Parrot_gc_completely_unblock(PARROT_INTERP) 214 __attribute__nonnull__(1); 215 216 PARROT_EXPORT 217 size_t Parrot_gc_count_collect_runs(PARROT_INTERP) 218 __attribute__nonnull__(1); 219 220 PARROT_EXPORT 221 size_t Parrot_gc_count_lazy_mark_runs(PARROT_INTERP) 222 __attribute__nonnull__(1); 223 224 PARROT_EXPORT 225 size_t Parrot_gc_count_mark_runs(PARROT_INTERP) 226 __attribute__nonnull__(1); 227 228 PARROT_EXPORT 229 void Parrot_gc_destroy_child_interp( 230 ARGMOD(Interp *dest_interp), 231 ARGIN(Interp *source_interp)) 232 __attribute__nonnull__(1) 233 __attribute__nonnull__(2) 234 FUNC_MODIFIES(*dest_interp); 235 236 PARROT_EXPORT 237 void Parrot_gc_finalize(PARROT_INTERP) 238 __attribute__nonnull__(1); 239 240 PARROT_EXPORT 241 void Parrot_gc_free_bufferlike_header(PARROT_INTERP, 242 ARGMOD(Parrot_Buffer *obj), 243 size_t size) 244 __attribute__nonnull__(1) 245 __attribute__nonnull__(2) 246 FUNC_MODIFIES(*obj); 247 248 PARROT_EXPORT 249 void Parrot_gc_free_fixed_size_storage(PARROT_INTERP, 250 size_t size, 251 ARGMOD(void *data)) 252 __attribute__nonnull__(1) 253 __attribute__nonnull__(3) 254 FUNC_MODIFIES(*data); 255 256 PARROT_EXPORT 257 void Parrot_gc_free_memory_chunk(PARROT_INTERP, ARGIN_NULLOK(void *data)) 258 __attribute__nonnull__(1); 259 260 PARROT_EXPORT 261 void Parrot_gc_free_pmc_attributes(PARROT_INTERP, ARGFREE(PMC *pmc)) 262 __attribute__nonnull__(1); 263 264 PARROT_EXPORT 265 void Parrot_gc_free_pmc_header(PARROT_INTERP, ARGMOD(PMC *pmc)) 266 __attribute__nonnull__(1) 267 __attribute__nonnull__(2) 268 FUNC_MODIFIES(*pmc); 269 270 PARROT_EXPORT 271 void Parrot_gc_free_string_header(PARROT_INTERP, ARGMOD(STRING *s)) 272 __attribute__nonnull__(1) 273 __attribute__nonnull__(2) 274 FUNC_MODIFIES(*s); 275 276 PARROT_EXPORT 277 size_t Parrot_gc_headers_alloc_since_last_collect(PARROT_INTERP) 278 __attribute__nonnull__(1); 279 280 PARROT_EXPORT 281 UINTVAL Parrot_gc_impatient_pmcs(PARROT_INTERP) 282 __attribute__nonnull__(1); 283 284 PARROT_EXPORT 285 void Parrot_gc_initialize(PARROT_INTERP, ARGIN(Parrot_GC_Init_Args *args)) 286 __attribute__nonnull__(1) 287 __attribute__nonnull__(2); 288 289 PARROT_EXPORT 290 void Parrot_gc_mark_and_sweep(PARROT_INTERP, UINTVAL flags) 291 __attribute__nonnull__(1); 292 293 PARROT_EXPORT 294 void Parrot_gc_mark_PMC_alive_fun(PARROT_INTERP, ARGMOD_NULLOK(PMC *obj)) 295 __attribute__nonnull__(1) 296 FUNC_MODIFIES(*obj); 297 298 PARROT_EXPORT 299 void Parrot_gc_mark_PObj_alive(PARROT_INTERP, ARGMOD(PObj *obj)) 300 __attribute__nonnull__(1) 301 __attribute__nonnull__(2) 302 FUNC_MODIFIES(*obj); 303 304 PARROT_EXPORT 305 void Parrot_gc_mark_STRING_alive_fun(PARROT_INTERP, 306 ARGMOD_NULLOK(STRING *obj)) 307 __attribute__nonnull__(1) 308 FUNC_MODIFIES(*obj); 309 310 PARROT_EXPORT 311 int Parrot_gc_max_generations(PARROT_INTERP) 312 __attribute__nonnull__(1); 313 314 PARROT_EXPORT 315 size_t Parrot_gc_mem_alloc_since_last_collect(PARROT_INTERP) 316 __attribute__nonnull__(1); 317 318 PARROT_EXPORT 319 PARROT_CANNOT_RETURN_NULL 320 PARROT_WARN_UNUSED_RESULT 321 Parrot_Buffer * Parrot_gc_new_bufferlike_header(PARROT_INTERP, size_t size) 322 __attribute__nonnull__(1); 323 324 PARROT_EXPORT 325 PARROT_WARN_UNUSED_RESULT 326 PARROT_CANNOT_RETURN_NULL 327 PMC * Parrot_gc_new_pmc_header(PARROT_INTERP, UINTVAL flags) 328 __attribute__nonnull__(1); 329 330 PARROT_EXPORT 331 PARROT_CANNOT_RETURN_NULL 332 PARROT_WARN_UNUSED_RESULT 333 STRING * Parrot_gc_new_string_header(PARROT_INTERP, UINTVAL flags) 334 __attribute__nonnull__(1); 335 336 PARROT_EXPORT 337 void Parrot_gc_pmc_needs_early_collection(PARROT_INTERP, ARGMOD(PMC *pmc)) 338 __attribute__nonnull__(1) 339 __attribute__nonnull__(2) 340 FUNC_MODIFIES(*pmc); 341 342 PARROT_EXPORT 343 void Parrot_gc_reallocate_buffer_storage(PARROT_INTERP, 344 ARGMOD(Parrot_Buffer *buffer), 345 size_t newsize) 346 __attribute__nonnull__(1) 347 __attribute__nonnull__(2) 348 FUNC_MODIFIES(*buffer); 349 350 PARROT_EXPORT 351 PARROT_CANNOT_RETURN_NULL 352 void * Parrot_gc_reallocate_memory_chunk(PARROT_INTERP, 353 ARGFREE(void *data), 354 size_t newsize) 355 __attribute__nonnull__(1); 356 357 PARROT_EXPORT 358 PARROT_CANNOT_RETURN_NULL 359 void * Parrot_gc_reallocate_memory_chunk_with_interior_pointers(PARROT_INTERP, 360 ARGFREE(void *data), 361 size_t newsize, 362 size_t oldsize) 363 __attribute__nonnull__(1); 364 365 PARROT_EXPORT 366 void Parrot_gc_reallocate_string_storage(PARROT_INTERP, 367 ARGMOD(STRING *str), 368 size_t newsize) 369 __attribute__nonnull__(1) 370 __attribute__nonnull__(2) 371 FUNC_MODIFIES(*str); 372 373 PARROT_EXPORT 374 PARROT_CANNOT_RETURN_NULL 375 STRING * Parrot_gc_sys_name(PARROT_INTERP) 376 __attribute__nonnull__(1); 377 378 PARROT_EXPORT 379 UINTVAL Parrot_gc_total_copied(PARROT_INTERP) 380 __attribute__nonnull__(1); 381 382 PARROT_EXPORT 383 size_t Parrot_gc_total_memory_allocated(PARROT_INTERP) 384 __attribute__nonnull__(1); 385 386 PARROT_EXPORT 387 size_t Parrot_gc_total_memory_used(PARROT_INTERP) 388 __attribute__nonnull__(1); 389 390 PARROT_EXPORT 391 int Parrot_gc_total_pmcs(PARROT_INTERP) 392 __attribute__nonnull__(1); 393 394 PARROT_EXPORT 395 int Parrot_gc_total_sized_buffers(PARROT_INTERP) 396 __attribute__nonnull__(1); 397 398 PARROT_EXPORT 399 void Parrot_gc_write_barrier(PARROT_INTERP, ARGIN(PMC *pmc)) 400 __attribute__nonnull__(1) 401 __attribute__nonnull__(2); 402 403 PARROT_EXPORT 404 unsigned int Parrot_is_blocked_GC_mark(PARROT_INTERP) 405 __attribute__nonnull__(1); 406 407 PARROT_EXPORT 408 unsigned int Parrot_is_blocked_GC_move(PARROT_INTERP) 409 __attribute__nonnull__(1); 410 411 PARROT_EXPORT 412 unsigned int Parrot_is_blocked_GC_sweep(PARROT_INTERP) 413 __attribute__nonnull__(1); 414 415 PARROT_EXPORT 416 void Parrot_unblock_GC_mark(PARROT_INTERP) 417 __attribute__nonnull__(1); 418 419 PARROT_EXPORT 420 void Parrot_unblock_GC_mark_locked(PARROT_INTERP) 421 __attribute__nonnull__(1); 422 423 PARROT_EXPORT 424 void Parrot_unblock_GC_move(PARROT_INTERP) 425 __attribute__nonnull__(1); 426 427 PARROT_EXPORT 428 void Parrot_unblock_GC_sweep(PARROT_INTERP) 429 __attribute__nonnull__(1); 430 431 #define ASSERT_ARGS_Parrot_block_GC_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 432 PARROT_ASSERT_ARG(interp)) 433 #define ASSERT_ARGS_Parrot_block_GC_mark_locked __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 434 PARROT_ASSERT_ARG(interp)) 435 #define ASSERT_ARGS_Parrot_block_GC_move __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 436 PARROT_ASSERT_ARG(interp)) 437 #define ASSERT_ARGS_Parrot_block_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 438 PARROT_ASSERT_ARG(interp)) 439 #define ASSERT_ARGS_Parrot_gc_active_pmcs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 440 PARROT_ASSERT_ARG(interp)) 441 #define ASSERT_ARGS_Parrot_gc_active_sized_buffers \ 442 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 443 PARROT_ASSERT_ARG(interp)) 444 #define ASSERT_ARGS_Parrot_gc_allocate_buffer_storage_aligned \ 445 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 446 PARROT_ASSERT_ARG(interp) \ 447 , PARROT_ASSERT_ARG(buffer)) 448 #define ASSERT_ARGS_Parrot_gc_allocate_fixed_size_storage \ 449 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 450 PARROT_ASSERT_ARG(interp)) 451 #define ASSERT_ARGS_Parrot_gc_allocate_memory_chunk \ 452 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 453 PARROT_ASSERT_ARG(interp)) 454 #define ASSERT_ARGS_Parrot_gc_allocate_memory_chunk_with_interior_pointers \ 455 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 456 PARROT_ASSERT_ARG(interp)) 457 #define ASSERT_ARGS_Parrot_gc_allocate_pmc_attributes \ 458 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 459 PARROT_ASSERT_ARG(interp) \ 460 , PARROT_ASSERT_ARG(pmc)) 461 #define ASSERT_ARGS_Parrot_gc_allocate_string_storage \ 462 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 463 PARROT_ASSERT_ARG(interp) \ 464 , PARROT_ASSERT_ARG(str)) 465 #define ASSERT_ARGS_Parrot_gc_compact_memory_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 466 PARROT_ASSERT_ARG(interp)) 467 #define ASSERT_ARGS_Parrot_gc_completely_unblock __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 468 PARROT_ASSERT_ARG(interp)) 469 #define ASSERT_ARGS_Parrot_gc_count_collect_runs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 470 PARROT_ASSERT_ARG(interp)) 471 #define ASSERT_ARGS_Parrot_gc_count_lazy_mark_runs \ 472 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 473 PARROT_ASSERT_ARG(interp)) 474 #define ASSERT_ARGS_Parrot_gc_count_mark_runs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 475 PARROT_ASSERT_ARG(interp)) 476 #define ASSERT_ARGS_Parrot_gc_destroy_child_interp \ 477 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 478 PARROT_ASSERT_ARG(dest_interp) \ 479 , PARROT_ASSERT_ARG(source_interp)) 480 #define ASSERT_ARGS_Parrot_gc_finalize __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 481 PARROT_ASSERT_ARG(interp)) 482 #define ASSERT_ARGS_Parrot_gc_free_bufferlike_header \ 483 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 484 PARROT_ASSERT_ARG(interp) \ 485 , PARROT_ASSERT_ARG(obj)) 486 #define ASSERT_ARGS_Parrot_gc_free_fixed_size_storage \ 487 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 488 PARROT_ASSERT_ARG(interp) \ 489 , PARROT_ASSERT_ARG(data)) 490 #define ASSERT_ARGS_Parrot_gc_free_memory_chunk __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 491 PARROT_ASSERT_ARG(interp)) 492 #define ASSERT_ARGS_Parrot_gc_free_pmc_attributes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 493 PARROT_ASSERT_ARG(interp)) 494 #define ASSERT_ARGS_Parrot_gc_free_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 495 PARROT_ASSERT_ARG(interp) \ 496 , PARROT_ASSERT_ARG(pmc)) 497 #define ASSERT_ARGS_Parrot_gc_free_string_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 498 PARROT_ASSERT_ARG(interp) \ 499 , PARROT_ASSERT_ARG(s)) 500 #define ASSERT_ARGS_Parrot_gc_headers_alloc_since_last_collect \ 501 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 502 PARROT_ASSERT_ARG(interp)) 503 #define ASSERT_ARGS_Parrot_gc_impatient_pmcs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 504 PARROT_ASSERT_ARG(interp)) 505 #define ASSERT_ARGS_Parrot_gc_initialize __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 506 PARROT_ASSERT_ARG(interp) \ 507 , PARROT_ASSERT_ARG(args)) 508 #define ASSERT_ARGS_Parrot_gc_mark_and_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 509 PARROT_ASSERT_ARG(interp)) 510 #define ASSERT_ARGS_Parrot_gc_mark_PMC_alive_fun __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 511 PARROT_ASSERT_ARG(interp)) 512 #define ASSERT_ARGS_Parrot_gc_mark_PObj_alive __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 513 PARROT_ASSERT_ARG(interp) \ 514 , PARROT_ASSERT_ARG(obj)) 515 #define ASSERT_ARGS_Parrot_gc_mark_STRING_alive_fun \ 516 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 517 PARROT_ASSERT_ARG(interp)) 518 #define ASSERT_ARGS_Parrot_gc_max_generations __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 519 PARROT_ASSERT_ARG(interp)) 520 #define ASSERT_ARGS_Parrot_gc_mem_alloc_since_last_collect \ 521 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 522 PARROT_ASSERT_ARG(interp)) 523 #define ASSERT_ARGS_Parrot_gc_new_bufferlike_header \ 524 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 525 PARROT_ASSERT_ARG(interp)) 526 #define ASSERT_ARGS_Parrot_gc_new_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 527 PARROT_ASSERT_ARG(interp)) 528 #define ASSERT_ARGS_Parrot_gc_new_string_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 529 PARROT_ASSERT_ARG(interp)) 530 #define ASSERT_ARGS_Parrot_gc_pmc_needs_early_collection \ 531 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 532 PARROT_ASSERT_ARG(interp) \ 533 , PARROT_ASSERT_ARG(pmc)) 534 #define ASSERT_ARGS_Parrot_gc_reallocate_buffer_storage \ 535 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 536 PARROT_ASSERT_ARG(interp) \ 537 , PARROT_ASSERT_ARG(buffer)) 538 #define ASSERT_ARGS_Parrot_gc_reallocate_memory_chunk \ 539 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 540 PARROT_ASSERT_ARG(interp)) 541 #define ASSERT_ARGS_Parrot_gc_reallocate_memory_chunk_with_interior_pointers \ 542 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 543 PARROT_ASSERT_ARG(interp)) 544 #define ASSERT_ARGS_Parrot_gc_reallocate_string_storage \ 545 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 546 PARROT_ASSERT_ARG(interp) \ 547 , PARROT_ASSERT_ARG(str)) 548 #define ASSERT_ARGS_Parrot_gc_sys_name __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 549 PARROT_ASSERT_ARG(interp)) 550 #define ASSERT_ARGS_Parrot_gc_total_copied __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 551 PARROT_ASSERT_ARG(interp)) 552 #define ASSERT_ARGS_Parrot_gc_total_memory_allocated \ 553 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 554 PARROT_ASSERT_ARG(interp)) 555 #define ASSERT_ARGS_Parrot_gc_total_memory_used __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 556 PARROT_ASSERT_ARG(interp)) 557 #define ASSERT_ARGS_Parrot_gc_total_pmcs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 558 PARROT_ASSERT_ARG(interp)) 559 #define ASSERT_ARGS_Parrot_gc_total_sized_buffers __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 560 PARROT_ASSERT_ARG(interp)) 561 #define ASSERT_ARGS_Parrot_gc_write_barrier __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 562 PARROT_ASSERT_ARG(interp) \ 563 , PARROT_ASSERT_ARG(pmc)) 564 #define ASSERT_ARGS_Parrot_is_blocked_GC_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 565 PARROT_ASSERT_ARG(interp)) 566 #define ASSERT_ARGS_Parrot_is_blocked_GC_move __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 567 PARROT_ASSERT_ARG(interp)) 568 #define ASSERT_ARGS_Parrot_is_blocked_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 569 PARROT_ASSERT_ARG(interp)) 570 #define ASSERT_ARGS_Parrot_unblock_GC_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 571 PARROT_ASSERT_ARG(interp)) 572 #define ASSERT_ARGS_Parrot_unblock_GC_mark_locked __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 573 PARROT_ASSERT_ARG(interp)) 574 #define ASSERT_ARGS_Parrot_unblock_GC_move __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 575 PARROT_ASSERT_ARG(interp)) 576 #define ASSERT_ARGS_Parrot_unblock_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\ 577 PARROT_ASSERT_ARG(interp)) 578 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */ 579 /* HEADERIZER END: src/gc/api.c */ 580 581 # define Parrot_gc_mark_STRING_alive(interp, obj) Parrot_gc_mark_STRING_alive_fun((interp), (obj)) 582 583 #if defined(PARROT_IN_CORE) 584 #ifdef THREAD_DEBUG 585 # define Parrot_gc_mark_PMC_alive(interp, obj) \ 586 do if (!PMC_IS_NULL(obj) \ 587 && (!PObj_is_shared_TEST(obj) || !Interp_flags_TEST((interp), PARROT_IS_THREAD))) { \ 588 PARROT_ASSERT((obj)->orig_interp == (interp)); \ 589 Parrot_gc_mark_PMC_alive_fun((interp), (obj)); \ 590 } \ 591 while (0) 592 #else 593 # define Parrot_gc_mark_PMC_alive(interp, obj) \ 594 do if (!PMC_IS_NULL(obj) \ 595 && (!PObj_is_shared_TEST(obj) || !Interp_flags_TEST((interp), PARROT_IS_THREAD))) { \ 596 Parrot_gc_mark_PMC_alive_fun((interp), (obj)); \ 597 } \ 598 while (0) 599 #endif 600 #else 601 # define Parrot_gc_mark_PMC_alive(interp, obj) Parrot_gc_mark_PMC_alive_fun((interp), (obj)) 602 #endif 603 604 #endif /* PARROT_GC_API_H_GUARD */ 605 606 /* 607 * Local variables: 608 * c-file-style: "parrot" 609 * End: 610 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' : 611 */ 612