12 typedef struct MMTk_Builder MMTk_Builder;
13 typedef struct MMTk_Mutator MMTk_Mutator;
18 typedef void *MMTk_Address;
19 typedef void *MMTk_ObjectReference;
20 typedef void *MMTk_NullableObjectReference;
21 typedef uint32_t MMTk_AllocationSemantics;
24 #define MMTk_OBJREF_OFFSET 8
26 #define MMTk_MIN_OBJ_ALIGN 8
28 #define MMTk_GC_THREAD_KIND_WORKER 1
31 bool ractor_check_mode;
35 typedef MMTk_ObjectReference (*MMTk_ObjectClosureFunction)(
void*,
void*, MMTk_ObjectReference, bool);
56 bool (*is_mutator)(void);
57 void (*stop_the_world)(void);
58 void (*resume_mutators)(void);
60 size_t (*number_of_mutators)(void);
61 void (*get_mutators)(void (*visit_mutator)(MMTk_Mutator*,
void*),
void *data);
62 void (*scan_gc_roots)(void);
63 void (*scan_objspace)(void);
66 void (*scan_object_ruby_style)(MMTk_ObjectReference object);
67 void (*call_gc_mark_children)(MMTk_ObjectReference object);
68 void (*call_obj_free)(MMTk_ObjectReference object);
69 size_t (*vm_live_bytes)(void);
70 void (*update_global_tables)(
int tbl_idx);
71 int (*global_tables_count)(void);
72 void (*update_finalizer_table)(void);
73 void (*update_obj_id_tables)(void);
77 MMTk_ObjectReference *ptr;
82 bool mmtk_is_live_object(MMTk_ObjectReference
object);
84 bool mmtk_is_reachable(MMTk_ObjectReference
object);
86 MMTk_Builder *mmtk_builder_default(
void);
88 void mmtk_init_binding(MMTk_Builder *builder,
91 MMTk_ObjectReference weak_reference_dead_value);
97 void mmtk_destroy_mutator(MMTk_Mutator *mutator);
101 void mmtk_set_gc_enabled(
bool enable);
103 bool mmtk_gc_enabled_p(
void);
105 MMTk_Address mmtk_alloc(MMTk_Mutator *mutator,
109 MMTk_AllocationSemantics semantics);
111 void mmtk_post_alloc(MMTk_Mutator *mutator,
112 MMTk_ObjectReference refer,
114 MMTk_AllocationSemantics semantics);
116 void mmtk_add_obj_free_candidate(MMTk_ObjectReference
object);
118 void mmtk_mark_weak(MMTk_ObjectReference *
ptr);
120 void mmtk_remove_weak(
const MMTk_ObjectReference *
ptr);
122 void mmtk_object_reference_write_post(MMTk_Mutator *mutator, MMTk_ObjectReference
object);
124 void mmtk_register_wb_unprotected_object(MMTk_ObjectReference
object);
126 bool mmtk_object_wb_unprotected_p(MMTk_ObjectReference
object);
128 void mmtk_enumerate_objects(
void (*callback)(MMTk_ObjectReference,
void*),
void *data);
134 void mmtk_before_fork(
void);
138 size_t mmtk_total_bytes(
void);
140 size_t mmtk_used_bytes(
void);
142 size_t mmtk_free_bytes(
void);
144 MMTk_Address mmtk_starting_heap_address(
void);
146 MMTk_Address mmtk_last_heap_address(
void);
148 bool mmtk_is_mmtk_object(MMTk_Address addr);
char * ptr
Pointer to the underlying memory region, of at least capa bytes.
void * rust_closure
The pointer to the Rust-level closure object.
MMTk_ObjectClosureFunction c_function
The function to be called from C.