diff options
| author | nagachika <nagachika@ruby-lang.org> | 2023-09-30 13:46:29 +0900 |
|---|---|---|
| committer | nagachika <nagachika@ruby-lang.org> | 2023-09-30 13:46:29 +0900 |
| commit | 97b7070ebd5493de8d3a6a9b0ecc91bef5068d3f (patch) | |
| tree | a6fa7e558dda05efec25cc022d06dc6ac5cdaf21 /method.h | |
| parent | 5640baa2f82f528a092d92ceaabeb76c43c098ee (diff) | |
merge revision(s) 8b236e0c66da8f92e9fc33de66cfbc8e4b0c0763: [Backport #19896]
[Bug #19896]
fix memory leak in vm_method
This introduces a unified reference_count to clarify who is referencing a method.
This also allows us to treat the refinement method as the def owner since it counts itself as a reference
Co-authored-by: Peter Zhu <peter@peterzhu.ca>
---
gc.c | 4 +-
method.h | 6 +--
rjit_c.rb | 6 +--
test/ruby/test_module.rb | 4 +-
vm_insnhelper.c | 2 +-
vm_method.c | 105 +++++++++++++++++++----------------------------
6 files changed, 54 insertions(+), 73 deletions(-)
Diffstat (limited to 'method.h')
| -rw-r--r-- | method.h | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -179,9 +179,9 @@ typedef struct rb_method_optimized { struct rb_method_definition_struct { BITFIELD(rb_method_type_t, type, VM_METHOD_TYPE_MINIMUM_BITS); unsigned int iseq_overload: 1; - int alias_count : 27; - int complemented_count : 28; unsigned int no_redef_warning: 1; + unsigned int aliased : 1; + int reference_count : 28; union { rb_method_iseq_t iseq; @@ -214,7 +214,7 @@ void rb_add_method_optimized(VALUE klass, ID mid, enum method_optimized_type, un void rb_add_refined_method_entry(VALUE refined_class, ID mid); rb_method_entry_t *rb_method_entry_set(VALUE klass, ID mid, const rb_method_entry_t *, rb_method_visibility_t noex); -rb_method_entry_t *rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, const rb_method_definition_t *def); +rb_method_entry_t *rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, rb_method_definition_t *def); const rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id); |
