source: src/examples/gc_no_raii/src/internal/collector.h @ 6be0cf9

aaron-thesisarm-ehcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since 6be0cf9 was 6be0cf9, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

gcpointers.c compiles

  • Property mode set to 100644
File size: 1.0 KB
Line 
1#pragma once
2
3#include <stddef.h>
4#include <stdint.h>
5
6#include "tools.h"
7
8#include "gcpointers.h"
9#include "internal/collector.h"
10#include "internal/gc_tools.h"
11#include "internal/globals.h"
12#include "internal/object_header.h"
13#include "internal/state.h"
14
15typedef int worklist_t;
16
17inline bool gc_is_managed(void* address)
18{
19        return gc_is_in_heap(gc_get_state(), address);
20}
21
22inline gc_object_header* gc_get_object_ptr(void* ptr)
23{
24        void* clean = gc_get_aligned_ptr(ptr);
25        return ((gc_object_header*)clean) - 1;
26}
27
28inline gc_memory_pool* pool_of(void* address)
29{
30        return (struct gc_memory_pool*)(((intptr_t)address) & POOL_PTR_MASK);
31}
32
33inline void gc_conditional_collect()
34{
35        if(gc_needs_collect(gc_get_state()))
36        {
37                gc_collect(gc_get_state());
38        }
39}
40
41gcpointer_t** gc_find_previous_ref(gcpointer_t* target);
42
43void* gc_allocate(size_t size);
44
45void gc_process_reference(void** ref, worklist_t* worklist);
46
47struct gc_object_header* gc_copy_object(struct gc_object_header* ptr);
48
49void gc_scan_object(struct gc_object_header* object, worklist_t* worklist);
Note: See TracBrowser for help on using the repository browser.