diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2024-02-21 15:48:40 -0500 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2024-02-22 11:35:09 -0500 |
| commit | e65315a7253c58ad2d3bbf5482723976ff3d6640 (patch) | |
| tree | aea284b9ac2c7a0ff7683f0a855342ad0bfc4963 /internal | |
| parent | e04146129ec6898dd6a9739dad2983c6e9b68056 (diff) | |
Extract imemo functions from gc.c into imemo.c
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/gc.h | 2 | ||||
| -rw-r--r-- | internal/imemo.h | 6 | ||||
| -rw-r--r-- | internal/sanitizers.h | 17 |
3 files changed, 24 insertions, 1 deletions
diff --git a/internal/gc.h b/internal/gc.h index c2f3b61deb..89f566cf8d 100644 --- a/internal/gc.h +++ b/internal/gc.h @@ -241,7 +241,7 @@ void rb_gc_ractor_newobj_cache_clear(rb_ractor_newobj_cache_t *newobj_cache); size_t rb_gc_obj_slot_size(VALUE obj); bool rb_gc_size_allocatable_p(size_t size); int rb_objspace_garbage_object_p(VALUE obj); -bool rb_gc_is_ptr_to_obj(void *ptr); +bool rb_gc_is_ptr_to_obj(const void *ptr); VALUE rb_gc_id2ref_obj_tbl(VALUE objid); VALUE rb_define_finalizer_no_check(VALUE obj, VALUE block); diff --git a/internal/imemo.h b/internal/imemo.h index 5b54629c99..673e7e668a 100644 --- a/internal/imemo.h +++ b/internal/imemo.h @@ -143,6 +143,12 @@ static inline VALUE rb_imemo_tmpbuf_auto_free_pointer_new_from_an_RString(VALUE static inline void MEMO_V1_SET(struct MEMO *m, VALUE v); static inline void MEMO_V2_SET(struct MEMO *m, VALUE v); +size_t rb_imemo_memsize(VALUE obj); +void rb_cc_table_mark(VALUE klass); +void rb_imemo_mark_and_move(VALUE obj, bool reference_updating); +void rb_cc_table_free(VALUE klass); +void rb_imemo_free(VALUE obj); + RUBY_SYMBOL_EXPORT_BEGIN #if IMEMO_DEBUG VALUE rb_imemo_new_debug(enum imemo_type type, VALUE v0, const char *file, int line); diff --git a/internal/sanitizers.h b/internal/sanitizers.h index a0d099e525..345380cebe 100644 --- a/internal/sanitizers.h +++ b/internal/sanitizers.h @@ -189,6 +189,23 @@ asan_unpoison_object(VALUE obj, bool newobj_p) asan_unpoison_memory_region(ptr, SIZEOF_VALUE, newobj_p); } +static inline void * +asan_unpoison_object_temporary(VALUE obj) +{ + void *ptr = asan_poisoned_object_p(obj); + asan_unpoison_object(obj, false); + return ptr; +} + +static inline void * +asan_poison_object_restore(VALUE obj, void *ptr) +{ + if (ptr) { + asan_poison_object(obj); + } + return NULL; +} + /*! * Checks if the given pointer is on an ASAN fake stack. If so, it returns the |
