Ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5ad0e4688e963d9de019557c78feed9)
transient_heap.h
Go to the documentation of this file.
1/**********************************************************************
2
3 transient_heap.h - declarations of transient_heap related APIs.
4
5 Copyright (C) 2018 Koichi Sasada
6
7**********************************************************************/
8
9#ifndef RUBY_TRANSIENT_HEAP_H
10#define RUBY_TRANSIENT_HEAP_H
11
12#include "internal.h"
13
14#if USE_TRANSIENT_HEAP
15
16/* public API */
17
18/* Allocate req_size bytes from transient_heap.
19 Allocated memories are free-ed when next GC
20 if this memory is not marked by `rb_transient_heap_mark()`.
21 */
22void *rb_transient_heap_alloc(VALUE obj, size_t req_size);
23
24/* If `obj` uses a memory pointed by `ptr` from transient_heap,
25 you need to call `rb_transient_heap_mark(obj, ptr)`
26 to assert liveness of `obj` (and ptr). */
27void rb_transient_heap_mark(VALUE obj, const void *ptr);
28
29/* used by gc.c */
31void rb_transient_heap_start_marking(int full_marking);
34
35/* for debug API */
36void rb_transient_heap_dump(void);
39
40/* evacuate functions for each type */
41void rb_ary_transient_heap_evacuate(VALUE ary, int promote);
43void rb_hash_transient_heap_evacuate(VALUE hash, int promote);
45
46#else /* USE_TRANSIENT_HEAP */
47
48#define rb_transient_heap_alloc(o, s) NULL
49#define rb_transient_heap_verify() ((void)0)
50#define rb_transient_heap_promote(obj) ((void)0)
51#define rb_transient_heap_start_marking(full_marking) ((void)0)
52#define rb_transient_heap_update_references() ((void)0)
53#define rb_transient_heap_finish_marking() ((void)0)
54#define rb_transient_heap_mark(obj, ptr) ((void)0)
55
56#define rb_ary_transient_heap_evacuate(x, y) ((void)0)
57#define rb_obj_transient_heap_evacuate(x, y) ((void)0)
58#define rb_hash_transient_heap_evacuate(x, y) ((void)0)
59#define rb_struct_transient_heap_evacuate(x, y) ((void)0)
60
61#endif /* USE_TRANSIENT_HEAP */
62#endif
struct RIMemo * ptr
Definition: debug.c:65
enum ruby_tag_type st
const VALUE VALUE obj
unsigned long VALUE
void rb_ary_transient_heap_evacuate(VALUE ary, int promote)
Definition: array.c:402
void * rb_transient_heap_alloc(VALUE obj, size_t req_size)
void rb_transient_heap_promote(VALUE obj)
int rb_transient_heap_managed_ptr_p(const void *ptr)
void rb_struct_transient_heap_evacuate(VALUE st, int promote)
Definition: struct.c:681
void rb_transient_heap_verify(void)
void rb_hash_transient_heap_evacuate(VALUE hash, int promote)
Definition: hash.c:1244
void rb_transient_heap_mark(VALUE obj, const void *ptr)
void rb_obj_transient_heap_evacuate(VALUE obj, int promote)
Definition: variable.c:1215
void rb_transient_heap_finish_marking(void)
void rb_transient_heap_dump(void)
void rb_transient_heap_start_marking(int full_marking)
void rb_transient_heap_update_references(void)