Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

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 */
22 void *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). */
27 void rb_transient_heap_mark(VALUE obj, const void *ptr);
28
29 /* used by gc.c */
30 void rb_transient_heap_promote(VALUE obj);
31 void rb_transient_heap_start_marking(int full_marking);
32 void rb_transient_heap_finish_marking(void);
33 void rb_transient_heap_update_references(void);
34
35 /* for debug API */
36 void rb_transient_heap_dump(void);
37 void rb_transient_heap_verify(void);
38 int rb_transient_heap_managed_ptr_p(const void *ptr);
39
40 /* evacuate functions for each type */
41 void rb_ary_transient_heap_evacuate(VALUE ary, int promote);
42 void rb_obj_transient_heap_evacuate(VALUE obj, int promote);
43 void rb_hash_transient_heap_evacuate(VALUE hash, int promote);
44 void rb_struct_transient_heap_evacuate(VALUE st, 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
VALUE
unsigned long VALUE
Definition: ruby.h:102
ptr
struct RIMemo * ptr
Definition: debug.c:74
rb_transient_heap_mark
void rb_transient_heap_mark(VALUE obj, const void *ptr)
Definition: transient_heap.c:529
rb_transient_heap_finish_marking
void rb_transient_heap_finish_marking(void)
Definition: transient_heap.c:916
rb_transient_heap_alloc
void * rb_transient_heap_alloc(VALUE obj, size_t req_size)
Definition: transient_heap.c:359
rb_transient_heap_dump
void rb_transient_heap_dump(void)
Definition: transient_heap.c:152
obj
const VALUE VALUE obj
Definition: rb_mjit_min_header-2.7.0.h:5742
rb_transient_heap_promote
void rb_transient_heap_promote(VALUE obj)
Definition: transient_heap.c:640
rb_hash_transient_heap_evacuate
void rb_hash_transient_heap_evacuate(VALUE hash, int promote)
Definition: hash.c:1222
rb_transient_heap_update_references
void rb_transient_heap_update_references(void)
Definition: transient_heap.c:853
rb_struct_transient_heap_evacuate
void rb_struct_transient_heap_evacuate(VALUE st, int promote)
Definition: struct.c:684
rb_transient_heap_verify
void rb_transient_heap_verify(void)
Definition: transient_heap.c:219
rb_transient_heap_start_marking
void rb_transient_heap_start_marking(int full_marking)
Definition: transient_heap.c:868
rb_ary_transient_heap_evacuate
void rb_ary_transient_heap_evacuate(VALUE ary, int promote)
Definition: array.c:402
internal.h
st
enum ruby_tag_type st
Definition: rb_mjit_min_header-2.7.0.h:11111
rb_obj_transient_heap_evacuate
void rb_obj_transient_heap_evacuate(VALUE obj, int promote)
Definition: variable.c:1215
rb_transient_heap_managed_ptr_p
int rb_transient_heap_managed_ptr_p(const void *ptr)
Definition: transient_heap.c:506