ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resnenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexerpthread-emulationqualifiedEnum
Last change
on this file since 72b0573 was
bf71cfd,
checked in by Thierry Delisle <tdelisle@…>, 6 years ago
|
Moved up many directories in source
|
-
Property mode set to
100644
|
File size:
1.9 KB
|
Rev | Line | |
---|
[d67a9a1] | 1 | #pragma once |
---|
| 2 | |
---|
[16cfd8c] | 3 | extern "C" { |
---|
| 4 | #include <stdbool.h> |
---|
[bee4283] | 5 | #include <stddef.h> |
---|
[d67a9a1] | 6 | #include <stdint.h> |
---|
[16cfd8c] | 7 | } |
---|
[d67a9a1] | 8 | |
---|
| 9 | #include "tools.h" |
---|
| 10 | |
---|
[16cfd8c] | 11 | #include "card_table.h" |
---|
[d67a9a1] | 12 | #include "globals.h" |
---|
[16cfd8c] | 13 | #include "state.h" |
---|
[d67a9a1] | 14 | |
---|
| 15 | struct gc_memory_pool |
---|
| 16 | { |
---|
| 17 | struct memory_pool* mirror; |
---|
| 18 | struct memory_pool* next; |
---|
| 19 | |
---|
| 20 | uint8_t type_code; |
---|
| 21 | |
---|
[16cfd8c] | 22 | card_table_t* cards; |
---|
[d67a9a1] | 23 | |
---|
| 24 | uint8_t* end_p; |
---|
| 25 | uint8_t* free_p; |
---|
| 26 | uint8_t start_p[1]; |
---|
| 27 | }; |
---|
| 28 | |
---|
[24bc651] | 29 | void ?{}( gc_memory_pool* this, |
---|
[16cfd8c] | 30 | size_t size, |
---|
| 31 | gc_memory_pool* next, |
---|
| 32 | gc_memory_pool* mirror, |
---|
| 33 | uint8_t type |
---|
[385c130] | 34 | ); |
---|
| 35 | |
---|
[24bc651] | 36 | void ^?{}(gc_memory_pool* this); |
---|
[16cfd8c] | 37 | |
---|
[d67a9a1] | 38 | struct gc_pool_object_iterator |
---|
| 39 | { |
---|
| 40 | struct gc_object_header* object; |
---|
[46f1d20] | 41 | #ifndef NDEBUG |
---|
[d67a9a1] | 42 | intptr_t lower_limit; |
---|
| 43 | intptr_t upper_limit; |
---|
| 44 | #endif |
---|
| 45 | }; |
---|
| 46 | |
---|
| 47 | |
---|
[46f1d20] | 48 | void ?{}( gc_pool_object_iterator* this, |
---|
[d67a9a1] | 49 | struct gc_object_header* start_object |
---|
[46f1d20] | 50 | #ifndef NDEBUG |
---|
[d67a9a1] | 51 | , intptr_t pool_start |
---|
| 52 | , intptr_t pool_end |
---|
| 53 | #endif |
---|
| 54 | ); |
---|
| 55 | |
---|
[46f1d20] | 56 | void ^?{}( gc_pool_object_iterator* this ); |
---|
| 57 | |
---|
[d67a9a1] | 58 | bool ?!=?(const gc_pool_object_iterator lhs, const gc_pool_object_iterator rhs); |
---|
| 59 | |
---|
[16cfd8c] | 60 | gc_pool_object_iterator begin(gc_memory_pool* const this); |
---|
[df4aea7] | 61 | gc_pool_object_iterator end(gc_memory_pool* const); |
---|
| 62 | |
---|
[d67a9a1] | 63 | gc_pool_object_iterator* ++?(gc_pool_object_iterator* it); |
---|
| 64 | |
---|
| 65 | const struct gc_object_header* *?(const gc_pool_object_iterator it); |
---|
| 66 | struct gc_object_header* *?(gc_pool_object_iterator it); |
---|
| 67 | |
---|
[16cfd8c] | 68 | static inline bool gc_pool_is_from_space(const gc_memory_pool* pool) |
---|
[d67a9a1] | 69 | { |
---|
| 70 | return gc_from_space_code(gc_get_state()) == pool->type_code; |
---|
| 71 | } |
---|
| 72 | |
---|
[16cfd8c] | 73 | void gc_reset_pool(gc_memory_pool* const pool); |
---|
[d67a9a1] | 74 | |
---|
[16cfd8c] | 75 | static inline size_t gc_pool_size_used(const gc_memory_pool* pool) |
---|
[385c130] | 76 | { |
---|
| 77 | return pool->free_p - pool->start_p; |
---|
| 78 | } |
---|
| 79 | |
---|
[16cfd8c] | 80 | static inline size_t gc_pool_size_total(const gc_memory_pool* pool) |
---|
[d67a9a1] | 81 | { |
---|
| 82 | return pool->end_p - pool->start_p; |
---|
| 83 | } |
---|
| 84 | |
---|
[16cfd8c] | 85 | static inline size_t gc_pool_size_left(const gc_memory_pool* pool) |
---|
[d67a9a1] | 86 | { |
---|
| 87 | return pool->end_p - pool->free_p; |
---|
| 88 | } |
---|
| 89 | |
---|
[16cfd8c] | 90 | void* gc_pool_allocate(gc_memory_pool* const pool, size_t size, bool zero); |
---|
[d67a9a1] | 91 | |
---|
[16cfd8c] | 92 | gc_pool_object_iterator gc_pool_iterator_for(gc_memory_pool* const pool, void* member); |
---|
Note: See
TracBrowser
for help on using the repository browser.