From 42c9ef769f210d88241a114395dd5ffc27b2fb87 Mon Sep 17 00:00:00 2001 From: "NARUSE, Yui" Date: Thu, 3 Feb 2022 08:04:57 +0900 Subject: merge revision(s) 7ff1bf317887c0d7b21e91ad548d07b9f05c540c,e89d80702bd98a8276243a7fcaa2a158b3bfb659: [Backport #18516] An alias can suppress method redefinition warning --- test/ruby/test_alias.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) Fix memory leak at the same named alias [Bug #18516] When aliasing a method to the same name method, set a separate bit flag on that method definition, instead of the reference count increment. Although this kind of alias has no actual effect at runtime, is used as the hack to suppress the method re-definition warning. --- method.h | 1 + test/ruby/test_alias.rb | 18 ++++++++++++++++++ vm_method.c | 9 ++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) --- method.h | 1 + 1 file changed, 1 insertion(+) (limited to 'method.h') diff --git a/method.h b/method.h index 815fd9da47..2f4504bfec 100644 --- a/method.h +++ b/method.h @@ -181,6 +181,7 @@ struct rb_method_definition_struct { unsigned int iseq_overload: 1; int alias_count : 27; int complemented_count : 28; + unsigned int no_redef_warning: 1; union { rb_method_iseq_t iseq; -- cgit v1.2.3